 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
28 "Usage: bmodedit [options] in.star",
29 "---------------------------------",
31 "The size of a new model is defined by the -distance option (except -gaussian).",
32 "If input files are specified, the new model is added or the new components replace old ones.",
34 "Actions for creation:",
35 "-create mod1 New model with the given ID.",
36 "-symmetry O-3 New model type based on symmetry (T, O and I).",
39 "-shell 134.2 Generate a spherical shell with the given radius.",
40 "-fibonacci 244,50 Generate a fibonacci sphere: number of components and radius.",
41 "-icosahedron 238.5,3,1 Generate an icosahedral shell with the given radius and divisions,",
42 " and a flag to make it spherical.",
43 "-circle 527,243 Generate a circle with the given radius and z offset.",
44 "-ellipse 620.5,314.9,5.2 Generate an ellipse with the given x and y semi-axes lengths and z offset.",
45 "-ellipsoid 24.3,51.2,68 Generate an ellipsoid with the given x,y,z semi-axes.",
46 "-cylinder 88.3,155 Generate a cylinder with the given radius and length.",
47 "-spindle 88.3,9.5 Generate a spindle with the radius and packing separation.",
48 "-randomfill 56 Random model with a number of non-overlapping components (use with -componentradius).",
49 "-randomshell 87 Random model with a number of components on a shell.",
50 "-gaussian 44,30.7 Random model with a number of gaussian distributed components and standard deviation.",
51 "-peaks cc.map Generate a model from peaks in a map.",
54 "-all Reset selection to all models and components before other selections.",
55 "-replace Replace existing components with newly created ones (default add).",
56 "-reduce submod.star Replace each set of linked components with one new component and write sub-model file.",
57 "-id model1 Set model identifier.",
58 "-settype VER Set all component types.",
59 "-changetype VER,KRN Change component type name.",
60 "-add -56,3.45,-123 Add a component (define model with -id and type with -settype).",
61 "-associate TRS,trs.pdb Associate a component type with a file name.",
62 "-linklength 56.3 Generate links with this maximum length.",
63 "-rdf 1.2 Calculate the radial distribution function with the given sampling (angstrom).",
64 "-consolidate 85.4 Consolidate models: components are considered the same if within the given distance.",
67 "-verbose 7 Verbosity of output.",
68 "-distance 54.7 Component distance from origin (default 100 angstrom).",
69 "-helix 31.6,43.2,35 Helix with given rise, rotation angle and number of components.",
70 "-direction 0.2,-0.5,0.3 Direction vector (for -cylinder and -spindle).",
71 "-componentradius 0.5 Component display radius (angstrom).",
72 "-linkradius 0.5 Link display radius (angstrom).",
73 "-color 0.1,0.5,0.2,1 Color new models.",
75 "Parameters for generating a model:",
76 "-points 152 Number of points.",
77 "-separation 2.5 Separation distance between points.",
80 "-parameters param.star Input parameter file.",
81 "-map file.map Input map file to associate with shell model.",
84 "-output newmod.star New model file.",
85 "-catenate catmap.pif New file name for catenated model maps.",
90 int main(
int argc,
char **argv)
95 double shell_radius(-1);
99 double circle_radius(0);
100 double circle_offset(0);
104 double cyl_rad(0), cyl_len(0);
105 double spindle_rad(0), packing(0);
120 double linklength(0);
121 double rdf_interval(0);
122 double consolidate(0);
123 double model_radius(100);
124 double helix_rise(0);
125 double helix_angle(0);
127 double compradius(0);
128 double linkradius(0);
132 double separation(0);
142 for ( curropt = option; curropt; curropt = curropt->
next ) {
143 if ( curropt->
tag ==
"create" ) create = curropt->
value;
144 if ( curropt->
tag ==
"symmetry" )
146 if ( curropt->
tag ==
"shell" )
147 if ( ( shell_radius = curropt->
value.
real() ) < 1 )
148 cerr <<
"-shell: The radius must be specified!" << endl;
149 if ( curropt->
tag ==
"fibonacci" )
150 if ( curropt->
values(fibonacci, points) < 1 )
151 cerr <<
"-fibonacci: The number of components must be specified!" << endl;
152 if ( curropt->
tag ==
"icosahedron" ) {
153 if ( curropt->
values(shell_radius, ico_divisions, sphere_flag) < 1 )
154 cerr <<
"-icosahedron: The radius and divisions must be specified!" << endl;
155 else if ( ico_divisions < 1 ) ico_divisions = 1;
157 if ( curropt->
tag ==
"circle" )
158 if ( curropt->
values(circle_radius, circle_offset) < 1 )
159 cerr <<
"-circle: The circle radius must be specified!" << endl;
160 if ( curropt->
tag ==
"ellipse" )
161 if ( curropt->
values(ellipse_semi_z[0], ellipse_semi_z[1],
162 ellipse_semi_z[2]) < 2 )
163 cerr <<
"-ellipse: The major and minor semiaxes must be specified!" << endl;
164 if ( curropt->
tag ==
"ellipsoid" )
165 if ( curropt->
values(ellipsoid_semi[0], ellipsoid_semi[1],
166 ellipsoid_semi[2]) < 3 )
167 cerr <<
"-ellipsoid: The 3 semiaxes must be specified!" << endl;
168 if ( curropt->
tag ==
"cylinder" )
169 if ( curropt->
values(cyl_rad, cyl_len) < 2 )
170 cerr <<
"-cylinder: Both radius and length must be specified!" << endl;
171 if ( curropt->
tag ==
"spindle" )
172 if ( curropt->
values(spindle_rad, packing) < 2 )
173 cerr <<
"-spindle: Both radius and packing separation must be specified!" << endl;
174 if ( curropt->
tag ==
"randomfill" )
176 cerr <<
"-randomfill: The number of components must be specified!" << endl;
177 if ( curropt->
tag ==
"randomshell" ) {
179 cerr <<
"-randomshell: The number of components must be specified!" << endl;
180 else model_shell = 1;
182 if ( curropt->
tag ==
"gaussian" )
183 if ( curropt->
values(ncomp, model_std) < 2 )
184 cerr <<
"-gaussian: The number of components and standard deviation must be specified!" << endl;
185 if ( curropt->
tag ==
"all" ) all = 1;
187 if ( curropt->
tag ==
"reduce" )
189 if ( curropt->
tag ==
"id" ) {
190 model_id = curropt->
value;
191 if ( model_id.
length() < 1 )
192 cerr <<
"-id: An identifier must be specified!" << endl;
194 if ( curropt->
tag ==
"settype" )
195 set_type = curropt->
value;
196 if ( curropt->
tag ==
"changetype" )
197 change_type = curropt->
value;
198 if ( curropt->
tag ==
"associate" ) {
199 astr = curropt->
value;
200 associate_type = astr.
pre(
',');
201 associate_file = astr.
post(
',');
204 if ( curropt->
tag ==
"peaks" )
206 if ( curropt->
tag ==
"add" ) {
207 if ( curropt->
values(newloc[0], newloc[1], newloc[2]) < 3 )
208 cerr <<
"-add: Three coordinates must be specified!" << endl;
212 if ( curropt->
tag ==
"linklength" )
213 if ( ( linklength = curropt->
value.
real() ) < 0.1 )
214 cerr <<
"-linklength: A link length must be specified!" << endl;
215 if ( curropt->
tag ==
"rdf" )
216 if ( ( rdf_interval = curropt->
value.
real() ) < 0.001 )
217 cerr <<
"-rdf: A sampling interval must be specified!" << endl;
218 if ( curropt->
tag ==
"consolidate" )
219 if ( ( consolidate = curropt->
real() ) < 1 )
220 cerr <<
"-consolidate: A cutoff distance must be specified!" << endl;
221 if ( curropt->
tag ==
"distance" )
222 if ( ( model_radius = curropt->
value.
real() ) < 1 )
223 cerr <<
"-distance: A value must be specified!" << endl;
224 if ( curropt->
tag ==
"helix" ) {
225 if ( curropt->
values(helix_rise, helix_angle, helix_comp) < 3 )
226 cerr <<
"-helix: The rise, angle and number must be specified!" << endl;
228 helix_angle *=
M_PI/180.0;
230 if ( curropt->
tag ==
"direction" )
232 if ( curropt->
tag ==
"componentradius" )
233 if ( ( compradius = curropt->
value.
real() ) < 0.1 )
234 cerr <<
"-componentradius: The component display radius must be specified!" << endl;
235 if ( curropt->
tag ==
"linkradius" )
236 if ( ( linkradius = curropt->
value.
real() ) < 0.1 )
237 cerr <<
"-linkradius: The link display radius must be specified!" << endl;
238 if ( curropt->
tag ==
"color" ) {
240 color[0], color[1], color[2], color[3]) < 3 ) {
241 cerr <<
"-color: At least three color values must be specified!" << endl;
246 if ( curropt->
tag ==
"points" )
248 cerr <<
"-points: The number of points must be specified!" << endl;
249 if ( curropt->
tag ==
"separation" )
250 if ( ( separation = curropt->
value.
real() ) < 0.1 )
251 cerr <<
"-separation: The separation distance must be specified!" << endl;
252 if ( curropt->
tag ==
"parameters" )
254 if ( curropt->
tag ==
"map" )
256 if ( curropt->
tag ==
"output" )
258 if ( curropt->
tag ==
"catenate" )
272 while ( optind < argc )
string_add(&file_list, argv[optind++]);
282 if ( !map )
bexit(-1);
287 if ( symmetry_string.
length() ) {
288 if ( symmetry_string.
contains(
"H") ) {
289 newmod =
model_helix(model_radius, helix_rise, helix_angle, helix_comp);
298 }
else if ( ncomp > 0 ) {
299 if ( model_std > 0 ) {
301 }
else if ( model_shell ) {
307 }
else if ( fibonacci > 0 ) {
309 }
else if ( shell_radius >= 0 ) {
310 if ( ico_divisions > 0 )
314 }
else if ( circle_radius > 0) {
316 }
else if ( ellipse_semi_z[0] > 0 && ellipse_semi_z[1] > 0) {
318 }
else if ( ellipsoid_semi.
volume() > 0) {
320 }
else if ( cyl_len > 0) {
322 }
else if ( spindle_rad > 0 && packing > 0) {
326 if ( model_id.
length() ) newmod->
id = model_id;
327 else model_id =
"create";
331 if ( associate_file.
length() )
336 if ( mapfile.
length() ) newmod->
fmap = mapfile;
345 if ( mp ) mp->
next = newmod;
A class for a command line input option.
Bmodel * model_create_ellipsoid(Vector3< double > axes, double distance)
Creates an ellipsoid with given semiaxes and component separation.
Bmodel * model_from_peaks(Bimage *p, double threshold, int wrap)
Generates a model from peaks in a map.
int string_kill(Bstring *list)
Kills a string linked list.
int replace(fstream *fin, char *rstring1, char *rstring2)
Header file for reading and writing atomic model files.
Bmodel * model_random_gaussian(long ncomp, double std)
Generates components at random gaussian-distributed locations and with random views.
int model_change_type(Bmodel *model, Bstring &change_type)
Change a component type name.
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.
Header file for model to map conversions.
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.
Bmodel * model_create_circle(double radius, double z, double distance)
Creates a circle with the given radius, height, and component separation.
long model_radial_distribution(Bmodel *model, double interval)
Calculates the radial distribution function of a model.
Bmodel * model_create_spindle(Vector3< double > direction, double radius, double separation, double packing)
Creates a spindle packed inside a sphere.
Functions to compare models and components.
int main(int argc, char **argv)
Library routines used for model link processing.
long models_process(Bmodel *model, long(modfunc)(Bmodel *))
Process a list of models using the specified function.
Bmodel * model_init(Bstring &id)
Initializes a model structure.
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.
Bmodel * model_random_shell(long ncomp, double radius)
Generates random components on a shell.
Library routines used for model creation.
int model_color_uniformly(Bmodel *model, RGBA< float > color)
Colors model components uniformly.
int model_kill(Bmodel *model)
Deallocates all memory in the list.
int model_catenate_maps(Bmodel *model, Bstring &filename)
Concatenates all model maps into one multi-image file.
long model_link_list_generate(Bmodel *model, double maxlength)
Generates a link list for a model based on vertex separation.
General image parameter class.
Header file for reading and writing atomic model files.
Utilities for timing functions.
Bmodel * model_create_ellipse(Vector3< double > axes, double distance)
Creates an ellipse with given semiaxes and component separation.
long model_reset_selection(Bmodel *model)
Resets the selection to all components.
Bstring symmetry_string()
Header file for searching for a template in a map and returning multiple hits in a model.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
int write_model(Bstring &filename, Bmodel *model)
Writes model parameters.
Bmodel * model_create_cylinder(Vector3< double > direction, double radius, double length, double distance)
Creates a cylinder with the given radius, length, and component separation.
Vector3< double > vector3()
Bmodel * model_platonic(Bsymmetry *sym, double radius)
Generates a platonic polyhedron.
Bsymmetry * init_point_group_symmetry(Bstring symmetry_string)
Sets up a symmetry structure from a string identifier.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Bmodel * model_create_fibonacci_sphere(long number, double radius)
Creates a Fibonacci sphere point model.
int kill_symmetry(Bsymmetry *sym)
Deallocates a symmetry structure.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
Library routines used for model processing.
Bmodel * read_model(Bstring &filename)
Bcomponent * model_add_component(Bmodel *model, Bstring &id, Bstring &type, Vector3< double > loc)
Adds a component to a model.
int model_set_type(Bmodel *model, Bstring &set_type)
Reset the component types.
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.
long model_consolidate(Bmodel *model, double distance)
Consolidates close components within a model.
int model_associate(Bmodel *model, Bstring &associate_type, Bstring &associate_file)
Associates a model file with a component type.
Bmodel * model_random(long ncomp, double comp_radius, double max_radius)
Generates components at random non-overlapping locations and with random views.
Bmodel * model_create_icosahedron(double radius, long divisions, double sphere_fraction)
Creates an icosahedron point model.
long model_replace_components(Bmodel *model, Bmodel *modref)
Replaces all components in a model with reference components.
long model_reduce_linked(Bmodel *model, Bstring &submodname, int flags)
Reduces a model to one component per linked set of components.
Functions to color models.
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
Bmodel * model_create_shell(long number, double radius, double distance)
Creates a sphere point model.
Bmodel * model_helix(double radius, double helix_rise, double helix_angle, long ncomp)
Generates a helix model.