Commit eb232608 authored by John Chodera (MSKCC)'s avatar John Chodera (MSKCC)
Browse files

Merge remote-tracking branch 'upstream/master'

parents 62581e9c 7f8c5089
...@@ -69,11 +69,13 @@ public: ...@@ -69,11 +69,13 @@ public:
* @param includeForce true if forces should be computed * @param includeForce true if forces should be computed
* @param includeEnergy true if potential energy should be computed * @param includeEnergy true if potential energy should be computed
* @param groups a set of bit flags for which force groups to include * @param groups a set of bit flags for which force groups to include
* @param valid the method may set this to false to indicate the results are invalid and the force/energy
* calculation should be repeated
* @return the potential energy of the system. This value is added to all values returned by ForceImpls' * @return the potential energy of the system. This value is added to all values returned by ForceImpls'
* calcForcesAndEnergy() methods. That is, each force kernel may <i>either</i> return its contribution to the * calcForcesAndEnergy() methods. That is, each force kernel may <i>either</i> return its contribution to the
* energy directly, <i>or</i> add it to an internal buffer so that it will be included here. * energy directly, <i>or</i> add it to an internal buffer so that it will be included here.
*/ */
double finishComputation(ContextImpl& context, bool includeForce, bool includeEnergy, int groups); double finishComputation(ContextImpl& context, bool includeForce, bool includeEnergy, int groups, bool& valid);
private: private:
class BeginComputationTask; class BeginComputationTask;
class FinishComputationTask; class FinishComputationTask;
...@@ -81,6 +83,7 @@ private: ...@@ -81,6 +83,7 @@ private:
std::vector<Kernel> kernels; std::vector<Kernel> kernels;
std::vector<long long> completionTimes; std::vector<long long> completionTimes;
std::vector<double> contextNonbondedFractions; std::vector<double> contextNonbondedFractions;
std::vector<int> tileCounts;
OpenCLArray* contextForces; OpenCLArray* contextForces;
cl::Buffer* pinnedPositionBuffer; cl::Buffer* pinnedPositionBuffer;
cl::Buffer* pinnedForceBuffer; cl::Buffer* pinnedForceBuffer;
......
...@@ -127,7 +127,7 @@ void OpenCLCalcForcesAndEnergyKernel::beginComputation(ContextImpl& context, boo ...@@ -127,7 +127,7 @@ void OpenCLCalcForcesAndEnergyKernel::beginComputation(ContextImpl& context, boo
nb.prepareInteractions(); nb.prepareInteractions();
} }
double OpenCLCalcForcesAndEnergyKernel::finishComputation(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double OpenCLCalcForcesAndEnergyKernel::finishComputation(ContextImpl& context, bool includeForces, bool includeEnergy, int groups, bool& valid) {
cl.getBondedUtilities().computeInteractions(groups); cl.getBondedUtilities().computeInteractions(groups);
if ((groups&(1<<cl.getNonbondedUtilities().getForceGroup())) != 0) if ((groups&(1<<cl.getNonbondedUtilities().getForceGroup())) != 0)
cl.getNonbondedUtilities().computeInteractions(); cl.getNonbondedUtilities().computeInteractions();
......
...@@ -54,7 +54,7 @@ private: ...@@ -54,7 +54,7 @@ private:
bool useDouble; bool useDouble;
}; };
OpenCLNonbondedUtilities::OpenCLNonbondedUtilities(OpenCLContext& context) : context(context), cutoff(-1.0), useCutoff(false), anyExclusions(false), usePadding(true), OpenCLNonbondedUtilities::OpenCLNonbondedUtilities(OpenCLContext& context) : context(context), cutoff(-1.0), useCutoff(false), usePeriodic(false), anyExclusions(false), usePadding(true),
numForceBuffers(0), exclusionIndices(NULL), exclusionRowIndices(NULL), exclusionTiles(NULL), exclusions(NULL), interactingTiles(NULL), interactingAtoms(NULL), numForceBuffers(0), exclusionIndices(NULL), exclusionRowIndices(NULL), exclusionTiles(NULL), exclusions(NULL), interactingTiles(NULL), interactingAtoms(NULL),
interactionCount(NULL), blockCenter(NULL), blockBoundingBox(NULL), sortedBlocks(NULL), sortedBlockCenter(NULL), sortedBlockBoundingBox(NULL), interactionCount(NULL), blockCenter(NULL), blockBoundingBox(NULL), sortedBlocks(NULL), sortedBlockCenter(NULL), sortedBlockBoundingBox(NULL),
oldPositions(NULL), rebuildNeighborList(NULL), blockSorter(NULL), nonbondedForceGroup(0) { oldPositions(NULL), rebuildNeighborList(NULL), blockSorter(NULL), nonbondedForceGroup(0) {
...@@ -282,14 +282,6 @@ void OpenCLNonbondedUtilities::initialize(const System& system) { ...@@ -282,14 +282,6 @@ void OpenCLNonbondedUtilities::initialize(const System& system) {
sortedBlockCenter = new OpenCLArray(context, numAtomBlocks+1, 4*elementSize, "sortedBlockCenter"); sortedBlockCenter = new OpenCLArray(context, numAtomBlocks+1, 4*elementSize, "sortedBlockCenter");
sortedBlockBoundingBox = new OpenCLArray(context, numAtomBlocks+1, 4*elementSize, "sortedBlockBoundingBox"); sortedBlockBoundingBox = new OpenCLArray(context, numAtomBlocks+1, 4*elementSize, "sortedBlockBoundingBox");
oldPositions = new OpenCLArray(context, numAtoms, 4*elementSize, "oldPositions"); oldPositions = new OpenCLArray(context, numAtoms, 4*elementSize, "oldPositions");
if (context.getUseDoublePrecision()) {
vector<mm_double4> oldPositionsVec(numAtoms, mm_double4(1e30, 1e30, 1e30, 0));
oldPositions->upload(oldPositionsVec);
}
else {
vector<mm_float4> oldPositionsVec(numAtoms, mm_float4(1e30f, 1e30f, 1e30f, 0));
oldPositions->upload(oldPositionsVec);
}
rebuildNeighborList = OpenCLArray::create<int>(context, 1, "rebuildNeighborList"); rebuildNeighborList = OpenCLArray::create<int>(context, 1, "rebuildNeighborList");
blockSorter = new OpenCLSort(context, new BlockSortTrait(context.getUseDoublePrecision()), numAtomBlocks); blockSorter = new OpenCLSort(context, new BlockSortTrait(context.getUseDoublePrecision()), numAtomBlocks);
vector<cl_uint> count(1, 0); vector<cl_uint> count(1, 0);
...@@ -340,6 +332,7 @@ void OpenCLNonbondedUtilities::initialize(const System& system) { ...@@ -340,6 +332,7 @@ void OpenCLNonbondedUtilities::initialize(const System& system) {
sortBoxDataKernel.setArg<cl::Buffer>(6, oldPositions->getDeviceBuffer()); sortBoxDataKernel.setArg<cl::Buffer>(6, oldPositions->getDeviceBuffer());
sortBoxDataKernel.setArg<cl::Buffer>(7, interactionCount->getDeviceBuffer()); sortBoxDataKernel.setArg<cl::Buffer>(7, interactionCount->getDeviceBuffer());
sortBoxDataKernel.setArg<cl::Buffer>(8, rebuildNeighborList->getDeviceBuffer()); sortBoxDataKernel.setArg<cl::Buffer>(8, rebuildNeighborList->getDeviceBuffer());
sortBoxDataKernel.setArg<cl_int>(9, true);
findInteractingBlocksKernel = cl::Kernel(interactingBlocksProgram, "findBlocksWithInteractions"); findInteractingBlocksKernel = cl::Kernel(interactingBlocksProgram, "findBlocksWithInteractions");
findInteractingBlocksKernel.setArg<cl::Buffer>(5, interactionCount->getDeviceBuffer()); findInteractingBlocksKernel.setArg<cl::Buffer>(5, interactionCount->getDeviceBuffer());
findInteractingBlocksKernel.setArg<cl::Buffer>(6, interactingTiles->getDeviceBuffer()); findInteractingBlocksKernel.setArg<cl::Buffer>(6, interactingTiles->getDeviceBuffer());
...@@ -406,6 +399,7 @@ void OpenCLNonbondedUtilities::prepareInteractions() { ...@@ -406,6 +399,7 @@ void OpenCLNonbondedUtilities::prepareInteractions() {
context.executeKernel(sortBoxDataKernel, context.getNumAtoms()); context.executeKernel(sortBoxDataKernel, context.getNumAtoms());
setPeriodicBoxArgs(context, findInteractingBlocksKernel, 0); setPeriodicBoxArgs(context, findInteractingBlocksKernel, 0);
context.executeKernel(findInteractingBlocksKernel, context.getNumAtoms(), interactingBlocksThreadBlockSize); context.executeKernel(findInteractingBlocksKernel, context.getNumAtoms(), interactingBlocksThreadBlockSize);
sortBoxDataKernel.setArg<cl_int>(9, false);
} }
void OpenCLNonbondedUtilities::computeInteractions() { void OpenCLNonbondedUtilities::computeInteractions() {
...@@ -445,15 +439,7 @@ void OpenCLNonbondedUtilities::updateNeighborListSize() { ...@@ -445,15 +439,7 @@ void OpenCLNonbondedUtilities::updateNeighborListSize() {
findInteractingBlocksKernel.setArg<cl::Buffer>(6, interactingTiles->getDeviceBuffer()); findInteractingBlocksKernel.setArg<cl::Buffer>(6, interactingTiles->getDeviceBuffer());
findInteractingBlocksKernel.setArg<cl::Buffer>(7, interactingAtoms->getDeviceBuffer()); findInteractingBlocksKernel.setArg<cl::Buffer>(7, interactingAtoms->getDeviceBuffer());
findInteractingBlocksKernel.setArg<cl_uint>(9, maxTiles); findInteractingBlocksKernel.setArg<cl_uint>(9, maxTiles);
int numAtoms = context.getNumAtoms(); sortBoxDataKernel.setArg<cl_int>(9, true);
if (context.getUseDoublePrecision()) {
vector<mm_double4> oldPositionsVec(numAtoms, mm_double4(1e30, 1e30, 1e30, 0));
oldPositions->upload(oldPositionsVec);
}
else {
vector<mm_float4> oldPositionsVec(numAtoms, mm_float4(1e30f, 1e30f, 1e30f, 0));
oldPositions->upload(oldPositionsVec);
}
} }
void OpenCLNonbondedUtilities::setUsePadding(bool padding) { void OpenCLNonbondedUtilities::setUsePadding(bool padding) {
...@@ -474,6 +460,7 @@ void OpenCLNonbondedUtilities::setAtomBlockRange(double startFraction, double en ...@@ -474,6 +460,7 @@ void OpenCLNonbondedUtilities::setAtomBlockRange(double startFraction, double en
forceKernel.setArg<cl_uint>(6, numTiles); forceKernel.setArg<cl_uint>(6, numTiles);
findInteractingBlocksKernel.setArg<cl_uint>(10, startBlockIndex); findInteractingBlocksKernel.setArg<cl_uint>(10, startBlockIndex);
findInteractingBlocksKernel.setArg<cl_uint>(11, numBlocks); findInteractingBlocksKernel.setArg<cl_uint>(11, numBlocks);
sortBoxDataKernel.setArg<cl_int>(9, true);
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2011-2013 Stanford University and the Authors. * * Portions copyright (c) 2011-2015 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -54,8 +54,8 @@ using namespace std; ...@@ -54,8 +54,8 @@ using namespace std;
class OpenCLParallelCalcForcesAndEnergyKernel::BeginComputationTask : public OpenCLContext::WorkTask { class OpenCLParallelCalcForcesAndEnergyKernel::BeginComputationTask : public OpenCLContext::WorkTask {
public: public:
BeginComputationTask(ContextImpl& context, OpenCLContext& cl, OpenCLCalcForcesAndEnergyKernel& kernel, BeginComputationTask(ContextImpl& context, OpenCLContext& cl, OpenCLCalcForcesAndEnergyKernel& kernel,
bool includeForce, bool includeEnergy, int groups, void* pinnedMemory) : context(context), cl(cl), kernel(kernel), bool includeForce, bool includeEnergy, int groups, void* pinnedMemory, int& numTiles) : context(context), cl(cl), kernel(kernel),
includeForce(includeForce), includeEnergy(includeEnergy), groups(groups), pinnedMemory(pinnedMemory) { includeForce(includeForce), includeEnergy(includeEnergy), groups(groups), pinnedMemory(pinnedMemory), numTiles(numTiles) {
} }
void execute() { void execute() {
// Copy coordinates over to this device and execute the kernel. // Copy coordinates over to this device and execute the kernel.
...@@ -63,6 +63,8 @@ public: ...@@ -63,6 +63,8 @@ public:
if (cl.getContextIndex() > 0) if (cl.getContextIndex() > 0)
cl.getQueue().enqueueWriteBuffer(cl.getPosq().getDeviceBuffer(), CL_FALSE, 0, cl.getPaddedNumAtoms()*cl.getPosq().getElementSize(), pinnedMemory); cl.getQueue().enqueueWriteBuffer(cl.getPosq().getDeviceBuffer(), CL_FALSE, 0, cl.getPaddedNumAtoms()*cl.getPosq().getElementSize(), pinnedMemory);
kernel.beginComputation(context, includeForce, includeEnergy, groups); kernel.beginComputation(context, includeForce, includeEnergy, groups);
if (cl.getNonbondedUtilities().getUsePeriodic())
cl.getNonbondedUtilities().getInteractionCount().download(&numTiles, false);
} }
private: private:
ContextImpl& context; ContextImpl& context;
...@@ -71,19 +73,20 @@ private: ...@@ -71,19 +73,20 @@ private:
bool includeForce, includeEnergy; bool includeForce, includeEnergy;
int groups; int groups;
void* pinnedMemory; void* pinnedMemory;
int& numTiles;
}; };
class OpenCLParallelCalcForcesAndEnergyKernel::FinishComputationTask : public OpenCLContext::WorkTask { class OpenCLParallelCalcForcesAndEnergyKernel::FinishComputationTask : public OpenCLContext::WorkTask {
public: public:
FinishComputationTask(ContextImpl& context, OpenCLContext& cl, OpenCLCalcForcesAndEnergyKernel& kernel, FinishComputationTask(ContextImpl& context, OpenCLContext& cl, OpenCLCalcForcesAndEnergyKernel& kernel,
bool includeForce, bool includeEnergy, int groups, double& energy, long long& completionTime, void* pinnedMemory) : bool includeForce, bool includeEnergy, int groups, double& energy, long long& completionTime, void* pinnedMemory, bool& valid, int& numTiles) :
context(context), cl(cl), kernel(kernel), includeForce(includeForce), includeEnergy(includeEnergy), groups(groups), energy(energy), context(context), cl(cl), kernel(kernel), includeForce(includeForce), includeEnergy(includeEnergy), groups(groups), energy(energy),
completionTime(completionTime), pinnedMemory(pinnedMemory) { completionTime(completionTime), pinnedMemory(pinnedMemory), valid(valid), numTiles(numTiles) {
} }
void execute() { void execute() {
// Execute the kernel, then download forces. // Execute the kernel, then download forces.
energy += kernel.finishComputation(context, includeForce, includeEnergy, groups); energy += kernel.finishComputation(context, includeForce, includeEnergy, groups, valid);
if (includeForce) { if (includeForce) {
if (cl.getContextIndex() > 0) { if (cl.getContextIndex() > 0) {
int numAtoms = cl.getPaddedNumAtoms(); int numAtoms = cl.getPaddedNumAtoms();
...@@ -95,6 +98,10 @@ public: ...@@ -95,6 +98,10 @@ public:
cl.getQueue().finish(); cl.getQueue().finish();
} }
completionTime = getTime(); completionTime = getTime();
if (cl.getNonbondedUtilities().getUsePeriodic() && numTiles > cl.getNonbondedUtilities().getInteractingTiles().getSize()) {
valid = false;
cl.getNonbondedUtilities().updateNeighborListSize();
}
} }
private: private:
ContextImpl& context; ContextImpl& context;
...@@ -105,11 +112,13 @@ private: ...@@ -105,11 +112,13 @@ private:
double& energy; double& energy;
long long& completionTime; long long& completionTime;
void* pinnedMemory; void* pinnedMemory;
bool& valid;
int& numTiles;
}; };
OpenCLParallelCalcForcesAndEnergyKernel::OpenCLParallelCalcForcesAndEnergyKernel(string name, const Platform& platform, OpenCLPlatform::PlatformData& data) : OpenCLParallelCalcForcesAndEnergyKernel::OpenCLParallelCalcForcesAndEnergyKernel(string name, const Platform& platform, OpenCLPlatform::PlatformData& data) :
CalcForcesAndEnergyKernel(name, platform), data(data), completionTimes(data.contexts.size()), contextNonbondedFractions(data.contexts.size()), contextForces(NULL), CalcForcesAndEnergyKernel(name, platform), data(data), completionTimes(data.contexts.size()), contextNonbondedFractions(data.contexts.size()),
pinnedPositionBuffer(NULL), pinnedPositionMemory(NULL), pinnedForceBuffer(NULL), pinnedForceMemory(NULL) { tileCounts(data.contexts.size()), contextForces(NULL), pinnedPositionBuffer(NULL), pinnedPositionMemory(NULL), pinnedForceBuffer(NULL), pinnedForceMemory(NULL) {
for (int i = 0; i < (int) data.contexts.size(); i++) for (int i = 0; i < (int) data.contexts.size(); i++)
kernels.push_back(Kernel(new OpenCLCalcForcesAndEnergyKernel(name, platform, *data.contexts[i]))); kernels.push_back(Kernel(new OpenCLCalcForcesAndEnergyKernel(name, platform, *data.contexts[i])));
} }
...@@ -150,21 +159,21 @@ void OpenCLParallelCalcForcesAndEnergyKernel::beginComputation(ContextImpl& cont ...@@ -150,21 +159,21 @@ void OpenCLParallelCalcForcesAndEnergyKernel::beginComputation(ContextImpl& cont
data.contextEnergy[i] = 0.0; data.contextEnergy[i] = 0.0;
OpenCLContext& cl = *data.contexts[i]; OpenCLContext& cl = *data.contexts[i];
OpenCLContext::WorkThread& thread = cl.getWorkThread(); OpenCLContext::WorkThread& thread = cl.getWorkThread();
thread.addTask(new BeginComputationTask(context, cl, getKernel(i), includeForce, includeEnergy, groups, pinnedPositionMemory)); thread.addTask(new BeginComputationTask(context, cl, getKernel(i), includeForce, includeEnergy, groups, pinnedPositionMemory, tileCounts[i]));
} }
} }
double OpenCLParallelCalcForcesAndEnergyKernel::finishComputation(ContextImpl& context, bool includeForce, bool includeEnergy, int groups) { double OpenCLParallelCalcForcesAndEnergyKernel::finishComputation(ContextImpl& context, bool includeForce, bool includeEnergy, int groups, bool& valid) {
for (int i = 0; i < (int) data.contexts.size(); i++) { for (int i = 0; i < (int) data.contexts.size(); i++) {
OpenCLContext& cl = *data.contexts[i]; OpenCLContext& cl = *data.contexts[i];
OpenCLContext::WorkThread& thread = cl.getWorkThread(); OpenCLContext::WorkThread& thread = cl.getWorkThread();
thread.addTask(new FinishComputationTask(context, cl, getKernel(i), includeForce, includeEnergy, groups, data.contextEnergy[i], completionTimes[i], pinnedForceMemory)); thread.addTask(new FinishComputationTask(context, cl, getKernel(i), includeForce, includeEnergy, groups, data.contextEnergy[i], completionTimes[i], pinnedForceMemory, valid, tileCounts[i]));
} }
data.syncContexts(); data.syncContexts();
double energy = 0.0; double energy = 0.0;
for (int i = 0; i < (int) data.contextEnergy.size(); i++) for (int i = 0; i < (int) data.contextEnergy.size(); i++)
energy += data.contextEnergy[i]; energy += data.contextEnergy[i];
if (includeForce) { if (includeForce && valid) {
// Sum the forces from all devices. // Sum the forces from all devices.
OpenCLContext& cl = *data.contexts[0]; OpenCLContext& cl = *data.contexts[0];
...@@ -177,6 +186,7 @@ double OpenCLParallelCalcForcesAndEnergyKernel::finishComputation(ContextImpl& c ...@@ -177,6 +186,7 @@ double OpenCLParallelCalcForcesAndEnergyKernel::finishComputation(ContextImpl& c
// Balance work between the contexts by transferring a little nonbonded work from the context that // Balance work between the contexts by transferring a little nonbonded work from the context that
// finished last to the one that finished first. // finished last to the one that finished first.
if (cl.getComputeForceCount() < 200) {
int firstIndex = 0, lastIndex = 0; int firstIndex = 0, lastIndex = 0;
for (int i = 0; i < (int) completionTimes.size(); i++) { for (int i = 0; i < (int) completionTimes.size(); i++) {
if (completionTimes[i] < completionTimes[firstIndex]) if (completionTimes[i] < completionTimes[firstIndex])
...@@ -196,6 +206,7 @@ double OpenCLParallelCalcForcesAndEnergyKernel::finishComputation(ContextImpl& c ...@@ -196,6 +206,7 @@ double OpenCLParallelCalcForcesAndEnergyKernel::finishComputation(ContextImpl& c
startFraction = endFraction; startFraction = endFraction;
} }
} }
}
return energy; return energy;
} }
......
...@@ -44,7 +44,7 @@ __kernel void findBlockBounds(int numAtoms, real4 periodicBoxSize, real4 invPeri ...@@ -44,7 +44,7 @@ __kernel void findBlockBounds(int numAtoms, real4 periodicBoxSize, real4 invPeri
__kernel void sortBoxData(__global const real2* restrict sortedBlock, __global const real4* restrict blockCenter, __kernel void sortBoxData(__global const real2* restrict sortedBlock, __global const real4* restrict blockCenter,
__global const real4* restrict blockBoundingBox, __global real4* restrict sortedBlockCenter, __global const real4* restrict blockBoundingBox, __global real4* restrict sortedBlockCenter,
__global real4* restrict sortedBlockBoundingBox, __global const real4* restrict posq, __global const real4* restrict oldPositions, __global real4* restrict sortedBlockBoundingBox, __global const real4* restrict posq, __global const real4* restrict oldPositions,
__global unsigned int* restrict interactionCount, __global int* restrict rebuildNeighborList) { __global unsigned int* restrict interactionCount, __global int* restrict rebuildNeighborList, int forceRebuild) {
for (int i = get_global_id(0); i < NUM_BLOCKS; i += get_global_size(0)) { for (int i = get_global_id(0); i < NUM_BLOCKS; i += get_global_size(0)) {
int index = (int) sortedBlock[i].y; int index = (int) sortedBlock[i].y;
sortedBlockCenter[i] = blockCenter[index]; sortedBlockCenter[i] = blockCenter[index];
...@@ -53,7 +53,7 @@ __kernel void sortBoxData(__global const real2* restrict sortedBlock, __global c ...@@ -53,7 +53,7 @@ __kernel void sortBoxData(__global const real2* restrict sortedBlock, __global c
// Also check whether any atom has moved enough so that we really need to rebuild the neighbor list. // Also check whether any atom has moved enough so that we really need to rebuild the neighbor list.
bool rebuild = false; bool rebuild = forceRebuild;
for (int i = get_global_id(0); i < NUM_ATOMS; i += get_global_size(0)) { for (int i = get_global_id(0); i < NUM_ATOMS; i += get_global_size(0)) {
real4 delta = oldPositions[i]-posq[i]; real4 delta = oldPositions[i]-posq[i];
if (delta.x*delta.x + delta.y*delta.y + delta.z*delta.z > 0.25f*PADDING*PADDING) if (delta.x*delta.x + delta.y*delta.y + delta.z*delta.z > 0.25f*PADDING*PADDING)
......
...@@ -77,10 +77,10 @@ void testHarmonicBonds() { ...@@ -77,10 +77,10 @@ void testHarmonicBonds() {
} }
void testLargeSystem() { void testLargeSystem() {
const int numMolecules = 50; const int numMolecules = 25;
const int numParticles = numMolecules*2; const int numParticles = numMolecules*2;
const double cutoff = 2.0; const double cutoff = 2.0;
const double boxSize = 5.0; const double boxSize = 4.0;
const double tolerance = 5; const double tolerance = 5;
System system; System system;
system.setDefaultPeriodicBoxVectors(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));
...@@ -134,10 +134,10 @@ void testLargeSystem() { ...@@ -134,10 +134,10 @@ void testLargeSystem() {
} }
void testVirtualSites() { void testVirtualSites() {
const int numMolecules = 50; const int numMolecules = 25;
const int numParticles = numMolecules*3; const int numParticles = numMolecules*3;
const double cutoff = 2.0; const double cutoff = 2.0;
const double boxSize = 5.0; const double boxSize = 4.0;
const double tolerance = 5; const double tolerance = 5;
System system; System system;
system.setDefaultPeriodicBoxVectors(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));
......
...@@ -296,7 +296,7 @@ void testArgonBox() { ...@@ -296,7 +296,7 @@ void testArgonBox() {
system.setDefaultPeriodicBoxVectors(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); system.addForce(nonbonded);
VariableLangevinIntegrator integrator(temp, 6.0, 1e-5); VariableLangevinIntegrator integrator(temp, 6.0, 1e-4);
Context context(system, integrator, platform); Context context(system, integrator, platform);
context.setPositions(positions); context.setPositions(positions);
context.setVelocitiesToTemperature(temp); context.setVelocitiesToTemperature(temp);
...@@ -308,13 +308,13 @@ void testArgonBox() { ...@@ -308,13 +308,13 @@ void testArgonBox() {
// Make sure the temperature is correct. // Make sure the temperature is correct.
double ke = 0.0; double ke = 0.0;
for (int i = 0; i < 2000; ++i) { for (int i = 0; i < 1000; ++i) {
double t = 2.0 + 0.01 * (i + 1); double t = 2.0 + 0.02 * (i + 1);
integrator.stepTo(t); integrator.stepTo(t);
State state = context.getState(State::Energy); State state = context.getState(State::Energy);
ke += state.getKineticEnergy(); ke += state.getKineticEnergy();
} }
ke /= 2000; ke /= 1000;
double expected = 1.5 * numParticles * BOLTZ * temp; double expected = 1.5 * numParticles * BOLTZ * temp;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.01); ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.01);
} }
......
...@@ -25,9 +25,10 @@ ...@@ -25,9 +25,10 @@
#ifndef __GBVIParameters_H__ #ifndef __GBVIParameters_H__
#define __GBVIParameters_H__ #define __GBVIParameters_H__
#include "SimTKOpenMMCommon.h" #include "RealVec.h"
#include <vector>
// --------------------------------------------------------------------------------------- namespace OpenMM {
class GBVIParameters { class GBVIParameters {
...@@ -57,9 +58,9 @@ class GBVIParameters { ...@@ -57,9 +58,9 @@ class GBVIParameters {
// parameter vectors // parameter vectors
RealOpenMMVector _atomicRadii; std::vector<RealOpenMM> _atomicRadii;
RealOpenMMVector _scaledRadii; std::vector<RealOpenMM> _scaledRadii;
RealOpenMMVector _gammaParameters; std::vector<RealOpenMM> _gammaParameters;
// cutoff and periodic boundary conditions // cutoff and periodic boundary conditions
...@@ -82,7 +83,7 @@ class GBVIParameters { ...@@ -82,7 +83,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
GBVIParameters( int numberOfAtoms ); GBVIParameters(int numberOfAtoms);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -90,7 +91,7 @@ class GBVIParameters { ...@@ -90,7 +91,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~GBVIParameters( ); ~GBVIParameters();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -100,7 +101,7 @@ class GBVIParameters { ...@@ -100,7 +101,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int getNumberOfAtoms( void ) const; int getNumberOfAtoms() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -110,7 +111,7 @@ class GBVIParameters { ...@@ -110,7 +111,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getElectricConstant( void ) const; RealOpenMM getElectricConstant() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -120,7 +121,7 @@ class GBVIParameters { ...@@ -120,7 +121,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getSolventDielectric( void ) const; RealOpenMM getSolventDielectric() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -130,7 +131,7 @@ class GBVIParameters { ...@@ -130,7 +131,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setSolventDielectric( RealOpenMM solventDielectric ); void setSolventDielectric(RealOpenMM solventDielectric);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -140,7 +141,7 @@ class GBVIParameters { ...@@ -140,7 +141,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getSoluteDielectric( void ) const; RealOpenMM getSoluteDielectric() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -150,7 +151,7 @@ class GBVIParameters { ...@@ -150,7 +151,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setSoluteDielectric( RealOpenMM soluteDielectric ); void setSoluteDielectric(RealOpenMM soluteDielectric);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -160,7 +161,7 @@ class GBVIParameters { ...@@ -160,7 +161,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const RealOpenMMVector& getScaledRadii( void ) const; const std::vector<RealOpenMM>& getScaledRadii() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -170,7 +171,7 @@ class GBVIParameters { ...@@ -170,7 +171,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setScaledRadii( const RealOpenMMVector& scaledRadii ); void setScaledRadii(const std::vector<RealOpenMM>& scaledRadii);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -180,7 +181,7 @@ class GBVIParameters { ...@@ -180,7 +181,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const RealOpenMMVector& getAtomicRadii( void ) const; const std::vector<RealOpenMM>& getAtomicRadii() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -190,7 +191,7 @@ class GBVIParameters { ...@@ -190,7 +191,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setAtomicRadii( const RealOpenMMVector& atomicRadii ); void setAtomicRadii(const std::vector<RealOpenMM>& atomicRadii);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -200,7 +201,7 @@ class GBVIParameters { ...@@ -200,7 +201,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const RealOpenMMVector& getGammaParameters( void ) const; const std::vector<RealOpenMM>& getGammaParameters() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -210,7 +211,7 @@ class GBVIParameters { ...@@ -210,7 +211,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setGammaParameters( const RealOpenMMVector& gammaParameters ); void setGammaParameters(const std::vector<RealOpenMM>& gammaParameters);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -220,7 +221,7 @@ class GBVIParameters { ...@@ -220,7 +221,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setUseCutoff( RealOpenMM distance ); void setUseCutoff(RealOpenMM distance);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -274,7 +275,7 @@ class GBVIParameters { ...@@ -274,7 +275,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getTau( void ) const; RealOpenMM getTau() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -284,7 +285,7 @@ class GBVIParameters { ...@@ -284,7 +285,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int getBornRadiusScalingMethod( void ) const; int getBornRadiusScalingMethod() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -294,7 +295,7 @@ class GBVIParameters { ...@@ -294,7 +295,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setBornRadiusScalingMethod( int bornRadiusScalingMethod ); void setBornRadiusScalingMethod(int bornRadiusScalingMethod);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -304,7 +305,7 @@ class GBVIParameters { ...@@ -304,7 +305,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getQuinticLowerLimitFactor( void ) const; RealOpenMM getQuinticLowerLimitFactor() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -314,7 +315,7 @@ class GBVIParameters { ...@@ -314,7 +315,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setQuinticLowerLimitFactor( RealOpenMM quinticLowerLimitFactor ); void setQuinticLowerLimitFactor(RealOpenMM quinticLowerLimitFactor);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -324,7 +325,7 @@ class GBVIParameters { ...@@ -324,7 +325,7 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getQuinticUpperBornRadiusLimit( void ) const; RealOpenMM getQuinticUpperBornRadiusLimit() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -334,8 +335,10 @@ class GBVIParameters { ...@@ -334,8 +335,10 @@ class GBVIParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setQuinticUpperBornRadiusLimit( RealOpenMM quinticUpperSplineLimit ); void setQuinticUpperBornRadiusLimit(RealOpenMM quinticUpperSplineLimit);
}; };
} // namespace OpenMM
#endif // __GBVIParameters_H__ #endif // __GBVIParameters_H__
...@@ -25,9 +25,10 @@ ...@@ -25,9 +25,10 @@
#ifndef __ObcParameters_H__ #ifndef __ObcParameters_H__
#define __ObcParameters_H__ #define __ObcParameters_H__
#include "SimTKOpenMMCommon.h" #include "RealVec.h"
#include <vector>
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ObcParameters { class ObcParameters {
...@@ -57,8 +58,8 @@ class ObcParameters { ...@@ -57,8 +58,8 @@ class ObcParameters {
// scaled radius factors (S_kk in HCT paper) // scaled radius factors (S_kk in HCT paper)
RealOpenMMVector _atomicRadii; std::vector<RealOpenMM> _atomicRadii;
RealOpenMMVector _scaledRadiusFactors; std::vector<RealOpenMM> _scaledRadiusFactors;
// cutoff and periodic boundary conditions // cutoff and periodic boundary conditions
...@@ -75,7 +76,7 @@ class ObcParameters { ...@@ -75,7 +76,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setDielectricOffset( RealOpenMM dielectricOffset ); void setDielectricOffset(RealOpenMM dielectricOffset);
public: public:
...@@ -87,7 +88,7 @@ class ObcParameters { ...@@ -87,7 +88,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ObcParameters( int numberOfAtoms, ObcParameters::ObcType obcType = ObcTypeII ); ObcParameters(int numberOfAtoms, ObcParameters::ObcType obcType = ObcTypeII);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -95,7 +96,7 @@ class ObcParameters { ...@@ -95,7 +96,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ObcParameters( ); ~ObcParameters();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -105,7 +106,7 @@ class ObcParameters { ...@@ -105,7 +106,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int getNumberOfAtoms( void ) const; int getNumberOfAtoms() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -115,7 +116,7 @@ class ObcParameters { ...@@ -115,7 +116,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getElectricConstant( void ) const; RealOpenMM getElectricConstant() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -125,7 +126,7 @@ class ObcParameters { ...@@ -125,7 +126,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getProbeRadius( void ) const; RealOpenMM getProbeRadius() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -135,7 +136,7 @@ class ObcParameters { ...@@ -135,7 +136,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setProbeRadius( RealOpenMM probeRadius ); void setProbeRadius(RealOpenMM probeRadius);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -146,7 +147,7 @@ class ObcParameters { ...@@ -146,7 +147,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getPi4Asolv( void ) const; RealOpenMM getPi4Asolv() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -154,7 +155,7 @@ class ObcParameters { ...@@ -154,7 +155,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setPi4Asolv( RealOpenMM pi4Asolv ); void setPi4Asolv(RealOpenMM pi4Asolv);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -164,7 +165,7 @@ class ObcParameters { ...@@ -164,7 +165,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getSolventDielectric( void ) const; RealOpenMM getSolventDielectric() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -174,7 +175,7 @@ class ObcParameters { ...@@ -174,7 +175,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setSolventDielectric( RealOpenMM solventDielectric ); void setSolventDielectric(RealOpenMM solventDielectric);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -184,7 +185,7 @@ class ObcParameters { ...@@ -184,7 +185,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getSoluteDielectric( void ) const; RealOpenMM getSoluteDielectric() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -194,7 +195,7 @@ class ObcParameters { ...@@ -194,7 +195,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setSoluteDielectric( RealOpenMM soluteDielectric ); void setSoluteDielectric(RealOpenMM soluteDielectric);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -204,7 +205,7 @@ class ObcParameters { ...@@ -204,7 +205,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ObcParameters::ObcType getObcType( void ) const; ObcParameters::ObcType getObcType() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -214,7 +215,7 @@ class ObcParameters { ...@@ -214,7 +215,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setObcTypeParameters( ObcParameters::ObcType obcType ); void setObcTypeParameters(ObcParameters::ObcType obcType);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -224,7 +225,7 @@ class ObcParameters { ...@@ -224,7 +225,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getAlphaObc( void ) const; RealOpenMM getAlphaObc() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -234,7 +235,7 @@ class ObcParameters { ...@@ -234,7 +235,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getBetaObc( void ) const; RealOpenMM getBetaObc() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -244,7 +245,7 @@ class ObcParameters { ...@@ -244,7 +245,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getGammaObc( void ) const; RealOpenMM getGammaObc() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -254,7 +255,7 @@ class ObcParameters { ...@@ -254,7 +255,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getDielectricOffset( void ) const; RealOpenMM getDielectricOffset() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -264,7 +265,7 @@ class ObcParameters { ...@@ -264,7 +265,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const RealOpenMMVector& getScaledRadiusFactors( void ) const; const std::vector<RealOpenMM>& getScaledRadiusFactors() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -274,7 +275,7 @@ class ObcParameters { ...@@ -274,7 +275,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setScaledRadiusFactors( const RealOpenMMVector& scaledRadiusFactors ); void setScaledRadiusFactors(const std::vector<RealOpenMM>& scaledRadiusFactors);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -284,7 +285,7 @@ class ObcParameters { ...@@ -284,7 +285,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const RealOpenMMVector& getAtomicRadii( void ) const; const std::vector<RealOpenMM>& getAtomicRadii() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -294,7 +295,7 @@ class ObcParameters { ...@@ -294,7 +295,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setAtomicRadii( const RealOpenMMVector& atomicRadii ); void setAtomicRadii(const std::vector<RealOpenMM>& atomicRadii);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -305,7 +306,7 @@ class ObcParameters { ...@@ -305,7 +306,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setUseCutoff( RealOpenMM distance ); void setUseCutoff(RealOpenMM distance);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -353,6 +354,6 @@ class ObcParameters { ...@@ -353,6 +354,6 @@ class ObcParameters {
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ObcParameters_H__ #endif // __ObcParameters_H__
...@@ -25,10 +25,9 @@ ...@@ -25,10 +25,9 @@
#ifndef __ReferenceAndersenThermostat_H__ #ifndef __ReferenceAndersenThermostat_H__
#define __ReferenceAndersenThermostat_H__ #define __ReferenceAndersenThermostat_H__
#include "SimTKOpenMMCommon.h"
#include <vector> #include <vector>
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ReferenceAndersenThermostat { class ReferenceAndersenThermostat {
...@@ -42,7 +41,7 @@ class ReferenceAndersenThermostat { ...@@ -42,7 +41,7 @@ class ReferenceAndersenThermostat {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceAndersenThermostat( ); ReferenceAndersenThermostat();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -50,7 +49,7 @@ class ReferenceAndersenThermostat { ...@@ -50,7 +49,7 @@ class ReferenceAndersenThermostat {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceAndersenThermostat( ); ~ReferenceAndersenThermostat();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -65,11 +64,11 @@ class ReferenceAndersenThermostat { ...@@ -65,11 +64,11 @@ class ReferenceAndersenThermostat {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void applyThermostat( const std::vector<std::vector<int> >& atomGroups, std::vector<OpenMM::RealVec>& atomVelocities, std::vector<RealOpenMM>& atomMasses, void applyThermostat(const std::vector<std::vector<int> >& atomGroups, std::vector<OpenMM::RealVec>& atomVelocities, std::vector<RealOpenMM>& atomMasses,
RealOpenMM temperature, RealOpenMM collisionFrequency, RealOpenMM stepSize ) const; RealOpenMM temperature, RealOpenMM collisionFrequency, RealOpenMM stepSize) const;
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceAndersenThermostat_H__ #endif // __ReferenceAndersenThermostat_H__
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "ReferenceBondIxn.h" #include "ReferenceBondIxn.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ReferenceAngleBondIxn : public ReferenceBondIxn { class ReferenceAngleBondIxn : public ReferenceBondIxn {
...@@ -41,7 +41,7 @@ class ReferenceAngleBondIxn : public ReferenceBondIxn { ...@@ -41,7 +41,7 @@ class ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceAngleBondIxn( ); ReferenceAngleBondIxn();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -49,7 +49,7 @@ class ReferenceAngleBondIxn : public ReferenceBondIxn { ...@@ -49,7 +49,7 @@ class ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceAngleBondIxn( ); ~ReferenceAngleBondIxn();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -63,8 +63,8 @@ class ReferenceAngleBondIxn : public ReferenceBondIxn { ...@@ -63,8 +63,8 @@ class ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void getPrefactorsGivenAngleCosine( RealOpenMM cosine, RealOpenMM* angleParameters, void getPrefactorsGivenAngleCosine(RealOpenMM cosine, RealOpenMM* angleParameters,
RealOpenMM* dEdR, RealOpenMM* energyTerm ) const; RealOpenMM* dEdR, RealOpenMM* energyTerm) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -79,13 +79,13 @@ class ReferenceAngleBondIxn : public ReferenceBondIxn { ...@@ -79,13 +79,13 @@ class ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateBondIxn( int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces,
RealOpenMM* totalEnergy ) const; RealOpenMM* totalEnergy) const;
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceAngleBondIxn_H__ #endif // __ReferenceAngleBondIxn_H__
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "ReferenceForce.h" #include "ReferenceForce.h"
#include "ReferenceBondIxn.h" #include "ReferenceBondIxn.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce { class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce {
...@@ -42,7 +42,7 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce { ...@@ -42,7 +42,7 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceBondForce( ); ReferenceBondForce();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -50,7 +50,7 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce { ...@@ -50,7 +50,7 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceBondForce( ); ~ReferenceBondForce();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -67,13 +67,13 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce { ...@@ -67,13 +67,13 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateForce( int numberOfBonds, int** atomIndices, void calculateForce(int numberOfBonds, int** atomIndices,
std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& atomCoordinates,
RealOpenMM** parameters, std::vector<OpenMM::RealVec>& forces, RealOpenMM** parameters, std::vector<OpenMM::RealVec>& forces,
RealOpenMM* totalEnergy, ReferenceBondIxn& referenceBondIxn ); RealOpenMM* totalEnergy, ReferenceBondIxn& referenceBondIxn);
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceBondForce_H__ #endif // __ReferenceBondForce_H__
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "openmm/internal/windowsExport.h" #include "openmm/internal/windowsExport.h"
#include <vector> #include <vector>
// --------------------------------------------------------------------------------------- namespace OpenMM {
class OPENMM_EXPORT ReferenceBondIxn { class OPENMM_EXPORT ReferenceBondIxn {
...@@ -43,7 +43,7 @@ class OPENMM_EXPORT ReferenceBondIxn { ...@@ -43,7 +43,7 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceBondIxn( ); ReferenceBondIxn();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -51,7 +51,7 @@ class OPENMM_EXPORT ReferenceBondIxn { ...@@ -51,7 +51,7 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceBondIxn( ); ~ReferenceBondIxn();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -65,9 +65,9 @@ class OPENMM_EXPORT ReferenceBondIxn { ...@@ -65,9 +65,9 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
virtual void calculateBondIxn( int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, virtual void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces,
RealOpenMM* totalEnergy ) const; RealOpenMM* totalEnergy) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -82,7 +82,7 @@ class OPENMM_EXPORT ReferenceBondIxn { ...@@ -82,7 +82,7 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getNormedDotProduct( RealOpenMM* vector1, RealOpenMM* vector2, int hasREntry ); static RealOpenMM getNormedDotProduct(RealOpenMM* vector1, RealOpenMM* vector2, int hasREntry);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -98,8 +98,8 @@ class OPENMM_EXPORT ReferenceBondIxn { ...@@ -98,8 +98,8 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getAngleBetweenTwoVectors( RealOpenMM* vector1, RealOpenMM* vector2, static RealOpenMM getAngleBetweenTwoVectors(RealOpenMM* vector1, RealOpenMM* vector2,
RealOpenMM* outputDotProduct, int hasREntry ); RealOpenMM* outputDotProduct, int hasREntry);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -119,13 +119,13 @@ class OPENMM_EXPORT ReferenceBondIxn { ...@@ -119,13 +119,13 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getDihedralAngleBetweenThreeVectors( RealOpenMM* vector1, RealOpenMM* vector2, static RealOpenMM getDihedralAngleBetweenThreeVectors(RealOpenMM* vector1, RealOpenMM* vector2,
RealOpenMM* vector3, RealOpenMM** outputCrossProduct, RealOpenMM* vector3, RealOpenMM** outputCrossProduct,
RealOpenMM* cosineOfAngle, RealOpenMM* signVector, RealOpenMM* cosineOfAngle, RealOpenMM* signVector,
RealOpenMM* signOfAngle, int hasREntry ); RealOpenMM* signOfAngle, int hasREntry);
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceBondIxn_H__ #endif // __ReferenceBondIxn_H__
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "ReferenceDynamics.h" #include "ReferenceDynamics.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ReferenceBrownianDynamics : public ReferenceDynamics { class ReferenceBrownianDynamics : public ReferenceDynamics {
...@@ -50,7 +50,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics { ...@@ -50,7 +50,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceBrownianDynamics( int numberOfAtoms, RealOpenMM deltaT, RealOpenMM friction, RealOpenMM temperature ); ReferenceBrownianDynamics(int numberOfAtoms, RealOpenMM deltaT, RealOpenMM friction, RealOpenMM temperature);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -58,7 +58,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics { ...@@ -58,7 +58,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceBrownianDynamics( ); ~ReferenceBrownianDynamics();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -68,7 +68,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics { ...@@ -68,7 +68,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getFriction( void ) const; RealOpenMM getFriction() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -88,6 +88,6 @@ class ReferenceBrownianDynamics : public ReferenceDynamics { ...@@ -88,6 +88,6 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceBrownianDynamics_H__ #endif // __ReferenceBrownianDynamics_H__
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <vector> #include <vector>
#include <set> #include <set>
// --------------------------------------------------------------------------------------- namespace OpenMM {
class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm { class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm {
...@@ -69,22 +69,22 @@ public: ...@@ -69,22 +69,22 @@ public:
*/ */
ReferenceCCMAAlgorithm(int numberOfAtoms, int numberOfConstraints, const std::vector<std::pair<int, int> >& atomIndices, const std::vector<RealOpenMM>& distance, std::vector<RealOpenMM>& masses, std::vector<AngleInfo>& angles); ReferenceCCMAAlgorithm(int numberOfAtoms, int numberOfConstraints, const std::vector<std::pair<int, int> >& atomIndices, const std::vector<RealOpenMM>& distance, std::vector<RealOpenMM>& masses, std::vector<AngleInfo>& angles);
~ReferenceCCMAAlgorithm( ); ~ReferenceCCMAAlgorithm();
/** /**
* Get the number of constraints. * Get the number of constraints.
*/ */
int getNumberOfConstraints( void ) const; int getNumberOfConstraints() const;
/** /**
* Get the maximum number of iterations to perform. * Get the maximum number of iterations to perform.
*/ */
int getMaximumNumberOfIterations( void ) const; int getMaximumNumberOfIterations() const;
/** /**
* Set the maximum number of iterations to perform. * Set the maximum number of iterations to perform.
*/ */
void setMaximumNumberOfIterations( int maximumNumberOfIterations ); void setMaximumNumberOfIterations(int maximumNumberOfIterations);
/** /**
* Apply the constraint algorithm. * Apply the constraint algorithm.
...@@ -120,6 +120,6 @@ public: ...@@ -120,6 +120,6 @@ public:
} }
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceCCMAAlgorithm_H__ #endif // __ReferenceCCMAAlgorithm_H__
...@@ -25,12 +25,11 @@ ...@@ -25,12 +25,11 @@
#ifndef __ReferenceCMAPTorsionIxn_H__ #ifndef __ReferenceCMAPTorsionIxn_H__
#define __ReferenceCMAPTorsionIxn_H__ #define __ReferenceCMAPTorsionIxn_H__
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceBondIxn.h" #include "ReferenceBondIxn.h"
#include <vector> #include <vector>
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ReferenceCMAPTorsionIxn : public ReferenceBondIxn { class ReferenceCMAPTorsionIxn : public ReferenceBondIxn {
...@@ -92,4 +91,6 @@ public: ...@@ -92,4 +91,6 @@ public:
}; };
} // namespace OpenMM
#endif // __ReferenceCMAPTorsionIxn_H__ #endif // __ReferenceCMAPTorsionIxn_H__
...@@ -25,8 +25,11 @@ ...@@ -25,8 +25,11 @@
#ifndef __ReferenceConstraintAlgorithm_H__ #ifndef __ReferenceConstraintAlgorithm_H__
#define __ReferenceConstraintAlgorithm_H__ #define __ReferenceConstraintAlgorithm_H__
#include "SimTKOpenMMCommon.h" #include "RealVec.h"
#include "openmm/internal/windowsExport.h" #include "openmm/internal/windowsExport.h"
#include <vector>
namespace OpenMM {
/** /**
* This abstract class defines the interface which constraint algorithms must implement. * This abstract class defines the interface which constraint algorithms must implement.
...@@ -59,6 +62,6 @@ public: ...@@ -59,6 +62,6 @@ public:
std::vector<OpenMM::RealVec>& velocities, std::vector<RealOpenMM>& inverseMasses, RealOpenMM tolerance) = 0; std::vector<OpenMM::RealVec>& velocities, std::vector<RealOpenMM>& inverseMasses, RealOpenMM tolerance) = 0;
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceConstraintAlgorithm_H__ #endif // __ReferenceConstraintAlgorithm_H__
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "ReferenceBondIxn.h" #include "ReferenceBondIxn.h"
#include "lepton/CompiledExpression.h" #include "lepton/CompiledExpression.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ReferenceCustomAngleIxn : public ReferenceBondIxn { class ReferenceCustomAngleIxn : public ReferenceBondIxn {
...@@ -57,7 +57,7 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn { ...@@ -57,7 +57,7 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceCustomAngleIxn( ); ~ReferenceCustomAngleIxn();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -71,13 +71,13 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn { ...@@ -71,13 +71,13 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateBondIxn( int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces,
RealOpenMM* totalEnergy) const; RealOpenMM* totalEnergy) const;
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // _ReferenceCustomAngleIxn___ #endif // _ReferenceCustomAngleIxn___
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "ReferenceBondIxn.h" #include "ReferenceBondIxn.h"
#include "lepton/CompiledExpression.h" #include "lepton/CompiledExpression.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ReferenceCustomBondIxn : public ReferenceBondIxn { class ReferenceCustomBondIxn : public ReferenceBondIxn {
...@@ -58,7 +58,7 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn { ...@@ -58,7 +58,7 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceCustomBondIxn( ); ~ReferenceCustomBondIxn();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -72,13 +72,13 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn { ...@@ -72,13 +72,13 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateBondIxn( int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces,
RealOpenMM* totalEnergy ) const; RealOpenMM* totalEnergy) const;
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // _ReferenceCustomBondIxn___ #endif // _ReferenceCustomBondIxn___
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <map> #include <map>
#include <vector> #include <vector>
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn { class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
...@@ -169,4 +169,6 @@ public: ...@@ -169,4 +169,6 @@ public:
} }
}; };
} // namespace OpenMM
#endif // __ReferenceCustomCompoundBondIxn_H__ #endif // __ReferenceCustomCompoundBondIxn_H__
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