Commit 75a04e7f authored by peastman's avatar peastman
Browse files

Renamed methods for dealing with TabulatedFunctions to avoid problems in...

Renamed methods for dealing with TabulatedFunctions to avoid problems in wrapper APIs.  Also fixed a few bugs.
parent f7e5492d
...@@ -970,7 +970,7 @@ void ReferenceCalcCustomNonbondedForceKernel::initialize(const System& system, c ...@@ -970,7 +970,7 @@ void ReferenceCalcCustomNonbondedForceKernel::initialize(const System& system, c
map<string, Lepton::CustomFunction*> functions; map<string, Lepton::CustomFunction*> functions;
for (int i = 0; i < force.getNumFunctions(); i++) for (int i = 0; i < force.getNumFunctions(); i++)
functions[force.getFunctionName(i)] = createReferenceTabulatedFunction(force.getFunction(i)); functions[force.getTabulatedFunctionName(i)] = createReferenceTabulatedFunction(force.getTabulatedFunction(i));
// Parse the various expressions used to calculate the force. // Parse the various expressions used to calculate the force.
...@@ -1252,7 +1252,7 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu ...@@ -1252,7 +1252,7 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu
map<string, Lepton::CustomFunction*> functions; map<string, Lepton::CustomFunction*> functions;
for (int i = 0; i < force.getNumFunctions(); i++) for (int i = 0; i < force.getNumFunctions(); i++)
functions[force.getFunctionName(i)] = createReferenceTabulatedFunction(force.getFunction(i)); functions[force.getTabulatedFunctionName(i)] = createReferenceTabulatedFunction(force.getTabulatedFunction(i));
// Parse the expressions for computed values. // Parse the expressions for computed values.
...@@ -1466,7 +1466,7 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const ...@@ -1466,7 +1466,7 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const
map<string, Lepton::CustomFunction*> functions; map<string, Lepton::CustomFunction*> functions;
for (int i = 0; i < force.getNumFunctions(); i++) for (int i = 0; i < force.getNumFunctions(); i++)
functions[force.getFunctionName(i)] = createReferenceTabulatedFunction(force.getFunction(i)); functions[force.getTabulatedFunctionName(i)] = createReferenceTabulatedFunction(force.getTabulatedFunction(i));
// Parse the expression and create the object used to calculate the interaction. // Parse the expression and create the object used to calculate the interaction.
...@@ -1563,7 +1563,7 @@ void ReferenceCalcCustomCompoundBondForceKernel::initialize(const System& system ...@@ -1563,7 +1563,7 @@ void ReferenceCalcCustomCompoundBondForceKernel::initialize(const System& system
map<string, Lepton::CustomFunction*> functions; map<string, Lepton::CustomFunction*> functions;
for (int i = 0; i < force.getNumFunctions(); i++) for (int i = 0; i < force.getNumFunctions(); i++)
functions[force.getFunctionName(i)] = createReferenceTabulatedFunction(force.getFunction(i)); functions[force.getTabulatedFunctionName(i)] = createReferenceTabulatedFunction(force.getTabulatedFunction(i));
// Parse the expression and create the object used to calculate the interaction. // Parse the expression and create the object used to calculate the interaction.
......
...@@ -189,7 +189,7 @@ void testContinuous2DFunction() { ...@@ -189,7 +189,7 @@ void testContinuous2DFunction() {
table[i+xsize*j] = sin(0.25*x)*cos(0.33*y); table[i+xsize*j] = sin(0.25*x)*cos(0.33*y);
} }
} }
forceField->addFunction("fn", new Continuous2DFunction(xsize, ysize, table, xmin, xmax, ymin, ymax)); forceField->addTabulatedFunction("fn", new Continuous2DFunction(xsize, ysize, table, xmin, xmax, ymin, ymax));
system.addForce(forceField); system.addForce(forceField);
Context context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(1); vector<Vec3> positions(1);
...@@ -240,7 +240,7 @@ void testContinuous3DFunction() { ...@@ -240,7 +240,7 @@ void testContinuous3DFunction() {
} }
} }
} }
forceField->addFunction("fn", new Continuous3DFunction(xsize, ysize, zsize, table, xmin, xmax, ymin, ymax, zmin, zmax)); forceField->addTabulatedFunction("fn", new Continuous3DFunction(xsize, ysize, zsize, table, xmin, xmax, ymin, ymax, zmin, zmax));
system.addForce(forceField); system.addForce(forceField);
Context context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(1); vector<Vec3> positions(1);
......
...@@ -281,7 +281,7 @@ void testTabulatedFunction() { ...@@ -281,7 +281,7 @@ void testTabulatedFunction() {
vector<double> table; vector<double> table;
for (int i = 0; i < 21; i++) for (int i = 0; i < 21; i++)
table.push_back(std::sin(0.25*i)); table.push_back(std::sin(0.25*i));
force->addFunction("fn", table, 1.0, 6.0); force->addTabulatedFunction("fn", new Continuous1DFunction(table, 1.0, 6.0));
system.addForce(force); system.addForce(force);
Context context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
......
...@@ -217,7 +217,7 @@ void testCustomFunctions() { ...@@ -217,7 +217,7 @@ void testCustomFunctions() {
vector<double> function(2); vector<double> function(2);
function[0] = 0; function[0] = 0;
function[1] = 1; function[1] = 1;
custom->addFunction("foo", function, 0, 10); custom->addTabulatedFunction("foo", new Continuous1DFunction(function, 0, 10));
system.addForce(custom); system.addForce(custom);
Context context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(3); vector<Vec3> positions(3);
......
...@@ -239,7 +239,7 @@ void testContinuous1DFunction() { ...@@ -239,7 +239,7 @@ void testContinuous1DFunction() {
vector<double> table; vector<double> table;
for (int i = 0; i < 21; i++) for (int i = 0; i < 21; i++)
table.push_back(sin(0.25*i)); table.push_back(sin(0.25*i));
forceField->addFunction("fn", new Continuous1DFunction(table, 1.0, 6.0)); forceField->addTabulatedFunction("fn", new Continuous1DFunction(table, 1.0, 6.0));
system.addForce(forceField); system.addForce(forceField);
Context context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
...@@ -290,7 +290,7 @@ void testContinuous2DFunction() { ...@@ -290,7 +290,7 @@ void testContinuous2DFunction() {
table[i+xsize*j] = sin(0.25*x)*cos(0.33*y); table[i+xsize*j] = sin(0.25*x)*cos(0.33*y);
} }
} }
forceField->addFunction("fn", new Continuous2DFunction(xsize, ysize, table, xmin, xmax, ymin, ymax)); forceField->addTabulatedFunction("fn", new Continuous2DFunction(xsize, ysize, table, xmin, xmax, ymin, ymax));
system.addForce(forceField); system.addForce(forceField);
Context context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
...@@ -346,7 +346,7 @@ void testContinuous3DFunction() { ...@@ -346,7 +346,7 @@ void testContinuous3DFunction() {
} }
} }
} }
forceField->addFunction("fn", new Continuous3DFunction(xsize, ysize, zsize, table, xmin, xmax, ymin, ymax, zmin, zmax)); forceField->addTabulatedFunction("fn", new Continuous3DFunction(xsize, ysize, zsize, table, xmin, xmax, ymin, ymax, zmin, zmax));
system.addForce(forceField); system.addForce(forceField);
Context context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
...@@ -386,7 +386,7 @@ void testDiscrete1DFunction() { ...@@ -386,7 +386,7 @@ void testDiscrete1DFunction() {
vector<double> table; vector<double> table;
for (int i = 0; i < 21; i++) for (int i = 0; i < 21; i++)
table.push_back(sin(0.25*i)); table.push_back(sin(0.25*i));
forceField->addFunction("fn", new Discrete1DFunction(table)); forceField->addTabulatedFunction("fn", new Discrete1DFunction(table));
system.addForce(forceField); system.addForce(forceField);
Context context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
...@@ -418,7 +418,7 @@ void testDiscrete2DFunction() { ...@@ -418,7 +418,7 @@ void testDiscrete2DFunction() {
for (int i = 0; i < xsize; i++) for (int i = 0; i < xsize; i++)
for (int j = 0; j < ysize; j++) for (int j = 0; j < ysize; j++)
table.push_back(sin(0.25*i)+cos(0.33*j)); table.push_back(sin(0.25*i)+cos(0.33*j));
forceField->addFunction("fn", new Discrete2DFunction(xsize, ysize, table)); forceField->addTabulatedFunction("fn", new Discrete2DFunction(xsize, ysize, table));
system.addForce(forceField); system.addForce(forceField);
Context context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
...@@ -454,7 +454,7 @@ void testDiscrete3DFunction() { ...@@ -454,7 +454,7 @@ void testDiscrete3DFunction() {
for (int j = 0; j < ysize; j++) for (int j = 0; j < ysize; j++)
for (int k = 0; k < zsize; k++) for (int k = 0; k < zsize; k++)
table.push_back(sin(0.25*i)+cos(0.33*j)+0.12345*k); table.push_back(sin(0.25*i)+cos(0.33*j)+0.12345*k);
forceField->addFunction("fn", new Discrete3DFunction(xsize, ysize, zsize, table)); forceField->addTabulatedFunction("fn", new Discrete3DFunction(xsize, ysize, zsize, table));
system.addForce(forceField); system.addForce(forceField);
Context context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
......
...@@ -123,8 +123,6 @@ class WrapperGenerator: ...@@ -123,8 +123,6 @@ class WrapperGenerator:
methodName = shortMethodDefinition.split()[-1] methodName = shortMethodDefinition.split()[-1]
if className+'::'+methodName in self.skipMethods: if className+'::'+methodName in self.skipMethods:
continue continue
if any(getNodeText(node) == "Deprecated" for node in findNodes(memberNode, "detaileddescription/para/xrefsect/xreftitle")):
continue # Skip deprecated methods
methodList.append(memberNode) methodList.append(memberNode)
return methodList return methodList
......
...@@ -136,6 +136,10 @@ NO_OUTPUT_ARGS = [('LocalEnergyMinimizer', 'minimize', 'context'), ...@@ -136,6 +136,10 @@ NO_OUTPUT_ARGS = [('LocalEnergyMinimizer', 'minimize', 'context'),
STEAL_OWNERSHIP = {("Platform", "registerPlatform") : [0], STEAL_OWNERSHIP = {("Platform", "registerPlatform") : [0],
("System", "addForce") : [0], ("System", "addForce") : [0],
("System", "setVirtualSite") : [1], ("System", "setVirtualSite") : [1],
("CustomNonbondedForce", "addTabulatedFunction") : [1],
("CustomGBForce", "addTabulatedFunction") : [1],
("CustomHbondForce", "addTabulatedFunction") : [1],
("CustomCompoundBondForce", "addTabulatedFunction") : [1],
} }
# This is a list of units to attach to return values and method args. # This is a list of units to attach to return values and method args.
...@@ -155,7 +159,6 @@ UNITS = { ...@@ -155,7 +159,6 @@ UNITS = {
("*", "getErrorTolerance") : (None, ()), ("*", "getErrorTolerance") : (None, ()),
("*", "getEwaldErrorTolerance") : (None, ()), ("*", "getEwaldErrorTolerance") : (None, ()),
("*", "getFriction") : ("1/unit.picosecond", ()), ("*", "getFriction") : ("1/unit.picosecond", ()),
("*", "getFunction") : (None, ()),
("*", "getGlobalVariable") : (None, ()), ("*", "getGlobalVariable") : (None, ()),
("*", "getIntegrator") : (None, ()), ("*", "getIntegrator") : (None, ()),
("*", "getMapParameters") : (None, ()), ("*", "getMapParameters") : (None, ()),
...@@ -180,6 +183,7 @@ UNITS = { ...@@ -180,6 +183,7 @@ UNITS = {
("*", "getSolventDielectric") : (None, ()), ("*", "getSolventDielectric") : (None, ()),
("*", "getStepSize") : ("unit.picosecond", ()), ("*", "getStepSize") : ("unit.picosecond", ()),
("*", "getSystem") : (None, ()), ("*", "getSystem") : (None, ()),
("*", "getTabulatedFunction") : (None, ()),
("*", "getUseDispersionCorrection") : (None, ()), ("*", "getUseDispersionCorrection") : (None, ()),
("*", "getTemperature") : ("unit.kelvin", ()), ("*", "getTemperature") : ("unit.kelvin", ()),
("*", "getUseDispersionCorrection") : (None, ()), ("*", "getUseDispersionCorrection") : (None, ()),
......
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