Commit 5610057f authored by Peter Eastman's avatar Peter Eastman
Browse files

The various addX() methods return the index of the thing they just added

parent 077241d4
...@@ -70,8 +70,9 @@ public: ...@@ -70,8 +70,9 @@ public:
* @param charge the charge of the particle, measured in units of the proton charge * @param charge the charge of the particle, measured in units of the proton charge
* @param radius the GBSA radius of the particle, measured in nm * @param radius the GBSA radius of the particle, measured in nm
* @param scalingFactor the OBC scaling factor for the particle * @param scalingFactor the OBC scaling factor for the particle
* @return the index of the particle that was added
*/ */
void addParticle(double charge, double radius, double scalingFactor); int addParticle(double charge, double radius, double scalingFactor);
/** /**
* Get the force field parameters for a particle. * Get the force field parameters for a particle.
* *
......
...@@ -70,8 +70,9 @@ public: ...@@ -70,8 +70,9 @@ public:
* @param charge the charge of the particle, measured in units of the proton charge * @param charge the charge of the particle, measured in units of the proton charge
* @param radius the GB/VI radius of the particle, measured in nm * @param radius the GB/VI radius of the particle, measured in nm
* @param gamma the gamma parameter * @param gamma the gamma parameter
* @return the index of the particle that was added
*/ */
void addParticle(double charge, double radius, double gamma); int addParticle(double charge, double radius, double gamma);
/** /**
* Get the force field parameters for a particle. * Get the force field parameters for a particle.
* *
......
...@@ -66,8 +66,9 @@ public: ...@@ -66,8 +66,9 @@ public:
* @param particle3 the index of the third particle forming the angle * @param particle3 the index of the third particle forming the angle
* @param angle the equilibrium angle, measured in radians * @param angle the equilibrium angle, measured in radians
* @param k the harmonic force constant for the angle * @param k the harmonic force constant for the angle
* @return the index of the angle that was added
*/ */
void addAngle(int particle1, int particle2, int particle3, double angle, double k); int addAngle(int particle1, int particle2, int particle3, double angle, double k);
/** /**
* Get the force field parameters for an angle term. * Get the force field parameters for an angle term.
* *
......
...@@ -65,8 +65,9 @@ public: ...@@ -65,8 +65,9 @@ public:
* @param particle2 the index of the second particle connected by the bond * @param particle2 the index of the second particle connected by the bond
* @param length the equilibrium length of the bond, measured in nm * @param length the equilibrium length of the bond, measured in nm
* @param k the harmonic force constant for the bond * @param k the harmonic force constant for the bond
* @return the index of the bond that was added
*/ */
void addBond(int particle1, int particle2, double length, double k); int addBond(int particle1, int particle2, double length, double k);
/** /**
* Get the force field parameters for a bond term. * Get the force field parameters for a bond term.
* *
......
...@@ -161,8 +161,9 @@ public: ...@@ -161,8 +161,9 @@ public:
* @param charge the charge of the particle, measured in units of the proton charge * @param charge the charge of the particle, measured in units of the proton charge
* @param sigma the sigma parameter of the Lennard-Jones potential (corresponding to the van der Waals radius of the particle), measured in nm * @param sigma the sigma parameter of the Lennard-Jones potential (corresponding to the van der Waals radius of the particle), measured in nm
* @param epsilon the epsilon parameter of the Lennard-Jones potential (corresponding to the well depth of the van der Waals interaction), measured in kJ/mol * @param epsilon the epsilon parameter of the Lennard-Jones potential (corresponding to the well depth of the van der Waals interaction), measured in kJ/mol
* @return the index of the particle that was added
*/ */
void addParticle(double charge, double sigma, double epsilon); int addParticle(double charge, double sigma, double epsilon);
/** /**
* Get the nonbonded force parameters for a particle. * Get the nonbonded force parameters for a particle.
* *
...@@ -195,8 +196,9 @@ public: ...@@ -195,8 +196,9 @@ public:
* @param chargeProd the scaled product of the atomic charges (i.e. the strength of the Coulomb interaction), measured in units of the proton charge squared * @param chargeProd the scaled product of the atomic charges (i.e. the strength of the Coulomb interaction), measured in units of the proton charge squared
* @param sigma the sigma parameter of the Lennard-Jones potential (corresponding to the van der Waals radius of the particle), measured in nm * @param sigma the sigma parameter of the Lennard-Jones potential (corresponding to the van der Waals radius of the particle), measured in nm
* @param epsilon the epsilon parameter of the Lennard-Jones potential (corresponding to the well depth of the van der Waals interaction), measured in kJ/mol * @param epsilon the epsilon parameter of the Lennard-Jones potential (corresponding to the well depth of the van der Waals interaction), measured in kJ/mol
* @return the index of the exception that was added
*/ */
void addException(int particle1, int particle2, double chargeProd, double sigma, double epsilon); int addException(int particle1, int particle2, double chargeProd, double sigma, double epsilon);
/** /**
* Get the force field parameters for an interaction that should be calculated differently from others. * Get the force field parameters for an interaction that should be calculated differently from others.
* *
......
...@@ -68,8 +68,9 @@ public: ...@@ -68,8 +68,9 @@ public:
* @param periodicity the periodicity of the torsion * @param periodicity the periodicity of the torsion
* @param phase the phase offset of the torsion, measured in radians * @param phase the phase offset of the torsion, measured in radians
* @param k the force constant for the torsion * @param k the force constant for the torsion
* @return the index of the torsion that was added
*/ */
void addTorsion(int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k); int addTorsion(int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k);
/** /**
* Get the force field parameters for a periodic torsion term. * Get the force field parameters for a periodic torsion term.
* *
......
...@@ -71,8 +71,9 @@ public: ...@@ -71,8 +71,9 @@ public:
* @param c3 the coefficient of the 3rd order term * @param c3 the coefficient of the 3rd order term
* @param c4 the coefficient of the 4th order term * @param c4 the coefficient of the 4th order term
* @param c5 the coefficient of the 5th order term * @param c5 the coefficient of the 5th order term
* @return the index of the torsion that was added
*/ */
void addTorsion(int particle1, int particle2, int particle3, int particle4, double c0, double c1, double c2, double c3, double c4, double c5); int addTorsion(int particle1, int particle2, int particle3, int particle4, double c0, double c1, double c2, double c3, double c4, double c5);
/** /**
* Get the force field parameters for a Ryckaert-Bellemans torsion term. * Get the force field parameters for a Ryckaert-Bellemans torsion term.
* *
......
...@@ -72,9 +72,11 @@ public: ...@@ -72,9 +72,11 @@ public:
* Add a particle to the System. * Add a particle to the System.
* *
* @param mass the mass of the particle (in atomic mass units) * @param mass the mass of the particle (in atomic mass units)
* @return the index of the particle that was added
*/ */
void addParticle(double mass) { int addParticle(double mass) {
masses.push_back(mass); masses.push_back(mass);
return masses.size()-1;
} }
/** /**
* Get the mass (in atomic mass units) of a particle. * Get the mass (in atomic mass units) of a particle.
...@@ -105,8 +107,9 @@ public: ...@@ -105,8 +107,9 @@ public:
* @param particle1 the index of the first particle involved in the constraint * @param particle1 the index of the first particle involved in the constraint
* @param particle2 the index of the second particle involved in the constraint * @param particle2 the index of the second particle involved in the constraint
* @param distance the required distance between the two particles, measured in nm * @param distance the required distance between the two particles, measured in nm
* @return the index of the constraint that was added
*/ */
void addConstraint(int particle1, int particle2, double distance); int addConstraint(int particle1, int particle2, double distance);
/** /**
* Get the parameters defining a distance constraint. * Get the parameters defining a distance constraint.
* *
......
...@@ -39,8 +39,9 @@ using namespace OpenMM; ...@@ -39,8 +39,9 @@ using namespace OpenMM;
GBSAOBCForce::GBSAOBCForce() : solventDielectric(78.3), soluteDielectric(1.0) { GBSAOBCForce::GBSAOBCForce() : solventDielectric(78.3), soluteDielectric(1.0) {
} }
void GBSAOBCForce::addParticle(double charge, double radius, double scalingFactor) { int GBSAOBCForce::addParticle(double charge, double radius, double scalingFactor) {
particles.push_back(ParticleInfo(charge, radius, scalingFactor)); particles.push_back(ParticleInfo(charge, radius, scalingFactor));
return particles.size()-1;
} }
void GBSAOBCForce::getParticleParameters(int index, double& charge, double& radius, double& scalingFactor) const { void GBSAOBCForce::getParticleParameters(int index, double& charge, double& radius, double& scalingFactor) const {
......
...@@ -39,8 +39,9 @@ using namespace OpenMM; ...@@ -39,8 +39,9 @@ using namespace OpenMM;
GBVIForce::GBVIForce() : solventDielectric(78.3), soluteDielectric(1.0) { GBVIForce::GBVIForce() : solventDielectric(78.3), soluteDielectric(1.0) {
} }
void GBVIForce::addParticle(double charge, double radius, double gamma) { int GBVIForce::addParticle(double charge, double radius, double gamma) {
particles.push_back(ParticleInfo(charge, radius, gamma)); particles.push_back(ParticleInfo(charge, radius, gamma));
return particles.size()-1;
} }
void GBVIForce::getParticleParameters(int index, double& charge, double& radius, double& gamma) const { void GBVIForce::getParticleParameters(int index, double& charge, double& radius, double& gamma) const {
......
...@@ -39,8 +39,9 @@ using namespace OpenMM; ...@@ -39,8 +39,9 @@ using namespace OpenMM;
HarmonicAngleForce::HarmonicAngleForce() { HarmonicAngleForce::HarmonicAngleForce() {
} }
void HarmonicAngleForce::addAngle(int particle1, int particle2, int particle3, double angle, double k) { int HarmonicAngleForce::addAngle(int particle1, int particle2, int particle3, double angle, double k) {
angles.push_back(AngleInfo(particle1, particle2, particle3, angle, k)); angles.push_back(AngleInfo(particle1, particle2, particle3, angle, k));
return angles.size()-1;
} }
void HarmonicAngleForce::getAngleParameters(int index, int& particle1, int& particle2, int& particle3, double& angle, double& k) const { void HarmonicAngleForce::getAngleParameters(int index, int& particle1, int& particle2, int& particle3, double& angle, double& k) const {
......
...@@ -39,8 +39,9 @@ using namespace OpenMM; ...@@ -39,8 +39,9 @@ using namespace OpenMM;
HarmonicBondForce::HarmonicBondForce() { HarmonicBondForce::HarmonicBondForce() {
} }
void HarmonicBondForce::addBond(int particle1, int particle2, double length, double k) { int HarmonicBondForce::addBond(int particle1, int particle2, double length, double k) {
bonds.push_back(BondInfo(particle1, particle2, length, k)); bonds.push_back(BondInfo(particle1, particle2, length, k));
return bonds.size()-1;
} }
void HarmonicBondForce::getBondParameters(int index, int& particle1, int& particle2, double& length, double& k) const { void HarmonicBondForce::getBondParameters(int index, int& particle1, int& particle2, double& length, double& k) const {
......
...@@ -81,8 +81,9 @@ void NonbondedForce::setPeriodicBoxVectors(Vec3 a, Vec3 b, Vec3 c) { ...@@ -81,8 +81,9 @@ void NonbondedForce::setPeriodicBoxVectors(Vec3 a, Vec3 b, Vec3 c) {
periodicBoxVectors[2] = c; periodicBoxVectors[2] = c;
} }
void NonbondedForce::addParticle(double charge, double sigma, double epsilon) { int NonbondedForce::addParticle(double charge, double sigma, double epsilon) {
particles.push_back(ParticleInfo(charge, sigma, epsilon)); particles.push_back(ParticleInfo(charge, sigma, epsilon));
return particles.size()-1;
} }
void NonbondedForce::getParticleParameters(int index, double& charge, double& sigma, double& epsilon) const { void NonbondedForce::getParticleParameters(int index, double& charge, double& sigma, double& epsilon) const {
...@@ -97,8 +98,9 @@ void NonbondedForce::setParticleParameters(int index, double charge, double sigm ...@@ -97,8 +98,9 @@ void NonbondedForce::setParticleParameters(int index, double charge, double sigm
particles[index].epsilon = epsilon; particles[index].epsilon = epsilon;
} }
void NonbondedForce::addException(int particle1, int particle2, double chargeProd, double sigma, double epsilon) { int NonbondedForce::addException(int particle1, int particle2, double chargeProd, double sigma, double epsilon) {
exceptions.push_back(ExceptionInfo(particle1, particle2, chargeProd, sigma, epsilon)); exceptions.push_back(ExceptionInfo(particle1, particle2, chargeProd, sigma, epsilon));
return exceptions.size()-1;
} }
void NonbondedForce::getExceptionParameters(int index, int& particle1, int& particle2, double& chargeProd, double& sigma, double& epsilon) const { void NonbondedForce::getExceptionParameters(int index, int& particle1, int& particle2, double& chargeProd, double& sigma, double& epsilon) const {
particle1 = exceptions[index].particle1; particle1 = exceptions[index].particle1;
......
...@@ -39,8 +39,9 @@ using namespace OpenMM; ...@@ -39,8 +39,9 @@ using namespace OpenMM;
PeriodicTorsionForce::PeriodicTorsionForce() { PeriodicTorsionForce::PeriodicTorsionForce() {
} }
void PeriodicTorsionForce::addTorsion(int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k) { int PeriodicTorsionForce::addTorsion(int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k) {
periodicTorsions.push_back(PeriodicTorsionInfo(particle1, particle2, particle3, particle4, periodicity, phase, k)); periodicTorsions.push_back(PeriodicTorsionInfo(particle1, particle2, particle3, particle4, periodicity, phase, k));
return periodicTorsions.size()-1;
} }
void PeriodicTorsionForce::getTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, int& periodicity, double& phase, double& k) const { void PeriodicTorsionForce::getTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, int& periodicity, double& phase, double& k) const {
......
...@@ -39,8 +39,9 @@ using namespace OpenMM; ...@@ -39,8 +39,9 @@ using namespace OpenMM;
RBTorsionForce::RBTorsionForce() { RBTorsionForce::RBTorsionForce() {
} }
void RBTorsionForce::addTorsion(int particle1, int particle2, int particle3, int particle4, double c0, double c1, double c2, double c3, double c4, double c5) { int RBTorsionForce::addTorsion(int particle1, int particle2, int particle3, int particle4, double c0, double c1, double c2, double c3, double c4, double c5) {
rbTorsions.push_back(RBTorsionInfo(particle1, particle2, particle3, particle4, c0, c1, c2, c3, c4, c5)); rbTorsions.push_back(RBTorsionInfo(particle1, particle2, particle3, particle4, c0, c1, c2, c3, c4, c5));
return rbTorsions.size()-1;
} }
void RBTorsionForce::getTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, double& c0, double& c1, double& c2, double& c3, double& c4, double& c5) const { void RBTorsionForce::getTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, double& c0, double& c1, double& c2, double& c3, double& c4, double& c5) const {
......
...@@ -42,8 +42,9 @@ System::~System() { ...@@ -42,8 +42,9 @@ System::~System() {
delete forces[i]; delete forces[i];
} }
void System::addConstraint(int particle1, int particle2, double distance) { int System::addConstraint(int particle1, int particle2, double distance) {
constraints.push_back(ConstraintInfo(particle1, particle2, distance)); constraints.push_back(ConstraintInfo(particle1, particle2, distance));
return constraints.size()-1;
} }
void System::getConstraintParameters(int index, int& particle1, int& particle2, double& distance) const { void System::getConstraintParameters(int index, int& particle1, int& particle2, double& distance) const {
......
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