Commit 5d4dcb42 authored by peastman's avatar peastman
Browse files

Delete TabulatedFunctions when their owner is deleted

parent a773952e
...@@ -107,6 +107,7 @@ public: ...@@ -107,6 +107,7 @@ public:
* and per-bond parameters * and per-bond parameters
*/ */
explicit CustomCompoundBondForce(int numParticles, const std::string& energy); explicit CustomCompoundBondForce(int numParticles, const std::string& energy);
~CustomCompoundBondForce();
/** /**
* Get the number of particles used to define each bond. * Get the number of particles used to define each bond.
*/ */
......
...@@ -182,6 +182,7 @@ public: ...@@ -182,6 +182,7 @@ public:
* Create a CustomGBForce. * Create a CustomGBForce.
*/ */
CustomGBForce(); CustomGBForce();
~CustomGBForce();
/** /**
* Get the number of particles for which force field parameters have been defined. * Get the number of particles for which force field parameters have been defined.
*/ */
......
...@@ -125,6 +125,7 @@ public: ...@@ -125,6 +125,7 @@ public:
* per-acceptor parameters * per-acceptor parameters
*/ */
explicit CustomHbondForce(const std::string& energy); explicit CustomHbondForce(const std::string& energy);
~CustomHbondForce();
/** /**
* Get the number of donors for which force field parameters have been defined. * Get the number of donors for which force field parameters have been defined.
*/ */
......
...@@ -157,6 +157,7 @@ public: ...@@ -157,6 +157,7 @@ public:
* of r, the distance between them, as well as any global and per-particle parameters * of r, the distance between them, as well as any global and per-particle parameters
*/ */
explicit CustomNonbondedForce(const std::string& energy); explicit CustomNonbondedForce(const std::string& energy);
~CustomNonbondedForce();
/** /**
* Get the number of particles for which force field parameters have been defined. * Get the number of particles for which force field parameters have been defined.
*/ */
......
...@@ -51,6 +51,12 @@ using std::vector; ...@@ -51,6 +51,12 @@ using std::vector;
CustomCompoundBondForce::CustomCompoundBondForce(int numParticles, const string& energy) : particlesPerBond(numParticles), energyExpression(energy) { CustomCompoundBondForce::CustomCompoundBondForce(int numParticles, const string& energy) : particlesPerBond(numParticles), energyExpression(energy) {
} }
CustomCompoundBondForce::~CustomCompoundBondForce() {
for (int i = 0; i < (int) functions.size(); i++)
delete functions[i].function;
}
const string& CustomCompoundBondForce::getEnergyFunction() const { const string& CustomCompoundBondForce::getEnergyFunction() const {
return energyExpression; return energyExpression;
} }
......
...@@ -50,6 +50,11 @@ using std::vector; ...@@ -50,6 +50,11 @@ using std::vector;
CustomGBForce::CustomGBForce() : nonbondedMethod(NoCutoff), cutoffDistance(1.0) { CustomGBForce::CustomGBForce() : nonbondedMethod(NoCutoff), cutoffDistance(1.0) {
} }
CustomGBForce::~CustomGBForce() {
for (int i = 0; i < (int) functions.size(); i++)
delete functions[i].function;
}
CustomGBForce::NonbondedMethod CustomGBForce::getNonbondedMethod() const { CustomGBForce::NonbondedMethod CustomGBForce::getNonbondedMethod() const {
return nonbondedMethod; return nonbondedMethod;
} }
......
...@@ -50,6 +50,12 @@ using std::vector; ...@@ -50,6 +50,12 @@ using std::vector;
CustomHbondForce::CustomHbondForce(const string& energy) : energyExpression(energy), nonbondedMethod(NoCutoff), cutoffDistance(1.0) { CustomHbondForce::CustomHbondForce(const string& energy) : energyExpression(energy), nonbondedMethod(NoCutoff), cutoffDistance(1.0) {
} }
CustomHbondForce::~CustomHbondForce() {
for (int i = 0; i < (int) functions.size(); i++)
delete functions[i].function;
}
const string& CustomHbondForce::getEnergyFunction() const { const string& CustomHbondForce::getEnergyFunction() const {
return energyExpression; return energyExpression;
} }
......
...@@ -51,6 +51,11 @@ CustomNonbondedForce::CustomNonbondedForce(const string& energy) : energyExpress ...@@ -51,6 +51,11 @@ CustomNonbondedForce::CustomNonbondedForce(const string& energy) : energyExpress
switchingDistance(-1.0), useSwitchingFunction(false), useLongRangeCorrection(false) { switchingDistance(-1.0), useSwitchingFunction(false), useLongRangeCorrection(false) {
} }
CustomNonbondedForce::~CustomNonbondedForce() {
for (int i = 0; i < (int) functions.size(); i++)
delete functions[i].function;
}
const string& CustomNonbondedForce::getEnergyFunction() const { const string& CustomNonbondedForce::getEnergyFunction() const {
return energyExpression; return energyExpression;
} }
......
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