"plugins/vscode:/vscode.git/clone" did not exist on "a5d900d1e5f63c5bddce72b6c2deb79c150ef008"
Commit 89904a9e authored by Robert McGibbon's avatar Robert McGibbon
Browse files

Update RPMD enforcePeriodicBox to support triclinic unit cells

parent 704b15bf
...@@ -128,21 +128,15 @@ State RPMDIntegrator::getState(int copy, int types, bool enforcePeriodicBox, int ...@@ -128,21 +128,15 @@ State RPMDIntegrator::getState(int copy, int types, bool enforcePeriodicBox, int
center *= 1.0/molecules[i].size(); center *= 1.0/molecules[i].size();
// Find the displacement to move it into the first periodic box. // Find the displacement to move it into the first periodic box.
Vec3 diff;
int xcell = (int) floor(center[0]/periodicBoxSize[0][0]); diff -= periodicBoxSize[0]*static_cast<int>(center[0]/periodicBoxSize[0][0]);
int ycell = (int) floor(center[1]/periodicBoxSize[1][1]); diff -= periodicBoxSize[1]*static_cast<int>(center[1]/periodicBoxSize[1][1]);
int zcell = (int) floor(center[2]/periodicBoxSize[2][2]); diff -= periodicBoxSize[2]*static_cast<int>(center[2]/periodicBoxSize[2][2]);
double dx = xcell*periodicBoxSize[0][0];
double dy = ycell*periodicBoxSize[1][1];
double dz = zcell*periodicBoxSize[2][2];
// Translate all the particles in the molecule. // Translate all the particles in the molecule.
for (int j = 0; j < (int) molecules[i].size(); j++) { for (int j = 0; j < (int) molecules[i].size(); j++) {
Vec3& pos = positions[molecules[i][j]]; Vec3& pos = positions[molecules[i][j]];
pos[0] -= dx; pos -= diff;
pos[1] -= dy;
pos[2] -= dz;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment