Skip to content

Commit

Permalink
Added an example of PLUMED bias
Browse files Browse the repository at this point in the history
Did is so that it does not run in the CI as we don't have PLUMED there
  • Loading branch information
ceriottm committed Apr 20, 2024
1 parent 75cdc7b commit 9a96412
Show file tree
Hide file tree
Showing 12 changed files with 262 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ipi_tests/regression_tests/README
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ To add a new regression test please provide:

reference file: ref_simulation.out
output to be genererated from i-pi: simulation.out

- Folder names terminating with '.NOAUTO' (e.g. 'PLUMED.NOAUTO') are ignored
when run without specifying the folder name explicitly. This is useful when the
test requires an external program (e.g. PLUMED) that may not be available on
the testing platform


Important:
Expand Down
4 changes: 2 additions & 2 deletions ipi_tests/regression_tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ def test_regtest(regtest):

try:
path = str(regtests_folder / args.folder)
reg_tests = get_test_list(path)
reg_tests = get_test_list(path, skip_noauto=False)
print("We will run only:")
for i in reg_tests:
print(i)
print("")
except:
print("We will run all available regression tests")
reg_tests = get_test_list(regtests_folder)
reg_tests = get_test_list(regtests_folder, skip_noauto=True)

print("We have found {} reg_tests".format(len(reg_tests)))
for test_info in reg_tests:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
filename format
----------------------------------------------------------
ref_simulation.frc_c.xyz xyz
ref_simulation.pos_c.xyz xyz
ref_simulation.out numpy
ref_COLVAR numpy
5 changes: 5 additions & 0 deletions ipi_tests/regression_tests/tests/PLUMED/BIAS.NOAUTO/init.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
3
#
O 0.54044984 -0.97485007 -0.21657970
H 0.18385954 -1.25804198 -1.07875142
H 0.04233158 -0.19485993 0.09228101
41 changes: 41 additions & 0 deletions ipi_tests/regression_tests/tests/PLUMED/BIAS.NOAUTO/input.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<simulation mode="static" verbosity="medium">
<output prefix='simulation'>
<properties stride='1' filename='out'> [ step, potential{electronvolt}] </properties>
<trajectory stride="20" filename="pos_c" format="xyz"> x_centroid </trajectory>
<trajectory stride="20" filename="frc_c" format="xyz"> f_centroid </trajectory>
</output>
<total_steps> 100 </total_steps>
<ffsocket name="pswater" mode="unix">
<address> localhost </address>
</ffsocket>
<ffplumed name="plumed">
<file mode="xyz">./init.xyz</file>
<plumeddat> plumed.dat </plumeddat>
</ffplumed>
<system >
<initialize nbeads='1'>
<file mode='xyz' units='angstrom'>init.xyz</file>
<cell> [ 25.29166, 0, 0, 0, 25.29166, 0, 0, 0, 25.29166 ] </cell>
</initialize>
<forces>
<force forcefield="pswater"> </force>
</forces>
<ensemble>
<temperature units="kelvin"> 300.0 </temperature>
<bias>
<force forcefield="plumed" nbeads="1"></force>
</bias>
</ensemble>
<motion mode="dynamics">
<dynamics mode="nvt">
<timestep units="femtosecond"> 0.5 </timestep>
<thermostat mode="langevin">
<tau units="femtosecond"> 5 </tau>
</thermostat>
</dynamics>
</motion>
</system>
<smotion mode="metad">
<metad> <metaff> [ plumed ] </metaff> </metad>
</smotion>
</simulation>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# default units are LENGTH=nm ENERGY=kJ/mol TIME=ps
dhh: DISTANCE ATOMS=2,3
RESTRAINT ARG=dhh AT=0.25 KAPPA=1e5 LABEL=rest

PRINT ARG=dhh,rest.* STRIDE=4 FILE=COLVAR
FLUSH STRIDE=1

