 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
27 "Usage: bmodel [options] in1.star [in2.star...]",
28 "----------------------------------------------",
29 "Manipulates models.",
31 "Actions for preparation:",
32 "-addnumber Add numbers to the model id's.",
33 "-merge Merge models in different files rather than concatenate.",
34 "-all Reset selection to all models and components before other selections.",
37 "-select #232@14 Select models and components.",
38 "-number 24,36 Select models based on the number of components.",
39 "-closed order,3 Select models based on valency (valency,<n>) or polygon order (order,<n>).",
40 "-fullerene Select fullerene type models.",
41 "-fom 0.25 Select: FOM cutoff.",
44 "-listmodels List model information in table form.",
45 "-listcomponents List component counts in table form.",
46 "-showmass Show model masses.",
47 "-axes Calculate principal axes.",
48 "-delete B Delete a component type.",
49 "-setfom 0.8 Set the FOM of selected components to a specific value.",
50 "-center Center before all other operations.",
51 "-average 4 Average sequential components and delete all but one in each set.",
52 "-histogram 0.2 FOM histogram with the given step size.",
53 "-id model1 Set model identifier.",
54 "-map image.pif,2 Map and image number associated with model.",
55 "-path ../map Path to map.",
56 "-views local Calculate views for components. Modes: origin: current origin,",
57 " com: center-of-mass origin, map: map origin, local: neigbor plane.",
58 "-invert Invert views for selected components.",
59 "-rdf 1.2 Calculate the radial distribution function with the given sampling (angstrom).",
60 "-curvature Calculate the curvature associated with each component.",
61 "-settype VER Set all component types.",
62 "-associate TRS,trs.pdb Associate a component type with a file name.",
63 "-mass TRS,288.7 Associate a component type with a mass.",
64 "-translate 12.3,95,-10.5 Shift along a vector (x,y,z).",
65 "-rotate 0.5,0,5.8,45 Rotate around a vector (x,y,z) by an angle.",
66 "-scale 1.5,0.8,1 Scale around the origin.",
67 "-reflect 0.4,-.22,0.5 Reflect through a mirror plane defined by the given normal.",
68 "-linklength 56.3 Generate links with this maximum length.",
69 "-setasu D8 Set components to within an asymmetric unit.",
70 "-apply C5 Apply point group symmetry.",
71 "-symmetrize C5 Symmetrize for a point group symmetry.",
73 "Actions for finishing:",
74 "-reset Reset selection to all components before other selections.",
77 "-verbose 7 Verbose output.",
78 "-componentradius 8.4 Set display radius for all components.",
79 "-linkradius 5.1 Set display radius for all links.",
80 "-origin 0,22.5,30 Set the origin for rotation and scaling.",
81 "-separate Each model is defined as a separate molecule group.",
82 "-reference 0,1.5,-0.2,35 Reference symmetry axis and rotation angle (default 0,0,1,0).",
85 "-parameters param.star Input parameter file.",
89 "-output file.star Output model parameter file.",
90 "-split 3 Split models into individual files:",
91 " Argument: 1-6: number of digits inserted before extension",
92 " Argument: \"id\": model ID's are used as file names.",
93 "-coordinates all.pdb Output coordinate files.",
98 int main(
int argc,
char **argv)
110 long ncomp_min(0), ncomp_max(0);
118 double fom_cutoff(0);
126 double rdf_interval(0);
130 double associate_mass(0);
134 double linklength(0);
154 for ( curropt = option; curropt; curropt = curropt->
next ) {
155 if ( curropt->
tag ==
"addnumber" ) num_id = 1;
156 if ( curropt->
tag ==
"all" ) all = 1;
157 if ( curropt->
tag ==
"merge" )
merge = 1;
158 if ( curropt->
tag ==
"reset" ) reset = 1;
159 if ( curropt->
tag ==
"select" )
160 mod_select = curropt->
value;
161 if ( curropt->
tag ==
"listmodels" ) list_models = 1;
162 if ( curropt->
tag ==
"listcomponents" ) list_comps = 1;
163 if ( curropt->
tag ==
"showmass" ) show_mass = 1;
164 if ( curropt->
tag ==
"axes" ) show_axes = 1;
165 if ( curropt->
tag ==
"number" )
166 if ( curropt->
values(ncomp_min, ncomp_max) < 1 )
167 cerr <<
"-number: A number of components must be specified!" << endl;
168 if ( curropt->
tag ==
"closed" ) {
169 if ( curropt->
value[0] ==
'v' ) closure_rule = 1;
170 if ( curropt->
value[0] ==
'o' ) closure_rule = 2;
174 if ( curropt->
tag ==
"fullerene" ) fullerene = 1;
175 if ( curropt->
tag ==
"delete" )
176 comp_delete = curropt->
value;
177 if ( curropt->
tag ==
"setfom" )
178 if ( ( setfom = curropt->
value.
real() ) < 0.001 )
179 cerr <<
"-setfom: A FOM value must be specified!" << endl;
180 if ( curropt->
tag ==
"center" ) center = 1;
181 if ( curropt->
tag ==
"average" )
183 cerr <<
"-average: A number of components must be specified!" << endl;
184 if ( curropt->
tag ==
"fom" )
185 if ( ( fom_cutoff = curropt->
value.
real() ) < 0.001 )
186 cerr <<
"-fom: A FOM cutoff must be specified!" << endl;
187 if ( curropt->
tag ==
"histogram" )
188 if ( ( fom_step = curropt->
value.
real() ) < 0.001 )
189 cerr <<
"-histogram: A FOM step size must be specified!" << endl;
190 if ( curropt->
tag ==
"id" ) {
191 model_id = curropt->
value;
192 if ( model_id.
length() < 1 )
193 cerr <<
"-id: An identifier must be specified!" << endl;
195 if ( curropt->
tag ==
"map" ) {
196 map_name = curropt->
value;
197 img_num = (map_name.
post(
',')).integer();
198 map_name = map_name.
pre(
',');
199 if ( map_name.
length() < 1 )
200 cerr <<
"-map: A file name must be specified!" << endl;
202 if ( curropt->
tag ==
"path" ) map_path = curropt->
value;
203 if ( curropt->
tag ==
"views" ) calc_views = curropt->
value.
lower();
204 if ( curropt->
tag ==
"invert" ) inv_views = 1;
205 if ( curropt->
tag ==
"rdf" )
206 if ( ( rdf_interval = curropt->
value.
real() ) < 0.1 )
207 cerr <<
"-rdf: A sampling interval must be specified!" << endl;
208 if ( curropt->
tag ==
"curvature" ) curvature = 1;
209 if ( curropt->
tag ==
"associate" ) {
210 astr = curropt->
value;
211 associate_type = astr.
pre(
',');
212 associate_file = astr.
post(
',');
215 if ( curropt->
tag ==
"mass" ) {
216 astr = curropt->
value;
217 associate_type = astr.
pre(
',');
218 astr = astr.
post(
',');
222 if ( curropt->
tag ==
"settype" )
223 set_type = curropt->
value;
224 if ( curropt->
tag ==
"origin" )
226 if ( curropt->
tag ==
"reference" )
227 ref_view = curropt->
view();
228 if ( curropt->
tag ==
"translate" ) {
230 if ( shift.
length() < 0.1 )
231 cerr <<
"-translate: Three values must be specified!" << endl;
233 if ( curropt->
tag ==
"rotate" ) {
236 cerr <<
"-rotate: All three vector elements and an angle must be specified!" << endl;
242 if ( curropt->
tag ==
"scale" ) {
244 for ( i=0; i<3 && scale[i]; i++ ) ;
246 cerr <<
"-scale: At least one scale value must be specified!" << endl;
248 if ( i == 1 ) scale[2] = scale[1] = scale[0];
249 else if ( i == 2 ) scale[2] = 1;
252 if ( curropt->
tag ==
"reflect" ) {
254 if ( reflect.
length() < 0 )
255 cerr <<
"-reflect: A mirror plane normal must be specified!" << endl;
257 if ( curropt->
tag ==
"linklength" )
258 if ( ( linklength = curropt->
value.
real() ) < 1 )
259 cerr <<
"-linklength: A link length must be specified!" << endl;
260 if ( curropt->
tag ==
"componentradius" )
261 if ( ( comprad = curropt->
value.
real() ) < 1 )
262 cerr <<
"-componentradius: A display radius must be specified!" << endl;
263 if ( curropt->
tag ==
"linkradius" )
264 if ( ( linkrad = curropt->
value.
real() ) < 1 )
265 cerr <<
"-linkradius: A radius must be specified!" << endl;
266 if ( curropt->
tag ==
"parameters" )
268 if ( curropt->
tag ==
"setasu" )
270 if ( curropt->
tag ==
"apply" )
272 if ( curropt->
tag ==
"symmetrize" )
274 if ( curropt->
tag ==
"output" )
276 if ( curropt->
tag ==
"split" ) {
279 cerr <<
"-split: An integer must be specified!" << endl;
283 if ( curropt->
tag ==
"coordinates" )
292 while ( optind < argc )
string_add(&file_list, argv[optind++]);
294 cerr <<
"Error: No model files specified!" << endl;
302 cerr <<
"Error: Input file not read!" << endl;
320 if ( map_name.
length() ) {
324 }
else if ( map_path.
length() ) {
330 if ( associate_file.
length() )
333 if ( associate_mass > 0 )
368 if ( symmetry_apply_string.
length() > 0 )
371 if ( symmetrize_string.
length() > 0 )
A class for a command line input option.
double get_option_mass(Bstring &optarg)
Returns the adjusted mass based on the added character.
int model_associate_mass(Bmodel *model, Bstring &associate_type, double mass)
Associates a mass with a component type.
long model_invert_views(Bmodel *model)
Invert views.
int model_check(Bmodel *model, Bstring path)
Checks model properties.
long model_list_comp(Bmodel *model)
Lists models with component counts in table form.
long model_select_number_of_components(Bmodel *model, int ncomp_min, int ncomp_max)
Selects models within a range of the number of components.
int string_kill(Bstring *list)
Kills a string linked list.
int main(int argc, char **argv)
Header file for reading and writing atomic model files.
Vector3< double > model_principal_axes(Bmodel *model, Vector3< double > *eigenvec)
Calculates the principal axes of a model.
long model_set_link_radius(Bmodel *model, double linkrad)
Set the display radius for all links to a specific value.
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.
Library routines used for model symmetry operations.
Header file for option handlers.
long model_merge(Bmodel *model)
Merges components from all models into one.
long model_radial_distribution(Bmodel *model, double interval)
Calculates the radial distribution function of a model.
long model_fom_deselect(Bmodel *model, double fom_cutoff)
Deselects components based on the FOM.
Vector3< double > origin()
Library routines used for model link processing.
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 model_fom_histogram(Bmodel *model, double fom_step)
Selects components based on the FOM.
long values(T1 &v1, T2 &v2)
int model_kill(Bmodel *model)
Deallocates all memory in the list.
long model_link_list_generate(Bmodel *model, double maxlength)
Generates a link list for a model based on vertex separation.
Header file for reading and writing atomic model files.
Utilities for timing functions.
long model_calculate_views(Bmodel *model, Bstring &mode)
Calculates the views associated with each component.
vector< double > split_into_doubles(const Bstring &delim)
long model_mass_all(Bmodel *model)
Calculates the masses of all the models in the list.
long model_reset_selection(Bmodel *model)
Resets the selection to all components.
Bstring symmetry_string()
long model_set_fom(Bmodel *model, double fom)
Set the FOM of selected components to a specific value.
double timer_start()
Starts timer and prints the time.
long model_symmetrize(Bmodel *model, Bstring &symmetry_string)
Symmetrize a model.
Header file for general utilities.
long model_find_asymmetric_unit(Bmodel *model, Bstring &symmetry_string)
Set model component locations within the asymmetric unit.
int write_model(Bstring &filename, Bmodel *model)
Writes model parameters.
vector< string > split(const string &s)
Splits a string on whitespace.
int model_curvature(Bmodel *model)
Calculates the curvature associated with each link.
Vector3< double > vector3()
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Library routines used for analysing model component views.
int merge(Bimage *p, int padd)
Pads an image and shifts it to the middle.
long model_delete_comp_type(Bmodel *model, Bstring &comptype)
Deletes components based on their types.
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.
long model_average_components(Bmodel *model, int number)
Averages sequential components.
Library routines used for model processing.
Bmodel * read_model(Bstring &filename)
int model_set_type(Bmodel *model, Bstring &set_type)
Reset the component types.
long model_select_fullerene(Bmodel *model)
Selects fullerene type models.
bool contains(const Bstring &s)
long model_set_component_radius(Bmodel *model, double comprad)
Set the display radius for all components to a specific value.
int model_associate(Bmodel *model, Bstring &associate_type, Bstring &associate_file)
Associates a model file with a component type.
long model_apply_point_group(Bmodel *model, Bstring &symmetry_string, Vector3< double > origin, View ref_view, int flags=0)
Applying symmetry to model components.
Library routines used for shell model processing.
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
long model_list(Bmodel *model)
Lists models in table form.
long model_number_ids(Bmodel *model)
Add a number to each model id.
long model_select(Bmodel *model, Bstring &comptype)
Selects models, components and component types.