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

Small cleanup

Allow to better isolate the heavy part to be parallelized
parent 1d139d77
No related branches found
No related tags found
No related merge requests found
......@@ -97,25 +97,23 @@ void PathMSDBase::calculate(){
//log.printf("NOW CALCULATE! \n");
// clean vectors
for(unsigned i=0;i< derivs_z.size();i++){derivs_z[i].zero();}
// full list: resize and calculate the msd
// resize the list to full
if(imgVec.empty()){ // this is the signal that means: recalculate all
imgVec.resize(nframes);
derivs_v.clear();for(unsigned i=0;i<nframes;i++){derivs_v.push_back(derivs_z);}
for(unsigned i=0;i<nframes;i++){
imgVec[i].distder=derivs_z;
imgVec[i].property=indexvec[i];
imgVec[i].index=i;
imgVec[i].distance=msdv[imgVec[i].index].calculate(getPositions(),imgVec[i].distder,true);
}
}else{// just recalculate rmsd for the things you have in the list and assume that property and msdv are ok
for(unsigned i=0;i<imgVec.size();i++){
imgVec[i].distance=msdv[imgVec[i].index].calculate(getPositions(),imgVec[i].distder,true);
}
}
// THIS IS THE HEAVY PART (RMSD STUFF)
// if imgVec.size() is less than nframes, it means that only some msd will be calculated
for(unsigned i=0;i<imgVec.size();i++){
imgVec[i].distance=msdv[imgVec[i].index].calculate(getPositions(),imgVec[i].distder,true);
}
// END OF THE HEAVY PART
vector<Value*> val_s_path;
if(labels.size()>0){
for(unsigned i=0;i<labels.size();i++){ val_s_path.push_back(getPntrToComponent(labels[i].c_str()));}
......@@ -128,6 +126,9 @@ void PathMSDBase::calculate(){
double partition=0.;
double tmp;
// clean vector
for(unsigned i=0;i< derivs_z.size();i++){derivs_z[i].zero();}
typedef vector< class ImagePath >::iterator imgiter;
for(imgiter it=imgVec.begin();it!=imgVec.end();++it){
(*it).similarity=exp(-lambda*((*it).distance));
......
......@@ -69,7 +69,6 @@ class PathMSDBase : public Colvar {
std::string reference;
std::vector<Vector> derivs_s;
std::vector<Vector> derivs_z;
std::vector< std::vector <Vector> > derivs_v;
std::vector <ImagePath> imgVec; // this can be used for doing neighlist
protected:
std::vector<PDB> pdbv;
......
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