Skip to content

Commit

Permalink
Enable and test mwABF in GROMACS
Browse files Browse the repository at this point in the history
I disabled an init-time check for mutliple replicas because the
info becomes available after the proxy construction in GMX.
The lack of mutliple-replica setup will then be caught when the
first communication attempt occurs.
  • Loading branch information
jhenin committed Oct 21, 2024
1 parent b5d8709 commit c5b951c
Show file tree
Hide file tree
Showing 18 changed files with 340 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gromacs/tests/interface/010_MPI_multi-sim/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ done
# cp -f a/test.colvars.traj a/test.colvars.state .
# cp -f a/test.log ./test.out

echo " Success!"
echo " Done."

20 changes: 20 additions & 0 deletions gromacs/tests/interface/011_MPI_mwABF/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Gromacs mwABF regression test

This directory contains a test for multiple-walker ABF in Colvars/Gromacs.


### Version tested

The tests are valid against Gromacs version 2024.3 and following.


### Files tested

Only the traj files of the simulation **a** is being tested.


### Scripts

- `create_tpr.sh` is used to generate the .tpr
- `run.sh` is called by a `run_tests.sh` script to run the REMD simulation
- `cleanup.sh` is called by a `run_tests.sh` to clean the simulations files in the subfolders.
56 changes: 56 additions & 0 deletions gromacs/tests/interface/011_MPI_mwABF/a/system.mdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
;Run control
integrator = md-vv
;time step in picoseconds
dt = 0.002
;number of steps
nsteps = 50
;no trr
nstxout = 0
nstvout = 0
nstfout = 0
;frequency to write energies to log file
nstlog = 1
;frequency to write energies to energy file
nstenergy = 1
nstcalcenergy = 1
;frequency to write coordinates to xtc trajectory
nstxout-compressed = 1

cutoff-scheme = verlet


; Periodic boundary conditions
pbc = xyz ; 3-D PBC

; Bond parameters
constraint_algorithm = lincs
constraints = h-bonds



;treatment of van der waals interactions
vdwtype = cut-off
vdw-modifier = Potential-switch
rvdw = 1.2
rvdw-switch = 1.0

coulombtype = PME
rcoulomb = 1.2
pme_order = 4 ; cubic interpolation
fourierspacing = 0.12 ; grid spacing for FFT

;Temperature coupling
tcoupl = v-rescale
tc-grps = System
ref-t = 300
tau-t = 1
ld-seed = 1

; pressure coupling
pcoupl = no

gen-vel = no

colvars-active = yes
colvars-configfile = test.colvars

1 change: 1 addition & 0 deletions gromacs/tests/interface/011_MPI_mwABF/a/test.colvars
Binary file added gromacs/tests/interface/011_MPI_mwABF/a/test.tpr
Binary file not shown.
56 changes: 56 additions & 0 deletions gromacs/tests/interface/011_MPI_mwABF/b/system.mdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
;Run control
integrator = md-vv
;time step in picoseconds
dt = 0.002
;number of steps
nsteps = 50
;no trr
nstxout = 0
nstvout = 0
nstfout = 0
;frequency to write energies to log file
nstlog = 1
;frequency to write energies to energy file
nstenergy = 1
nstcalcenergy = 1
;frequency to write coordinates to xtc trajectory
nstxout-compressed = 1

cutoff-scheme = verlet


; Periodic boundary conditions
pbc = xyz ; 3-D PBC

; Bond parameters
constraint_algorithm = lincs
constraints = h-bonds



;treatment of van der waals interactions
vdwtype = cut-off
vdw-modifier = Potential-switch
rvdw = 1.2
rvdw-switch = 1.0

coulombtype = PME
rcoulomb = 1.2
pme_order = 4 ; cubic interpolation
fourierspacing = 0.12 ; grid spacing for FFT

;Temperature coupling
tcoupl = v-rescale
tc-grps = System
ref-t = 300
tau-t = 1
ld-seed = 2

; pressure coupling
pcoupl = no

gen-vel = no

colvars-active = yes
colvars-configfile = test.colvars

1 change: 1 addition & 0 deletions gromacs/tests/interface/011_MPI_mwABF/b/test.colvars
Binary file added gromacs/tests/interface/011_MPI_mwABF/b/test.tpr
Binary file not shown.
56 changes: 56 additions & 0 deletions gromacs/tests/interface/011_MPI_mwABF/c/system.mdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
;Run control
integrator = md-vv
;time step in picoseconds
dt = 0.002
;number of steps
nsteps = 50
;no trr
nstxout = 0
nstvout = 0
nstfout = 0
;frequency to write energies to log file
nstlog = 1
;frequency to write energies to energy file
nstenergy = 1
nstcalcenergy = 1
;frequency to write coordinates to xtc trajectory
nstxout-compressed = 1

cutoff-scheme = verlet


; Periodic boundary conditions
pbc = xyz ; 3-D PBC

; Bond parameters
constraint_algorithm = lincs
constraints = h-bonds



;treatment of van der waals interactions
vdwtype = cut-off
vdw-modifier = Potential-switch
rvdw = 1.2
rvdw-switch = 1.0

coulombtype = PME
rcoulomb = 1.2
pme_order = 4 ; cubic interpolation
fourierspacing = 0.12 ; grid spacing for FFT

;Temperature coupling
tcoupl = v-rescale
tc-grps = System
ref-t = 300
tau-t = 1
ld-seed = 3

