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

Changed how kernels get initialized. StandardMMForceField now has you set the...

Changed how kernels get initialized.  StandardMMForceField now has you set the 1-4 interactions explicitly.  CMMotionRemover allows the removal frequency to be set.
parent bf93e42f
......@@ -54,50 +54,28 @@ public:
}
~ReferenceCalcStandardMMForceFieldKernel();
/**
* Initialize the kernel, setting up the values of all the force field parameters.
* Initialize the kernel.
*
* @param bondIndices the two atoms connected by each bond term
* @param bondParameters the force parameters (length, k) for each bond term
* @param angleIndices the three atoms connected by each angle term
* @param angleParameters the force parameters (angle, k) for each angle term
* @param periodicTorsionIndices the four atoms connected by each periodic torsion term
* @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term
* @param rbTorsionIndices the four atoms connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param bonded14Indices each element contains the indices of two atoms whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair
* @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs
* @param coulomb14Scale the factor by which Coulomb interactions should be reduced for bonded 1-4 pairs
* @param exclusions the i'th element lists the indices of all atoms with which the i'th atom should not interact through
* nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from
* the standard nonbonded calculation.
* @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each atom
* @param nonbondedMethod the method to use for handling long range nonbonded interactions
* @param nonbondedCutoff the cutoff distance for nonbonded interactions (if nonbondedMethod involves a cutoff)
* @param periodicBoxSize the size of the periodic box (if nonbondedMethod involves a periodic boundary conditions)
* @param system the System this kernel will be applied to
* @param force the StandardMMForceField this kernel will be used for
* @param exclusions the i'th element lists the indices of all atoms with which the i'th atom should not interact through
* nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from
* the standard nonbonded calculation.
*/
void initialize(const std::vector<std::vector<int> >& bondIndices, const std::vector<std::vector<double> >& bondParameters,
const std::vector<std::vector<int> >& angleIndices, const std::vector<std::vector<double> >& angleParameters,
const std::vector<std::vector<int> >& periodicTorsionIndices, const std::vector<std::vector<double> >& periodicTorsionParameters,
const std::vector<std::vector<int> >& rbTorsionIndices, const std::vector<std::vector<double> >& rbTorsionParameters,
const std::vector<std::vector<int> >& bonded14Indices, double lj14Scale, double coulomb14Scale,
const std::vector<std::set<int> >& exclusions, const std::vector<std::vector<double> >& nonbondedParameters,
NonbondedMethod nonbondedMethod, double nonbondedCutoff, double periodicBoxSize[3]);
void initialize(const System& system, const StandardMMForceField& force, const std::vector<std::set<int> >& exclusions);
/**
* Execute the kernel to calculate the forces.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom. On entry, this contains the forces that
* have been calculated so far. The kernel should add its own forces to the values already in the stream.
* @param context the context in which to execute this kernel
*/
void executeForces(const Stream& positions, Stream& forces);
void executeForces(OpenMMContextImpl& context);
/**
* Execute the kernel to calculate the energy.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param context the context in which to execute this kernel
* @return the potential energy due to the StandardMMForceField
*/
double executeEnergy(const Stream& positions);
double executeEnergy(OpenMMContextImpl& context);
private:
int numAtoms, numBonds, numAngles, numPeriodicTorsions, numRBTorsions, num14;
int **bondIndexArray, **angleIndexArray, **periodicTorsionIndexArray, **rbTorsionIndexArray, **exclusionArray, **bonded14IndexArray;
......@@ -117,28 +95,25 @@ public:
}
~ReferenceCalcGBSAOBCForceFieldKernel();
/**
* Initialize the kernel, setting up the values of all the force field parameters.
* Initialize the kernel.
*
* @param atomParameters the force parameters (charge, atomic radius, scaling factor) for each atom
* @param solventDielectric the dielectric constant of the solvent
* @param soluteDielectric the dielectric constant of the solute
* @param system the System this kernel will be applied to
* @param force the GBSAOBCForceField this kernel will be used for
*/
void initialize(const std::vector<std::vector<double> >& atomParameters, double solventDielectric, double soluteDielectric);
void initialize(const System& system, const GBSAOBCForceField& force);
/**
* Execute the kernel to calculate the forces.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom. On entry, this contains the forces that
* have been calculated so far. The kernel should add its own forces to the values already in the stream.
* @param context the context in which to execute this kernel
*/
void executeForces(const Stream& positions, Stream& forces);
void executeForces(OpenMMContextImpl& context);
/**
* Execute the kernel to calculate the energy.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param context the context in which to execute this kernel
* @return the potential energy due to the GBSAOBCForceField
*/
double executeEnergy(const Stream& positions);
double executeEnergy(OpenMMContextImpl& context);
private:
CpuObc* obc;
std::vector<RealOpenMM> charges;
......@@ -154,23 +129,19 @@ public:
}
~ReferenceIntegrateVerletStepKernel();
/**
* Initialize the kernel, setting up all parameters related to integrator.
* Initialize the kernel.
*
* @param masses the mass of each atom
* @param constraintIndices each element contains the indices of two atoms whose distance should be constrained
* @param constraintLengths the required distance between each pair of constrained atoms
* @param system the System this kernel will be applied to
* @param integrator the VerletIntegrator this kernel will be used for
*/
void initialize(const std::vector<double>& masses, const std::vector<std::vector<int> >& constraintIndices,
const std::vector<double>& constraintLengths);
void initialize(const System& system, const VerletIntegrator& integrator);
/**
* Execute the kernel.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom
* @param stepSize the integration step size
* @param context the context in which to execute this kernel
* @param integrator the VerletIntegrator this kernel is being used for
*/
void execute(Stream& positions, Stream& velocities, const Stream& forces, double stepSize);
void execute(OpenMMContextImpl& context, const VerletIntegrator& integrator);
private:
ReferenceVerletDynamics* dynamics;
ReferenceShakeAlgorithm* shake;
......@@ -191,25 +162,19 @@ public:
}
~ReferenceIntegrateLangevinStepKernel();
/**
* Initialize the kernel, setting up all parameters related to integrator.
* Initialize the kernel, setting up the atomic masses.
*
* @param masses the mass of each atom
* @param constraintIndices each element contains the indices of two atoms whose distance should be constrained
* @param constraintLengths the required distance between each pair of constrained atoms
* @param system the System this kernel will be applied to
* @param integrator the LangevinIntegrator this kernel will be used for
*/
void initialize(const std::vector<double>& masses, const std::vector<std::vector<int> >& constraintIndices,
const std::vector<double>& constraintLengths);
void initialize(const System& system, const LangevinIntegrator& integrator);
/**
* Execute the kernel.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom
* @param temperature the temperature of the heat bath
* @param friction the friction coefficient coupling the system to the heat bath
* @param stepSize the integration step size
* @param context the context in which to execute this kernel
* @param integrator the LangevinIntegrator this kernel is being used for
*/
void execute(Stream& positions, Stream& velocities, const Stream& forces, double temperature, double friction, double stepSize);
void execute(OpenMMContextImpl& context, const LangevinIntegrator& integrator);
private:
ReferenceStochasticDynamics* dynamics;
ReferenceShakeAlgorithm* shake;
......@@ -230,25 +195,19 @@ public:
}
~ReferenceIntegrateBrownianStepKernel();
/**
* Initialize the kernel, setting up all parameters related to integrator.
* Initialize the kernel.
*
* @param masses the mass of each atom
* @param constraintIndices each element contains the indices of two atoms whose distance should be constrained
* @param constraintLengths the required distance between each pair of constrained atoms
* @param system the System this kernel will be applied to
* @param integrator the BrownianIntegrator this kernel will be used for
*/
void initialize(const std::vector<double>& masses, const std::vector<std::vector<int> >& constraintIndices,
const std::vector<double>& constraintLengths);
void initialize(const System& system, const BrownianIntegrator& integrator);
/**
* Execute the kernel.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom
* @param temperature the temperature of the heat bath
* @param friction the friction coefficient coupling the system to the heat bath
* @param stepSize the integration step size
* @param context the context in which to execute this kernel
* @param integrator the BrownianIntegrator this kernel is being used for
*/
void execute(Stream& positions, Stream& velocities, const Stream& forces, double temperature, double friction, double stepSize);
void execute(OpenMMContextImpl& context, const BrownianIntegrator& integrator);
private:
ReferenceBrownianDynamics* dynamics;
ReferenceShakeAlgorithm* shake;
......@@ -268,20 +227,18 @@ public:
}
~ReferenceApplyAndersenThermostatKernel();
/**
* Initialize the kernel, setting up the values of unchanging parameters.
* Initialize the kernel.
*
* @param masses the mass of each atom
* @param system the System this kernel will be applied to
* @param thermostat the AndersenThermostat this kernel will be used for
*/
void initialize(const std::vector<double>& masses);
void initialize(const System& system, const AndersenThermostat& thermostat);
/**
* Execute the kernel.
*
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @param temperature the temperature of the heat bath
* @param collisionFrequency the frequency at which atom collide with particles in the heat bath
* @param stepSize the integration step size
* @param context the context in which to execute this kernel
*/
void execute(Stream& velocities, double temperature, double collisionFrequency, double stepSize);
void execute(OpenMMContextImpl& context);
private:
ReferenceAndersenThermostat* thermostat;
RealOpenMM* masses;
......@@ -295,18 +252,17 @@ public:
ReferenceCalcKineticEnergyKernel(std::string name, const Platform& platform) : CalcKineticEnergyKernel(name, platform) {
}
/**
* Initialize the kernel, setting up the atomic masses.
* Initialize the kernel.
*
* @param masses the mass of each atom
* @param system the System this kernel will be applied to
*/
void initialize(const std::vector<double>& masses);
void initialize(const System& system);
/**
* Execute the kernel.
*
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @return the kinetic energy of the system
* @param context the context in which to execute this kernel
*/
double execute(const Stream& velocities);
double execute(OpenMMContextImpl& context);
private:
std::vector<double> masses;
};
......@@ -321,17 +277,19 @@ public:
/**
* Initialize the kernel, setting up the atomic masses.
*
* @param masses the mass of each atom
* @param system the System this kernel will be applied to
* @param force the CMMotionRemover this kernel will be used for
*/
void initialize(const std::vector<double>& masses);
void initialize(const System& system, const CMMotionRemover& force);
/**
* Execute the kernel.
*
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @param context the context in which to execute this kernel
*/
void execute(Stream& velocities);
void execute(OpenMMContextImpl& context);
private:
std::vector<double> masses;
int frequency;
};
} // namespace OpenMM
......
......@@ -55,7 +55,7 @@ void testTemperature() {
ReferencePlatform platform;
System system(numAtoms, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 0, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 0, 0, 0, 0, 0);
for (int i = 0; i < numAtoms; ++i) {
system.setAtomMass(i, 2.0);
forceField->setAtomParameters(i, (i%2 == 0 ? 1.0 : -1.0), 1.0, 5.0);
......
......@@ -56,7 +56,7 @@ void testSingleBond() {
system.setAtomMass(1, 2.0);
double dt = 0.01;
BrownianIntegrator integrator(0, 0.1, dt);
StandardMMForceField* forceField = new StandardMMForceField(2, 1, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(2, 1, 0, 0, 0, 0);
forceField->setBondParameters(0, 0, 1, 1.5, 1);
system.addForce(forceField);
OpenMMContext context(system, integrator, platform);
......@@ -90,7 +90,7 @@ void testTemperature() {
ReferencePlatform platform;
System system(numAtoms, 0);
BrownianIntegrator integrator(temp, 2.0, 0.01);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, numBonds, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, numBonds, 0, 0, 0, 0);
for (int i = 0; i < numAtoms; ++i) {
system.setAtomMass(i, 2.0);
// forceField->setAtomParameters(i, (i%2 == 0 ? 1.0 : -1.0), 1.0, 5.0);
......@@ -127,7 +127,7 @@ void testConstraints() {
ReferencePlatform platform;
System system(numAtoms, numAtoms-1);
BrownianIntegrator integrator(temp, 2.0, 0.001);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 0, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 0, 0, 0, 0, 0);
for (int i = 0; i < numAtoms; ++i) {
system.setAtomMass(i, 10.0);
forceField->setAtomParameters(i, (i%2 == 0 ? 0.2 : -0.2), 0.5, 5.0);
......
......@@ -65,7 +65,7 @@ void testMotionRemoval() {
ReferencePlatform platform;
System system(numAtoms, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 1, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 1, 0, 0, 0, 0);
for (int i = 0; i < numAtoms; ++i) {
system.setAtomMass(i, i+1);
forceField->setAtomParameters(i, (i%2 == 0 ? 1.0 : -1.0), 1.0, 5.0);
......
......@@ -55,7 +55,7 @@ void testSingleBond() {
system.setAtomMass(0, 2.0);
system.setAtomMass(1, 2.0);
LangevinIntegrator integrator(0, 0.1, 0.01);
StandardMMForceField* forceField = new StandardMMForceField(2, 1, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(2, 1, 0, 0, 0, 0);
forceField->setBondParameters(0, 0, 1, 1.5, 1);
system.addForce(forceField);
OpenMMContext context(system, integrator, platform);
......@@ -99,7 +99,7 @@ void testTemperature() {
ReferencePlatform platform;
System system(numAtoms, 0);
LangevinIntegrator integrator(temp, 2.0, 0.01);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 0, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 0, 0, 0, 0, 0);
for (int i = 0; i < numAtoms; ++i) {
system.setAtomMass(i, 2.0);
forceField->setAtomParameters(i, (i%2 == 0 ? 1.0 : -1.0), 1.0, 5.0);
......@@ -134,7 +134,7 @@ void testConstraints() {
ReferencePlatform platform;
System system(numAtoms, numAtoms-1);
LangevinIntegrator integrator(temp, 2.0, 0.01);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 0, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 0, 0, 0, 0, 0);
for (int i = 0; i < numAtoms; ++i) {
system.setAtomMass(i, 10.0);
forceField->setAtomParameters(i, (i%2 == 0 ? 0.2 : -0.2), 0.5, 5.0);
......
......@@ -52,7 +52,7 @@ void testBonds() {
ReferencePlatform platform;
System system(3, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(3, 2, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(3, 2, 0, 0, 0, 0);
forceField->setBondParameters(0, 0, 1, 1.5, 0.8);
forceField->setBondParameters(1, 1, 2, 1.2, 0.7);
system.addForce(forceField);
......@@ -74,7 +74,7 @@ void testAngles() {
ReferencePlatform platform;
System system(4, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(4, 0, 2, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(4, 0, 2, 0, 0, 0);
forceField->setAngleParameters(0, 0, 1, 2, PI_M/3, 1.1);
forceField->setAngleParameters(1, 1, 2, 3, PI_M/2, 1.2);
system.addForce(forceField);
......@@ -99,7 +99,7 @@ void testPeriodicTorsions() {
ReferencePlatform platform;
System system(4, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(4, 0, 0, 1, 0);
StandardMMForceField* forceField = new StandardMMForceField(4, 0, 0, 1, 0, 0);
forceField->setPeriodicTorsionParameters(0, 0, 1, 2, 3, 2, PI_M/3, 1.1);
system.addForce(forceField);
OpenMMContext context(system, integrator, platform);
......@@ -122,7 +122,7 @@ void testRBTorsions() {
ReferencePlatform platform;
System system(4, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(4, 0, 0, 0, 1);
StandardMMForceField* forceField = new StandardMMForceField(4, 0, 0, 0, 1, 0);
forceField->setRBTorsionParameters(0, 0, 1, 2, 3, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6);
system.addForce(forceField);
OpenMMContext context(system, integrator, platform);
......@@ -155,7 +155,7 @@ void testCoulomb() {
ReferencePlatform platform;
System system(2, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(2, 0, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(2, 0, 0, 0, 0, 0);
forceField->setAtomParameters(0, 0.5, 1, 0);
forceField->setAtomParameters(1, -1.5, 1, 0);
system.addForce(forceField);
......@@ -176,7 +176,7 @@ void testLJ() {
ReferencePlatform platform;
System system(2, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(2, 0, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(2, 0, 0, 0, 0, 0);
forceField->setAtomParameters(0, 0, 1.2, 1);
forceField->setAtomParameters(1, 0, 1.4, 2);
system.addForce(forceField);
......@@ -199,7 +199,7 @@ void testExclusionsAnd14() {
ReferencePlatform platform;
System system(5, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(5, 4, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(5, 4, 0, 0, 0, 2);
forceField->setBondParameters(0, 0, 1, 1, 0);
forceField->setBondParameters(1, 1, 2, 1, 0);
forceField->setBondParameters(2, 2, 3, 1, 0);
......@@ -218,6 +218,8 @@ void testExclusionsAnd14() {
}
forceField->setAtomParameters(0, 0, 1.5, 1);
forceField->setAtomParameters(i, 0, 1.5, 1);
forceField->setNonbonded14Parameters(0, 0, 3, 0, 1.5, i == 3 ? 0.5 : 0.0);
forceField->setNonbonded14Parameters(1, 1, 4, 0, 1.5, 0.0);
positions[i] = Vec3(r, 0, 0);
context.reinitialize();
context.setPositions(positions);
......@@ -243,6 +245,8 @@ void testExclusionsAnd14() {
forceField->setAtomParameters(0, 2, 1.5, 0);
forceField->setAtomParameters(i, 2, 1.5, 0);
forceField->setNonbonded14Parameters(0, 0, 3, i == 3 ? 4/1.2 : 0, 1.5, 0);
forceField->setNonbonded14Parameters(1, 1, 4, 0, 1.5, 0);
context.reinitialize();
context.setPositions(positions);
state = context.getState(State::Forces | State::Energy);
......@@ -267,7 +271,7 @@ void testCutoff() {
ReferencePlatform platform;
System system(3, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(3, 0, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(3, 0, 0, 0, 0, 0);
forceField->setAtomParameters(0, 1.0, 1, 0);
forceField->setAtomParameters(1, 1.0, 1, 0);
forceField->setAtomParameters(2, 1.0, 1, 0);
......@@ -300,7 +304,7 @@ void testCutoff14() {
ReferencePlatform platform;
System system(5, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(5, 4, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(5, 4, 0, 0, 0, 2);
forceField->setBondParameters(0, 0, 1, 1, 0);
forceField->setBondParameters(1, 1, 2, 1, 0);
forceField->setBondParameters(2, 2, 3, 1, 0);
......@@ -324,6 +328,8 @@ void testCutoff14() {
for (int j = 1; j < 5; ++j)
forceField->setAtomParameters(j, 0, 1.5, 0);
forceField->setAtomParameters(i, 0, 1.5, 1);
forceField->setNonbonded14Parameters(0, 0, 3, 0, 1.5, i == 3 ? 0.5 : 0.0);
forceField->setNonbonded14Parameters(1, 1, 4, 0, 1.5, 0.0);
context.reinitialize();
context.setPositions(positions);
State state = context.getState(State::Forces | State::Energy);
......@@ -350,6 +356,8 @@ void testCutoff14() {
const double q = 0.7;
forceField->setAtomParameters(0, q, 1.5, 0);
forceField->setAtomParameters(i, q, 1.5, 0);
forceField->setNonbonded14Parameters(0, 0, 3, i == 3 ? q*q/1.2 : 0, 1.5, 0);
forceField->setNonbonded14Parameters(1, 1, 4, 0, 1.5, 0);
context.reinitialize();
context.setPositions(positions);
state = context.getState(State::Forces | State::Energy);
......@@ -377,7 +385,7 @@ void testPeriodic() {
ReferencePlatform platform;
System system(3, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(3, 1, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(3, 1, 0, 0, 0, 0);
forceField->setAtomParameters(0, 1.0, 1, 0);
forceField->setAtomParameters(1, 1.0, 1, 0);
forceField->setAtomParameters(2, 1.0, 1, 0);
......
......@@ -55,7 +55,7 @@ void testSingleBond() {
system.setAtomMass(0, 2.0);
system.setAtomMass(1, 2.0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forceField = new StandardMMForceField(2, 1, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(2, 1, 0, 0, 0, 0);
forceField->setBondParameters(0, 0, 1, 1.5, 1);
system.addForce(forceField);
OpenMMContext context(system, integrator, platform);
......@@ -90,7 +90,7 @@ void testConstraints() {
ReferencePlatform platform;
System system(numAtoms, numAtoms-1);
VerletIntegrator integrator(0.002);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 0, 0, 0, 0);
StandardMMForceField* forceField = new StandardMMForceField(numAtoms, 0, 0, 0, 0, 0);
for (int i = 0; i < numAtoms; ++i) {
system.setAtomMass(i, 10.0);
forceField->setAtomParameters(i, (i%2 == 0 ? 0.2 : -0.2), 0.5, 5.0);
......
......@@ -140,19 +140,13 @@ class DummyForceKernel : public CalcStandardMMForceFieldKernel {
public:
DummyForceKernel(string name, const Platform& platform) : CalcStandardMMForceFieldKernel(name, platform) {
}
void initialize(const vector<vector<int> >& bondIndices, const vector<vector<double> >& bondParameters,
const vector<vector<int> >& angleIndices, const vector<vector<double> >& angleParameters,
const vector<vector<int> >& periodicTorsionIndices, const vector<vector<double> >& periodicTorsionParameters,
const vector<vector<int> >& rbTorsionIndices, const vector<vector<double> >& rbTorsionParameters,
const vector<vector<int> >& bonded14Indices, double lj14Scale, double coulomb14Scale,
const vector<set<int> >& exclusions, const vector<vector<double> >& nonbondedParameters,
NonbondedMethod nonbondedMethod, double nonbondedCutoff, double periodicBoxSize[3]) {
void initialize(const System& system, const StandardMMForceField& force, const std::vector<std::set<int> >& exclusions) {
verifyExclusions(exclusions);
verify14(bonded14Indices);
// verify14(bonded14Indices);
}
void executeForces(const Stream& positions, Stream& forces) {
void executeForces(OpenMMContextImpl& context) {
}
double executeEnergy(const Stream& positions) {
double executeEnergy(OpenMMContextImpl& context) {
return 0.0;
}
};
......@@ -161,9 +155,9 @@ class DummyIntegratorKernel : public IntegrateVerletStepKernel {
public:
DummyIntegratorKernel(string name, const Platform& platform) : IntegrateVerletStepKernel(name, platform) {
}
void initialize(const vector<double>& masses, const vector<vector<int> >& constraintIndices, const vector<double>& constraintLengths) {
void initialize(const System& system, const VerletIntegrator& integrator) {
}
void execute(Stream& positions, Stream& velocities, const Stream& forces, double stepSize) {
void execute(OpenMMContextImpl& context, const VerletIntegrator& integrator) {
}
};
......@@ -171,9 +165,9 @@ class DummyKEKernel : public CalcKineticEnergyKernel {
public:
DummyKEKernel(string name, const Platform& platform) : CalcKineticEnergyKernel(name, platform) {
}
void initialize(const vector<double>& masses) {
void initialize(const System& system) {
}
double execute(const Stream& positions) {
double execute(OpenMMContextImpl& context) {
return 0.0;
}
};
......@@ -238,7 +232,7 @@ int main() {
DummyPlatform platform;
System system(NUM_ATOMS, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forces = new StandardMMForceField(NUM_ATOMS, NUM_ATOMS-1, 0, 0, 0);
StandardMMForceField* forces = new StandardMMForceField(NUM_ATOMS, NUM_ATOMS-1, 0, 0, 0, 0);
// loop over all main-chain atoms (even numbered atoms)
for (int i = 0; i < NUM_ATOMS-1; i += 2)
......
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