Page 1 of 1

Setup PBC box

Posted: Thu Jun 06, 2019 9:35 am
by xinyu.gu
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

Re: Setup PBC box

Posted: Thu Jun 06, 2019 9:49 am
by peastman
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.

Re: Setup PBC box

Posted: Thu Jun 06, 2019 12:03 pm
by xinyu.gu
Thank you so much for your quick reply! It's pretty helpful! :-)