Skip to content
Snippets Groups Projects
Commit 28129c66 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Small cleanup

Pbc are now stored in ActionAtomistic only, and not in Atoms.
This is more consistent: equivalently to atom positions,
Pbc are local to the Action.
parent 8c4d1f39
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ void ActionAtomistic::requestAtoms(const vector<AtomNumber> & a){
}
Vector ActionAtomistic::pbcDistance(const Vector &v1,const Vector &v2)const{
return plumed.getAtoms().getPbc().distance(v1,v2);
return pbc.distance(v1,v2);
}
void ActionAtomistic::calculateNumericalDerivatives(){
......@@ -59,13 +59,13 @@ void ActionAtomistic::calculateNumericalDerivatives(){
}
for(int i=0;i<3;i++) for(int k=0;k<3;k++){
double arg0=box(i,k);
for(int j=0;j<natoms;j++) positions[j]=plumed.getAtoms().getPbc().realToScaled(positions[j]);
for(int j=0;j<natoms;j++) positions[j]=pbc.realToScaled(positions[j]);
box(i,k)=box(i,k)+delta;
plumed.getAtoms().getPbc().setBox(box);
for(int j=0;j<natoms;j++) positions[j]=plumed.getAtoms().getPbc().scaledToReal(positions[j]);
pbc.setBox(box);
for(int j=0;j<natoms;j++) positions[j]=pbc.scaledToReal(positions[j]);
calculate();
box(i,k)=arg0;
plumed.getAtoms().getPbc().setBox(box);
pbc.setBox(box);
for(int j=0;j<natoms;j++) positions[j]=savedPositions[j];
for(int j=0;j<nval;j++) valuebox[j](i,k)=a->getValue(j)->get();
}
......@@ -101,6 +101,7 @@ void ActionAtomistic::parseAtomList(const std::string&key,std::vector<AtomNumber
void ActionAtomistic::retrieveAtoms(){
box=plumed.getAtoms().box;
pbc.setBox(box);
const vector<Vector> & p(plumed.getAtoms().positions);
const vector<double> & c(plumed.getAtoms().charges);
const vector<double> & m(plumed.getAtoms().masses);
......
......@@ -6,6 +6,7 @@
#include "PlumedMain.h"
#include <vector>
#include <set>
#include "Pbc.h"
namespace PLMD {
......@@ -20,6 +21,7 @@ class ActionAtomistic :
std::set<int> unique;
std::vector<Vector> positions; // positions of the needed atoms
Tensor box;
Pbc pbc;
Tensor virial;
std::vector<Vector> forces; // forces on the needed atoms
std::vector<double> masses;
......@@ -127,7 +129,7 @@ void ActionAtomistic::clearOutputForces(){
inline
const Pbc & ActionAtomistic::getPbc() const{
return plumed.getAtoms().getPbc();
return pbc;
}
}
......
......@@ -38,7 +38,6 @@ Atoms::~Atoms(){
void Atoms::setBox(void*p){
mdatoms->setBox(p);
Tensor b; mdatoms->getBox(b);
pbc.setBox(b);
}
void Atoms::setPositions(void*p){
......
......@@ -3,7 +3,6 @@
#include "PlumedCommunicator.h"
#include "Tensor.h"
#include "Pbc.h"
#include <vector>
#include <set>
#include <cassert>
......@@ -32,7 +31,6 @@ class Atoms
std::vector<int> fullList;
MDAtomsBase* mdatoms;
Pbc pbc;
PlumedMain & plumed;
......@@ -65,9 +63,6 @@ public:
void setTimeStep(void*);
double getTimeStep()const;
const Pbc& getPbc()const{return pbc;};
Pbc& getPbc(){return pbc;};
private:
std::vector<const ActionAtomistic*> actions;
std::vector<int> gatindex;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment