Skip to content
Snippets Groups Projects
Commit 16f9a310 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

the position list in set position should be const

parent 40c50fcf
No related branches found
No related tags found
No related merge requests found
...@@ -180,19 +180,29 @@ geom::Vec3List Simulation::GetForces(){ ...@@ -180,19 +180,29 @@ geom::Vec3List Simulation::GetForces(){
return return_vec; return return_vec;
} }
void Simulation::SetPositions(geom::Vec3List& positions, bool in_angstrom){ void Simulation::SetPositions(const geom::Vec3List& positions, bool in_angstrom){
if(top_->GetNumAtoms() != positions.size()){ if(top_->GetNumAtoms() != positions.size()){
throw ost::Error("Number of positions does not correspond to number of atoms in topology!"); throw ost::Error("Number of positions does not correspond to number of atoms in topology!");
} }
if(in_angstrom) positions /= 10;
std::vector<OpenMM::Vec3> openmm_positions; std::vector<OpenMM::Vec3> openmm_positions;
OpenMM::Vec3 open_mm_vec; OpenMM::Vec3 open_mm_vec;
for(geom::Vec3List::iterator i = positions.begin(); if(in_angstrom){
i != positions.end(); ++i){ for(geom::Vec3List::const_iterator i = positions.begin();
open_mm_vec[0] = (*i)[0]; i != positions.end(); ++i){
open_mm_vec[1] = (*i)[1]; open_mm_vec[0] = (*i)[0]*0.1;
open_mm_vec[2] = (*i)[2]; open_mm_vec[1] = (*i)[1]*0.1;
openmm_positions.push_back(open_mm_vec); open_mm_vec[2] = (*i)[2]*0.1;
openmm_positions.push_back(open_mm_vec);
}
}
else{
for(geom::Vec3List::const_iterator i = positions.begin();
i != positions.end(); ++i){
open_mm_vec[0] = (*i)[0];
open_mm_vec[1] = (*i)[1];
open_mm_vec[2] = (*i)[2];
openmm_positions.push_back(open_mm_vec);
}
} }
context_->setPositions(openmm_positions); context_->setPositions(openmm_positions);
} }
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
geom::Vec3List GetForces(); geom::Vec3List GetForces();
void SetPositions(geom::Vec3List& positions, bool in_angstrom = true); void SetPositions(const geom::Vec3List& positions, bool in_angstrom = true);
void SetVelocities(geom::Vec3List& velocities); void SetVelocities(geom::Vec3List& velocities);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment