Setup PBC box

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Xinyu Gu
Posts: 7
Joined: Thu Jun 06, 2019 9:09 am

Setup PBC box

Post by Xinyu Gu » Thu Jun 06, 2019 9:35 am

Dear OpenMM developers:

I'm setting up a simulation with PBC, and find that there are two functions for defining the periodic box: topology.setPeriodicBoxVectors() and system.setDefaultPeriodicBoxVectors(). I'm wondering which one should be chosen and what's their differences? I'll really appreciate it if anyone could help me figure it out :-)

Thanks for your attention :-)
Xinyu

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

Re: Setup PBC box

Post by Peter Eastman » Thu Jun 06, 2019 9:49 am

Topologies and Systems are different objects that represent different things. When you call forcefield.createSystem(topology, ...) to create a System from a Topology, that System has its default periodic box vectors set to the ones from the Topology.

There's also a third place where box vectors get stored: in the Context. The System specifies default box vectors, that is, the ones to use on newly created Contexts. If your simulation includes a barostat, the box vectors will change with time. The Context stores the current box vectors at a particular point during the simulation.

User avatar
Xinyu Gu
Posts: 7
Joined: Thu Jun 06, 2019 9:09 am

Re: Setup PBC box

Post by Xinyu Gu » Thu Jun 06, 2019 12:03 pm

Thank you so much for your quick reply! It's pretty helpful! :-)

POST REPLY