26 changes: 26 additions & 0 deletions ipi_tests/regression_tests/tests/PLUMED/BIAS.NOAUTO/ref_COLVAR
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! FIELDS time dhh rest.bias rest.force2
0.000097 0.184331 215.623573 43124714.631938
0.000194 0.220153 44.540998 8908199.552153
0.000290 0.228350 23.437102 4687420.313194
0.000387 0.208506 86.087415 17217483.027251
0.000484 0.186316 202.783446 40556689.120482
0.000581 0.195882 146.437129 29287425.761376
0.000677 0.214331 63.613732 12722746.423567
0.000774 0.219615 46.161372 9232274.453717
0.000871 0.209151 83.431772 16686354.439035
0.000968 0.193753 158.186674 31637334.717337
0.001064 0.189815 181.114349 36222869.853859
0.001161 0.201878 115.787834 23157566.814556
0.001258 0.213007 68.424614 13684922.701663
0.001355 0.213897 65.169567 13033913.399078
0.001451 0.206660 93.918793 18783758.690671
0.001548 0.194784 152.440133 30488026.631448
0.001645 0.199688 126.563246 25312649.262310
0.001742 0.205663 98.287587 19657517.347279
0.001838 0.206943 92.697079 18539415.792061
0.001935 0.203886 106.323087 21264617.450864
0.002032 0.200653 121.758531 24351706.255268
0.002129 0.197283 138.953307 27790661.446668
0.002225 0.200037 124.813581 24962716.130805
0.002322 0.205228 100.224485 20044897.099738
0.002419 0.202661 112.047234 22409446.836354
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 0 Bead: 0 f_centroid{atomic_unit} cell{atomic_unit}
O -7.34145e-03 4.55046e-03 -4.38801e-03
H 1.78151e-03 1.10616e-02 1.67248e-02
H 5.55994e-03 -1.56120e-02 -1.23368e-02
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 20 Bead: 0 f_centroid{atomic_unit} cell{atomic_unit}
O 3.00660e-02 -6.51393e-02 -2.11490e-02
H -1.36193e-02 5.76692e-02 5.16106e-02
H -1.64467e-02 7.47005e-03 -3.04616e-02
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 40 Bead: 0 f_centroid{atomic_unit} cell{atomic_unit}
O -8.54149e-03 6.99613e-03 -1.05965e-02
H -8.06995e-03 5.15873e-02 7.46366e-02
H 1.66114e-02 -5.85834e-02 -6.40401e-02
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 60 Bead: 0 f_centroid{atomic_unit} cell{atomic_unit}
O 2.25533e-03 1.23581e-02 3.15938e-02
H -1.72452e-02 5.30545e-02 6.25606e-02
H 1.49899e-02 -6.54126e-02 -9.41544e-02
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 80 Bead: 0 f_centroid{atomic_unit} cell{atomic_unit}
O 5.90243e-03 -1.75604e-03 1.37665e-03
H -1.36026e-02 5.64416e-02 8.00102e-02
H 7.70016e-03 -5.46855e-02 -8.13869e-02
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 100 Bead: 0 f_centroid{atomic_unit} cell{atomic_unit}
O -3.77567e-03 -2.01726e-03 -2.78397e-03
H -2.26877e-03 5.64479e-02 8.41792e-02
H 6.04444e-03 -5.44307e-02 -8.13952e-02
103 changes: 103 additions & 0 deletions ipi_tests/regression_tests/tests/PLUMED/BIAS.NOAUTO/ref_simulation.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# column 1 --> step : The current simulation time step.
# column 2 --> potential{electronvolt} : The physical system potential energy.
0.00000000e+00 3.25615492e-02
1.00000000e+00 5.76949314e-02
2.00000000e+00 1.41165251e-01
3.00000000e+00 3.66274711e-01
4.00000000e+00 7.39957788e-01
5.00000000e+00 1.18657709e+00
6.00000000e+00 1.64059978e+00
7.00000000e+00 2.11730348e+00
8.00000000e+00 2.51283801e+00
9.00000000e+00 2.80217377e+00
1.00000000e+01 2.98085379e+00
1.10000000e+01 3.02318306e+00
1.20000000e+01 2.90767615e+00
1.30000000e+01 2.71609007e+00
1.40000000e+01 2.45544674e+00
1.50000000e+01 2.13952149e+00
1.60000000e+01 1.78209900e+00
1.70000000e+01 1.45127851e+00
1.80000000e+01 1.18472483e+00
1.90000000e+01 9.72369496e-01
2.00000000e+01 8.25580153e-01
2.10000000e+01 7.68242936e-01
2.20000000e+01 7.84240488e-01
2.30000000e+01 9.09298701e-01
2.40000000e+01 1.13361847e+00
2.50000000e+01 1.38850907e+00
2.60000000e+01 1.64658535e+00
2.70000000e+01 1.88173226e+00
2.80000000e+01 2.05674122e+00
2.90000000e+01 2.19192921e+00
3.00000000e+01 2.28081628e+00
3.10000000e+01 2.34212600e+00
3.20000000e+01 2.34394085e+00
3.30000000e+01 2.30719281e+00
3.40000000e+01 2.13131605e+00
3.50000000e+01 1.96317480e+00
3.60000000e+01 1.74668285e+00
3.70000000e+01 1.50102140e+00
3.80000000e+01 1.30438679e+00
3.90000000e+01 1.12391496e+00
4.00000000e+01 9.69291798e-01
4.10000000e+01 8.66893892e-01
4.20000000e+01 7.85790720e-01
4.30000000e+01 7.61510117e-01
4.40000000e+01 7.99245224e-01
4.50000000e+01 8.98409910e-01
4.60000000e+01 1.04454649e+00
4.70000000e+01 1.22633875e+00
4.80000000e+01 1.40156356e+00
4.90000000e+01 1.56699046e+00
5.00000000e+01 1.74743959e+00
5.10000000e+01 1.89622664e+00
5.20000000e+01 1.99519129e+00
5.30000000e+01 2.04454885e+00
5.40000000e+01 2.05902285e+00
5.50000000e+01 2.05184435e+00
5.60000000e+01 2.03091989e+00
5.70000000e+01 1.96961817e+00
5.80000000e+01 1.89824694e+00
5.90000000e+01 1.78203375e+00
6.00000000e+01 1.62576266e+00
6.10000000e+01 1.43878440e+00
6.20000000e+01 1.27078130e+00
6.30000000e+01 1.12019035e+00
6.40000000e+01 1.05533955e+00
6.50000000e+01 1.08185462e+00
6.60000000e+01 1.14155728e+00
6.70000000e+01 1.20894642e+00
6.80000000e+01 1.25352795e+00
6.90000000e+01 1.33414251e+00
7.00000000e+01 1.39149390e+00
7.10000000e+01 1.47005568e+00
7.20000000e+01 1.53239691e+00
7.30000000e+01 1.58728429e+00
7.40000000e+01 1.59932992e+00
7.50000000e+01 1.60508486e+00
7.60000000e+01 1.59916236e+00
7.70000000e+01 1.55469308e+00
7.80000000e+01 1.52514794e+00
7.90000000e+01 1.49101237e+00
8.00000000e+01 1.44091236e+00
8.10000000e+01 1.41637975e+00
8.20000000e+01 1.39748798e+00
8.30000000e+01 1.34828554e+00
8.40000000e+01 1.28372097e+00
8.50000000e+01 1.24049201e+00
8.60000000e+01 1.17313816e+00
8.70000000e+01 1.12352079e+00
8.80000000e+01 1.11917209e+00
8.90000000e+01 1.10723717e+00
9.00000000e+01 1.14348946e+00
9.10000000e+01 1.17896254e+00
9.20000000e+01 1.25654189e+00
9.30000000e+01 1.34171864e+00
9.40000000e+01 1.43036501e+00
9.50000000e+01 1.49167593e+00
9.60000000e+01 1.51978189e+00
9.70000000e+01 1.51103238e+00
9.80000000e+01 1.46516604e+00
9.90000000e+01 1.40203871e+00
1.00000000e+02 1.37586058e+00
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 0 Bead: 0 x_centroid{atomic_unit} cell{atomic_unit}
O 1.02130e+00 -1.84220e+00 -4.09276e-01
H 3.47444e-01 -2.37735e+00 -2.03854e+00
H 7.99951e-02 -3.68232e-01 1.74386e-01
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 20 Bead: 0 x_centroid{atomic_unit} cell{atomic_unit}
O 9.69225e-01 -1.82197e+00 -4.19100e-01
H 8.30712e-01 -2.73182e+00 -2.12743e+00
H 4.23365e-01 -3.34913e-01 4.19203e-01
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 40 Bead: 0 x_centroid{atomic_unit} cell{atomic_unit}
O 9.86598e-01 -1.84319e+00 -4.13643e-01
H 7.48846e-01 -2.49957e+00 -2.31041e+00
H 2.29459e-01 -2.30219e-01 5.15560e-01
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 60 Bead: 0 x_centroid{atomic_unit} cell{atomic_unit}
O 9.76284e-01 -1.83587e+00 -4.39929e-01
H 8.20561e-01 -2.52441e+00 -2.28179e+00
H 3.21472e-01 -3.21702e-01 9.04183e-01
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 80 Bead: 0 x_centroid{atomic_unit} cell{atomic_unit}
O 9.99042e-01 -1.80673e+00 -4.46798e-01
H 6.00194e-01 -2.74082e+00 -2.21121e+00
H 1.80588e-01 -5.67817e-01 9.42645e-01
3
# CELL(abcABC): 25.29166 25.29166 25.29166 90.00000 90.00000 90.00000 Step: 100 Bead: 0 x_centroid{atomic_unit} cell{atomic_unit}
O 1.01297e+00 -1.78473e+00 -4.65187e-01
H 3.71459e-01 -2.89285e+00 -2.07779e+00
H 1.88253e-01 -7.64974e-01 1.10112e+00
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver_model pswater
address localhost
port 32342
socket_mode unix
4 changes: 3 additions & 1 deletion ipi_tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@
]


def get_test_list(parent):
def get_test_list(parent, skip_noauto=True):
"""This function recursively searches for test"""
folders = [x[0] for x in os.walk(parent)]
reg_tests = list()

for ff in folders:
if skip_noauto and ff[-7:].lower() == ".noauto":
continue
if os.path.isfile(Path(ff) / "input.xml"):
reg_tests.append(ff)

Expand Down

0 comments on commit 9a96412

Please sign in to comment.