aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-03-31 16:45:33 +0200
committerThomas White <taw@physics.org>2010-03-31 16:45:33 +0200
commit77e9c97e207430752011df229710a063a1c0fc84 (patch)
tree60eed4fa3b7799583a109c56c2234fcdac304a24 /src
parentfe13ba95984f107a63df837dbbb946d194478d96 (diff)
indexamajig: Add --pdb option
Diffstat (limited to 'src')
-rw-r--r--src/indexamajig.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 9a878e0b..bcb0683c 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -77,8 +77,9 @@ static void show_help(const char *s)
" --no-match Don't attempt to match the indexed cell to the\n"
" model, just proceed with the one generated by the\n"
" auto-indexing procedure.\n"
-" --intensities=<file> Specify file containing reflection intensities\n"
-" to use.\n"
+" --intensities=<file> Specify file containing reflection intensities\n"
+" to use when simulating.\n"
+" -p, --pdb=<file> PDB file from which to get the unit cell to match.\n"
);
}
@@ -194,6 +195,7 @@ int main(int argc, char *argv[])
double *intensities = NULL;
char *intfile = NULL;
unsigned int *counts = NULL;
+ char *pdb = NULL;
/* Long options */
const struct option longopts[] = {
@@ -212,11 +214,12 @@ int main(int argc, char *argv[])
{"verbose", 0, &config_verbose, 1},
{"alternate", 0, &config_alternate, 1},
{"intensities", 1, NULL, 'q'},
+ {"pdb", 1, NULL, 'p'},
{0, 0, NULL, 0}
};
/* Short options */
- while ((c = getopt_long(argc, argv, "hi:w", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "hi:wp:", longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
@@ -239,6 +242,11 @@ int main(int argc, char *argv[])
break;
}
+ case 'p' : {
+ pdb = strdup(optarg);
+ break;
+ }
+
case 0 : {
break;
}
@@ -271,6 +279,10 @@ int main(int argc, char *argv[])
counts = NULL;
}
+ if ( pdb == NULL ) {
+ pdb = strdup("molecule.pdb");
+ }
+
if ( indm_str == NULL ) {
STATUS("You didn't specify an indexing method, so I won't"
" try to index anything.\n"
@@ -287,7 +299,8 @@ int main(int argc, char *argv[])
}
free(indm_str);
- cell = load_cell_from_pdb("molecule.pdb");
+ cell = load_cell_from_pdb(pdb);
+ free(pdb);
if ( cell == NULL ) {
ERROR("Couldn't read unit cell (from molecule.pdb)\n");
return 1;