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
map<string, Lepton::CustomFunction*> functions;
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.
......@@ -1252,7 +1252,7 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu
map<string, Lepton::CustomFunction*> functions;
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.
......@@ -1466,7 +1466,7 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const
map<string, Lepton::CustomFunction*> functions;
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.
......@@ -1563,7 +1563,7 @@ void ReferenceCalcCustomCompoundBondForceKernel::initialize(const System& system
map<string, Lepton::CustomFunction*> functions;
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.
......
......@@ -189,7 +189,7 @@ void testContinuous2DFunction() {
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);
Context context(system, integrator, platform);
vector<Vec3> positions(1);
......@@ -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);
Context context(system, integrator, platform);
vector<Vec3> positions(1);
......
......@@ -281,7 +281,7 @@ void testTabulatedFunction() {
vector<double> table;
for (int i = 0; i < 21; 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);
Context context(system, integrator, platform);
vector<Vec3> positions(2);
......
......@@ -217,7 +217,7 @@ void testCustomFunctions() {
vector<double> function(2);
function[0] = 0;
function[1] = 1;
custom->addFunction("foo", function, 0, 10);
custom->addTabulatedFunction("foo", new Continuous1DFunction(function, 0, 10));
system.addForce(custom);
Context context(system, integrator, platform);
vector<Vec3> positions(3);
......
......@@ -239,7 +239,7 @@ void testContinuous1DFunction() {
vector<double> table;
for (int i = 0; i < 21; 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);
Context context(system, integrator, platform);
vector<Vec3> positions(2);
......@@ -290,7 +290,7 @@ void testContinuous2DFunction() {
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);
Context context(system, integrator, platform);
vector<Vec3> positions(2);
......@@ -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);
Context context(system, integrator, platform);
vector<Vec3> positions(2);
......@@ -386,7 +386,7 @@ void testDiscrete1DFunction() {
vector<double> table;
for (int i = 0; i < 21; i++)
table.push_back(sin(0.25*i));
forceField->addFunction("fn", new Discrete1DFunction(table));
forceField->addTabulatedFunction("fn", new Discrete1DFunction(table));
system.addForce(forceField);
Context context(system, integrator, platform);
vector<Vec3> positions(2);
......@@ -418,7 +418,7 @@ void testDiscrete2DFunction() {
for (int i = 0; i < xsize; i++)
for (int j = 0; j < ysize; 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);
Context context(system, integrator, platform);
vector<Vec3> positions(2);
......@@ -454,7 +454,7 @@ void testDiscrete3DFunction() {
for (int j = 0; j < ysize; j++)
for (int k = 0; k < zsize; 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);
Context context(system, integrator, platform);
vector<Vec3> positions(2);
......
......@@ -123,8 +123,6 @@ class WrapperGenerator:
methodName = shortMethodDefinition.split()[-1]
if className+'::'+methodName in self.skipMethods:
continue
if any(getNodeText(node) == "Deprecated" for node in findNodes(memberNode, "detaileddescription/para/xrefsect/xreftitle")):
continue # Skip deprecated methods
methodList.append(memberNode)
return methodList
......
......@@ -136,6 +136,10 @@ NO_OUTPUT_ARGS = [('LocalEnergyMinimizer', 'minimize', 'context'),
STEAL_OWNERSHIP = {("Platform", "registerPlatform") : [0],
("System", "addForce") : [0],
("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.
......@@ -155,7 +159,6 @@ UNITS = {
("*", "getErrorTolerance") : (None, ()),
("*", "getEwaldErrorTolerance") : (None, ()),
("*", "getFriction") : ("1/unit.picosecond", ()),
("*", "getFunction") : (None, ()),
("*", "getGlobalVariable") : (None, ()),
("*", "getIntegrator") : (None, ()),
("*", "getMapParameters") : (None, ()),
......@@ -180,6 +183,7 @@ UNITS = {
("*", "getSolventDielectric") : (None, ()),
("*", "getStepSize") : ("unit.picosecond", ()),
("*", "getSystem") : (None, ()),
("*", "getTabulatedFunction") : (None, ()),
("*", "getUseDispersionCorrection") : (None, ()),
("*", "getTemperature") : ("unit.kelvin", ()),
("*", "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