Commit 8a01b345 authored by Jason Swails's avatar Jason Swails
Browse files

Remove default and kludgey way to half-support backwards compatibility.

Update the Python application layer to use both force constants when building
the AmoebaStretchBendForce.
parent e6dbc496
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
* @return the index of the stretch-bend that was added * @return the index of the stretch-bend that was added
*/ */
int addStretchBend(int particle1, int particle2, int particle3, double lengthAB, double lengthCB, double angle, int addStretchBend(int particle1, int particle2, int particle3, double lengthAB, double lengthCB, double angle,
double k1, double k2=-1.0); double k1, double k2);
/** /**
* Get the force field parameters for a stretch-bend term. * Get the force field parameters for a stretch-bend term.
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
* @param k2 the force constant of the product of bond bc and angle a-b-c (optional, default is the same as k1) * @param k2 the force constant of the product of bond bc and angle a-b-c (optional, default is the same as k1)
*/ */
void setStretchBendParameters(int index, int particle1, int particle2, int particle3, void setStretchBendParameters(int index, int particle1, int particle2, int particle3,
double lengthAB, double lengthCB, double angle, double k1, double k2=-1.0 ); double lengthAB, double lengthCB, double angle, double k1, double k2);
/** /**
* Update the per-stretch-bend term parameters in a Context to match those stored in this Force object. This method provides * Update the per-stretch-bend term parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it. * an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
......
...@@ -41,7 +41,6 @@ AmoebaStretchBendForce::AmoebaStretchBendForce() { ...@@ -41,7 +41,6 @@ AmoebaStretchBendForce::AmoebaStretchBendForce() {
int AmoebaStretchBendForce::addStretchBend(int particle1, int particle2, int particle3, int AmoebaStretchBendForce::addStretchBend(int particle1, int particle2, int particle3,
double lengthAB, double lengthCB, double angle, double k1, double k2) { double lengthAB, double lengthCB, double angle, double k1, double k2) {
if (k2 == -1.0) k2 = k1;
stretchBends.push_back(StretchBendInfo(particle1, particle2, particle3, lengthAB, lengthCB, angle, k1, k2)); stretchBends.push_back(StretchBendInfo(particle1, particle2, particle3, lengthAB, lengthCB, angle, k1, k2));
return stretchBends.size()-1; return stretchBends.size()-1;
} }
...@@ -67,10 +66,7 @@ void AmoebaStretchBendForce::setStretchBendParameters(int index, int particle1, ...@@ -67,10 +66,7 @@ void AmoebaStretchBendForce::setStretchBendParameters(int index, int particle1,
stretchBends[index].lengthCB = lengthCB; stretchBends[index].lengthCB = lengthCB;
stretchBends[index].angle = angle; stretchBends[index].angle = angle;
stretchBends[index].k1 = k1; stretchBends[index].k1 = k1;
if (k2 == -1.0) stretchBends[index].k2 = k2;
stretchBends[index].k2 = k1;
else
stretchBends[index].k2 = k2;
} }
ForceImpl* AmoebaStretchBendForce::createImpl() const { ForceImpl* AmoebaStretchBendForce::createImpl() const {
......
...@@ -276,7 +276,7 @@ void testOneStretchBend( FILE* log ) { ...@@ -276,7 +276,7 @@ void testOneStretchBend( FILE* log ) {
//double kStretchBend = 0.750491578E-01; //double kStretchBend = 0.750491578E-01;
double kStretchBend = 1.0; double kStretchBend = 1.0;
amoebaStretchBendForce->addStretchBend(0, 1, 2, abLength, cbLength, angleStretchBend, kStretchBend ); amoebaStretchBendForce->addStretchBend(0, 1, 2, abLength, cbLength, angleStretchBend, kStretchBend, kStretchBend );
system.addForce(amoebaStretchBendForce); system.addForce(amoebaStretchBendForce);
Context context(system, integrator, Platform::getPlatformByName( "CUDA")); Context context(system, integrator, Platform::getPlatformByName( "CUDA"));
...@@ -292,7 +292,7 @@ void testOneStretchBend( FILE* log ) { ...@@ -292,7 +292,7 @@ void testOneStretchBend( FILE* log ) {
// Try changing the stretch-bend parameters and make sure it's still correct. // Try changing the stretch-bend parameters and make sure it's still correct.
amoebaStretchBendForce->setStretchBendParameters(0, 0, 1, 2, 1.1*abLength, 1.2*cbLength, 1.3*angleStretchBend, 1.4*kStretchBend); amoebaStretchBendForce->setStretchBendParameters(0, 0, 1, 2, 1.1*abLength, 1.2*cbLength, 1.3*angleStretchBend, 1.4*kStretchBend, 1.4*kStretchBend);
bool exceptionThrown = false; bool exceptionThrown = false;
try { try {
// This should throw an exception. // This should throw an exception.
......
...@@ -275,7 +275,7 @@ void testOneStretchBend( FILE* log ) { ...@@ -275,7 +275,7 @@ void testOneStretchBend( FILE* log ) {
//double kStretchBend = 0.750491578E-01; //double kStretchBend = 0.750491578E-01;
double kStretchBend = 1.0; double kStretchBend = 1.0;
amoebaStretchBendForce->addStretchBend(0, 1, 2, abLength, cbLength, angleStretchBend, kStretchBend ); amoebaStretchBendForce->addStretchBend(0, 1, 2, abLength, cbLength, angleStretchBend, kStretchBend, kStretchBend );
system.addForce(amoebaStretchBendForce); system.addForce(amoebaStretchBendForce);
ASSERT(!amoebaStretchBendForce->usesPeriodicBoundaryConditions()); ASSERT(!amoebaStretchBendForce->usesPeriodicBoundaryConditions());
...@@ -293,7 +293,7 @@ void testOneStretchBend( FILE* log ) { ...@@ -293,7 +293,7 @@ void testOneStretchBend( FILE* log ) {
// Try changing the stretch-bend parameters and make sure it's still correct. // Try changing the stretch-bend parameters and make sure it's still correct.
amoebaStretchBendForce->setStretchBendParameters(0, 0, 1, 2, 1.1*abLength, 1.2*cbLength, 1.3*angleStretchBend, 1.4*kStretchBend); amoebaStretchBendForce->setStretchBendParameters(0, 0, 1, 2, 1.1*abLength, 1.2*cbLength, 1.3*angleStretchBend, 1.4*kStretchBend, 1.4*kStretchBend);
bool exceptionThrown = false; bool exceptionThrown = false;
try { try {
// This should throw an exception. // This should throw an exception.
......
...@@ -3086,7 +3086,7 @@ class AmoebaStretchBendGenerator: ...@@ -3086,7 +3086,7 @@ class AmoebaStretchBendGenerator:
raise ValueError(outputString) raise ValueError(outputString)
else: else:
force.addStretchBend(angle[0], angle[1], angle[2], bondAB, bondCB, angleDict['idealAngle']/radian, self.k1[i]) force.addStretchBend(angle[0], angle[1], angle[2], bondAB, bondCB, angleDict['idealAngle']/radian, self.k1[i], self.k2[i])
break break
......
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