aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-10-14 16:17:44 +0200
committerThomas White <taw@physics.org>2014-10-14 16:17:44 +0200
commit8030ccdc24abd2b1c807ceb7c1bb501f6e44d129 (patch)
tree4d86b279c9546b909fd6510d60689ada0fe8cf1f /src
parentab566d34cfa925eaf0c4ea4bbba5c088b276b119 (diff)
Final gradients for SCGaussian
Diffstat (limited to 'src')
-rw-r--r--src/post-refinement.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 8bdc0956..4dae5096 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -59,12 +59,13 @@
static double gaussian_fraction_gradient(double r, double R)
{
const double ng = 2.6;
+ const double sig = R/ng;
/* If the Ewald sphere isn't within the profile, the gradient is zero */
if ( r < -R ) return 0.0;
if ( r > +R ) return 0.0;
- return ng/(R*sqrt(2.0*M_PI)) * exp(-pow(r*ng/R, 2.0)/2.0);
+ return exp(-pow(r/sig, 2.0)/2.0) / (sig*sqrt(2.0*M_PI));
}
@@ -123,11 +124,14 @@ static double sphere_fraction_rgradient(double r, double R)
static double gaussian_fraction_rgradient(double r, double R)
{
+ const double ng = 2.6;
+ const double sig = R/ng;
+
/* If the Ewald sphere isn't within the profile, the gradient is zero */
if ( r < -R ) return 0.0;
if ( r > +R ) return 0.0;
- return -(3.0*r/(4.0*R*R)) * (1.0 - r*r/(R*R));
+ return -(ng*r/(sqrt(2.0*M_PI)*R*R))*exp(-r*r/(2.0*sig*sig));
}