Skip to content

Instantly share code, notes, and snippets.

@cstein
Created August 9, 2012 13:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cstein/3304265 to your computer and use it in GitHub Desktop.
Save cstein/3304265 to your computer and use it in GitHub Desktop.
How to center a molecule from an MD-simulation in Gromacs
#!/usr/bin/env bash
TRAJIN=traj.xtc
TRAJOUT=trajfin.xtc
# delete the trajectory so gromacs wont display silly backup messages
if [ -e $TRAJOUT ]
then
rm -f $TRAJOUT
fi
# center molecule (you will be asked!)
trjconv -pbc mol -center -ur compact -s md.tpr -f $TRAJIN -o tmp.xtc
# make everything rotate and translate around that molecule (you will be asked!)
trjconv -fit rot+trans -s md.tpr -f tmp.xtc -o $TRAJOUT
rm -f tmp.xtc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment