 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
26 "Usage: bmodsel [options] in1.star [in2.star...]",
27 "-----------------------------------------------",
28 "Selects and manipulates models and components.",
33 " %component_type_id",
34 " #model_id@component_id",
35 " #model_id%component_type_id",
36 " ^model_type_id@component_id",
37 " ^model_type_id%component_type_id",
38 " wild cards allowed: .",
40 "Actions for preparation:",
41 "-all Reset selection to all components before other selections.",
42 "-merge Merge models in different files rather than concatenate.",
43 "-invert Inverts selection.",
46 "-select #Mod1@14 Select models and components.",
47 "-group 3 Select components with this selection flag number.",
48 "-number 24,36 Select models based on the number of components.",
49 "-sets 20,1 Generate sets of this size of selected components, ",
50 " with a flag not to select across model boundaries.",
51 "-closed order,3 Select models based on valency (valency,<n>) or polygon order (order,<n>).",
52 "-fullerene Select fullerene type models.",
53 "-nonfullerene Select non-fullerene type models.",
54 "-fom 0.25 Select: FOM cutoff.",
55 "-fraction 0.6 Select: FOM/FOMmax ratio cutoff.",
56 "-rank 5 Select: Rank components into a number of groups.",
57 "-prune fom Type of pruning: simple, fom, similar, large.",
58 "-minradius 70 Distance criterion for minimal allowed distance from the origin.",
59 "-maxradius 180 Distance criterion for maximal allowed distance from the origin.",
61 "-delete Delete non-selected models and components.",
63 "Actions for finishing:",
64 "-reset Reset selection to all components after other operations.",
67 "-verbose 7 Verbose output.",
68 "-distance 12.8 Distance criterion for pruning or overlap (default 10 angstrom).",
71 "-parameters param.star Input parameter file.",
72 "-overlap file.star Deselect components that overlap with this model (use with -distance).",
73 "-mask mask.pif Select components only within the mask.",
76 "-output file.star Output model parameter file.",
77 "-FOM histogram.ps Postscript output with component FOM distributions.",
82 int main(
int argc,
char **argv)
91 long ncomp_min(0), ncomp_max(0);
99 double fom_fraction(0);
102 Bstring prune_type_string(
"none");
117 for ( curropt = option; curropt; curropt = curropt->
next ) {
118 if ( curropt->
tag ==
"merge" )
merge = 1;
119 if ( curropt->
tag ==
"all" ) all = 1;
120 if ( curropt->
tag ==
"reset" ) reset = 1;
121 if ( curropt->
tag ==
"invert" ) invert = 1;
122 if ( curropt->
tag ==
"select" )
123 mod_select = curropt->
value;
124 if ( curropt->
tag ==
"group" )
125 if ( ( group = curropt->
integer() ) < 1 )
126 cerr <<
"-group: A selection number must be specified!" << endl;
127 if ( curropt->
tag ==
"number" )
128 if ( curropt->
values(ncomp_min, ncomp_max) < 1 )
129 cerr <<
"-number: A number of components must be specified!" << endl;
130 if ( curropt->
tag ==
"delete" ) mod_comp_del = 1;
131 if ( curropt->
tag ==
"sets" )
132 if ( curropt->
values(set_size, set_flag) < 1 )
133 cerr <<
"-sets: A set size must be specified!" << endl;
134 if ( curropt->
tag ==
"closed" ) {
135 if ( curropt->
value[0] ==
'v' ) closure_rule = 1;
136 if ( curropt->
value[0] ==
'o' ) closure_rule = 2;
140 if ( curropt->
tag ==
"fullerene" ) fullerene = 1;
141 if ( curropt->
tag ==
"nonfullerene" ) nonfullerene = 1;
142 if ( curropt->
tag ==
"fom" )
143 if ( ( fom_cutoff = curropt->
value.
real() ) < 0.0001 )
144 cerr <<
"-fom: A FOM cutoff must be specified!" << endl;
145 if ( curropt->
tag ==
"fraction" )
146 if ( ( fom_fraction = curropt->
value.
real() ) < 0.0001 )
147 cerr <<
"-fraction: A fraction must be specified!" << endl;
148 if ( curropt->
tag ==
"rank" )
150 cerr <<
"-rank: A number must be specified!" << endl;
151 if ( curropt->
tag ==
"prune" ) {
152 prune_type_string = curropt->
value;
153 if ( prune_type_string.
length() < 1 )
154 cerr <<
"-prune: A prune type must be specified!" << endl;
156 if ( prune_type_string.
contains(
"simp") ) prune_type = 1;
157 if ( prune_type_string.
contains(
"fom") ) prune_type = 2;
158 if ( prune_type_string.
contains(
"fit") ) prune_type = 3;
159 if ( prune_type_string.
contains(
"simi") ) prune_type = 4;
160 if ( prune_type_string.
contains(
"larg") ) prune_type = 5;
163 if ( curropt->
tag ==
"distance" )
165 cerr <<
"-distance: The overlap distance must be specified!" << endl;
166 if ( curropt->
tag ==
"minradius" )
167 if ( ( minrad = curropt->
value.
real() ) < 1 )
168 cerr <<
"-minradius: The minimum allowed distance from the origin must be specified!" << endl;
169 if ( curropt->
tag ==
"maxradius" )
170 if ( ( maxrad = curropt->
value.
real() ) < 1 )
171 cerr <<
"-maxradius: The maximum allowed distance from the origin must be specified!" << endl;
172 if ( curropt->
tag ==
"parameters" )
174 if ( curropt->
tag ==
"overlap" )
176 if ( curropt->
tag ==
"mask" )
178 if ( curropt->
tag ==
"output" )
180 if ( curropt->
tag ==
"FOM" )
189 while ( optind < argc )
string_add(&file_list, argv[optind++]);
191 cerr <<
"Error: No parameter or image files specified!" << endl;
199 cerr <<
"Error: Input file not read!" << endl;
238 if ( maskfile.
length() ) {
A class for a command line input option.
long model_prune_fom(Bmodel *model, double distance)
Deselects components based on overlap distance and the FOM.
long model_select_number_of_components(Bmodel *model, int ncomp_min, int ncomp_max)
Selects models within a range of the number of components.
long model_select_in_mask(Bmodel *model, Bimage *pmask)
Selects components within a mask.
int string_kill(Bstring *list)
Kills a string linked list.
Header file for reading and writing atomic model files.
long model_prune_similar(Bmodel *model)
Averages similar components and reduces redundancy.
int bexit(int value)
Exit function for cleanup and debugging.
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Header file for option handlers.
long model_merge(Bmodel *model)
Merges components from all models into one.
long model_fom_deselect(Bmodel *model, double fom_cutoff)
Deselects components based on the FOM.
long models_process(Bmodel *model, long(modfunc)(Bmodel *))
Process a list of models using the specified function.
long model_selection_stats(Bmodel *model)
Calculates selection statistics.
long values(T1 &v1, T2 &v2)
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
long model_prune_simple(Bmodel *model, double mindist)
Prunes overlapping components based on a distance criterion.
long model_invert_selection(Bmodel *model)
Inverts the selection of all components.
long model_fom_ranking(Bmodel *model, int nrank)
Ranks components based on the FOM.
Header file for reading reflection files.
long model_delete_non_selected(Bmodel **model)
Deletes selected components and associated links from the model.
int model_kill(Bmodel *model)
Deallocates all memory in the list.
General image parameter class.
Header file for reading and writing atomic model files.
Utilities for timing functions.
long model_select_sets(Bmodel *model, int size, int flag)
Selects sets of components, each set with the same size.
double distance(vector< T1 > &v1, vector< T2 > &v2)
long model_reset_selection(Bmodel *model)
Resets the selection to all components.
long model_select_non_fullerene(Bmodel *model)
Selects non-fullerene type models.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
int write_model(Bstring &filename, Bmodel *model)
Writes model parameters.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
int merge(Bimage *p, int padd)
Pads an image and shifts it to the middle.
Header file for 2D and 3D image I/O.
long model_select_closed(Bmodel *model, int closure_rule, int val_order)
Determines if a polyhedron is closed given a rule.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
Library routines used for model processing.
long model_prune_fit(Bmodel *model, double distance)
Deselects components based on overlap distance and the FOM.
Bmodel * read_model(Bstring &filename)
int main(int argc, char **argv)
long model_fom_max_fraction_deselect(Bmodel *model, double fom_fraction)
Deselects components based on the FOM relative to the maximum FOM.
long model_select_fullerene(Bmodel *model)
Selects fullerene type models.
bool contains(const Bstring &s)
Header file for postscript tools dealing with models.
long models_radius_deselect(Bmodel *model, double minrad, double maxrad)
Deselects components based on the distance from the origin.
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
int ps_model_fom_histogram(Bstring &filename, Bmodel *model)
Postscript plot of the model component FOM histogram.
long model_prune_large(Bmodel *model, double sampling)
Deselects components based on overlap distance and the FOM.
long model_select(Bmodel *model, Bstring &comptype)
Selects models, components and component types.
long model_find_overlap(Bmodel *model, Bstring &reffile, double distance)
Finds the components that overlap with the reference.