aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-02-26 13:11:22 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-02-26 13:11:22 +0000
commit76cd15aa8de3f6c78960314ed5e40849be8fd081 (patch)
treecb95a6e31c23a9fbe2421a18b544cdee2fee61dd /src/utils.c
parent4feae844d4782f98eb879e31073fa892bca82baf (diff)
Honour voltage from MRC header if present
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@11 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index ce7c7f3..4055676 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -42,3 +42,15 @@ double angle_between(double x1, double y1, double z1, double x2, double y2, doub
return ((acos((x1*x2 + y1*y2 + z1*z2) / (mod1*mod2)))/M_PI) * 180;
}
+
+/* Wavelength of an electron (in m) given accelerating potential (in V) */
+double lambda(double V) {
+
+ double m = 9.110E-31;
+ double h = 6.625E-34;
+ double e = 1.60E-19;
+ double c = 2.998E8;
+
+ return h / sqrt(2*m*e*V*(1+(e*V / 2*m*c*c)));
+
+}