"vscode:/vscode.git/clone" did not exist on "d44381f736adc9eae9f4d9fdeba04e2ca95bb187"
Commit 52c35f70 authored by peastman's avatar peastman
Browse files

Revert "Added System::getNumDegreesOfFreedom()"

This reverts commit 542ee547.
parent 542ee547
......@@ -224,12 +224,6 @@ public:
* @param c the vector defining the third edge of the periodic box
*/
void setDefaultPeriodicBoxVectors(const Vec3& a, const Vec3& b, const Vec3& c);
/**
* Get the total number of degrees of freedom in this system. This is equal to
* 3*(number of massive particles)-(number of constraints), where massive particles
* are ones whose mass does not equal zero.
*/
int getNumDegreesOfFreedom() const;
private:
class ConstraintInfo;
Vec3 periodicBoxVectors[3];
......
......@@ -119,11 +119,3 @@ void System::setDefaultPeriodicBoxVectors(const Vec3& a, const Vec3& b, const Ve
periodicBoxVectors[1] = b;
periodicBoxVectors[2] = c;
}
int System::getNumDegreesOfFreedom() const {
int numMassiveParticles = 0;
for (int i = 0; i < (int) masses.size(); i++)
if (masses[i] != 0.0)
numMassiveParticles++;
return 3*numMassiveParticles-constraints.size();
}
......@@ -138,7 +138,7 @@ void testConstraints() {
integrator.step(1);
}
ke /= numSteps;
double expected = 0.5*system.getNumDegreesOfFreedom()*BOLTZ*temp;
double expected = 0.5*(numParticles*3-system.getNumConstraints())*BOLTZ*temp;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.1);
}
......
......@@ -128,7 +128,7 @@ void testRandomVelocities() {
Vec3 v = state.getVelocities()[i];
ke += 0.5*system.getParticleMass(i)*v.dot(v);
}
double expected = 0.5*system.getNumDegreesOfFreedom()*BOLTZ*temperture;
double expected = 0.5*(numParticles*3-system.getNumConstraints())*BOLTZ*temperture;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 4/sqrt((double) numParticles));
}
......
......@@ -138,7 +138,7 @@ void testConstraints() {
integrator.step(1);
}
ke /= numSteps;
double expected = 0.5*system.getNumDegreesOfFreedom()*BOLTZ*temp;
double expected = 0.5*(numParticles*3-system.getNumConstraints())*BOLTZ*temp;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.1);
}
......
......@@ -126,7 +126,7 @@ void testRandomVelocities() {
Vec3 v = state.getVelocities()[i];
ke += 0.5*system.getParticleMass(i)*v.dot(v);
}
double expected = 0.5*system.getNumDegreesOfFreedom()*BOLTZ*temperture;
double expected = 0.5*(numParticles*3-system.getNumConstraints())*BOLTZ*temperture;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 4/sqrt((double) numParticles));
}
......
......@@ -138,7 +138,7 @@ void testConstraints() {
integrator.step(1);
}
ke /= numSteps;
double expected = 0.5*system.getNumDegreesOfFreedom()*BOLTZ*temp;
double expected = 0.5*(numParticles*3-system.getNumConstraints())*BOLTZ*temp;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.1);
}
......
......@@ -108,7 +108,7 @@ void testRandomVelocities() {
Vec3 v = state.getVelocities()[i];
ke += 0.5*system.getParticleMass(i)*v.dot(v);
}
double expected = 0.5*system.getNumDegreesOfFreedom()*BOLTZ*temperture;
double expected = 0.5*(numParticles*3-system.getNumConstraints())*BOLTZ*temperture;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 4/sqrt((double) numParticles));
}
......
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