Christopher
unread,Feb 14, 2012, 5:28:13 AM2/14/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Sire Developers
Hi Gaetano,
The best way to do it is to use the same methods as in
"VelocityVerlet::integrate(...)". You can get the raw pointers into
the atom_coords and atom_momenta arrays via the "coordsArray" and
"momentaArray" member functions of AtomicVelocityWorkspace. These
return the pointers to the arrays for the ith molecule in the
workspace. You can get the size of the ith array by using the "nAtoms"
function of AtomicVelocityWorkspace to get the number of atoms in the
ith molecule.
For example, if you have the velocities and coordinates from OpenMM in
one set of arrays, then you could use memcpy or qMemCopy to block copy
the data, e.g.
AtomicVelocityWorkspace ws = ...;
for (int i=0; i<nmols; ++i)
{
int nats = ws.nAtoms(i);
Vector *coords = ws.coordsArray(i);
Vector *momenta = ws.momentaArray(i);
qMemCopy(coords, openmm_coords[i], nats * sizeof(Vector));
qMemCopy(momenta, openmm_momenta[i], nats * sizeof(Vector));
}
or, if you wanted to copy directly, as perhaps the OpenMM arrays have
a different layout, then use;
for (int i=0; i<nmols; ++i)
{
int nats = ws.nAtoms(i);
Vector *coords = ws.coordsArray(i);
Vector *momenta = ws.momentaArray(i);
for (int j=0; j<nats; ++j)
{
coords[j] = Vector( openmm_coords[i][j].x, openmm_coords[i]
[j].y, openmm_coords[i][j].z );
momenta[j] = Vector( openmm_momenta[i][j].x, openmm_momenta[i]
[j].y, openmm_momenta[i][j].z );
}
}
I hope this helps. Please feel to email more, or email me code if you
want more help :-)
Best wishes,
Christopher