Page 1 of 1

New User Questions

Posted: Tue May 14, 2019 11:08 am
by gideonsimpson
I'm just getting started with OpenMM and I had a few questions I was hoping to get some guidance on:

1. Is it absolutely necessary to specify an integrator to do anything? I have in mind that there may be times I just want to make static calculations or find local minimizers. It's certainly not a big deal to specify one, but I was curious.

2. What is the role of the topology data structure? When is it needed/not needed?

3. Is there a way to confine the problem to 2D, akin to the

Code: Select all

fix enforce2d 
tool in LAMMPS?

Re: New User Questions

Posted: Tue May 14, 2019 11:33 am
by peastman
Is it absolutely necessary to specify an integrator to do anything?
Anything that requires a Context, yes. If you're just doing static energy evaluations, it doesn't matter what integrator you use.
What is the role of the topology data structure?
You need it for any of the following: using Modeller to edit your model; using a ForceField to construct a System; writing out PDB files.
Is there a way to confine the problem to 2D
The simplest way would probably be to write a CustomIntegrator that explicitly sets the z coordinate of each particle to 0 after every position update.

Re: New User Questions

Posted: Wed May 15, 2019 11:57 am
by gideonsimpson
For a CustomIntegrator, is there a way to only manipulate particular degrees of freedom per particle? I see commands like addComputePerDof, but these appear to operate on the entire position, x, and entire velocity, v space. Is there a way to access x[0], x[1], etc.?

Re: New User Questions

Posted: Wed May 15, 2019 2:29 pm
by peastman
One easy way is like this:

Code: Select all

integrator.addComputePerDof("x", "vector(_x(x), _y(x), 0)")
That will set the z component of the position to 0.

Another way is to create a per-DOF variable, and set it to (1, 1, 0) for each particle. Then you can multiply any calculation by that variable, and the z component will be set to 0.

Re: New User Questions

Posted: Thu May 16, 2019 1:09 pm
by gideonsimpson
Both suggestions work as expected. I'm guessing there's no straightforward way to modify the quenching tool (minimize energy) to restrict to 2D?

Re: New User Questions

Posted: Thu May 16, 2019 1:13 pm
by peastman
If your initial coordinates are confined to the xy plane, and all forces are in that plane, then the minimizer shouldn't ever move the particles out of it. But if you do have forces acting out of the plane, there's no way to prevent the minimizer from responding to them. The best you could do is add a fairly strong restraining force to keep them in the plane.