1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#include "Molmodel.h"
#include <iostream>
#include <fstream>
using namespace SimTK;
int main()
{
try {
// Initialize simbody objects
CompoundSystem system;
SimbodyMatterSubsystem matter(system);
DecorationSubsystem decoration(system);
DuMMForceFieldSubsystem forces(system);
forces.loadAmber99Parameters();
// Initialize molmodel objects
RNA rna("AAA");
// Set bond mobilities
//Compound& residue1 = rna.updResidue(Compound::Index(0));
//Compound& residue2 = rna.updResidue(Compound::Index(1));
//Compound& residue3 = rna.updResidue(Compound::Index(2));
// Set first residue to Euclidean mobilities
rna.setResidueBondMobility(ResidueInfo::Index(0), BondMobility::Free);
// for (Compound::BondIndex bond(0); bond < residue1.getNumBonds(); ++bond)
// residue1.setBondMobility(BondMobility::Free, bond);
// Leave second residue at default combination of Torsion and Rigid mobilities
// Set third residue to Rigid
rna.setResidueBondMobility(ResidueInfo::Index(2), BondMobility::Rigid);
//for (Compound::BondIndex bond(0); bond < residue3.getNumBonds(); ++bond)
// residue3.setBondMobility(BondMobility::Rigid, bond);
// Finalize the multibody system
system.adoptCompound(rna);
system.modelCompounds();
// Maintain temperature
system.addEventHandler(new VelocityRescalingThermostat(
system, 293.15, 0.1));
// Show me a movie
Visualizer viz(system);
system.addEventReporter( new Visualizer::Reporter(viz, 0.015) );
system.realizeTopology();
State state = system.getDefaultState();
// Relax the structure before dynamics run
LocalEnergyMinimizer::minimizeEnergy(system, state, 15.0);
// Prepare for molecular dynamics
VerletIntegrator integrator(system);
integrator.setAccuracy(0.001);
TimeStepper timeStepper(system, integrator);
timeStepper.initialize(state);
// Start simulation
timeStepper.stepTo(500.0);
return 0;
}
catch(const std::exception& e) {
std::cerr << "ERROR: " << e.what() << std::endl;
return 1;
}
catch(...) {
std::cerr << "ERROR: An unknown exception was raised" << std::endl;
return 1;
}
}
|