Skip to content

Commit

Permalink
Merge branch 'fix-919'
Browse files Browse the repository at this point in the history
fixes #919
  • Loading branch information
carlocamilloni committed Dec 1, 2023
2 parents e158c05 + 90254fc commit 3b92f7e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/colvar/PathMSDBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,21 +270,25 @@ void PathMSDBase::calculate() {
Value* val_z_path=getPntrToComponent("zzz");

std::vector<double> s_path(val_s_path.size()); for(unsigned i=0; i<s_path.size(); i++)s_path[i]=0.;
double partition=0.;
double tmp;

// clean vector
Tools::set_to_zero(derivs_z);
double min_distance=1e10;
for(auto & it : imgVec) {
if(it.distance < min_distance) min_distance=it.distance;
}

double partition=0.;
for(auto & it : imgVec) {
it.similarity=std::exp(-lambda*(it.distance));
it.similarity=std::exp(-lambda*(it.distance - min_distance));
for(unsigned i=0; i<s_path.size(); i++) {
s_path[i]+=(it.property[i])*it.similarity;
}
partition+=it.similarity;
}
for(unsigned i=0; i<s_path.size(); i++) { s_path[i]/=partition; val_s_path[i]->set(s_path[i]) ;}
val_z_path->set(-(1./lambda)*std::log(partition));
val_z_path->set(-(1./lambda)*std::log(partition) + min_distance);

// clean vector
Tools::set_to_zero(derivs_z);
double tmp;
for(unsigned j=0; j<s_path.size(); j++) {
// clean up
Tools::set_to_zero(derivs_s);
Expand Down

1 comment on commit 3b92f7e

@PlumedBot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found broken examples in automatic/a-masterclass-22-09.txt
Found broken examples in automatic/a-masterclass-22-11.txt
Found broken examples in automatic/a-masterclass-22-12.txt
Found broken examples in automatic/performance-optimization.txt
Found broken examples in automatic/a-trieste-6.txt
Found broken examples in automatic/munster.txt
Found broken examples in automatic/ANN.tmp
Found broken examples in automatic/EDS.tmp
Found broken examples in automatic/EMMI.tmp
Found broken examples in automatic/ENVIRONMENTSIMILARITY.tmp
Found broken examples in automatic/FOURIER_TRANSFORM.tmp
Found broken examples in automatic/FUNCPATHGENERAL.tmp
Found broken examples in automatic/FUNCPATHMSD.tmp
Found broken examples in automatic/FUNNEL.tmp
Found broken examples in automatic/FUNNEL_PS.tmp
Found broken examples in automatic/GHBFIX.tmp
Found broken examples in automatic/INCLUDE.tmp
Found broken examples in automatic/MAZE_MEMETIC_SAMPLING.tmp
Found broken examples in automatic/MAZE_OPTIMIZER_BIAS.tmp
Found broken examples in automatic/MAZE_RANDOM_ACCELERATION_MD.tmp
Found broken examples in automatic/MAZE_RANDOM_WALK.tmp
Found broken examples in automatic/MAZE_SIMULATED_ANNEALING.tmp
Found broken examples in automatic/MAZE_STEERED_MD.tmp
Found broken examples in automatic/PIV.tmp
Found broken examples in automatic/PLUMED.tmp
Found broken examples in MiscelaneousPP.md

Please sign in to comment.