aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-19 14:45:03 +0100
committerThomas White <taw@physics.org>2009-11-19 14:45:03 +0100
commita90da1791f73b8b9ddcca28e1865c6ae17a78db2 (patch)
tree1aee00a15479e9331a460bcb0edaf03d00c5e71b
parent145eb787b1a59baaa8cc3f96bb28742786e68f49 (diff)
Tidy up floating-point precision
-rw-r--r--src/sfac.c7
-rw-r--r--src/sfac.h10
2 files changed, 10 insertions, 7 deletions
diff --git a/src/sfac.c b/src/sfac.c
index 42aa72ce..ffe98f11 100644
--- a/src/sfac.c
+++ b/src/sfac.c
@@ -228,7 +228,8 @@ struct molecule *load_molecule()
char el[4];
int j, r;
int done = 0;
- float x, y, z, occ, B;
+ float xf, yf, zf, occf, Bf;
+ double x, y, z, occ, B;
char *coords;
rval = fgets(line, 1023, fh);
@@ -248,11 +249,13 @@ struct molecule *load_molecule()
}
coords = line + 29;
- r = sscanf(coords, "%f %f %f %f %f", &x, &y, &z, &occ, &B);
+ r = sscanf(coords, "%f %f %f %f %f", &xf, &yf, &zf, &occf, &Bf);
if ( r != 5 ) {
fprintf(stderr, "WTF?\n");
abort();
}
+ /* Promote to double precision */
+ x = xf; y = yf; z = zf; occ = occf; B = Bf;
for ( j=0; j<mol->n_species; j++ ) {
diff --git a/src/sfac.h b/src/sfac.h
index 81b90234..725ebff9 100644
--- a/src/sfac.h
+++ b/src/sfac.h
@@ -24,11 +24,11 @@ struct mol_species
char species[4]; /* Species name */
int n_atoms; /* Number of atoms of this species */
- float x[32*1024];
- float y[32*1024];
- float z[32*1024];
- float occ[32*1024];
- float B[32*1024];
+ double x[32*1024];
+ double y[32*1024];
+ double z[32*1024];
+ double occ[32*1024];
+ double B[32*1024];
};