diff --git a/drivers/f90/driver.f90 b/drivers/f90/driver.f90 index 33985910d..4ad8a4070 100644 --- a/drivers/f90/driver.f90 +++ b/drivers/f90/driver.f90 @@ -185,13 +185,15 @@ PROGRAM DRIVER vstyle = 63 ELSEIF (trim(cmdbuffer) == "qtip4pf-c-2-delta") THEN vstyle = 64 + ELSEIF (trim(cmdbuffer) == "qtip4pf-c-json-delta") THEN + vstyle = 65 ELSEIF (trim(cmdbuffer) == "gas") THEN vstyle = 0 ! ideal gas ELSEIF (trim(cmdbuffer) == "dummy") THEN vstyle = 99 ! returns non-zero but otherwise meaningless values ELSE WRITE(*,*) " Unrecognized potential type ", trim(cmdbuffer) - WRITE(*,*) " Use -m [dummy|gas|lj|sg|harm|harm3d|morse|morsedia|zundel|qtip4pf|pswater|lepsm1|lepsm2|qtip4pf-efield|eckart|ch4hcbe|ljpolymer|MB|doublewell|doublewell_1D|water_dip_pol|qtip4pf-sr|qtip4pf-c-1|qtip4pf-c-2|qtip4pf-c-json|qtip4pf-c-1-delta|qtip4pf-c-2-delta|harmonic_bath|meanfield_bath] " + WRITE(*,*) " Use -m [dummy|gas|lj|sg|harm|harm3d|morse|morsedia|zundel|qtip4pf|pswater|lepsm1|lepsm2|qtip4pf-efield|eckart|ch4hcbe|ljpolymer|MB|doublewell|doublewell_1D|water_dip_pol|harmonic_bath|meanfield_bath|qtip4pf-sr|qtip4pf-c-1|qtip4pf-c-2|qtip4pf-c-json|qtip4pf-c-1-delta|qtip4pf-c-2-delta|qtip4pf-c-json-delta] " STOP "ENDED" ENDIF ELSEIF (ccmd == 4) THEN @@ -678,7 +680,7 @@ PROGRAM DRIVER STOP "ENDED" ENDIF CALL qtip4pf_sr(atoms,nat,forces,pot,virial) - ELSEIF (vstyle .ge. 60 .and. vstyle .le. 64 ) THEN + ELSEIF (vstyle .ge. 60 .and. vstyle .le. 65 ) THEN ! qtip4pf committee potential. adds two different types of (small) ! LJ potentials just to have variations on a theme @@ -693,7 +695,7 @@ PROGRAM DRIVER WRITE(*,*) " qtip4pf PES only works with orthorhombic cells", cell_h(1,2), cell_h(1,3), cell_h(2,3) STOP "ENDED" ENDIF - IF (vstyle == 63 .or. vstyle == 64) THEN + IF (vstyle == 63 .or. vstyle == 64 .or. vstyle == 65) THEN pot = 0.0 forces = 0.0 virial = 0.0 @@ -735,7 +737,7 @@ PROGRAM DRIVER CALL LJ_getall(rc, 2.5d0, 2d-6, nat, atoms, cell_h, cell_ih, index_list, n_list, pot, forces, virial) ELSEIF (vstyle == 61 .or. vstyle == 64) THEN ! type 2 CALL LJ_getall(rc, 2.1d0, 24d-6, nat, atoms, cell_h, cell_ih, index_list, n_list, pot, forces, virial) - ELSEIF (vstyle == 62) THEN ! returns both as json + ELSEIF (vstyle == 62 .or. vstyle == 65) THEN ! returns both as json ! return both the committee members as a JSON extra string CALL LJ_getall(rc, 2.5d0, 2d-6, nat, atoms, cell_h, cell_ih, index_list, n_list, pot, forces, virial) @@ -1016,7 +1018,7 @@ PROGRAM DRIVER CALL writebuffer(socket,TRIM(longbuffer),cbuf) IF (verbose > 1) WRITE(*,*) " !write!=> extra: ", & & initbuffer - ELSEIF (vstyle==62) THEN ! returns committee data + ELSEIF (vstyle==62 .or. vstyle==65) THEN ! returns committee data cbuf = LEN_TRIM(initbuffer) CALL writebuffer(socket,cbuf) CALL writebuffer(socket,initbuffer,cbuf) @@ -1046,9 +1048,7 @@ PROGRAM DRIVER CONTAINS SUBROUTINE helpmessage ! Help banner - - WRITE(*,*) " SYNTAX: driver.x [-u] -h hostname -p port -m [dummy|gas|lj|sg|harm|harm3d|morse|zundel|qtip4pf|pswater|lepsm1|lepsm2|qtip4p-efield|eckart|ch4hcbe|ljpolymer|..." - WRITE(*,*) "...|MB|doublewell|doublewell_1D|harmonic_bath|meanfield_bath|morsedia|qtip4pf-sr|water_dip_pol]" + WRITE(*,*) " SYNTAX: driver.x [-u] -a address -p port -m [dummy|gas|lj|sg|harm|harm3d|morse|morsedia|zundel|qtip4pf|pswater|lepsm1|lepsm2|qtip4p-efield|eckart|ch4hcbe|ljpolymer|MB|doublewell|doublewell_1D|water_dip_pol|harmonic_bath|meanfield_bath|qtip4pf-sr|qtip4pf-c-1|qtip4pf-c-2|qtip4pf-c-json|qtip4pf-c-1-delta|qtip4pf-c-2-delta|qtip4pf-c-json-delta]" WRITE(*,*) " -o 'comma_separated_parameters' [-v] " WRITE(*,*) "" WRITE(*,*) " For LJ potential use -o sigma,epsilon,cutoff " @@ -1058,7 +1058,7 @@ SUBROUTINE helpmessage WRITE(*,*) " For qtip4pf-efield use -o Ex,Ey,Ez with Ei in V/nm" WRITE(*,*) " For ljpolymer use -o n_monomer,sigma,epsilon,cutoff " WRITE(*,*) " For gas, dummy, use the optional -o sleep_seconds to add a delay" - WRITE(*,*) " For the ideal qtip4pf, qtip4p-sr, zundel, ch4hcbe, nasa, doublewell or doublewell_1D no options are needed! " + WRITE(*,*) " For the ideal, qtip4pf*, zundel, ch4hcbe, nasa, doublewell or doublewell_1D no options are needed! " END SUBROUTINE helpmessage END PROGRAM diff --git a/examples/features/committee_models/README.md b/examples/features/committee_models/README.md index 01bbf5769..7ba5fa703 100644 --- a/examples/features/committee_models/README.md +++ b/examples/features/committee_models/README.md @@ -12,4 +12,6 @@ All the simulations here use an artificial committee model built by arbitrarily `weighted_baseline` provides an example of how to use the uncertainty estimate to revert the predictions to a baseline model when the error becomes too large. The ML model in this case is meant to describe a correction over the baseline, which is smoothly suppressed if its uncertainty increases beyond a cutoff. -`extra_json` shows how to run this kind of simulations with a model that provides all the estimates in one go as part of a .json formatted `extras`` string +`extra_json` shows how to run this kind of simulations with a model that provides all the estimates in one go as part of a JSON formatted `extras`` string + +`weighted_baseline_extra` replicates the `weighted_baseline` model using a JSON-based ensemble diff --git a/examples/features/committee_models/weighted_baseline/test_settings.dat b/examples/features/committee_models/weighted_baseline/test_settings.dat index 6359628fb..efc1cb870 100644 --- a/examples/features/committee_models/weighted_baseline/test_settings.dat +++ b/examples/features/committee_models/weighted_baseline/test_settings.dat @@ -1,4 +1,4 @@ driver_model dummy driver_model2 dummy -driver_model3 dummt +driver_model3 dummy nsteps 10 diff --git a/examples/features/committee_models/weighted_baseline_extra/input.xml b/examples/features/committee_models/weighted_baseline_extra/input.xml new file mode 100644 index 000000000..77d12b014 --- /dev/null +++ b/examples/features/committee_models/weighted_baseline_extra/input.xml @@ -0,0 +1,59 @@ + + + [ step, time{picosecond}, conserved{electronvolt}, temperature{kelvin}, kinetic_cv{electronvolt}, potential{electronvolt}, pressure_cv{megapascal} ] + positions + extras + extras + extras + extras + extras + extras + extras + + + 100 + + 31415 + + + + base + 1.5 + 0.1 + 0.05 + +
base
1e-3 +
+ +
h2o-comm.json
1e-3 +
+ True +
+ + + water_216.xyz + 300 + + + + + [committee_pot, committee_force, committee_virial, baseline_pot, baseline_force, baseline_virial, wb_mixing] + + + + + 0.5 + + 10 + + + + + 300 + + +
diff --git a/examples/features/committee_models/weighted_baseline_extra/run.sh b/examples/features/committee_models/weighted_baseline_extra/run.sh new file mode 100644 index 000000000..1c47aacdf --- /dev/null +++ b/examples/features/committee_models/weighted_baseline_extra/run.sh @@ -0,0 +1,18 @@ +ipi=i-pi +driver=i-pi-driver +sleep_time=2 + +${ipi} input.xml > log.i-pi & +echo "# i-PI is running" + +echo "# Waiting for ${sleep_time} (s) before executing driver" +sleep ${sleep_time} + +${driver} -u -a base -m qtip4pf & +${driver} -u -a h2o-comm.json -m qtip4pf-c-json-delta & + +echo "# All driver instances are running" + +wait + +echo "# Simulation complete" diff --git a/examples/features/committee_models/weighted_baseline_extra/test_settings.dat b/examples/features/committee_models/weighted_baseline_extra/test_settings.dat new file mode 100644 index 000000000..7814c9f37 --- /dev/null +++ b/examples/features/committee_models/weighted_baseline_extra/test_settings.dat @@ -0,0 +1,3 @@ +driver_model dummy +driver_model2 dummy +nsteps 10 diff --git a/examples/features/committee_models/weighted_baseline_extra/water_216.xyz b/examples/features/committee_models/weighted_baseline_extra/water_216.xyz new file mode 120000 index 000000000..58a9ede12 --- /dev/null +++ b/examples/features/committee_models/weighted_baseline_extra/water_216.xyz @@ -0,0 +1 @@ +../../../init_files/water_216.xyz \ No newline at end of file