Integrator->step question
- Siddharth Srinivasan
- Posts: 223
- Joined: Thu Feb 12, 2009 6:49 pm
Integrator->step question
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.
- Peter Eastman
- Posts: 2588
- Joined: Thu Aug 09, 2007 1:25 pm
RE: Integrator->step question
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
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