From d4f4991dfd12c8beba670fede3573a9061fbbb37 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 30 Jun 2010 16:19:04 +0200 Subject: render_hkl: Add --sqrt option --- src/render_hkl.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/render_hkl.c') diff --git a/src/render_hkl.c b/src/render_hkl.c index 4c3546a7..7bfe97b3 100644 --- a/src/render_hkl.c +++ b/src/render_hkl.c @@ -42,12 +42,14 @@ static void show_help(const char *s) " -j Run instances of POV-ray in parallel.\n" " -p, --pdb= PDB file from which to get the unit cell.\n" " -y, --symmetry= Expand reflections according to point group .\n" +" --sqrt Plot square roots of intensities, rather than\n" +" the intensities themselves.\n" ); } static void render_za(UnitCell *cell, double *ref, unsigned int *c, - double boost, const char *sym) + double boost, const char *sym, int config_sqrt) { cairo_surface_t *surface; cairo_t *dctx; @@ -107,7 +109,9 @@ static void render_za(UnitCell *cell, double *ref, unsigned int *c, if ( ct < 1 ) continue; intensity = lookup_intensity(ref, h, k, 0) / (float)ct; - + if ( config_sqrt ) { + intensity = (intensity>0.0) ? sqrt(intensity) : 0.0; + } if ( intensity != 0 ) { nequiv = num_equivs(h, k, 0, sym); @@ -164,6 +168,9 @@ static void render_za(UnitCell *cell, double *ref, unsigned int *c, if ( ct < 1 ) continue; intensity = lookup_intensity(ref, h, k, 0) / (float)ct; + if ( config_sqrt ) { + intensity = (intensity>0.0) ? sqrt(intensity) : 0.0; + } val = boost*intensity/max_intensity; nequiv = num_equivs(h, k, 0, sym); @@ -238,6 +245,7 @@ int main(int argc, char *argv[]) unsigned int *cts; int config_povray = 0; int config_zoneaxis = 0; + int config_sqrt = 0; unsigned int nproc = 1; char *pdb = NULL; int r = 0; @@ -252,6 +260,7 @@ int main(int argc, char *argv[]) {"pdb", 1, NULL, 'p'}, {"boost", 1, NULL, 'b'}, {"symmetry", 1, NULL, 'y'}, + {"sqrt", 0, &config_sqrt, 1}, {0, 0, NULL, 0} }; @@ -313,7 +322,7 @@ int main(int argc, char *argv[]) if ( config_povray ) { r = povray_render_animation(cell, ref, cts, nproc); } else if ( config_zoneaxis ) { - render_za(cell, ref, cts, boost, sym); + render_za(cell, ref, cts, boost, sym, config_sqrt); } else { ERROR("Try again with either --povray or --zone-axis.\n"); } -- cgit v1.2.3