From ffce0d31b400de13d999819f1f7d9d9434831a6f Mon Sep 17 00:00:00 2001 From: Mariana Rossi Date: Tue, 12 Nov 2024 09:54:27 +0100 Subject: [PATCH] Making the dummy driver pass a json-formatted string for extras field (#395) * This commit json-formats the meaningless extra argument of the f90 and the py dummy drivers. Makes it possible to test examples such as the ones in examples/temp/pes/pswater/nvt that were not testable before. * linting * Enabling the fhi_aims test with dummy driver now, which should pass * Update excluded_test.txt --------- Co-authored-by: Mariana Rossi Co-authored-by: litman90 --- drivers/f90/driver.f90 | 3 +-- drivers/py/pes/dummy.py | 6 +++++- ipi_tests/examples/excluded_test.txt | 2 -- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/f90/driver.f90 b/drivers/f90/driver.f90 index 7fa0b378b..c1554f0fd 100644 --- a/drivers/f90/driver.f90 +++ b/drivers/f90/driver.f90 @@ -1000,8 +1000,7 @@ PROGRAM DRIVER CALL writebuffer(socket,initbuffer,cbuf) IF (verbose > 1) WRITE(*,*) " !write!=> extra: ", & & initbuffer(1:cbuf) -! ELSEIF (vstyle==5 .or. vstyle==6 .or. vstyle==8 .or. vstyle==99) THEN ! returns the dipole through initbuffer - ELSEIF (vstyle==5 .or. vstyle==6 .or. vstyle==8) THEN ! returns the dipole through initbuffer + ELSEIF (vstyle==5 .or. vstyle==6 .or. vstyle==8 .or. vstyle==99) THEN ! returns the dipole through initbuffer WRITE(initbuffer, '(a,3x,f15.8,a,f15.8,a,f15.8, & & 3x,a)') '{"dipole": [',dip(1),",",dip(2),",",dip(3),"]}" cbuf = LEN_TRIM(initbuffer) diff --git a/drivers/py/pes/dummy.py b/drivers/py/pes/dummy.py index ca756a54e..457c624a3 100644 --- a/drivers/py/pes/dummy.py +++ b/drivers/py/pes/dummy.py @@ -2,6 +2,8 @@ __DRIVER_NAME__ = "dummy" __DRIVER_CLASS__ = "Dummy_driver" +import json + class Dummy_driver(object): """Base class providing the structure of a PES for the python driver.""" @@ -24,5 +26,7 @@ def __call__(self, cell, pos): pot = 0.0 force = pos * 0.0 # makes a zero force with same shape as pos vir = cell * 0.0 # makes a zero virial with same shape as cell - extras = "nada" + extras = json.dumps( + {"dipole": [0.0, 0.0, 0.0]} + ) # have json formatting to potentially work with some test examples. meaningless value return pot, force, vir, extras diff --git a/ipi_tests/examples/excluded_test.txt b/ipi_tests/examples/excluded_test.txt index bb6434db1..49f775043 100644 --- a/ipi_tests/examples/excluded_test.txt +++ b/ipi_tests/examples/excluded_test.txt @@ -8,8 +8,6 @@ temp/ph2/rpmd # long and complicated # Needs infrastructure fixing -clients/fhi_aims/zundel # dummy driver has an issue with extra_type. example works with actual backends. - # Need of external dependency clients/yaff/mil53_ffyaff clients/yaff/mil53_ffsocket