Skip to content

Commit

Permalink
Making the dummy driver pass a json-formatted string for extras field (
Browse files Browse the repository at this point in the history
…i-pi#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 <[email protected]>
Co-authored-by: litman90 <[email protected]>
  • Loading branch information
3 people authored Nov 12, 2024
1 parent 4ae034b commit ffce0d3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions drivers/f90/driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion drivers/py/pes/dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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
2 changes: 0 additions & 2 deletions ipi_tests/examples/excluded_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ffce0d3

Please sign in to comment.