Integrator->step question

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Siddharth Srinivasan
Posts: 223
Joined: Thu Feb 12, 2009 6:49 pm

Integrator->step question

Post by Siddharth Srinivasan » Tue Mar 10, 2009 6:42 pm

I was looking through the Gromacs source, and noticed that there seems to be no explicit calcForce call anyplace, hence I assume that when the call to integrator->step(1) is made, that includes a force computation + position/velocity propagation? I ask because all I want to do is compute nonbonded forces on a bunch of atoms, I would like to position-integrate, and velocity-integrate outside of OpenMM. Which function (method I guess, not a C++ guy!) would I need to implement to basically say "here are a bunch of atoms, positions and nonbonded constants, give me an array of forces"? From that Im sure I can figure out how to do bonded forces and other things.

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

RE: Integrator->step question

Post by Peter Eastman » Wed Mar 11, 2009 11:47 am

After you create your OpenMMContext, call

context.setPositions(positions);

to tell it the positions of the atoms. To get the forces, you can then call

State state = context.getState(State::Forces);

The force on atom i is given by state.getForces().

Peter

POST REPLY