aboutsummaryrefslogtreecommitdiff
path: root/src/render_hkl.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-06-14 18:11:42 -0700
committerThomas White <taw@physics.org>2012-02-22 15:26:50 +0100
commit43ea1a2417d96e34b475c5128067ca6ce8632bff (patch)
treef0468050384e0289e0d9c279057f0c77105fd66a /src/render_hkl.c
parent91e18f00bf8fdbc019cbf60648715ef70a09366c (diff)
render_hkl: Read unit cell from file on command line
Diffstat (limited to 'src/render_hkl.c')
-rw-r--r--src/render_hkl.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/render_hkl.c b/src/render_hkl.c
index 4e17e307..5c094cef 100644
--- a/src/render_hkl.c
+++ b/src/render_hkl.c
@@ -38,11 +38,12 @@ static void show_help(const char *s)
printf(
"Render intensity lists using POV-ray.\n"
"\n"
-" -h, --help Display this help message.\n"
-" --povray Render a 3D animation using POV-ray.\n"
-" -j <n> Run <n> instances of POV-ray in parallel.\n"
-" --zone-axis Render a 2D zone axis pattern.\n"
-"\n");
+" -h, --help Display this help message.\n"
+" --povray Render a 3D animation using POV-ray.\n"
+" --zone-axis Render a 2D zone axis pattern.\n"
+" -j <n> Run <n> instances of POV-ray in parallel.\n"
+" -p, --pdb=<file> PDB file from which to get the unit cell.\n"
+);
}
@@ -428,17 +429,19 @@ int main(int argc, char *argv[])
int config_povray = 0;
int config_zoneaxis = 0;
unsigned int nproc = 1;
+ char *pdb = NULL;
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
{"povray", 0, &config_povray, 1},
{"zone-axis", 0, &config_zoneaxis, 1},
+ {"pdb", 1, NULL, 'p'},
{0, 0, NULL, 0}
};
/* Short options */
- while ((c = getopt_long(argc, argv, "hj:", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "hj:p:", longopts, NULL)) != -1) {
switch (c) {
case 'h' :
@@ -449,6 +452,10 @@ int main(int argc, char *argv[])
nproc = atoi(optarg);
break;
+ case 'p' :
+ pdb = strdup(optarg);
+ break;
+
case 0 :
break;
@@ -458,6 +465,10 @@ int main(int argc, char *argv[])
}
+ if ( pdb == NULL ) {
+ pdb = strdup("molecule.pdb");
+ }
+
if ( (nproc > MAX_PROC) || (nproc < 1) ) {
ERROR("Number of processes is invalid.\n");
return 1;
@@ -465,7 +476,7 @@ int main(int argc, char *argv[])
infile = argv[optind];
- cell = load_cell_from_pdb("molecule.pdb");
+ cell = load_cell_from_pdb(pdb);
cts = new_list_count();
ref = read_reflections(infile, cts, NULL);
if ( ref == NULL ) {
@@ -481,6 +492,7 @@ int main(int argc, char *argv[])
ERROR("Try again with either --povray or --zone-axis.\n");
}
+ free(pdb);
return 0;
}