Commit 7f5a83cb authored by Gareth Tribello's avatar Gareth Tribello
Browse files

Added first go at checks on PLUMED interface to LAMMPS

parent b299bfa8
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
#!/bin/bash

LAMMPS=../../../src/lmp_mpi

# Run first LAMMPS calculation
$LAMMPS < in.peptide-plumed

# Check PLUMED positions
nlines=`paste plumed.xyz lammps.xyz | awk '{if( $2<$6-0.0001 || $2>$6+0.0001 || $3<$7-0.0001 || $3>$7+0.0001 || $4<$8-0.0002 || $4>$8+0.0002 ) if( $5!="Timestep:" && $1!=2004 ) print $0}' | wc -l` 
if [ "$nlines" -gt 0 ] ; then
@@ -30,3 +35,47 @@ if [ "$nlines" -gt 0 ] ; then
fi
rm -f plmd_energy2

# Check PLMD mass and charge
nlines=`wc -l mq_lammps | awk '{print $1}'`
sline=`grep -n "mass q" mq_lammps | awk '{print $1}' | sed -e s/:ITEM://`
for ((i=$sline+1;i<$nlines;i++)); do
    # Mass and charge from LAMMPS
    index=`head -n $i mq_lammps | tail -n 1 | awk '{print $1}'`
    l_mass=`head -n $i mq_lammps | tail -n 1 | awk '{print $2}'`
    l_charge=`head -n $i mq_lammps | tail -n 1 | awk '{print $3}'`
    # Mass and charge from PLUMED
    p_mass=`head -n $(($index+1)) mq_plumed | tail -n 1 | awk '{print $2}'`
    p_charge=`head -n $(($index+1)) mq_plumed | tail -n 1 | awk '{print $3}'`
    # Check PLUMED mass is same as lammps mass
    mdiff=`echo \( $l_mass - $p_mass \) \> 0 | bc -l` 
    if [ "$mdiff" -gt 0 ] ; then
         echo ERROR passing masses from LAMMPS to PLUMED
    fi 
    # Check PLUMED charge is same as lammps charge
    qdiff=`echo \( $l_charge - $p_charge \) \> 0 | bc -l` 
    if [ "$qdiff" -gt 0 ] ; then
         echo ERROR passing charges from LAMMPS to PLUMED
    fi 
done

# Run calculations to test adding restraint on bond
$LAMMPS < in.peptide-plumed-plumed-restraint
$LAMMPS < in.peptide-plumed-lammps-restraint
# Now compare value of distance when lammps and plumed restraint the distance
nlines=`paste lammps_restraint plumed_restraint | tail -n +2 | awk '{if( $2<$4-0.0001 || $2>$4+0.0001 ) print $0}' | wc -l`
if [ "$nlines" -gt 0 ] ; then
      echo ERROR passing forces from PLUMED back to LAMMPS
fi

# Nothing from here works

# Now try to simply increase the size of the box by applying a moving restraint on the volume
$LAMMPS < in.peptide-plumed-expand

# Now run calculations to test virial
$LAMMPS < in.peptide-plumed-npt
$LAMMPS < in.peptide-plumed-npt2	

# Now run calculations to check forces on energy
$LAMMPS < in.peptide-plumed-engforce-ref
$LAMMPS < in.peptide-plumed-eng-force-plumed
+8 −0
Original line number Diff line number Diff line
#!/bin/bash

# Data from first set of checks
rm bck.* plmd_energy lammps_energy mq_plumed mq_lammps lammps.xyz plumed.xyz p.log
# Data from checks on restraints
rm bck.* p.log lammps_restraint plumed_restraint
# Data from checks on virial
rm bck.* lammps_energy lammps.xyz log.lammps plmd_volume p.log plmd_volume_without_restraint plmd_volume_with_restraint
+1 −0
Original line number Diff line number Diff line
@@ -39,5 +39,6 @@ dump dd all xyz 10 lammps.xyz
variable        step equal step
variable        pe equal pe
fix             5 all print 10 "$(v_step) $(v_pe)" file lammps_energy
dump            mq all custom 200 mq_lammps id mass q 

run		101
+41 −0
Original line number Diff line number Diff line
# Solvated 5-mer peptide

units		real
atom_style	full

pair_style	lj/charmm/coul/long 8.0 10.0 10.0
bond_style      harmonic
angle_style     charmm
dihedral_style  charmm
improper_style  harmonic
kspace_style	pppm 0.0001

read_data	data.peptide

neighbor	2.0 bin
neigh_modify	delay 5

timestep	1.8181818181818181

group		peptide type <= 12
group		one id 2 4 5 6
group		two id 80 82 83 84
group		ref id 37
group		colvar union one two ref

fix		1 all nvt temp  363.0 363.0 90.90909090909091 tchain 1

fix		2 all plumed plumedfile plumed-engforce.dat outfile p.log

#dump		1 colvar custom 1 dump.colvar.lammpstrj id xu yu zu fx fy fz
#dump_modify 1 sort id

thermo_style	custom step temp etotal pe ke epair ebond f_2
thermo		10
dump            dd all xyz 10 lammps.xyz
variable        step equal step
variable        pe equal pe
fix             5 all print 10 "$(v_step) $(v_pe)" file lammps_energy
dump            mq all custom 200 mq_lammps id mass q 

run		101
+40 −0
Original line number Diff line number Diff line
# Solvated 5-mer peptide

units		real
atom_style	full

pair_style	lj/charmm/coul/long 8.0 10.0 10.0
bond_style      harmonic
angle_style     charmm
dihedral_style  charmm
improper_style  harmonic
kspace_style	pppm 0.0001

read_data	data.peptide

neighbor	2.0 bin
neigh_modify	delay 5

timestep	2.0

group		peptide type <= 12
group		one id 2 4 5 6
group		two id 80 82 83 84
group		ref id 37
group		colvar union one two ref

fix		1 all nvt temp  300.0 300.0 100.0 tchain 1

fix		2 all plumed plumedfile plumed-eng-ref.dat outfile p.log

#dump		1 colvar custom 1 dump.colvar.lammpstrj id xu yu zu fx fy fz
#dump_modify 1 sort id

thermo_style	custom step temp etotal pe ke epair ebond f_2
thermo		10
dump            dd all xyz 10 lammps.xyz
variable        step equal step
variable        pe equal pe
dump            mq all custom 200 mq_lammps id mass q 

run		101
Loading