diff options
author | Thomas White <taw@physics.org> | 2009-11-19 16:14:02 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2009-11-19 16:14:02 +0100 |
commit | cc261b60d06a475f40995e14e83cdd4189b92b0b (patch) | |
tree | bcad019fb90843c1a4208e35d778704cb8f71428 | |
parent | a90da1791f73b8b9ddcca28e1865c6ae17a78db2 (diff) |
Make molecular transform work
-rw-r--r-- | src/diffraction.c | 3 | ||||
-rw-r--r-- | src/sfac.c | 16 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/diffraction.c b/src/diffraction.c index 0fd8dea9..87f2a5f7 100644 --- a/src/diffraction.c +++ b/src/diffraction.c @@ -80,12 +80,13 @@ static double complex molecule_factor(struct molecule *mol, struct threevec q, double en) { int i; - double F = 0.0; + double complex F = 0.0; double s; /* s = sin(theta)/lambda = 1/2d = (1/d)/2.0 */ s = modulus(q.u, q.v, q.w) / 2.0; + /* Atoms are grouped by species for faster calculation */ for ( i=0; i<mol->n_species; i++ ) { double complex sfac; @@ -268,11 +268,11 @@ struct molecule *load_molecule() n = mol->species[j]->n_atoms; - spec->x[n] = x; - spec->y[n] = y; - spec->z[n] = z; + spec->x[n] = x*1.0e-10; /* Convert to nm */ + spec->y[n] = y*1.0e-10; + spec->z[n] = z*1.0e-10; spec->occ[n] = occ; - spec->B[n] = B; + spec->B[n] = B*1.0e-20; /* Convert to m^2 */ mol->species[j]->n_atoms++; done = 1; @@ -287,11 +287,11 @@ struct molecule *load_molecule() spec = malloc(sizeof(struct mol_species)); memcpy(spec->species, el, 4); - spec->x[0] = x; - spec->y[0] = y; - spec->z[0] = z; + spec->x[0] = x*1.0e-10; /* Convert to nm */ + spec->y[0] = y*1.0e-10; + spec->z[0] = z*1.0e-10; spec->occ[0] = occ; - spec->B[0] = B; + spec->B[0] = B*1.0e-20; /* Convert to nm^2 */ spec->n_atoms = 1; mol->species[mol->n_species] = spec; |