Commit 6e6c912a by Francois Gygi

Moved sync_positions and sync_velocities calls to the AtomSet set_positions

and set_velocities functions


git-svn-id: http://qboxcode.org/svn/qb/trunk@1801 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 079359e2
......@@ -357,8 +357,9 @@ void AtomSet::sync_positions(vector<vector<double> >& tau)
}
////////////////////////////////////////////////////////////////////////////////
void AtomSet::set_positions(const vector<vector<double> >& tau)
void AtomSet::set_positions(vector<vector<double> >& tau)
{
sync_positions(tau);
assert(tau.size() == atom_list.size());
for ( int is = 0; is < atom_list.size(); is++ )
{
......@@ -411,8 +412,9 @@ void AtomSet::sync_velocities(vector<vector<double> >& vel)
}
////////////////////////////////////////////////////////////////////////////////
void AtomSet::set_velocities(const vector<vector<double> >& vel)
void AtomSet::set_velocities(vector<vector<double> >& vel)
{
sync_velocities(vel);
assert(vel.size() == atom_list.size());
for ( int is = 0; is < atom_list.size(); is++ )
{
......@@ -596,6 +598,7 @@ D3tensor AtomSet::quadrupole(void) const
void AtomSet::set_cell(const D3vector& a, const D3vector& b, const D3vector& c)
{
cell_.set(a,b,c);
sync_cell();
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -72,10 +72,10 @@ class AtomSet
int nsp(void) const { return species_list.size(); }
void get_positions(std::vector<std::vector<double> >& tau) const;
void sync_positions(std::vector<std::vector<double> >& tau);
void set_positions(const std::vector<std::vector<double> >& tau);
void set_positions(std::vector<std::vector<double> >& tau);
void get_velocities(std::vector<std::vector<double> >& vel) const;
void sync_velocities(std::vector<std::vector<double> >& vel);
void set_velocities(const std::vector<std::vector<double> >& vel);
void set_velocities(std::vector<std::vector<double> >& vel);
const UnitCell& cell(void) const { return cell_; }
void set_cell(const UnitCell& cell) { cell_ = cell; }
void set_cell(const D3vector& a, const D3vector& b, const D3vector& c);
......
......@@ -36,7 +36,6 @@ void BMDIonicStepper::compute_r(double e0, const vector<vector< double> >& f0)
fm_ = f0;
em_ = e0_;
r0_ = rp_;
atoms_.sync_positions(r0_);
atoms_.set_positions(r0_);
}
......
......@@ -177,9 +177,7 @@ void CGCellStepper::compute_new_cell(double e, const valarray<double>& sigma,
////////////////////////////////////////////////////////////////////////////////
void CGCellStepper::update_cell(void)
{
s_.atoms.sync_positions(rp_);
s_.atoms.set_positions(rp_);
s_.atoms.sync_cell(cellp);
s_.atoms.set_cell(cellp);
u_ = up_;
......
......@@ -92,7 +92,6 @@ void CGIonicStepper::compute_r(double e0, const vector<vector<double> >& f0)
constraints_.enforce_r(r0_,rp_);
rm_ = r0_;
r0_ = rp_;
atoms_.sync_positions(r0_);
atoms_.set_positions(r0_);
atoms_.reset_velocities();
}
......@@ -15,14 +15,12 @@
// ConstraintSet.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: ConstraintSet.C,v 1.11 2010-02-20 23:13:02 fgygi Exp $
#include "ConstraintSet.h"
#include "PositionConstraint.h"
#include "DistanceConstraint.h"
#include "AngleConstraint.h"
#include "TorsionConstraint.h"
//#include "MultiDistanceConstraint.h"
#include "Atom.h"
#include "AtomSet.h"
#include "Context.h"
......@@ -560,10 +558,8 @@ void ConstraintSet::enforce(AtomSet& atoms)
rp=r0;
atoms.get_velocities(v0);
enforce_r(r0,rp);
atoms.sync_positions(rp);
atoms.set_positions(rp);
enforce_v(r0,v0);
atoms.sync_velocities(v0);
atoms.set_velocities(v0);
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -15,7 +15,6 @@
// MDIonicStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: MDIonicStepper.C,v 1.23 2010-04-16 22:41:55 fgygi Exp $
#include "MDIonicStepper.h"
#include "sampling.h"
......@@ -43,7 +42,6 @@ void MDIonicStepper::compute_r(double e0, const vector<vector< double> >& f0)
constraints_.enforce_r(r0_,rp_);
rm_ = r0_;
r0_ = rp_;
atoms_.sync_positions(r0_);
atoms_.set_positions(r0_);
}
......@@ -122,7 +120,6 @@ void MDIonicStepper::compute_v(double e0, const vector<vector< double> >& f0)
}
}
}
atoms_.sync_velocities(v0_);
atoms_.set_velocities(v0_);
}
else if ( thermostat_ == "LOWE" )
......@@ -197,7 +194,6 @@ void MDIonicStepper::compute_v(double e0, const vector<vector< double> >& f0)
}
}
}
atoms_.sync_velocities(v0_);
atoms_.set_velocities(v0_);
//cout << " npairs: " << npairs << endl;
}
......@@ -247,13 +243,11 @@ void MDIonicStepper::compute_v(double e0, const vector<vector< double> >& f0)
if ( !s_.ctxt_.onpe0() )
s_.ctxt_.dbcast_recv(1,1,&ekin_stepper_,1,0,0);
atoms_.sync_velocities(v0_);
atoms_.set_velocities(v0_);
}
constraints_.enforce_v(r0_,v0_);
// recompute ekin as velocities may be affected by constraints
compute_ekin();
atoms_.sync_velocities(v0_);
atoms_.set_velocities(v0_);
}
......
......@@ -15,7 +15,6 @@
// SDAIonicStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SDAIonicStepper.C,v 1.9 2008-09-08 15:56:19 fgygi Exp $
#include "SDAIonicStepper.h"
using namespace std;
......@@ -54,7 +53,6 @@ void SDAIonicStepper::compute_r(double e0, const vector<vector< double> >& f0)
constraints_.enforce_r(r0_,rp_);
rm_ = r0_;
r0_ = rp_;
atoms_.sync_positions(r0_);
atoms_.set_positions(r0_);
// reset the SDA algorithm
first_step_ = true;
......@@ -127,7 +125,6 @@ void SDAIonicStepper::compute_r(double e0, const vector<vector< double> >& f0)
constraints_.enforce_r(r0_,rp_);
rm_ = r0_;
r0_ = rp_;
atoms_.sync_positions(r0_);
atoms_.set_positions(r0_);
first_step_ = false;
......
......@@ -15,7 +15,6 @@
// SDIonicStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SDIonicStepper.C,v 1.8 2008-09-08 15:56:19 fgygi Exp $
#include "SDIonicStepper.h"
using namespace std;
......@@ -35,6 +34,5 @@ void SDIonicStepper::compute_r(double e0, const vector<vector< double> >& f0)
constraints_.enforce_r(r0_,rp_);
rm_ = r0_;
r0_ = rp_;
atoms_.sync_positions(r0_);
atoms_.set_positions(r0_);
}
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