"libraries/vscode:/vscode.git/clone" did not exist on "3bcccc3d65d55153fdc7141ea908f3295a7003c4"
Commit 77866475 authored by Christopher Bruns's avatar Christopher Bruns
Browse files

Debugged memory corruption in TestFindExclusions

parent f1c16534
......@@ -53,6 +53,7 @@ class ForceImpl;
class Force {
public:
Force() {}
virtual ~Force() {
}
protected:
......@@ -63,6 +64,10 @@ protected:
* The ForceImpl will be deleted automatically when the OpenMMContext is deleted.
*/
virtual ForceImpl* createImpl() = 0;
private:
Force& operator=(const Force& rhs);
Force(const Force& rhs);
};
} // namespace OpenMM
......
......@@ -78,6 +78,7 @@ public:
* @param platform the Platform to use for calculations
*/
OpenMMContext(System& system, Integrator& integrator, Platform& platform);
~OpenMMContext();
/**
* Get System being simulated in this context.
*/
......
......@@ -42,6 +42,10 @@ OpenMMContext::OpenMMContext(System& system, Integrator& integrator) : impl(new
OpenMMContext::OpenMMContext(System& system, Integrator& integrator, Platform& platform) : impl(new OpenMMContextImpl(*this, system, integrator, &platform)) {
}
OpenMMContext::~OpenMMContext() {
delete impl;
}
const System& OpenMMContext::getSystem() const {
return impl->getSystem();
......
......@@ -236,11 +236,18 @@ int main() {
System system(NUM_ATOMS, 0);
VerletIntegrator integrator(0.01);
StandardMMForceField* forces = new StandardMMForceField(NUM_ATOMS, NUM_ATOMS-1, 0, 0, 0);
for (int i = 0; i < NUM_ATOMS; i += 2) {
// loop over all main-chain atoms (even numbered atoms)
for (int i = 0; i < NUM_ATOMS-1; i += 2)
{
// side-chain bonds
forces->setBondParameters(i, i, i+1, 1.0, 1.0);
if (i < NUM_ATOMS-1)
// main-chain bonds
if (i < NUM_ATOMS-2) // penultimate atom (NUM_ATOMS-2) has no subsequent main-chain atom
forces->setBondParameters(i+1, i, i+2, 1.0, 1.0);
}
system.addForce(forces);
OpenMMContext context(system, integrator, platform);
}
......
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