; pressure coupling
pcoupl = no

gen-vel = no

colvars-active = yes
colvars-configfile = test.colvars

1 change: 1 addition & 0 deletions gromacs/tests/interface/011_MPI_mwABF/c/test.colvars
Binary file added gromacs/tests/interface/011_MPI_mwABF/c/test.tpr
Binary file not shown.
14 changes: 14 additions & 0 deletions gromacs/tests/interface/011_MPI_mwABF/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# -*- sh-basic-offset: 2; sh-indentation: 2; -*-

# Script to remove simulations files
# Called by `run_tests.sh` scripts

echo "Cleaning up output files"
for i in a b c d
do
cd $i
rm -f *.xtc *.trr *.edr *.cpt *.gro *.log *~ \#*\# mdout.mdp
rm -f *.state *.old *.traj *.zcount
cd ..
done
56 changes: 56 additions & 0 deletions gromacs/tests/interface/011_MPI_mwABF/d/system.mdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
;Run control
integrator = md-vv
;time step in picoseconds
dt = 0.002
;number of steps
nsteps = 50
;no trr
nstxout = 0
nstvout = 0
nstfout = 0
;frequency to write energies to log file
nstlog = 1
;frequency to write energies to energy file
nstenergy = 1
nstcalcenergy = 1
;frequency to write coordinates to xtc trajectory
nstxout-compressed = 1

cutoff-scheme = verlet


; Periodic boundary conditions
pbc = xyz ; 3-D PBC

; Bond parameters
constraint_algorithm = lincs
constraints = h-bonds



;treatment of van der waals interactions
vdwtype = cut-off
vdw-modifier = Potential-switch
rvdw = 1.2
rvdw-switch = 1.0

coulombtype = PME
rcoulomb = 1.2
pme_order = 4 ; cubic interpolation
fourierspacing = 0.12 ; grid spacing for FFT

;Temperature coupling
tcoupl = v-rescale
tc-grps = System
ref-t = 300
tau-t = 1
ld-seed = 4

; pressure coupling
pcoupl = no

gen-vel = no

colvars-active = yes
colvars-configfile = test.colvars

1 change: 1 addition & 0 deletions gromacs/tests/interface/011_MPI_mwABF/d/test.colvars
Binary file added gromacs/tests/interface/011_MPI_mwABF/d/test.tpr
Binary file not shown.
46 changes: 46 additions & 0 deletions gromacs/tests/interface/011_MPI_mwABF/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# -*- sh-basic-offset: 2; sh-indentation: 2; -*-

# Script to launch the REMD regression tests
# It's best to have Gromacs compiled in double precision
# Reference files have been generated with Gromacs version 2024-dev

echo -n "Running $(basename $PWD)..."

#set -e

# if script called from `run_tests.sh` in the parent folder, retrieve the correct command binary from the argument
if [ -x "$1" ]
then
BINARY=$1
else
BINARY="gmx_mpi_d"
fi

mpirun -np 16 -oversubscribe $BINARY mdrun -multidir a b c d -s test.tpr -deffnm test -reseed 376 >& test.out

labels=(a b c d)
for number in $(seq 1 ${#labels[@]}) ; do
index=$((${number} - 1))
label=${labels[${index}]}
replica_msg=$(grep -s "colvars: Enabling multiple replicas: this is replica number" ${label}/test.log)
if [ -z "${replica_msg}" ] ; then
echo "Error: missing replica initialization message." >& 2
exit 1
fi
replica_num=$(echo ${replica_msg} | cut -d' ' -f 9)
replicas_count=$(echo ${replica_msg} | cut -d' ' -f 11)
replicas_count=${replicas_count%.}
if [ ${replicas_count} != 4 ] || [ ${replica_num} != ${number} ] ; then
echo -e "Error: wrong initialization for replica number ${number}; got the following message:\n\n${replica_msg}\n" >& 2
exit 1
fi
done

# Copy result files to be tested in the main folder
cp a/test.colvars.traj a/test.colvars.state .
cp a/test.log ./test.out
cp a/test.all.czar.pmf ./test.all.czar.pmf

echo " Done."

29 changes: 20 additions & 9 deletions gromacs/tests/interface/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ if [ ! -d ${TOPDIR} ] ; then
exit 1
fi

MPI_TESTS=[0-9][0-9][0-9]_MPI_*

tests=([0-9][0-9][0-9]_*)
tests=(${tests[@]/010_MPI_multi-sim})

for DIR in $MPI_TESTS
do
tests=(${tests[@]/$DIR})
done

ALL_SUCCESS=1

echo "Running tests ${tests[@]}"

../library/run_tests.sh $1 ${tests[@]}

if [ $? -ne 0 ]
Expand All @@ -20,14 +28,17 @@ fi

# Run tests that depend on an MPI build
if source ${TOPDIR}/devel-tools/load-openmpi.sh ; then
if pushd 010_MPI_multi-sim > /dev/null ; then
./run.sh $1
if [ $? -ne 0 ]
then
ALL_SUCCESS=0
fi
popd > /dev/null
fi
for DIR in $MPI_TESTS
do
if pushd $DIR > /dev/null ; then
./run.sh $1
if [ $? -ne 0 ]
then
ALL_SUCCESS=0
fi
popd > /dev/null
fi
done
fi


Expand Down
Loading

0 comments on commit c5b951c

Please sign in to comment.