start simulation from specific frame from dcd file?

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Wei Chen
Posts: 83
Joined: Thu Jul 02, 2015 6:35 pm

start simulation from specific frame from dcd file?

Post by Wei Chen » Mon Mar 18, 2019 11:59 am

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!

User avatar
Peter Eastman
Posts: 2593
Joined: Thu Aug 09, 2007 1:25 pm

Re: start simulation from specific frame from dcd file?

Post by Peter Eastman » Mon Mar 18, 2019 12:05 pm

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.

User avatar
Wei Chen
Posts: 83
Joined: Thu Jul 02, 2015 6:35 pm

Re: start simulation from specific frame from dcd file?

Post by Wei Chen » Mon Mar 18, 2019 12:29 pm

Great, that works, thank you!

POST REPLY