Commit bcc6216d authored by Peter Eastman's avatar Peter Eastman
Browse files

Periodic box dimensions can be changed in the middle of a simulation

parent 149c6ec6
......@@ -248,7 +248,7 @@ myInitializeOpenMM( int numWatersAlongEdge,
// Create periodic box
nonbond.setNonbondedMethod(OpenMM::NonbondedForce::CutoffPeriodic);
nonbond.setCutoffDistance(CutoffDistanceInAng * OpenMM::NmPerAngstrom);
system.setPeriodicBoxVectors(Vec3(boxEdgeLengthInNm,0,0),
system.setDefaultPeriodicBoxVectors(Vec3(boxEdgeLengthInNm,0,0),
Vec3(0,boxEdgeLengthInNm,0),
Vec3(0,0,boxEdgeLengthInNm));
......
......@@ -387,8 +387,8 @@ System* ValidateOpenMM::copySystemExcludingForces( const System& systemToCopy )
}
Vec3 a, b, c;
systemToCopy.getPeriodicBoxVectors( a, b, c );
system->setPeriodicBoxVectors( a, b, c );
systemToCopy.getDefaultPeriodicBoxVectors( a, b, c );
system->setDefaultPeriodicBoxVectors( a, b, c );
copyConstraints( systemToCopy, system );
......@@ -490,7 +490,7 @@ void ValidateOpenMM::writeMasses( FILE* filePtr, const System& system ) const {
}
Vec3 a, b, c;
system.getPeriodicBoxVectors( a, b, c);
system.getDefaultPeriodicBoxVectors( a, b, c);
(void) fprintf( filePtr, "Box %14.6f %14.6f %14.6f %14.6f %14.6f %14.6f %14.6f %14.6f %14.6f\n",
a[0], a[1], a[2], b[0], b[1], b[2], c[0], c[1], c[2] );
}
......
......@@ -153,6 +153,30 @@ public:
* @param value the value of the parameter
*/
void setParameter(const std::string& name, double value);
/**
* Get the vectors defining the axes of the periodic box (measured in nm). They will affect
* any Force that uses periodic boundary conditions.
*
* Currently, only rectangular boxes are supported. This means that a, b, and c must be aligned with the
* x, y, and z axes respectively. Future releases may support arbitrary triclinic boxes.
*
* @param a on exit, this contains the vector defining the first edge of the periodic box
* @param b on exit, this contains the vector defining the second edge of the periodic box
* @param c on exit, this contains the vector defining the third edge of the periodic box
*/
void getPeriodicBoxVectors(Vec3& a, Vec3& b, Vec3& c) const;
/**
* Set the vectors defining the axes of the periodic box (measured in nm). They will affect
* any Force that uses periodic boundary conditions.
*
* Currently, only rectangular boxes are supported. This means that a, b, and c must be aligned with the
* x, y, and z axes respectively. Future releases may support arbitrary triclinic boxes.
*
* @param a the vector defining the first edge of the periodic box
* @param b the vector defining the second edge of the periodic box
* @param c the vector defining the third edge of the periodic box
*/
void setPeriodicBoxVectors(Vec3 a, Vec3 b, Vec3 c);
/**
* When a Context is created, it may cache information about the System being simulated
* and the Force objects contained in it. This means that, if the System or Forces are then
......@@ -167,6 +191,7 @@ private:
friend class Platform;
ContextImpl* impl;
std::map<std::string, std::string> properties;
Vec3 periodicBoxVectors[3];
};
} // namespace OpenMM
......
......@@ -165,7 +165,8 @@ public:
return *forces[index];
}
/**
* Get the vectors which define the axes of the periodic box (measured in nm). These will affect
* Get the default values of the vectors defining the axes of the periodic box (measured in nm). Any newly
* created Context will have its box vectors set to these. They will affect
* any Force added to the System that uses periodic boundary conditions.
*
* Currently, only rectangular boxes are supported. This means that a, b, and c must be aligned with the
......@@ -175,9 +176,10 @@ public:
* @param b on exit, this contains the vector defining the second edge of the periodic box
* @param c on exit, this contains the vector defining the third edge of the periodic box
*/
void getPeriodicBoxVectors(Vec3& a, Vec3& b, Vec3& c) const;
void getDefaultPeriodicBoxVectors(Vec3& a, Vec3& b, Vec3& c) const;
/**
* Set the vectors which define the axes of the periodic box (measured in nm). These will affect
* Set the default values of the vectors defining the axes of the periodic box (measured in nm). Any newly
* created Context will have its box vectors set to these. They will affect
* any Force added to the System that uses periodic boundary conditions.
*
* Currently, only rectangular boxes are supported. This means that a, b, and c must be aligned with the
......@@ -187,7 +189,7 @@ public:
* @param b the vector defining the second edge of the periodic box
* @param c the vector defining the third edge of the periodic box
*/
void setPeriodicBoxVectors(Vec3 a, Vec3 b, Vec3 c);
void setDefaultPeriodicBoxVectors(Vec3 a, Vec3 b, Vec3 c);
private:
class ConstraintInfo;
Vec3 periodicBoxVectors[3];
......
......@@ -38,14 +38,17 @@ using namespace std;
Context::Context(System& system, Integrator& integrator) : properties(map<string, string>()) {
impl = new ContextImpl(*this, system, integrator, 0, properties);
system.getDefaultPeriodicBoxVectors(periodicBoxVectors[0], periodicBoxVectors[1], periodicBoxVectors[2]);
}
Context::Context(System& system, Integrator& integrator, Platform& platform) : properties(map<string, string>()) {
impl = new ContextImpl(*this, system, integrator, &platform, properties);
system.getDefaultPeriodicBoxVectors(periodicBoxVectors[0], periodicBoxVectors[1], periodicBoxVectors[2]);
}
Context::Context(System& system, Integrator& integrator, Platform& platform, const map<string, string>& properties) : properties(properties) {
impl = new ContextImpl(*this, system, integrator, &platform, properties);
system.getDefaultPeriodicBoxVectors(periodicBoxVectors[0], periodicBoxVectors[1], periodicBoxVectors[2]);
}
Context::~Context() {
......@@ -120,10 +123,29 @@ void Context::setParameter(const string& name, double value) {
impl->setParameter(name, value);
}
void Context::getPeriodicBoxVectors(Vec3& a, Vec3& b, Vec3& c) const {
a = periodicBoxVectors[0];
b = periodicBoxVectors[1];
c = periodicBoxVectors[2];
}
void Context::setPeriodicBoxVectors(Vec3 a, Vec3 b, Vec3 c) {
if (a[1] != 0.0 || a[2] != 0.0)
throw OpenMMException("First periodic box vector must be parallel to x.");
if (b[0] != 0.0 || b[2] != 0.0)
throw OpenMMException("Second periodic box vector must be parallel to y.");
if (c[0] != 0.0 || c[1] != 0.0)
throw OpenMMException("Third periodic box vector must be parallel to z.");
periodicBoxVectors[0] = a;
periodicBoxVectors[1] = b;
periodicBoxVectors[2] = c;
}
void Context::reinitialize() {
System& system = impl->getSystem();
Integrator& integrator = impl->getIntegrator();
Platform& platform = impl->getPlatform();
system.getDefaultPeriodicBoxVectors(periodicBoxVectors[0], periodicBoxVectors[1], periodicBoxVectors[2]);
delete impl;
impl = new ContextImpl(*this, system, integrator, &platform, properties);
}
......@@ -97,7 +97,7 @@ void CustomGBForceImpl::initialize(ContextImpl& context) {
}
if (owner.getNonbondedMethod() == CustomGBForce::CutoffPeriodic) {
Vec3 boxVectors[3];
system.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
system.getDefaultPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
double cutoff = owner.getCutoffDistance();
if (cutoff > 0.5*boxVectors[0][0] || cutoff > 0.5*boxVectors[1][1] || cutoff > 0.5*boxVectors[2][2])
throw OpenMMException("CustomGBForce: The cutoff distance cannot be greater than half the periodic box size.");
......
......@@ -170,7 +170,7 @@ void CustomHbondForceImpl::initialize(ContextImpl& context) {
}
if (owner.getNonbondedMethod() == CustomHbondForce::CutoffPeriodic) {
Vec3 boxVectors[3];
system.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
system.getDefaultPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
double cutoff = owner.getCutoffDistance();
if (cutoff > 0.5*boxVectors[0][0] || cutoff > 0.5*boxVectors[1][1] || cutoff > 0.5*boxVectors[2][2])
throw OpenMMException("CustomHbondForce: The cutoff distance cannot be greater than half the periodic box size.");
......
......@@ -97,7 +97,7 @@ void CustomNonbondedForceImpl::initialize(ContextImpl& context) {
}
if (owner.getNonbondedMethod() == CustomNonbondedForce::CutoffPeriodic) {
Vec3 boxVectors[3];
system.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
system.getDefaultPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
double cutoff = owner.getCutoffDistance();
if (cutoff > 0.5*boxVectors[0][0] || cutoff > 0.5*boxVectors[1][1] || cutoff > 0.5*boxVectors[2][2])
throw OpenMMException("CustomNonbondedForce: The cutoff distance cannot be greater than half the periodic box size.");
......
......@@ -47,7 +47,7 @@ void GBSAOBCForceImpl::initialize(ContextImpl& context) {
throw OpenMMException("GBSAOBCForce must have exactly as many particles as the System it belongs to.");
if (owner.getNonbondedMethod() == GBSAOBCForce::CutoffPeriodic) {
Vec3 boxVectors[3];
context.getSystem().getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
context.getSystem().getDefaultPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
double cutoff = owner.getCutoffDistance();
if (cutoff > 0.5*boxVectors[0][0] || cutoff > 0.5*boxVectors[1][1] || cutoff > 0.5*boxVectors[2][2])
throw OpenMMException("GBSAOBCForce: The cutoff distance cannot be greater than half the periodic box size.");
......
......@@ -96,7 +96,7 @@ void GBVIForceImpl::initialize(ContextImpl& context) {
}
if (owner.getNonbondedMethod() == GBVIForce::CutoffPeriodic) {
Vec3 boxVectors[3];
system.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
system.getDefaultPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
double cutoff = owner.getCutoffDistance();
if (cutoff > 0.5*boxVectors[0][0] || cutoff > 0.5*boxVectors[1][1] || cutoff > 0.5*boxVectors[2][2])
throw OpenMMException("GBVIForce: The cutoff distance cannot be greater than half the periodic box size.");
......
......@@ -89,7 +89,7 @@ void NonbondedForceImpl::initialize(ContextImpl& context) {
owner.getNonbondedMethod() == NonbondedForce::Ewald ||
owner.getNonbondedMethod() == NonbondedForce::PME) {
Vec3 boxVectors[3];
system.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
system.getDefaultPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
double cutoff = owner.getCutoffDistance();
if (cutoff > 0.5*boxVectors[0][0] || cutoff > 0.5*boxVectors[1][1] || cutoff > 0.5*boxVectors[2][2])
throw OpenMMException("NonbondedForce: The cutoff distance cannot be greater than half the periodic box size.");
......@@ -130,7 +130,7 @@ private:
void NonbondedForceImpl::calcEwaldParameters(const System& system, const NonbondedForce& force, double& alpha, int& kmaxx, int& kmaxy, int& kmaxz) {
Vec3 boxVectors[3];
system.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
system.getDefaultPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
double tol = force.getEwaldErrorTolerance();
alpha = (1.0/force.getCutoffDistance())*std::sqrt(-log(2.0*tol));
kmaxx = findZero(EwaldErrorFunction(boxVectors[0][0], alpha, tol), 10);
......@@ -146,7 +146,7 @@ void NonbondedForceImpl::calcEwaldParameters(const System& system, const Nonbond
void NonbondedForceImpl::calcPMEParameters(const System& system, const NonbondedForce& force, double& alpha, int& xsize, int& ysize, int& zsize) {
Vec3 boxVectors[3];
system.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
system.getDefaultPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
double tol = force.getEwaldErrorTolerance();
alpha = (1.0/force.getCutoffDistance())*std::sqrt(-log(2.0*tol));
xsize = (int) ceil(alpha*boxVectors[0][0]/pow(0.5*tol, 0.2));
......
......@@ -63,13 +63,13 @@ void System::setConstraintParameters(int index, int particle1, int particle2, do
constraints[index].distance = distance;
}
void System::getPeriodicBoxVectors(Vec3& a, Vec3& b, Vec3& c) const {
void System::getDefaultPeriodicBoxVectors(Vec3& a, Vec3& b, Vec3& c) const {
a = periodicBoxVectors[0];
b = periodicBoxVectors[1];
c = periodicBoxVectors[2];
}
void System::setPeriodicBoxVectors(Vec3 a, Vec3 b, Vec3 c) {
void System::setDefaultPeriodicBoxVectors(Vec3 a, Vec3 b, Vec3 c) {
if (a[1] != 0.0 || a[2] != 0.0)
throw OpenMMException("First periodic box vector must be parallel to x.");
if (b[0] != 0.0 || b[2] != 0.0)
......
......@@ -45,6 +45,13 @@ void CudaCalcForcesAndEnergyKernel::initialize(const System& system) {
void CudaCalcForcesAndEnergyKernel::beginForceComputation(ContextImpl& context) {
_gpuContext* gpu = data.gpu;
Vec3 boxVectors[3];
context.getOwner().getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
float boxx = boxVectors[0][0], boxy = boxVectors[1][1], boxz = boxVectors[2][2];
if (boxx != gpu->sim.periodicBoxSizeX || boxy != gpu->sim.periodicBoxSizeY || boxz != gpu->sim.periodicBoxSizeZ) {
gpuSetPeriodicBoxSize(gpu, boxx, boxy, boxz);
gpuSetConstants(gpu);
}
if (data.nonbondedMethod != NO_CUTOFF && data.computeForceCount%100 == 0)
gpuReorderAtoms(gpu);
data.computeForceCount++;
......@@ -77,6 +84,13 @@ void CudaCalcForcesAndEnergyKernel::finishForceComputation(ContextImpl& context)
void CudaCalcForcesAndEnergyKernel::beginEnergyComputation(ContextImpl& context) {
_gpuContext* gpu = data.gpu;
Vec3 boxVectors[3];
context.getOwner().getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
float boxx = boxVectors[0][0], boxy = boxVectors[1][1], boxz = boxVectors[2][2];
if (boxx != gpu->sim.periodicBoxSizeX || boxy != gpu->sim.periodicBoxSizeY || boxz != gpu->sim.periodicBoxSizeZ) {
gpuSetPeriodicBoxSize(gpu, boxx, boxy, boxz);
gpuSetConstants(gpu);
}
if (data.nonbondedMethod != NO_CUTOFF && data.stepCount%100 == 0)
gpuReorderAtoms(gpu);
data.stepCount++;
......@@ -490,9 +504,6 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
exclusionList[exclusions[i].first].push_back(exclusions[i].second);
exclusionList[exclusions[i].second].push_back(exclusions[i].first);
}
Vec3 boxVectors[3];
system.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
gpuSetPeriodicBoxSize(gpu, (float)boxVectors[0][0], (float)boxVectors[1][1], (float)boxVectors[2][2]);
CudaNonbondedMethod method = NO_CUTOFF;
if (force.getNonbondedMethod() != NonbondedForce::NoCutoff) {
gpuSetNonbondedCutoff(gpu, (float) force.getCutoffDistance(), (float) force.getReactionFieldDielectric());
......@@ -583,9 +594,6 @@ void CudaCalcCustomNonbondedForceKernel::initialize(const System& system, const
exclusionList[particle1].push_back(particle2);
exclusionList[particle2].push_back(particle1);
}
Vec3 boxVectors[3];
system.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
gpuSetPeriodicBoxSize(gpu, (float)boxVectors[0][0], (float)boxVectors[1][1], (float)boxVectors[2][2]);
CudaNonbondedMethod method = NO_CUTOFF;
if (force.getNonbondedMethod() != CustomNonbondedForce::NoCutoff)
method = CUTOFF;
......
......@@ -187,7 +187,7 @@ void testPeriodic() {
forceField->addParticle(vector<double>());
forceField->setNonbondedMethod(CustomNonbondedForce::CutoffPeriodic);
forceField->setCutoffDistance(2.0);
system.setPeriodicBoxVectors(Vec3(4, 0, 0), Vec3(0, 4, 0), Vec3(0, 0, 4));
system.setDefaultPeriodicBoxVectors(Vec3(4, 0, 0), Vec3(0, 4, 0), Vec3(0, 0, 4));
system.addForce(forceField);
Context context(system, integrator, platform);
vector<Vec3> positions(3);
......
......@@ -79,7 +79,7 @@ void testEwaldPME(bool includeExceptions) {
nonbonded->addParticle(1.0, 1.0,0.0);
for (int i = 0; i < numParticles/2; i++)
nonbonded->addParticle(-1.0, 1.0,0.0);
system.setPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.addForce(nonbonded);
vector<Vec3> positions(numParticles);
......@@ -184,7 +184,7 @@ void testEwald2Ions() {
const double cutoff = 2.0;
nonbonded->setCutoffDistance(cutoff);
nonbonded->setEwaldErrorTolerance(TOL);
system.setPeriodicBoxVectors(Vec3(6, 0, 0), Vec3(0, 6, 0), Vec3(0, 0, 6));
system.setDefaultPeriodicBoxVectors(Vec3(6, 0, 0), Vec3(0, 6, 0), Vec3(0, 0, 6));
system.addForce(nonbonded);
Context context(system, integrator, platform);
vector<Vec3> positions(2);
......@@ -205,7 +205,7 @@ void testErrorTolerance(NonbondedForce::NonbondedMethod method) {
const int numParticles = 51;
const double boxWidth = 5.0;
System system;
system.setPeriodicBoxVectors(Vec3(boxWidth, 0, 0), Vec3(0, boxWidth, 0), Vec3(0, 0, boxWidth));
system.setDefaultPeriodicBoxVectors(Vec3(boxWidth, 0, 0), Vec3(0, boxWidth, 0), Vec3(0, 0, boxWidth));
NonbondedForce* force = new NonbondedForce();
system.addForce(force);
vector<Vec3> positions(numParticles);
......
......@@ -91,7 +91,7 @@ void testCutoffAndPeriodic() {
const double boxSize = 10.0;
nonbonded->setCutoffDistance(cutoffDistance);
gbsa->setCutoffDistance(cutoffDistance);
system.setPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.addForce(gbsa);
system.addForce(nonbonded);
vector<Vec3> positions(2);
......@@ -152,7 +152,7 @@ void testForce(int numParticles, NonbondedForce::NonbondedMethod method, GBSAOBC
int grid = (int) floor(0.5+pow(numParticles, 1.0/3.0));
if (method == NonbondedForce::CutoffPeriodic) {
double boxSize = (grid+1)*1.1;
system.setPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
}
system.addForce(gbsa);
system.addForce(nonbonded);
......
......@@ -343,7 +343,7 @@ void testPeriodic() {
nonbonded->setNonbondedMethod(NonbondedForce::CutoffPeriodic);
const double cutoff = 2.0;
nonbonded->setCutoffDistance(cutoff);
system.setPeriodicBoxVectors(Vec3(4, 0, 0), Vec3(0, 4, 0), Vec3(0, 0, 4));
system.setDefaultPeriodicBoxVectors(Vec3(4, 0, 0), Vec3(0, 4, 0), Vec3(0, 0, 4));
system.addForce(nonbonded);
Context context(system, integrator, platform);
vector<Vec3> positions(3);
......@@ -423,7 +423,7 @@ void testLargeSystem() {
// Now do the same thing with periodic boundary conditions.
nonbonded->setNonbondedMethod(NonbondedForce::CutoffPeriodic);
system.setPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
cudaContext.reinitialize();
referenceContext.reinitialize();
cudaContext.setPositions(positions);
......@@ -461,7 +461,7 @@ void testBlockInteractions(bool periodic) {
}
nonbonded->setNonbondedMethod(periodic ? NonbondedForce::CutoffPeriodic : NonbondedForce::CutoffNonPeriodic);
nonbonded->setCutoffDistance(cutoff);
system.setPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.addForce(nonbonded);
Context context(system, integrator, cuda);
context.setPositions(positions);
......
......@@ -3848,9 +3848,9 @@ Integrator* readParameterFile( const std::string& inputParameterFile, MapStringI
boxIndex++;
}
}
system.setPeriodicBoxVectors( box[0], box[1], box[2] );
system.setDefaultPeriodicBoxVectors( box[0], box[1], box[2] );
Vec3 a, b, c;
system.getPeriodicBoxVectors( a, b, c);
system.getDefaultPeriodicBoxVectors( a, b, c);
if( log ){
(void) fprintf( log, "Box [%14.7f %14.7f %14.7f]\n [%14.7f %14.7f %14.7f]\n [%14.7f %14.7f %14.7f]\n",
a[0], a[1], a[2], b[0], b[1], b[2], c[0], c[1], c[2] );
......
......@@ -408,7 +408,6 @@ void OpenCLContext::reorderAtoms() {
posq->download();
velm->download();
mm_float4 periodicBoxSize = nonbonded->getPeriodicBoxSize();
float minx = posq->get(0).x, maxx = posq->get(0).x;
float miny = posq->get(0).y, maxy = posq->get(0).y;
float minz = posq->get(0).z, maxz = posq->get(0).z;
......
......@@ -315,6 +315,25 @@ public:
int getSIMDWidth() const {
return simdWidth;
}
/**
* Get the size of the periodic box.
*/
mm_float4 getPeriodicBoxSize() const {
return periodicBoxSize;
}
/**
* Set the size of the periodic box.
*/
void setPeriodicBoxSize(double xsize, double ysize, double zsize) {
periodicBoxSize = mm_float4((float) xsize, (float) ysize, (float) zsize, 0);
invPeriodicBoxSize = mm_float4((float) (1.0/xsize), (float) (1.0/ysize), (float) (1.0/zsize), 0);
}
/**
* Get the inverse of the size of the periodic box.
*/
mm_float4 getInvPeriodicBoxSize() const {
return invPeriodicBoxSize;
}
/**
* Get the OpenCLIntegrationUtilities for this context.
*/
......@@ -347,6 +366,8 @@ private:
int numThreadBlocks;
int numForceBuffers;
int simdWidth;
mm_float4 periodicBoxSize;
mm_float4 invPeriodicBoxSize;
std::string compilationOptions;
cl::Context context;
cl::Device device;
......
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