Skip to content
Snippets Groups Projects
Commit c04dd4f6 authored by Massimiliano Bonomi's avatar Massimiliano Bonomi Committed by Giovanni Bussi
Browse files

fix Q switch function derivatives for large distances

(cherry picked from commit ae6c8ee4)
parent 78f6578b
No related branches found
No related tags found
No related merge requests found
......@@ -392,8 +392,9 @@ double SwitchingFunction::calculate(double distance,double&dfunc)const {
} else if(type==nativeq) {
double rdist2 = beta*(distance - lambda * ref);
double exprdist=exp(rdist2);
double exprmdist=1.0/exprdist;
result=1./(1.+exprdist);
dfunc=-exprdist/(1.+exprdist)/(1.+exprdist);
dfunc=-1.0/(exprmdist+1.0)/(1.+exprdist);
} else if(type==gaussian) {
result=exp(-0.5*rdist*rdist);
dfunc=-rdist*result;
......
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