Page 1 of 1

start simulation from specific frame from dcd file?

Posted: Mon Mar 18, 2019 11:59 am
by fisiksnju
Hi,

I am trying to start simulation from a specific frame from dcd file, something similar for pdb file would be:

Code: Select all

pdb = PDBFile(start_pdb)
modeller = Modeller(pdb.topology, pdb.getPositions(frame=start_frame))
where `pdb.getPositions(frame=start_frame)` specifies the positions for starting configuration.

However, sometimes pdb file could be quite large and uses lots of memory and I would like to start simulation from the corresponding dcd file which is much smaller. But it seems that `DCDFile` class does not have "getPositions()" method (according to https://simtk.org/api_docs/openmm/api4_ ... DFile.html). I wonder if it is possible to do that for dcd file as well?

Thank you!

Re: start simulation from specific frame from dcd file?

Posted: Mon Mar 18, 2019 12:05 pm
by peastman
You can use MDTraj to read the DCD file. Something along these lines should work:

Code: Select all

import mdtraj as md
traj = md.load(dcd_file, top=pdb_file)
positions = traj.xyz[start_frame]
See http://mdtraj.org/development/ for documentation.

Re: start simulation from specific frame from dcd file?

Posted: Mon Mar 18, 2019 12:29 pm
by fisiksnju
Great, that works, thank you!