Commit d95b90b9 authored by peastman's avatar peastman
Browse files

Cleaned up formatting in AMOEBA code

parent a568bb12
......@@ -41,29 +41,29 @@ using namespace std;
AmoebaMultipoleForceProxy::AmoebaMultipoleForceProxy() : SerializationProxy("AmoebaMultipoleForce") {
}
static void getCovalentTypes( std::vector<std::string>& covalentTypes ){
static void getCovalentTypes(std::vector<std::string>& covalentTypes) {
covalentTypes.push_back( "Covalent12" );
covalentTypes.push_back( "Covalent13" );
covalentTypes.push_back( "Covalent14" );
covalentTypes.push_back( "Covalent15" );
covalentTypes.push_back("Covalent12");
covalentTypes.push_back("Covalent13");
covalentTypes.push_back("Covalent14");
covalentTypes.push_back("Covalent15");
covalentTypes.push_back( "PolarizationCovalent11" );
covalentTypes.push_back( "PolarizationCovalent12" );
covalentTypes.push_back( "PolarizationCovalent13" );
covalentTypes.push_back( "PolarizationCovalent14" );
covalentTypes.push_back("PolarizationCovalent11");
covalentTypes.push_back("PolarizationCovalent12");
covalentTypes.push_back("PolarizationCovalent13");
covalentTypes.push_back("PolarizationCovalent14");
}
static void addCovalentMap( SerializationNode& particleExclusions, int particleIndex, std::string mapName, std::vector< int > covalentMap ){
static void addCovalentMap(SerializationNode& particleExclusions, int particleIndex, std::string mapName, std::vector< int > covalentMap) {
SerializationNode& map = particleExclusions.createChildNode(mapName);
for (unsigned int ii = 0; ii < covalentMap.size(); ii++) {
map.createChildNode("Cv").setIntProperty( "v", covalentMap[ii] );
map.createChildNode("Cv").setIntProperty("v", covalentMap[ii]);
}
}
void loadCovalentMap( const SerializationNode& map, std::vector< int >& covalentMap ){
void loadCovalentMap(const SerializationNode& map, std::vector< int >& covalentMap) {
for (unsigned int ii = 0; ii < map.getChildren().size(); ii++) {
covalentMap.push_back( map.getChildren()[ii].getIntProperty( "v" ) );
covalentMap.push_back(map.getChildren()[ii].getIntProperty("v"));
}
}
......@@ -84,12 +84,12 @@ void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode&
node.setDoubleProperty("ewaldErrorTolerance", force.getEwaldErrorTolerance());
std::vector<int> gridDimensions;
force.getPmeGridDimensions( gridDimensions );
force.getPmeGridDimensions(gridDimensions);
SerializationNode& gridDimensionsNode = node.createChildNode("MultipoleParticleGridDimension");
gridDimensionsNode.setIntProperty( "d0", gridDimensions[0] ).setIntProperty( "d1", gridDimensions[1] ).setIntProperty( "d2", gridDimensions[2] );
gridDimensionsNode.setIntProperty("d0", gridDimensions[0]).setIntProperty("d1", gridDimensions[1]).setIntProperty("d2", gridDimensions[2]);
std::vector<std::string> covalentTypes;
getCovalentTypes( covalentTypes );
getCovalentTypes(covalentTypes);
SerializationNode& particles = node.createChildNode("MultipoleParticles");
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumMultipoles()); ii++) {
......@@ -100,25 +100,25 @@ void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode&
std::vector<double> molecularDipole;
std::vector<double> molecularQuadrupole;
force.getMultipoleParameters( ii, charge, molecularDipole, molecularQuadrupole,
axisType, multipoleAtomZ, multipoleAtomX, multipoleAtomY, thole, dampingFactor, polarity );
force.getMultipoleParameters(ii, charge, molecularDipole, molecularQuadrupole,
axisType, multipoleAtomZ, multipoleAtomX, multipoleAtomY, thole, dampingFactor, polarity);
SerializationNode& particle = particles.createChildNode("Particle");
particle.setIntProperty("axisType", axisType).setIntProperty("multipoleAtomZ", multipoleAtomZ).setIntProperty("multipoleAtomX", multipoleAtomX).setIntProperty("multipoleAtomY", multipoleAtomY);
particle.setDoubleProperty("charge", charge).setDoubleProperty("thole", thole).setDoubleProperty("damp", dampingFactor).setDoubleProperty("polarity", polarity);
SerializationNode& dipole = particle.createChildNode("Dipole");
dipole.setDoubleProperty( "d0", molecularDipole[0] ).setDoubleProperty( "d1", molecularDipole[1] ).setDoubleProperty( "d2", molecularDipole[2] );
dipole.setDoubleProperty("d0", molecularDipole[0]).setDoubleProperty("d1", molecularDipole[1]).setDoubleProperty("d2", molecularDipole[2]);
SerializationNode& quadrupole = particle.createChildNode("Quadrupole");
quadrupole.setDoubleProperty( "q0", molecularQuadrupole[0] ).setDoubleProperty( "q1", molecularQuadrupole[1] ).setDoubleProperty( "q2", molecularQuadrupole[2] );
quadrupole.setDoubleProperty( "q3", molecularQuadrupole[3] ).setDoubleProperty( "q4", molecularQuadrupole[4] ).setDoubleProperty( "q5", molecularQuadrupole[5] );
quadrupole.setDoubleProperty( "q6", molecularQuadrupole[6] ).setDoubleProperty( "q7", molecularQuadrupole[7] ).setDoubleProperty( "q8", molecularQuadrupole[8] );
quadrupole.setDoubleProperty("q0", molecularQuadrupole[0]).setDoubleProperty("q1", molecularQuadrupole[1]).setDoubleProperty("q2", molecularQuadrupole[2]);
quadrupole.setDoubleProperty("q3", molecularQuadrupole[3]).setDoubleProperty("q4", molecularQuadrupole[4]).setDoubleProperty("q5", molecularQuadrupole[5]);
quadrupole.setDoubleProperty("q6", molecularQuadrupole[6]).setDoubleProperty("q7", molecularQuadrupole[7]).setDoubleProperty("q8", molecularQuadrupole[8]);
for (unsigned int jj = 0; jj < covalentTypes.size(); jj++) {
std::vector< int > covalentMap;
force.getCovalentMap(ii, static_cast<AmoebaMultipoleForce::CovalentType>(jj), covalentMap );
addCovalentMap( particle, ii, covalentTypes[jj], covalentMap );
force.getCovalentMap(ii, static_cast<AmoebaMultipoleForce::CovalentType>(jj), covalentMap);
addCovalentMap(particle, ii, covalentTypes[jj], covalentMap);
}
}
}
......@@ -130,54 +130,54 @@ void* AmoebaMultipoleForceProxy::deserialize(const SerializationNode& node) cons
try {
force->setNonbondedMethod( static_cast<AmoebaMultipoleForce::NonbondedMethod>(node.getIntProperty( "nonbondedMethod" )) );
if( node.getIntProperty("version") == 2 ){
force->setPolarizationType( static_cast<AmoebaMultipoleForce::PolarizationType>(node.getIntProperty( "polarizationType" )) );
force->setNonbondedMethod(static_cast<AmoebaMultipoleForce::NonbondedMethod>(node.getIntProperty("nonbondedMethod")));
if (node.getIntProperty("version") == 2) {
force->setPolarizationType(static_cast<AmoebaMultipoleForce::PolarizationType>(node.getIntProperty("polarizationType")));
}
//force->setPmeBSplineOrder( node.getIntProperty( "pmeBSplineOrder" ) );
//force->setMutualInducedIterationMethod( static_cast<AmoebaMultipoleForce::MutualInducedIterationMethod>(node.getIntProperty( "mutualInducedIterationMethod" ) ) );
force->setMutualInducedMaxIterations( node.getIntProperty( "mutualInducedMaxIterations" ) );
//force->setPmeBSplineOrder(node.getIntProperty("pmeBSplineOrder"));
//force->setMutualInducedIterationMethod(static_cast<AmoebaMultipoleForce::MutualInducedIterationMethod>(node.getIntProperty("mutualInducedIterationMethod")));
force->setMutualInducedMaxIterations(node.getIntProperty("mutualInducedMaxIterations"));
force->setCutoffDistance( node.getDoubleProperty( "cutoffDistance" ) );
force->setAEwald( node.getDoubleProperty( "aEwald" ) );
force->setMutualInducedTargetEpsilon( node.getDoubleProperty( "mutualInducedTargetEpsilon" ) );
//force->setElectricConstant( node.getDoubleProperty( "electricConstant" ) );
force->setEwaldErrorTolerance( node.getDoubleProperty( "ewaldErrorTolerance" ) );
force->setCutoffDistance(node.getDoubleProperty("cutoffDistance"));
force->setAEwald(node.getDoubleProperty("aEwald"));
force->setMutualInducedTargetEpsilon(node.getDoubleProperty("mutualInducedTargetEpsilon"));
//force->setElectricConstant(node.getDoubleProperty("electricConstant"));
force->setEwaldErrorTolerance(node.getDoubleProperty("ewaldErrorTolerance"));
std::vector<int> gridDimensions;
const SerializationNode& gridDimensionsNode = node.getChildNode("MultipoleParticleGridDimension");
gridDimensions.push_back( gridDimensionsNode.getIntProperty( "d0" ));
gridDimensions.push_back( gridDimensionsNode.getIntProperty( "d1" ));
gridDimensions.push_back( gridDimensionsNode.getIntProperty( "d2" ));
force->setPmeGridDimensions( gridDimensions );
gridDimensions.push_back(gridDimensionsNode.getIntProperty("d0"));
gridDimensions.push_back(gridDimensionsNode.getIntProperty("d1"));
gridDimensions.push_back(gridDimensionsNode.getIntProperty("d2"));
force->setPmeGridDimensions(gridDimensions);
std::vector<std::string> covalentTypes;
getCovalentTypes( covalentTypes );
getCovalentTypes(covalentTypes);
const SerializationNode& particles = node.getChildNode("MultipoleParticles");
for ( unsigned int ii = 0; ii < particles.getChildren().size(); ii++) {
for (unsigned int ii = 0; ii < particles.getChildren().size(); ii++) {
const SerializationNode& particle = particles.getChildren()[ii];
std::vector<double> molecularDipole;
const SerializationNode& dipole = particle.getChildNode("Dipole");
molecularDipole.push_back( dipole.getDoubleProperty( "d0" ) );
molecularDipole.push_back( dipole.getDoubleProperty( "d1" ) );
molecularDipole.push_back( dipole.getDoubleProperty( "d2" ) );
molecularDipole.push_back(dipole.getDoubleProperty("d0"));
molecularDipole.push_back(dipole.getDoubleProperty("d1"));
molecularDipole.push_back(dipole.getDoubleProperty("d2"));
std::vector<double> molecularQuadrupole;
const SerializationNode& quadrupole = particle.getChildNode("Quadrupole");
molecularQuadrupole.push_back( quadrupole.getDoubleProperty( "q0" ) );
molecularQuadrupole.push_back( quadrupole.getDoubleProperty( "q1" ) );
molecularQuadrupole.push_back( quadrupole.getDoubleProperty( "q2" ) );
molecularQuadrupole.push_back( quadrupole.getDoubleProperty( "q3" ) );
molecularQuadrupole.push_back( quadrupole.getDoubleProperty( "q4" ) );
molecularQuadrupole.push_back( quadrupole.getDoubleProperty( "q5" ) );
molecularQuadrupole.push_back( quadrupole.getDoubleProperty( "q6" ) );
molecularQuadrupole.push_back( quadrupole.getDoubleProperty( "q7" ) );
molecularQuadrupole.push_back( quadrupole.getDoubleProperty( "q8" ) );
force->addMultipole( particle.getDoubleProperty("charge"), molecularDipole, molecularQuadrupole,
molecularQuadrupole.push_back(quadrupole.getDoubleProperty("q0"));
molecularQuadrupole.push_back(quadrupole.getDoubleProperty("q1"));
molecularQuadrupole.push_back(quadrupole.getDoubleProperty("q2"));
molecularQuadrupole.push_back(quadrupole.getDoubleProperty("q3"));
molecularQuadrupole.push_back(quadrupole.getDoubleProperty("q4"));
molecularQuadrupole.push_back(quadrupole.getDoubleProperty("q5"));
molecularQuadrupole.push_back(quadrupole.getDoubleProperty("q6"));
molecularQuadrupole.push_back(quadrupole.getDoubleProperty("q7"));
molecularQuadrupole.push_back(quadrupole.getDoubleProperty("q8"));
force->addMultipole(particle.getDoubleProperty("charge"), molecularDipole, molecularQuadrupole,
particle.getIntProperty("axisType"),
particle.getIntProperty("multipoleAtomZ"),
particle.getIntProperty("multipoleAtomX"),
......@@ -189,8 +189,8 @@ void* AmoebaMultipoleForceProxy::deserialize(const SerializationNode& node) cons
for (unsigned int jj = 0; jj < covalentTypes.size(); jj++) {
std::vector< int > covalentMap;
loadCovalentMap( particle.getChildNode(covalentTypes[jj]), covalentMap );
force->setCovalentMap( ii, static_cast<AmoebaMultipoleForce::CovalentType>(jj), covalentMap );
loadCovalentMap(particle.getChildNode(covalentTypes[jj]), covalentMap);
force->setCovalentMap(ii, static_cast<AmoebaMultipoleForce::CovalentType>(jj), covalentMap);
}
}
......
......@@ -64,10 +64,10 @@ void* AmoebaOutOfPlaneBendForceProxy::deserialize(const SerializationNode& node)
AmoebaOutOfPlaneBendForce* force = new AmoebaOutOfPlaneBendForce();
try {
force->setAmoebaGlobalOutOfPlaneBendCubic(node.getDoubleProperty( "cubic"));
force->setAmoebaGlobalOutOfPlaneBendCubic(node.getDoubleProperty("cubic"));
force->setAmoebaGlobalOutOfPlaneBendQuartic(node.getDoubleProperty("quartic"));
force->setAmoebaGlobalOutOfPlaneBendPentic(node.getDoubleProperty( "pentic"));
force->setAmoebaGlobalOutOfPlaneBendSextic(node.getDoubleProperty( "sextic"));
force->setAmoebaGlobalOutOfPlaneBendPentic(node.getDoubleProperty("pentic"));
force->setAmoebaGlobalOutOfPlaneBendSextic(node.getDoubleProperty("sextic"));
const SerializationNode& bonds = node.getChildNode("OutOfPlaneBend");
for (unsigned int ii = 0; ii < bonds.getChildren().size(); ii++) {
......
......@@ -45,7 +45,7 @@ void AmoebaPiTorsionForceProxy::serialize(const void* object, SerializationNode&
node.setIntProperty("version", 1);
const AmoebaPiTorsionForce& force = *reinterpret_cast<const AmoebaPiTorsionForce*>(object);
SerializationNode& bonds = node.createChildNode("PiTorsion");
for ( unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumPiTorsions()); ii++) {
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumPiTorsions()); ii++) {
int particle1, particle2, particle3, particle4, particle5, particle6;
double k;
force.getPiTorsionParameters(ii, particle1, particle2, particle3, particle4, particle5, particle6, k);
......
......@@ -60,7 +60,7 @@ void* AmoebaStretchBendForceProxy::deserialize(const SerializationNode& node) co
AmoebaStretchBendForce* force = new AmoebaStretchBendForce();
try {
const SerializationNode& bonds = node.getChildNode("StretchBendAngles");
for ( unsigned int ii = 0; ii < (int) bonds.getChildren().size(); ii++) {
for (unsigned int ii = 0; ii < (int) bonds.getChildren().size(); ii++) {
const SerializationNode& bond = bonds.getChildren()[ii];
force->addStretchBend(bond.getIntProperty("p1"), bond.getIntProperty("p2"), bond.getIntProperty("p3"), bond.getDoubleProperty("dAB"), bond.getDoubleProperty("dCB"), bond.getDoubleProperty("angle"), bond.getDoubleProperty("k1"), bond.getDoubleProperty("k2"));
......
......@@ -41,23 +41,23 @@ using namespace std;
AmoebaTorsionTorsionForceProxy::AmoebaTorsionTorsionForceProxy() : SerializationProxy("AmoebaTorsionTorsionForce") {
}
static void loadGrid( const SerializationNode& grid, std::vector< std::vector< std::vector<double> > >& gridVector ){
static void loadGrid(const SerializationNode& grid, std::vector< std::vector< std::vector<double> > >& gridVector) {
const std::vector<SerializationNode>& gridSerializationRows = grid.getChildren();
gridVector.resize( gridSerializationRows.size() );
gridVector.resize(gridSerializationRows.size());
for( unsigned int ii = 0; ii < gridSerializationRows.size(); ii++) {
for (unsigned int ii = 0; ii < gridSerializationRows.size(); ii++) {
const std::vector<SerializationNode>& gridSerializationColumns = gridSerializationRows[ii].getChildren();
gridVector[ii].resize( gridSerializationColumns.size() );
for( unsigned int jj = 0; jj < gridSerializationColumns.size(); jj++) {
gridVector[ii].resize(gridSerializationColumns.size());
for (unsigned int jj = 0; jj < gridSerializationColumns.size(); jj++) {
const SerializationNode& gridSerializationColumnNode = gridSerializationColumns[jj];
gridVector[ii][jj].resize( 6 );
gridVector[ii][jj][0] = gridSerializationColumnNode.getDoubleProperty( "x" );
gridVector[ii][jj][1] = gridSerializationColumnNode.getDoubleProperty( "y" );
gridVector[ii][jj][2] = gridSerializationColumnNode.getDoubleProperty( "f" );
gridVector[ii][jj][3] = gridSerializationColumnNode.getDoubleProperty( "fx" );
gridVector[ii][jj][4] = gridSerializationColumnNode.getDoubleProperty( "fy" );
gridVector[ii][jj][5] = gridSerializationColumnNode.getDoubleProperty( "fxy" );
gridVector[ii][jj].resize(6);
gridVector[ii][jj][0] = gridSerializationColumnNode.getDoubleProperty("x");
gridVector[ii][jj][1] = gridSerializationColumnNode.getDoubleProperty("y");
gridVector[ii][jj][2] = gridSerializationColumnNode.getDoubleProperty("f");
gridVector[ii][jj][3] = gridSerializationColumnNode.getDoubleProperty("fx");
gridVector[ii][jj][4] = gridSerializationColumnNode.getDoubleProperty("fy");
gridVector[ii][jj][5] = gridSerializationColumnNode.getDoubleProperty("fxy");
}
}
}
......@@ -78,28 +78,28 @@ void AmoebaTorsionTorsionForceProxy::serialize(const void* object, Serialization
SerializationNode& grids = node.createChildNode("TorsionTorsionGrids");
for (unsigned int kk = 0; kk < static_cast<unsigned int>(force.getNumTorsionTorsionGrids()); kk++) {
const std::vector< std::vector< std::vector<double> > > grid = force.getTorsionTorsionGrid( kk );
const std::vector< std::vector< std::vector<double> > > grid = force.getTorsionTorsionGrid(kk);
unsigned int gridCount = 0;
unsigned int gridYsize = grid[0].size();
for ( unsigned int ii = 0; ii < grid.size(); ii++) {
for (unsigned int ii = 0; ii < grid.size(); ii++) {
gridCount += grid[ii].size();
}
SerializationNode& gridNode = grids.createChildNode("TorsionTorsionGrid");
for ( unsigned int ii = 0; ii < grid.size(); ii++) {
for (unsigned int ii = 0; ii < grid.size(); ii++) {
SerializationNode& gridSerializationRow = gridNode.createChildNode("RowNode");
gridSerializationRow.setIntProperty("dim", ii );
for ( unsigned int jj = 0; jj < grid[ii].size(); jj++) {
gridSerializationRow.setIntProperty("dim", ii);
for (unsigned int jj = 0; jj < grid[ii].size(); jj++) {
SerializationNode& gridSerializationColumnNode = gridSerializationRow.createChildNode("ColumnNode");
gridSerializationColumnNode.setIntProperty("dim", jj );
gridSerializationColumnNode.setIntProperty("dim", jj);
unsigned int index = 0;
gridSerializationColumnNode.setDoubleProperty("x", grid[ii][jj][index++] );
gridSerializationColumnNode.setDoubleProperty("y", grid[ii][jj][index++] );
gridSerializationColumnNode.setDoubleProperty("f", grid[ii][jj][index++] );
gridSerializationColumnNode.setDoubleProperty("fx", grid[ii][jj][index++] );
gridSerializationColumnNode.setDoubleProperty("fy", grid[ii][jj][index++] );
gridSerializationColumnNode.setDoubleProperty("fxy", grid[ii][jj][index++] );
gridSerializationColumnNode.setDoubleProperty("x", grid[ii][jj][index++]);
gridSerializationColumnNode.setDoubleProperty("y", grid[ii][jj][index++]);
gridSerializationColumnNode.setDoubleProperty("f", grid[ii][jj][index++]);
gridSerializationColumnNode.setDoubleProperty("fx", grid[ii][jj][index++]);
gridSerializationColumnNode.setDoubleProperty("fy", grid[ii][jj][index++]);
gridSerializationColumnNode.setDoubleProperty("fxy", grid[ii][jj][index++]);
}
}
}
......@@ -108,8 +108,8 @@ void AmoebaTorsionTorsionForceProxy::serialize(const void* object, Serialization
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumTorsionTorsions()); ii++) {
int particle1, particle2, particle3, particle4, particle5;
int chiralCheckAtomIndex, gridIndex;
force.getTorsionTorsionParameters(ii, particle1, particle2, particle3, particle4, particle5, chiralCheckAtomIndex, gridIndex );
bonds.createChildNode("TorsionTorsion").setIntProperty("p1", particle1).setIntProperty("p2", particle2).setIntProperty("p3", particle3).setIntProperty("p4", particle4).setIntProperty("p5", particle5).setIntProperty("chiralCheckAtomIndex", chiralCheckAtomIndex).setIntProperty("gridIndex", gridIndex );
force.getTorsionTorsionParameters(ii, particle1, particle2, particle3, particle4, particle5, chiralCheckAtomIndex, gridIndex);
bonds.createChildNode("TorsionTorsion").setIntProperty("p1", particle1).setIntProperty("p2", particle2).setIntProperty("p3", particle3).setIntProperty("p4", particle4).setIntProperty("p5", particle5).setIntProperty("chiralCheckAtomIndex", chiralCheckAtomIndex).setIntProperty("gridIndex", gridIndex);
}
}
......@@ -124,10 +124,10 @@ void* AmoebaTorsionTorsionForceProxy::deserialize(const SerializationNode& node)
const SerializationNode& grids = node.getChildNode("TorsionTorsionGrids");
const std::vector<SerializationNode>& gridList = grids.getChildren();
for( unsigned int ii = 0; ii < gridList.size(); ii++) {
for (unsigned int ii = 0; ii < gridList.size(); ii++) {
std::vector< std::vector< std::vector<double> > > gridVector;
loadGrid( gridList[ii], gridVector );
force->setTorsionTorsionGrid( ii, gridVector );
loadGrid(gridList[ii], gridVector);
force->setTorsionTorsionGrid(ii, gridVector);
}
const SerializationNode& bonds = node.getChildNode("TorsionTorsion");
......
......@@ -56,17 +56,17 @@ void AmoebaVdwForceProxy::serialize(const void* object, SerializationNode& node)
int ivIndex;
double sigma, epsilon, reductionFactor;
force.getParticleParameters( ii, ivIndex, sigma, epsilon, reductionFactor );
force.getParticleParameters(ii, ivIndex, sigma, epsilon, reductionFactor);
SerializationNode& particle = particles.createChildNode("Particle");
particle.setIntProperty("ivIndex", ivIndex).setDoubleProperty("sigma", sigma).setDoubleProperty("epsilon", epsilon).setDoubleProperty("reductionFactor", reductionFactor);
std::vector< int > exclusions;
force.getParticleExclusions( ii, exclusions );
force.getParticleExclusions(ii, exclusions);
SerializationNode& particleExclusions = particle.createChildNode("ParticleExclusions");
for (unsigned int jj = 0; jj < exclusions.size(); jj++) {
particleExclusions.createChildNode( "excl" ).setIntProperty( "index", exclusions[jj] );
particleExclusions.createChildNode("excl").setIntProperty("index", exclusions[jj]);
}
}
}
......@@ -77,9 +77,9 @@ void* AmoebaVdwForceProxy::deserialize(const SerializationNode& node) const {
AmoebaVdwForce* force = new AmoebaVdwForce();
try {
force->setSigmaCombiningRule(node.getStringProperty( "SigmaCombiningRule" ) );
force->setEpsilonCombiningRule(node.getStringProperty( "EpsilonCombiningRule" ) );
force->setCutoff(node.getDoubleProperty( "VdwCutoff" ) );
force->setSigmaCombiningRule(node.getStringProperty("SigmaCombiningRule"));
force->setEpsilonCombiningRule(node.getStringProperty("EpsilonCombiningRule"));
force->setCutoff(node.getDoubleProperty("VdwCutoff"));
force->setNonbondedMethod((AmoebaVdwForce::NonbondedMethod) node.getIntProperty("method"));
const SerializationNode& particles = node.getChildNode("VdwParticles");
......@@ -92,9 +92,9 @@ void* AmoebaVdwForceProxy::deserialize(const SerializationNode& node) const {
const SerializationNode& particleExclusions = particle.getChildNode("ParticleExclusions");
std::vector< int > exclusions;
for (unsigned int jj = 0; jj < particleExclusions.getChildren().size(); jj++) {
exclusions.push_back( particleExclusions.getChildren()[jj].getIntProperty("index") );
exclusions.push_back(particleExclusions.getChildren()[jj].getIntProperty("index"));
}
force->setParticleExclusions( ii, exclusions );
force->setParticleExclusions(ii, exclusions);
}
}
......
......@@ -56,7 +56,7 @@ void AmoebaWcaDispersionForceProxy::serialize(const void* object, SerializationN
SerializationNode& particles = node.createChildNode("WcaDispersionParticles");
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumParticles()); ii++) {
double radius, epsilon;
force.getParticleParameters( ii, radius, epsilon );
force.getParticleParameters(ii, radius, epsilon);
particles.createChildNode("Particle").setDoubleProperty("radius", radius).setDoubleProperty("epsilon", epsilon);
}
......@@ -69,21 +69,21 @@ void* AmoebaWcaDispersionForceProxy::deserialize(const SerializationNode& node)
try {
force->setEpso( node.getDoubleProperty( "Epso" ) );
force->setEpsh( node.getDoubleProperty( "Epsh" ) );
force->setRmino( node.getDoubleProperty( "Rmino" ) );
force->setRminh( node.getDoubleProperty( "Rminh" ) );
force->setEpso( node.getDoubleProperty("Epso"));
force->setEpsh( node.getDoubleProperty("Epsh"));
force->setRmino( node.getDoubleProperty("Rmino"));
force->setRminh( node.getDoubleProperty("Rminh"));
force->setAwater( node.getDoubleProperty( "Awater" ) );
force->setShctd( node.getDoubleProperty( "Shctd" ) );
force->setDispoff( node.getDoubleProperty( "Dispoff" ) );
force->setSlevy( node.getDoubleProperty( "Slevy" ) );
force->setAwater( node.getDoubleProperty("Awater"));
force->setShctd( node.getDoubleProperty("Shctd"));
force->setDispoff(node.getDoubleProperty("Dispoff"));
force->setSlevy( node.getDoubleProperty("Slevy"));
const SerializationNode& particles = node.getChildNode("WcaDispersionParticles");
for (unsigned int ii = 0; ii < particles.getChildren().size(); ii++) {
const SerializationNode& particle = particles.getChildren()[ii];
force->addParticle( particle.getDoubleProperty("radius"), particle.getDoubleProperty("epsilon"));
force->addParticle(particle.getDoubleProperty("radius"), particle.getDoubleProperty("epsilon"));
}
}
......
......@@ -45,10 +45,10 @@ void testSerialization() {
// Create a Force.
AmoebaAngleForce force1;
force1.setAmoebaGlobalAngleCubic( 12.3 );
force1.setAmoebaGlobalAngleQuartic( 98.7 );
force1.setAmoebaGlobalAnglePentic( 91.7 );
force1.setAmoebaGlobalAngleSextic( 93.7 );
force1.setAmoebaGlobalAngleCubic(12.3);
force1.setAmoebaGlobalAngleQuartic(98.7);
force1.setAmoebaGlobalAnglePentic(91.7);
force1.setAmoebaGlobalAngleSextic(93.7);
force1.addAngle(0, 1, 3, 1.0, 2.0);
force1.addAngle(0, 2, 3, 2.0, 2.1);
force1.addAngle(2, 3, 5, 3.0, 2.2);
......
......@@ -45,8 +45,8 @@ void testSerialization() {
// Create a Force.
AmoebaBondForce force1;
force1.setAmoebaGlobalBondCubic( 12.3 );
force1.setAmoebaGlobalBondQuartic( 98.7 );
force1.setAmoebaGlobalBondCubic(12.3);
force1.setAmoebaGlobalBondQuartic(98.7);
force1.addBond(0, 1, 1.0, 2.0);
force1.addBond(0, 2, 2.0, 2.1);
force1.addBond(2, 3, 3.0, 2.2);
......
......@@ -45,12 +45,12 @@ void testSerialization() {
// Create a Force.
AmoebaGeneralizedKirkwoodForce force1;
force1.setSolventDielectric( 80.0 );
force1.setSoluteDielectric( 1.0 );
//force1.setDielectricOffset( 0.09 );
force1.setProbeRadius( 1.40 );
force1.setSurfaceAreaFactor( 0.888 );
force1.setIncludeCavityTerm( 1 );
force1.setSolventDielectric( 80.0);
force1.setSoluteDielectric( 1.0);
//force1.setDielectricOffset( 0.09);
force1.setProbeRadius( 1.40);
force1.setSurfaceAreaFactor( 0.888);
force1.setIncludeCavityTerm( 1);
force1.addParticle(1.0, 2.0, 0.9);
force1.addParticle(-1.1,2.1, 0.8);
......@@ -77,8 +77,8 @@ void testSerialization() {
double radius1, charge1, scaleFactor1;
double radius2, charge2, scaleFactor2;
force1.getParticleParameters( ii, charge1, radius1, scaleFactor1 );
force2.getParticleParameters( ii, charge2, radius2, scaleFactor2 );
force1.getParticleParameters(ii, charge1, radius1, scaleFactor1);
force2.getParticleParameters(ii, charge2, radius2, scaleFactor2);
ASSERT_EQUAL(charge1, charge2);
ASSERT_EQUAL(radius1, radius2);
......
......@@ -46,10 +46,10 @@ void testSerialization() {
AmoebaInPlaneAngleForce force1;
force1.setAmoebaGlobalInPlaneAngleCubic( 12.3 );
force1.setAmoebaGlobalInPlaneAngleQuartic( 98.7 );
force1.setAmoebaGlobalInPlaneAnglePentic( 91.7 );
force1.setAmoebaGlobalInPlaneAngleSextic( 93.7 );
force1.setAmoebaGlobalInPlaneAngleCubic(12.3);
force1.setAmoebaGlobalInPlaneAngleQuartic(98.7);
force1.setAmoebaGlobalInPlaneAnglePentic(91.7);
force1.setAmoebaGlobalInPlaneAngleSextic(93.7);
force1.addAngle(0, 1, 3, 4, 1.0, 2.0);
force1.addAngle(0, 2, 3, 5, 2.0, 2.1);
......@@ -71,7 +71,7 @@ void testSerialization() {
ASSERT_EQUAL(force1.getAmoebaGlobalInPlaneAngleSextic(), force2.getAmoebaGlobalInPlaneAngleSextic());
ASSERT_EQUAL(force1.getNumAngles(), force2.getNumAngles());
for ( unsigned int ii = 0; ii < static_cast<unsigned int>(force1.getNumAngles()); ii++) {
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force1.getNumAngles()); ii++) {
int a1, a2, a3, a4, b1, b2, b3, b4;
double da, db, ka, kb;
force1.getAngleParameters(ii, a1, a2, a3, a4, da, ka);
......
......@@ -42,56 +42,56 @@ using namespace std;
extern "C" void registerAmoebaSerializationProxies();
static void getCovalentTypes( std::vector<std::string>& covalentTypes ){
static void getCovalentTypes(std::vector<std::string>& covalentTypes) {
covalentTypes.push_back( "Covalent12" );
covalentTypes.push_back( "Covalent13" );
covalentTypes.push_back( "Covalent14" );
covalentTypes.push_back( "Covalent15" );
covalentTypes.push_back("Covalent12");
covalentTypes.push_back("Covalent13");
covalentTypes.push_back("Covalent14");
covalentTypes.push_back("Covalent15");
covalentTypes.push_back( "PolarizationCovalent11" );
covalentTypes.push_back( "PolarizationCovalent12" );
covalentTypes.push_back( "PolarizationCovalent13" );
covalentTypes.push_back( "PolarizationCovalent14" );
covalentTypes.push_back("PolarizationCovalent11");
covalentTypes.push_back("PolarizationCovalent12");
covalentTypes.push_back("PolarizationCovalent13");
covalentTypes.push_back("PolarizationCovalent14");
}
void testSerialization() {
// Create a Force.
AmoebaMultipoleForce force1;
force1.setNonbondedMethod( AmoebaMultipoleForce::NoCutoff );
force1.setCutoffDistance( 0.9 );
force1.setAEwald( 0.544 );
//force1.setPmeBSplineOrder( 4 );
force1.setNonbondedMethod(AmoebaMultipoleForce::NoCutoff);
force1.setCutoffDistance(0.9);
force1.setAEwald(0.544);
//force1.setPmeBSplineOrder(4);
std::vector<int> gridDimension;
gridDimension.push_back( 64 );
gridDimension.push_back( 63 );
gridDimension.push_back( 61 );
force1.setPmeGridDimensions( gridDimension );
//force1.setMutualInducedIterationMethod( AmoebaMultipoleForce::SOR );
force1.setMutualInducedMaxIterations( 200 );
force1.setMutualInducedTargetEpsilon( 1.0e-05 );
//force1.setElectricConstant( 138.93 );
force1.setEwaldErrorTolerance( 1.0e-05 );
gridDimension.push_back(64);
gridDimension.push_back(63);
gridDimension.push_back(61);
force1.setPmeGridDimensions(gridDimension);
//force1.setMutualInducedIterationMethod(AmoebaMultipoleForce::SOR);
force1.setMutualInducedMaxIterations(200);
force1.setMutualInducedTargetEpsilon(1.0e-05);
//force1.setElectricConstant(138.93);
force1.setEwaldErrorTolerance(1.0e-05);
std::vector<std::string> covalentTypes;
getCovalentTypes( covalentTypes );
getCovalentTypes(covalentTypes);
for( unsigned int ii = 0; ii < 3; ii++ ){
for (unsigned int ii = 0; ii < 3; ii++) {
std::vector<double> molecularDipole;
std::vector<double> molecularQuadrupole;
molecularDipole.push_back( 0.1 ); molecularDipole.push_back( rand() ); molecularDipole.push_back( rand() );
for( unsigned int jj = 0; jj < 9; jj++ ){
molecularQuadrupole.push_back( static_cast<double>(rand()) );
molecularDipole.push_back(0.1); molecularDipole.push_back(rand()); molecularDipole.push_back(rand());
for (unsigned int jj = 0; jj < 9; jj++) {
molecularQuadrupole.push_back(static_cast<double>(rand()));
}
force1.addMultipole( static_cast<double>(ii+1), molecularDipole, molecularQuadrupole, AmoebaMultipoleForce::Bisector,
ii+1, ii+2, ii+3, static_cast<double>(rand()), static_cast<double>(rand()), static_cast<double>(rand()) );
force1.addMultipole(static_cast<double>(ii+1), molecularDipole, molecularQuadrupole, AmoebaMultipoleForce::Bisector,
ii+1, ii+2, ii+3, static_cast<double>(rand()), static_cast<double>(rand()), static_cast<double>(rand()));
for( unsigned int jj = 0; jj < covalentTypes.size(); jj++ ){
for (unsigned int jj = 0; jj < covalentTypes.size(); jj++) {
std::vector< int > covalentMap;
covalentMap.push_back( ii*jj ); covalentMap.push_back( rand() ); covalentMap.push_back( rand() );
force1.setCovalentMap( ii, static_cast<AmoebaMultipoleForce::CovalentType>(jj), covalentMap);
covalentMap.push_back(ii*jj); covalentMap.push_back(rand()); covalentMap.push_back(rand());
force1.setCovalentMap(ii, static_cast<AmoebaMultipoleForce::CovalentType>(jj), covalentMap);
}
}
......@@ -118,10 +118,10 @@ void testSerialization() {
std::vector<int> gridDimension1;
std::vector<int> gridDimension2;
force1.getPmeGridDimensions( gridDimension1 );
force2.getPmeGridDimensions( gridDimension2 );
force1.getPmeGridDimensions(gridDimension1);
force2.getPmeGridDimensions(gridDimension2);
ASSERT_EQUAL(gridDimension1.size(), gridDimension2.size());
for( unsigned int jj = 0; jj < gridDimension1.size(); jj++ ){
for (unsigned int jj = 0; jj < gridDimension1.size(); jj++) {
ASSERT_EQUAL(gridDimension1[jj], gridDimension2[jj]);
}
......@@ -140,11 +140,11 @@ void testSerialization() {
std::vector<double> molecularDipole2;
std::vector<double> molecularQuadrupole2;
force1.getMultipoleParameters( ii, charge1, molecularDipole1, molecularQuadrupole1, axisType1, multipoleAtomZ1, multipoleAtomX1, multipoleAtomY1,
thole1, dampingFactor1, polarity1 );
force1.getMultipoleParameters(ii, charge1, molecularDipole1, molecularQuadrupole1, axisType1, multipoleAtomZ1, multipoleAtomX1, multipoleAtomY1,
thole1, dampingFactor1, polarity1);
force2.getMultipoleParameters( ii, charge2, molecularDipole2, molecularQuadrupole2, axisType2, multipoleAtomZ2, multipoleAtomX2, multipoleAtomY2,
thole2, dampingFactor2, polarity2 );
force2.getMultipoleParameters(ii, charge2, molecularDipole2, molecularQuadrupole2, axisType2, multipoleAtomZ2, multipoleAtomX2, multipoleAtomY2,
thole2, dampingFactor2, polarity2);
ASSERT_EQUAL(charge1, charge2);
ASSERT_EQUAL(axisType1, axisType2);
......@@ -155,25 +155,25 @@ void testSerialization() {
ASSERT_EQUAL(dampingFactor1, dampingFactor2);
ASSERT_EQUAL(polarity1, polarity2);
ASSERT_EQUAL(molecularDipole1.size(), molecularDipole2.size() );
ASSERT_EQUAL(molecularDipole1.size(), 3 );
ASSERT_EQUAL(molecularDipole1.size(), molecularDipole2.size());
ASSERT_EQUAL(molecularDipole1.size(), 3);
for (unsigned int jj = 0; jj < molecularDipole1.size(); jj++) {
ASSERT_EQUAL(molecularDipole1[jj], molecularDipole2[jj] );
ASSERT_EQUAL(molecularDipole1[jj], molecularDipole2[jj]);
}
ASSERT_EQUAL(molecularQuadrupole1.size(), molecularQuadrupole2.size() );
ASSERT_EQUAL(molecularQuadrupole1.size(), 9 );
ASSERT_EQUAL(molecularQuadrupole1.size(), molecularQuadrupole2.size());
ASSERT_EQUAL(molecularQuadrupole1.size(), 9);
for (unsigned int jj = 0; jj < molecularQuadrupole1.size(); jj++) {
ASSERT_EQUAL(molecularQuadrupole1[jj], molecularQuadrupole2[jj] );
ASSERT_EQUAL(molecularQuadrupole1[jj], molecularQuadrupole2[jj]);
}
for (unsigned int jj = 0; jj < covalentTypes.size(); jj++) {
std::vector<int> covalentMap1;
std::vector<int> covalentMap2;
force1.getCovalentMap( ii, static_cast<AmoebaMultipoleForce::CovalentType>(jj), covalentMap1 );
force2.getCovalentMap( ii, static_cast<AmoebaMultipoleForce::CovalentType>(jj), covalentMap2 );
ASSERT_EQUAL(covalentMap1.size(), covalentMap2.size() );
force1.getCovalentMap(ii, static_cast<AmoebaMultipoleForce::CovalentType>(jj), covalentMap1);
force2.getCovalentMap(ii, static_cast<AmoebaMultipoleForce::CovalentType>(jj), covalentMap2);
ASSERT_EQUAL(covalentMap1.size(), covalentMap2.size());
for (unsigned int kk = 0; kk < covalentMap1.size(); kk++) {
ASSERT_EQUAL(covalentMap1[kk], covalentMap2[kk] );
ASSERT_EQUAL(covalentMap1[kk], covalentMap2[kk]);
}
}
}
......
......@@ -46,10 +46,10 @@ void testSerialization() {
AmoebaOutOfPlaneBendForce force1;
force1.setAmoebaGlobalOutOfPlaneBendCubic( 12.3 );
force1.setAmoebaGlobalOutOfPlaneBendQuartic( 98.7 );
force1.setAmoebaGlobalOutOfPlaneBendPentic( 91.7 );
force1.setAmoebaGlobalOutOfPlaneBendSextic( 93.7 );
force1.setAmoebaGlobalOutOfPlaneBendCubic(12.3);
force1.setAmoebaGlobalOutOfPlaneBendQuartic(98.7);
force1.setAmoebaGlobalOutOfPlaneBendPentic(91.7);
force1.setAmoebaGlobalOutOfPlaneBendSextic(93.7);
force1.addOutOfPlaneBend(0, 1, 3, 4, 2.0);
force1.addOutOfPlaneBend(0, 2, 3, 5, 2.1);
......
......@@ -42,27 +42,27 @@ using namespace std;
extern "C" void registerAmoebaSerializationProxies();
static void loadTorsionTorsionGrid( std::vector< std::vector< std::vector<double> > >& gridVector ){
static void loadTorsionTorsionGrid(std::vector< std::vector< std::vector<double> > >& gridVector) {
static const int gridSize = 25;
gridVector.resize( gridSize );
for( unsigned int ii = 0; ii < gridSize; ii++ ){
gridVector[ii].resize( gridSize );
for( unsigned int jj = 0; jj < gridSize; jj++ ){
gridVector[ii][jj].resize( 6 );
for( unsigned int kk = 0; kk < 6; kk++ ){
gridVector.resize(gridSize);
for (unsigned int ii = 0; ii < gridSize; ii++) {
gridVector[ii].resize(gridSize);
for (unsigned int jj = 0; jj < gridSize; jj++) {
gridVector[ii][jj].resize(6);
for (unsigned int kk = 0; kk < 6; kk++) {
gridVector[ii][jj][0] = -180.0 + 15.0*static_cast<double>(ii);
gridVector[ii][jj][1] = -180.0 + 15.0*static_cast<double>(jj);
gridVector[ii][jj][2] = static_cast<double>( rand());
gridVector[ii][jj][3] = static_cast<double>( rand());
gridVector[ii][jj][4] = static_cast<double>( rand());
gridVector[ii][jj][5] = static_cast<double>( rand());
gridVector[ii][jj][2] = static_cast<double>(rand());
gridVector[ii][jj][3] = static_cast<double>(rand());
gridVector[ii][jj][4] = static_cast<double>(rand());
gridVector[ii][jj][5] = static_cast<double>(rand());
}
}
}
}
static void compareGrids( const std::vector< std::vector< std::vector<double> > >& grid1, const std::vector< std::vector< std::vector<double> > >& grid2 ) {
static void compareGrids(const std::vector< std::vector< std::vector<double> > >& grid1, const std::vector< std::vector< std::vector<double> > >& grid2) {
ASSERT_EQUAL(grid1.size(), grid2.size());
for (unsigned int ii = 0; ii < grid1.size(); ii++) {
......@@ -81,13 +81,13 @@ void testSerialization() {
AmoebaTorsionTorsionForce force1;
for( unsigned int ii = 0; ii < 5; ii++ ){
for (unsigned int ii = 0; ii < 5; ii++) {
std::vector< std::vector< std::vector<double> > > gridVector;
loadTorsionTorsionGrid( gridVector );
force1.setTorsionTorsionGrid( ii, gridVector );
loadTorsionTorsionGrid(gridVector);
force1.setTorsionTorsionGrid(ii, gridVector);
}
for( unsigned int ii = 0; ii < 5; ii++ ){
force1.addTorsionTorsion( ii, ii+1,ii+3, ii+4, ii+5, ( (ii % 2 ) ? 1 : 0), (ii % 4) );
for (unsigned int ii = 0; ii < 5; ii++) {
force1.addTorsionTorsion(ii, ii+1,ii+3, ii+4, ii+5, ((ii % 2) ? 1 : 0), (ii % 4));
}
// Serialize and then deserialize it.
......@@ -104,8 +104,8 @@ void testSerialization() {
int a1, a2, a3, a4, a5, aChiral, aGridIndex, b1, b2, b3, b4, b5, bChiral, bGridIndex;
force1.getTorsionTorsionParameters( ii, a1, a2, a3, a4, a5, aChiral, aGridIndex);
force2.getTorsionTorsionParameters( ii, b1, b2, b3, b4, b5, bChiral, bGridIndex);
force1.getTorsionTorsionParameters(ii, a1, a2, a3, a4, a5, aChiral, aGridIndex);
force2.getTorsionTorsionParameters(ii, b1, b2, b3, b4, b5, bChiral, bGridIndex);
ASSERT_EQUAL(a1, b1);
ASSERT_EQUAL(a2, b2);
......@@ -113,14 +113,14 @@ void testSerialization() {
ASSERT_EQUAL(a4, b4);
ASSERT_EQUAL(a5, b5);
ASSERT_EQUAL(aChiral, bChiral);
ASSERT_EQUAL(aGridIndex, bGridIndex );
ASSERT_EQUAL(aGridIndex, bGridIndex);
}
ASSERT_EQUAL(force1.getNumTorsionTorsionGrids(), force2.getNumTorsionTorsionGrids());
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force1.getNumTorsionTorsionGrids()); ii++) {
const std::vector< std::vector< std::vector<double> > >& grid1 = force1.getTorsionTorsionGrid( ii );
const std::vector< std::vector< std::vector<double> > >& grid2 = force2.getTorsionTorsionGrid( ii );
compareGrids(grid1, grid2 );
const std::vector< std::vector< std::vector<double> > >& grid1 = force1.getTorsionTorsionGrid(ii);
const std::vector< std::vector< std::vector<double> > >& grid2 = force2.getTorsionTorsionGrid(ii);
compareGrids(grid1, grid2);
}
}
......
......@@ -45,20 +45,20 @@ void testSerialization() {
// Create a Force.
AmoebaVdwForce force1;
force1.setSigmaCombiningRule( "GEOMETRIC" );
force1.setEpsilonCombiningRule( "GEOMETRIC" );
force1.setCutoff( 0.9 );
force1.setSigmaCombiningRule("GEOMETRIC");
force1.setEpsilonCombiningRule("GEOMETRIC");
force1.setCutoff(0.9);
force1.setNonbondedMethod(AmoebaVdwForce::CutoffPeriodic);
force1.addParticle(0, 1.0, 2.0, 0.9);
force1.addParticle(1, 1.1, 2.1, 0.9);
force1.addParticle(2, 1.3, 4.1, 0.9);
for( unsigned int ii = 0; ii < 3; ii++ ){
for (unsigned int ii = 0; ii < 3; ii++) {
std::vector< int > exclusions;
exclusions.push_back( ii );
exclusions.push_back( ii + 1 );
exclusions.push_back( ii + 10 );
force1.setParticleExclusions( ii, exclusions );
exclusions.push_back(ii);
exclusions.push_back(ii + 1);
exclusions.push_back(ii + 10);
force1.setParticleExclusions(ii, exclusions);
}
// Serialize and then deserialize it.
......@@ -85,10 +85,10 @@ void testSerialization() {
double sigma1, epsilon1, reductionFactor1;
double sigma2, epsilon2, reductionFactor2;
force1.getParticleParameters( ii, ivIndex1, sigma1, epsilon1, reductionFactor1 );
force2.getParticleParameters( ii, ivIndex2, sigma2, epsilon2, reductionFactor2 );
force1.getParticleParameters(ii, ivIndex1, sigma1, epsilon1, reductionFactor1);
force2.getParticleParameters(ii, ivIndex2, sigma2, epsilon2, reductionFactor2);
ASSERT_EQUAL(ivIndex1, ivIndex2 );
ASSERT_EQUAL(ivIndex1, ivIndex2);
ASSERT_EQUAL(sigma1, sigma2);
ASSERT_EQUAL(epsilon1, epsilon2);
ASSERT_EQUAL(reductionFactor1, reductionFactor2);
......@@ -98,14 +98,14 @@ void testSerialization() {
std::vector< int > exclusions1;
std::vector< int > exclusions2;
force1.getParticleExclusions( ii, exclusions1 );
force2.getParticleExclusions( ii, exclusions2 );
force1.getParticleExclusions(ii, exclusions1);
force2.getParticleExclusions(ii, exclusions2);
ASSERT_EQUAL(exclusions1.size(), exclusions2.size());
for (unsigned int jj = 0; jj < exclusions1.size(); jj++) {
int hit = 0;
for (unsigned int kk = 0; kk < exclusions2.size(); kk++) {
if( exclusions2[jj] == exclusions1[kk] )hit++;
if (exclusions2[jj] == exclusions1[kk])hit++;
}
ASSERT_EQUAL(hit, 1);
}
......
......@@ -45,14 +45,14 @@ void testSerialization() {
// Create a Force.
AmoebaWcaDispersionForce force1;
force1.setEpso( 1.0 );
force1.setEpsh( 1.1 );
force1.setRmino( 1.2 );
force1.setRminh( 1.3 );
force1.setAwater( 1.4 );
force1.setShctd( 1.5 );
force1.setDispoff( 1.6 );
force1.setSlevy( 1.7 );
force1.setEpso( 1.0);
force1.setEpsh( 1.1);
force1.setRmino( 1.2);
force1.setRminh( 1.3);
force1.setAwater( 1.4);
force1.setShctd( 1.5);
force1.setDispoff(1.6);
force1.setSlevy( 1.7);
force1.addParticle(1.0, 2.0);
force1.addParticle(1.1, 2.1);
......@@ -83,8 +83,8 @@ void testSerialization() {
double radius1, epsilon1;
double radius2, epsilon2;
force1.getParticleParameters( ii, radius1, epsilon1 );
force2.getParticleParameters( ii, radius2, epsilon2 );
force1.getParticleParameters(ii, radius1, epsilon1);
force2.getParticleParameters(ii, radius2, epsilon2);
ASSERT_EQUAL(radius1, radius2);
ASSERT_EQUAL(epsilon1, epsilon2);
......
......@@ -327,7 +327,7 @@ extern "C" {
/* OpenMM_3D_DoubleArray */
OPENMM_EXPORT_AMOEBA OpenMM_3D_DoubleArray* OpenMM_3D_DoubleArray_create(int size1, int size2, int size3);
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_set(OpenMM_3D_DoubleArray* array, int index1, int index2, OpenMM_DoubleArray* values);
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_destroy( OpenMM_3D_DoubleArray* array);""", file=self.out)
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_destroy(OpenMM_3D_DoubleArray* array);""", file=self.out)
self.writeClasses()
......@@ -586,29 +586,29 @@ OPENMM_EXPORT_AMOEBA int OpenMM_2D_IntArray_getSize(const OpenMM_2D_IntArray* ar
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_resize(OpenMM_2D_IntArray* array, int size) {
reinterpret_cast<vector<vector<int> >*>(array)->resize(size);
}
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_append(OpenMM_2D_IntArray* array, int index1, int value ) {
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_append(OpenMM_2D_IntArray* array, int index1, int value) {
vector<vector<int> >* array2DInt = reinterpret_cast<vector<vector<int> >*>(array);
if( array2DInt->size() <= index1 ){
array2DInt->resize( index1+1 );
if (array2DInt->size() <= index1) {
array2DInt->resize(index1+1);
}
(*array2DInt)[index1].push_back( value );
(*array2DInt)[index1].push_back(value);
}
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_set(OpenMM_2D_IntArray* array, int index1, int index2, int value) {
vector<vector<int> >* array2DInt = reinterpret_cast<vector<vector<int> >*>(array);
if( array2DInt->size() <= index1 ){
array2DInt->resize( index1+1 );
if (array2DInt->size() <= index1) {
array2DInt->resize(index1+1);
}
if( array2DInt[index1].size() <= index2 ){
array2DInt[index1].resize( index2+1 );
if (array2DInt[index1].size() <= index2) {
array2DInt[index1].resize(index2+1);
}
(*array2DInt)[index1][index2] = value;
}
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_get(const OpenMM_2D_IntArray* array, int index1, int index2, int* value) {
const vector<vector<int> >* array2DInt = reinterpret_cast<const vector<vector<int> >*>(array);
if ( array2DInt->size() <= index1 )
if (array2DInt->size() <= index1)
throw OpenMMException("OpenMM_2D_IntArray_get: first index out of range.");
if ( (*array2DInt)[index1].size() <= index2 )
if ((*array2DInt)[index1].size() <= index2)
throw OpenMMException("OpenMM_2D_IntArray_get: second index out of range.");
*value = (*array2DInt)[index1][index2];
}
......@@ -618,9 +618,9 @@ OPENMM_EXPORT_AMOEBA OpenMM_3D_DoubleArray* OpenMM_3D_DoubleArray_create(int siz
int ii, jj;
std::vector< std::vector< std::vector<double> > >* v3D_Array = new std::vector<std::vector<std::vector<double> > >(size1);
for( ii = 0; ii < size1; ii++ ){
for (ii = 0; ii < size1; ii++) {
(*v3D_Array)[ii].resize(size2);
for( jj = 0; jj < size2; jj++ ){
for (jj = 0; jj < size2; jj++) {
(*v3D_Array)[ii][jj].resize(size3);
}
}
......@@ -631,12 +631,12 @@ OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_set(OpenMM_3D_DoubleArray* array
unsigned int ii;
std::vector< std::vector< std::vector<double> > >* v3D_Array = reinterpret_cast<std::vector<std::vector<std::vector<double> > >*>(array);
std::vector<double> * value_array = reinterpret_cast<std::vector<double> *>(values);
for( ii = 0; ii < (*value_array).size(); ii++ ){
for (ii = 0; ii < (*value_array).size(); ii++) {
(*v3D_Array)[index1][index2][ii] = (*value_array)[ii];
}
}
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_destroy( OpenMM_3D_DoubleArray* array) {
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_destroy(OpenMM_3D_DoubleArray* array) {
delete reinterpret_cast<std::vector<std::vector<std::vector<double> > >*>(array);
}""", file=self.out)
......
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