Unverified Commit 2abeb801 authored by Yannick Lemke's avatar Yannick Lemke Committed by GitHub
Browse files

fix(openmmapi): move getNum...() definitions to implementation files (#5009)



Fixes #5001.
Signed-off-by: default avatarYannick Lemke <yannick.lemke@posteo.de>
parent d47ea1de
...@@ -153,33 +153,23 @@ public: ...@@ -153,33 +153,23 @@ public:
/** /**
* 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.
*/ */
int getNumParticles() const { int getNumParticles() const;
return particles.size();
}
/** /**
* Get the number of special interactions that should be calculated differently from other interactions. * Get the number of special interactions that should be calculated differently from other interactions.
*/ */
int getNumExceptions() const { int getNumExceptions() const;
return exceptions.size();
}
/** /**
* Get the number of global parameters that have been added. * Get the number of global parameters that have been added.
*/ */
int getNumGlobalParameters() const { int getNumGlobalParameters() const;
return globalParameters.size();
}
/** /**
* Get the number of particles parameter offsets that have been added. * Get the number of particles parameter offsets that have been added.
*/ */
int getNumParticleParameterOffsets() const { int getNumParticleParameterOffsets() const;
return particleOffsets.size();
}
/** /**
* Get the number of exception parameter offsets that have been added. * Get the number of exception parameter offsets that have been added.
*/ */
int getNumExceptionParameterOffsets() const { int getNumExceptionParameterOffsets() const;
return exceptionOffsets.size();
}
/** /**
* Get the method used for handling long range nonbonded interactions. * Get the method used for handling long range nonbonded interactions.
*/ */
......
...@@ -56,9 +56,7 @@ public: ...@@ -56,9 +56,7 @@ public:
/** /**
* Get the number of periodic torsion terms in the potential function * Get the number of periodic torsion terms in the potential function
*/ */
int getNumTorsions() const { int getNumTorsions() const;
return periodicTorsions.size();
}
/** /**
* Add a periodic torsion term to the force field. * Add a periodic torsion term to the force field.
* *
......
...@@ -56,9 +56,7 @@ public: ...@@ -56,9 +56,7 @@ public:
/** /**
* Get the number of Ryckaert-Bellemans torsion terms in the potential function * Get the number of Ryckaert-Bellemans torsion terms in the potential function
*/ */
int getNumTorsions() const { int getNumTorsions() const;
return rbTorsions.size();
}
/** /**
* Add a Ryckaert-Bellemans torsion term to the force field. * Add a Ryckaert-Bellemans torsion term to the force field.
* *
......
...@@ -73,9 +73,7 @@ public: ...@@ -73,9 +73,7 @@ public:
/** /**
* Get the number of particles in this System. * Get the number of particles in this System.
*/ */
int getNumParticles() const { int getNumParticles() const;
return masses.size();
}
/** /**
* Add a particle to the System. If the mass is 0, Integrators will ignore * Add a particle to the System. If the mass is 0, Integrators will ignore
* the particle and not modify its position or velocity. This is most often * the particle and not modify its position or velocity. This is most often
...@@ -136,9 +134,7 @@ public: ...@@ -136,9 +134,7 @@ public:
/** /**
* Get the number of distance constraints in this System. * Get the number of distance constraints in this System.
*/ */
int getNumConstraints() const { int getNumConstraints() const;
return constraints.size();
}
/** /**
* Add a constraint to the System. Particles whose mass is 0 cannot participate * Add a constraint to the System. Particles whose mass is 0 cannot participate
* in constraints. * in constraints.
...@@ -189,9 +185,7 @@ public: ...@@ -189,9 +185,7 @@ public:
/** /**
* Get the number of Force objects that have been added to the System. * Get the number of Force objects that have been added to the System.
*/ */
int getNumForces() const { int getNumForces() const;
return forces.size();
}
/** /**
* Get a const reference to one of the Forces in this System. * Get a const reference to one of the Forces in this System.
* *
......
...@@ -176,3 +176,18 @@ void ATMForce::getPerturbationEnergy(OpenMM::Context& context, double& u0, doubl ...@@ -176,3 +176,18 @@ void ATMForce::getPerturbationEnergy(OpenMM::Context& context, double& u0, doubl
dynamic_cast<ATMForceImpl&>(getImplInContext(context)).getPerturbationEnergy(getContextImpl(context), u0, u1, energy); dynamic_cast<ATMForceImpl&>(getImplInContext(context)).getPerturbationEnergy(getContextImpl(context), u0, u1, energy);
} }
int ATMForce::getNumParticles() const {
return particles.size();
}
int ATMForce::getNumForces() const {
return forces.size();
}
int ATMForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int ATMForce::getNumEnergyParameterDerivatives() const {
return energyParameterDerivatives.size();
}
...@@ -107,3 +107,11 @@ void CMAPTorsionForce::setUsesPeriodicBoundaryConditions(bool periodic) { ...@@ -107,3 +107,11 @@ void CMAPTorsionForce::setUsesPeriodicBoundaryConditions(bool periodic) {
bool CMAPTorsionForce::usesPeriodicBoundaryConditions() const { bool CMAPTorsionForce::usesPeriodicBoundaryConditions() const {
return usePeriodic; return usePeriodic;
} }
int CMAPTorsionForce::getNumMaps() const {
return maps.size();
}
int CMAPTorsionForce::getNumTorsions() const {
return torsions.size();
}
...@@ -159,3 +159,19 @@ void CustomAngleForce::setUsesPeriodicBoundaryConditions(bool periodic) { ...@@ -159,3 +159,19 @@ void CustomAngleForce::setUsesPeriodicBoundaryConditions(bool periodic) {
bool CustomAngleForce::usesPeriodicBoundaryConditions() const { bool CustomAngleForce::usesPeriodicBoundaryConditions() const {
return usePeriodic; return usePeriodic;
} }
int CustomAngleForce::getNumAngles() const {
return angles.size();
}
int CustomAngleForce::getNumPerAngleParameters() const {
return parameters.size();
}
int CustomAngleForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int CustomAngleForce::getNumEnergyParameterDerivatives() const {
return energyParameterDerivatives.size();
}
...@@ -157,3 +157,19 @@ void CustomBondForce::setUsesPeriodicBoundaryConditions(bool periodic) { ...@@ -157,3 +157,19 @@ void CustomBondForce::setUsesPeriodicBoundaryConditions(bool periodic) {
bool CustomBondForce::usesPeriodicBoundaryConditions() const { bool CustomBondForce::usesPeriodicBoundaryConditions() const {
return usePeriodic; return usePeriodic;
} }
int CustomBondForce::getNumBonds() const {
return bonds.size();
}
int CustomBondForce::getNumPerBondParameters() const {
return parameters.size();
}
int CustomBondForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int CustomBondForce::getNumEnergyParameterDerivatives() const {
return energyParameterDerivatives.size();
}
...@@ -162,3 +162,19 @@ bool CustomCVForce::usesPeriodicBoundaryConditions() const { ...@@ -162,3 +162,19 @@ bool CustomCVForce::usesPeriodicBoundaryConditions() const {
return true; return true;
return false; return false;
} }
int CustomCVForce::getNumCollectiveVariables() const {
return variables.size();
}
int CustomCVForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int CustomCVForce::getNumEnergyParameterDerivatives() const {
return energyParameterDerivatives.size();
}
int CustomCVForce::getNumTabulatedFunctions() const {
return functions.size();
}
...@@ -195,3 +195,35 @@ void CustomCentroidBondForce::setUsesPeriodicBoundaryConditions(bool periodic) { ...@@ -195,3 +195,35 @@ void CustomCentroidBondForce::setUsesPeriodicBoundaryConditions(bool periodic) {
bool CustomCentroidBondForce::usesPeriodicBoundaryConditions() const { bool CustomCentroidBondForce::usesPeriodicBoundaryConditions() const {
return usePeriodic; return usePeriodic;
} }
int CustomCentroidBondForce::getNumGroupsPerBond() const {
return groupsPerBond;
}
int CustomCentroidBondForce::getNumGroups() const {
return groups.size();
}
int CustomCentroidBondForce::getNumBonds() const {
return bonds.size();
}
int CustomCentroidBondForce::getNumPerBondParameters() const {
return bondParameters.size();
}
int CustomCentroidBondForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int CustomCentroidBondForce::getNumTabulatedFunctions() const {
return functions.size();
}
int CustomCentroidBondForce::getNumFunctions() const {
return functions.size();
}
int CustomCentroidBondForce::getNumEnergyParameterDerivatives() const {
return energyParameterDerivatives.size();
}
...@@ -198,3 +198,31 @@ void CustomCompoundBondForce::setUsesPeriodicBoundaryConditions(bool periodic) { ...@@ -198,3 +198,31 @@ void CustomCompoundBondForce::setUsesPeriodicBoundaryConditions(bool periodic) {
bool CustomCompoundBondForce::usesPeriodicBoundaryConditions() const { bool CustomCompoundBondForce::usesPeriodicBoundaryConditions() const {
return usePeriodic; return usePeriodic;
} }
int CustomCompoundBondForce::getNumParticlesPerBond() const {
return particlesPerBond;
}
int CustomCompoundBondForce::getNumBonds() const {
return bonds.size();
}
int CustomCompoundBondForce::getNumPerBondParameters() const {
return bondParameters.size();
}
int CustomCompoundBondForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int CustomCompoundBondForce::getNumEnergyParameterDerivatives() const {
return energyParameterDerivatives.size();
}
int CustomCompoundBondForce::getNumTabulatedFunctions() const {
return functions.size();
}
int CustomCompoundBondForce::getNumFunctions() const {
return functions.size();
}
...@@ -136,3 +136,15 @@ void CustomExternalForce::updateParametersInContext(Context& context) { ...@@ -136,3 +136,15 @@ void CustomExternalForce::updateParametersInContext(Context& context) {
bool CustomExternalForce::usesPeriodicBoundaryConditions() const { bool CustomExternalForce::usesPeriodicBoundaryConditions() const {
return (energyExpression.find("periodicdistance") != string::npos); return (energyExpression.find("periodicdistance") != string::npos);
} }
int CustomExternalForce::getNumParticles() const {
return particles.size();
}
int CustomExternalForce::getNumPerParticleParameters() const {
return parameters.size();
}
int CustomExternalForce::getNumGlobalParameters() const {
return globalParameters.size();
}
...@@ -244,3 +244,39 @@ ForceImpl* CustomGBForce::createImpl() const { ...@@ -244,3 +244,39 @@ ForceImpl* CustomGBForce::createImpl() const {
void CustomGBForce::updateParametersInContext(Context& context) { void CustomGBForce::updateParametersInContext(Context& context) {
dynamic_cast<CustomGBForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context)); dynamic_cast<CustomGBForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
} }
int CustomGBForce::getNumParticles() const {
return particles.size();
}
int CustomGBForce::getNumExclusions() const {
return exclusions.size();
}
int CustomGBForce::getNumPerParticleParameters() const {
return parameters.size();
}
int CustomGBForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int CustomGBForce::getNumEnergyParameterDerivatives() const {
return energyParameterDerivatives.size();
}
int CustomGBForce::getNumTabulatedFunctions() const {
return functions.size();
}
int CustomGBForce::getNumFunctions() const {
return functions.size();
}
int CustomGBForce::getNumComputedValues() const {
return computedValues.size();
}
int CustomGBForce::getNumEnergyTerms() const {
return energyTerms.size();
}
...@@ -245,3 +245,35 @@ ForceImpl* CustomHbondForce::createImpl() const { ...@@ -245,3 +245,35 @@ ForceImpl* CustomHbondForce::createImpl() const {
void CustomHbondForce::updateParametersInContext(Context& context) { void CustomHbondForce::updateParametersInContext(Context& context) {
dynamic_cast<CustomHbondForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context)); dynamic_cast<CustomHbondForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
} }
int CustomHbondForce::getNumDonors() const {
return donors.size();
}
int CustomHbondForce::getNumAcceptors() const {
return acceptors.size();
}
int CustomHbondForce::getNumExclusions() const {
return exclusions.size();
}
int CustomHbondForce::getNumPerDonorParameters() const {
return donorParameters.size();
}
int CustomHbondForce::getNumPerAcceptorParameters() const {
return acceptorParameters.size();
}
int CustomHbondForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int CustomHbondForce::getNumTabulatedFunctions() const {
return functions.size();
}
int CustomHbondForce::getNumFunctions() const {
return functions.size();
}
...@@ -378,3 +378,19 @@ void CustomIntegrator::deserializeParameters(const SerializationNode& node) { ...@@ -378,3 +378,19 @@ void CustomIntegrator::deserializeParameters(const SerializationNode& node) {
setPerDofVariableByName(var.getName(), perDofValues); setPerDofVariableByName(var.getName(), perDofValues);
} }
} }
int CustomIntegrator::getNumGlobalVariables() const {
return globalNames.size();
}
int CustomIntegrator::getNumPerDofVariables() const {
return perDofNames.size();
}
int CustomIntegrator::getNumComputations() const {
return computations.size();
}
int CustomIntegrator::getNumTabulatedFunctions() const {
return functions.size();
}
...@@ -223,3 +223,27 @@ ForceImpl* CustomManyParticleForce::createImpl() const { ...@@ -223,3 +223,27 @@ ForceImpl* CustomManyParticleForce::createImpl() const {
void CustomManyParticleForce::updateParametersInContext(Context& context) { void CustomManyParticleForce::updateParametersInContext(Context& context) {
dynamic_cast<CustomManyParticleForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context)); dynamic_cast<CustomManyParticleForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
} }
int CustomManyParticleForce::getNumParticlesPerSet() const {
return particlesPerSet;
}
int CustomManyParticleForce::getNumParticles() const {
return particles.size();
}
int CustomManyParticleForce::getNumExclusions() const {
return exclusions.size();
}
int CustomManyParticleForce::getNumPerParticleParameters() const {
return particleParameters.size();
}
int CustomManyParticleForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int CustomManyParticleForce::getNumTabulatedFunctions() const {
return functions.size();
}
...@@ -343,3 +343,39 @@ void CustomNonbondedForce::updateParametersInContext(Context& context) { ...@@ -343,3 +343,39 @@ void CustomNonbondedForce::updateParametersInContext(Context& context) {
lastChangedParticle = -1; lastChangedParticle = -1;
} }
} }
int CustomNonbondedForce::getNumParticles() const {
return particles.size();
}
int CustomNonbondedForce::getNumExclusions() const {
return exclusions.size();
}
int CustomNonbondedForce::getNumPerParticleParameters() const {
return parameters.size();
}
int CustomNonbondedForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int CustomNonbondedForce::getNumTabulatedFunctions() const {
return functions.size();
}
int CustomNonbondedForce::getNumFunctions() const {
return functions.size();
}
int CustomNonbondedForce::getNumComputedValues() const {
return computedValues.size();
}
int CustomNonbondedForce::getNumInteractionGroups() const {
return interactionGroups.size();
}
int CustomNonbondedForce::getNumEnergyParameterDerivatives() const {
return energyParameterDerivatives.size();
}
...@@ -161,3 +161,19 @@ void CustomTorsionForce::setUsesPeriodicBoundaryConditions(bool periodic) { ...@@ -161,3 +161,19 @@ void CustomTorsionForce::setUsesPeriodicBoundaryConditions(bool periodic) {
bool CustomTorsionForce::usesPeriodicBoundaryConditions() const { bool CustomTorsionForce::usesPeriodicBoundaryConditions() const {
return usePeriodic; return usePeriodic;
} }
int CustomTorsionForce::getNumTorsions() const {
return torsions.size();
}
int CustomTorsionForce::getNumPerTorsionParameters() const {
return parameters.size();
}
int CustomTorsionForce::getNumGlobalParameters() const {
return globalParameters.size();
}
int CustomTorsionForce::getNumEnergyParameterDerivatives() const {
return energyParameterDerivatives.size();
}
...@@ -75,3 +75,7 @@ void CustomVolumeForce::setGlobalParameterDefaultValue(int index, double default ...@@ -75,3 +75,7 @@ void CustomVolumeForce::setGlobalParameterDefaultValue(int index, double default
ForceImpl* CustomVolumeForce::createImpl() const { ForceImpl* CustomVolumeForce::createImpl() const {
return new CustomVolumeForceImpl(*this); return new CustomVolumeForceImpl(*this);
} }
int CustomVolumeForce::getNumGlobalParameters() const {
return globalParameters.size();
}
...@@ -138,3 +138,7 @@ void DPDIntegrator::step(int steps) { ...@@ -138,3 +138,7 @@ void DPDIntegrator::step(int steps) {
kernel.getAs<IntegrateDPDStepKernel>().execute(*context, *this); kernel.getAs<IntegrateDPDStepKernel>().execute(*context, *this);
} }
} }
int DPDIntegrator::getNumTypePairs() const {
return pairs.size();
}
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