 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
29 "Usage: bshell [options] in1.star [in2.star ...]",
30 "-----------------------------------------------",
31 "Generates and operates on shell models.",
33 "Actions for creation action:",
34 "-shell 134.2 Generate a shell with the given radius.",
35 "-dodecahedron 215,3,0.3 Generate an dodecahedral shell with the given radius and divisions,",
36 " and a fraction to make it spherical.",
37 "-icosahedron 238.5,3,0.5 Generate an icosahedral shell with the given radius and divisions,",
38 " and a fraction to make it spherical.",
39 "-circle 527,243 Generate a circle with the given radius and z offset.",
40 "-ellipse 620.5,314.9,5.2 Generate an ellipse with the given x and y semi-axes lengths and z offset.",
41 "-ellipsoid 24.3,51.2,68 Generate an ellipsoid with the given x,y,z semi-axes.",
42 "-cylinder 0,1,0,88.3,155 Generate a cylinder with the given direction, radius and length.",
43 "-add -14.7 Add a shell offset by a radial distance from selected components.",
44 "-fromcomponents 18.6,1 Generate shells from components with given radius and flag for 2D.",
47 "-merge Merge models into one after all other operations.",
48 "-guide poly.star Input guide polyhedron to adjust the shell model.",
49 "-linklength 56.3 Generate links with this maximum length for the sphere model.",
50 "-views local Calculate views for components. Modes: origin: current origin,",
51 " com: center-of-mass origin, map: map origin, local: neigbor plane.",
52 "-rdf 1.2 Calculate the radial distribution function with the given sampling (angstrom).",
53 "-fit 15.6,200,1 Fits a shell model to a map using the given resolution limits,",
54 " and a flag to indicate negative contrast.",
55 "-radial Calculate a radial profile based on a shell model.",
56 "-powerspectrum out.map Calculate 2D power spectra around components in the shell.",
59 "-all Reset selection to all models and components before other selections.",
60 "-select #Mod1@14 Select models and components.",
63 "-verbose 7 Verbose output.",
64 "-id model1 Set model identifier.",
65 "-newtype MEM Type for all new components.",
66 "-componentradius 0.5 Component display radius.",
67 "-linkradius 0.5 Link display radius.",
69 "Parameters for generating a model:",
70 "-points 152 Number of points.",
71 "-separation 2.5 Separation distance between points.",
73 "Parameter for adjusting to a guide model:",
74 "-fraction 0.6 Fraction of adjustment to a guide model (default 1).",
75 "-curved Flag to indicate curved hull or shell surface (default not).",
77 "Parameters for power spectra:",
78 "-size 45,40,20 Size of densities to extract (default 20,20,20 voxels).",
79 "-origin 0.8,-10,15.7 Set the origin for extracted densities.",
80 "-fftsize 256 Size of power spectrum (default from images).",
81 "-resolution 20,360 High and low resolution limits for cross-correlation (angstrom).",
82 "-annuli 2,95 Real space annular limits (default 0,inf pixels).",
85 "-parameters param.star Input parameter file.",
86 "-map file.map Input map file to associate with shell model.",
89 "-output file.star Output model parameter file.",
94 int main(
int argc,
char **argv)
99 double shell_radius(-1);
100 int dod_divisions(0);
101 int ico_divisions(0);
102 double sphere_fraction(0);
103 double circle_radius(0);
104 double circle_offset(0);
108 double cyl_rad(0), cyl_len(0);
109 double add_distance(0);
110 double comp2shell(0), twod(0);
111 double linklength(0);
113 double rdf_interval(0);
117 double hires(0), lores(1e6);
124 double compradius(0);
125 double linkradius(0);
126 double separation(0);
127 double guide_fraction(1);
142 for ( curropt = option; curropt; curropt = curropt->
next ) {
143 if ( curropt->
tag ==
"merge" )
merge = 1;
144 if ( curropt->
tag ==
"shell" )
145 if ( ( shell_radius = curropt->
value.
real() ) < 0.001 )
146 cerr <<
"-shell: The radius must be specified!" << endl;
147 if ( curropt->
tag ==
"dodecahedron" ) {
148 if ( curropt->
values(shell_radius, dod_divisions, sphere_fraction) < 1 )
149 cerr <<
"-dodecahedron: The radius and divisions must be specified!" << endl;
150 else if ( dod_divisions < 1 ) dod_divisions = 1;
152 if ( curropt->
tag ==
"icosahedron" ) {
153 if ( curropt->
values(shell_radius, ico_divisions, sphere_fraction) < 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 ellipse_semi_z = curropt->
vector3();
162 if ( ellipse_semi_z.
length() < 1 )
163 cerr <<
"-ellipse: The major and minor semiaxes must be specified!" << endl;
165 if ( curropt->
tag ==
"ellipsoid" ) {
166 ellipsoid_semi = curropt->
vector3();
167 if ( ellipsoid_semi.
volume() < 1 )
168 cerr <<
"-ellipsoid: The 3 semiaxes must be specified!" << endl;
170 if ( curropt->
tag ==
"cylinder" ) {
173 cerr <<
"-cylinder: All 5 parameters must be specified!" << endl;
180 if ( curropt->
tag ==
"add" )
181 if ( ( add_distance = curropt->
value.
real() ) < 0.001 )
182 cerr <<
"-add: A distance must be specified!" << endl;
183 if ( curropt->
tag ==
"fromcomponents" )
184 if ( curropt->
values(comp2shell, twod) < 1 )
185 cerr <<
"-fromcomponents: A distance must be specified!" << endl;
186 if ( curropt->
tag ==
"guide" )
188 if ( curropt->
tag ==
"linklength" )
189 if ( ( linklength = curropt->
value.
real() ) < 1 )
190 cerr <<
"-linklength: A link length must be specified!" << endl;
191 if ( curropt->
tag ==
"views" ) calc_views = curropt->
value.
lower();
192 if ( curropt->
tag ==
"rdf" )
193 if ( ( rdf_interval = curropt->
value.
real() ) < 0.1 )
194 cerr <<
"-rdf: A sampling interval must be specified!" << endl;
195 if ( curropt->
tag ==
"fit" ) {
196 if ( curropt->
values(hires, lores, neg_flag) < 1 )
197 cerr <<
"-fit: A high resolution limit must be specified!" << endl;
201 if ( curropt->
tag ==
"radial" ) radial = 1;
202 if ( curropt->
tag ==
"all" ) reset = 1;
203 if ( curropt->
tag ==
"select" )
204 mod_select = curropt->
value;
205 if ( curropt->
tag ==
"id" ) {
206 model_id = curropt->
value;
207 if ( model_id.
length() < 1 )
208 cerr <<
"-id: An identifier must be specified!" << endl;
210 if ( curropt->
tag ==
"newtype" ) {
211 nutype = curropt->
value;
212 if ( nutype.
length() < 1 )
213 cerr <<
"-newtype: An type identifier must be specified!" << endl;
215 if ( curropt->
tag ==
"componentradius" )
216 if ( ( compradius = curropt->
value.
real() ) < 1 )
217 cerr <<
"-componentradius: The component display radius must be specified!" << endl;
218 if ( curropt->
tag ==
"linkradius" )
219 if ( ( linkradius = curropt->
value.
real() ) < 1 )
220 cerr <<
"-linkradius: The link display radius must be specified!" << endl;
221 if ( curropt->
tag ==
"points" )
223 cerr <<
"-points: The number of points must be specified!" << endl;
224 if ( curropt->
tag ==
"separation" )
225 if ( ( separation = curropt->
value.
real() ) < 0.001 )
226 cerr <<
"-separation: The separation distance must be specified!" << endl;
227 if ( curropt->
tag ==
"fraction" )
228 if ( ( guide_fraction = curropt->
value.
real() ) < 0.001 )
229 cerr <<
"-fraction: A fraction must be specified!" << endl;
230 if ( curropt->
tag ==
"curved" ) curv_flag = 1;
231 if ( curropt->
tag ==
"size" )
232 size = curropt->
size();
233 if ( curropt->
tag ==
"origin" )
234 origin = curropt->
origin();
235 if ( curropt->
tag ==
"fftsize" )
237 cerr <<
"-fftsize: A Fourier transform size must be specified!" << endl;
238 if ( curropt->
tag ==
"resolution" ) {
239 if ( curropt->
values(hires, lores) < 1 )
240 cerr <<
"-resolution: At least one resolution limit must be specified!" << endl;
242 if ( lores < hires ) swap(hires, lores);
244 if ( curropt->
tag ==
"annuli" )
245 if ( curropt->
values(ann_min, ann_max) < 1 )
246 cerr <<
"-annuli: At least a minimum annulus must be specified!" << endl;
247 if ( curropt->
tag ==
"parameters" )
249 if ( curropt->
tag ==
"map" )
251 if ( curropt->
tag ==
"output" )
253 if ( curropt->
tag ==
"powerspectrum" )
267 while ( optind < argc )
string_add(&file_list, argv[optind++]);
273 cerr <<
"Error: Input file not read!" << endl;
285 if ( shell_radius >= 0 ) {
286 if ( dod_divisions > 0 )
288 else if ( ico_divisions > 0 )
292 }
else if ( circle_radius > 0) {
294 }
else if ( ellipse_semi_z[0] > 0 && ellipse_semi_z[1] > 0) {
296 }
else if ( ellipsoid_semi.
volume() > 0) {
298 }
else if ( cyl_len > 0 ) {
303 cerr <<
"Error: Ellipsoid model not generated!" << endl;
308 else if (
model != sph ) {
321 if ( model_id.
length() ) sph->
id = model_id;
344 if ( guide && guide_fraction > 0 )
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.
int main(int argc, char **argv)
int string_kill(Bstring *list)
Kills a string linked list.
Header file for reading and writing atomic model files.
Bimage * model_shell_power_spectrum(Bmodel *model, Vector3< long > size, Vector3< double > origin, int ft_size, int ann_min, int ann_max, double hires, double lores)
Calculates a radial profile from a shell model.
long model_set_link_radius(Bmodel *model, double linkrad)
Set the display radius for all links to a specific value.
int model_shell_fit(Bmodel *model, double hires, double lores, int neg)
Fits a shell model as a rigid body to a map.
int bexit(int value)
Exit function for cleanup and debugging.
Header file for model to map conversions.
long model_add_shell(Bmodel *model, double add_distance, Bstring &new_type)
Adds a shell to a model using selected components.
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_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.
Vector3< double > origin()
Library routines used for model link processing.
long model_selection_stats(Bmodel *model)
Calculates selection statistics.
long values(T1 &v1, T2 &v2)
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
Library routines used for model creation.
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.
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_calculate_views(Bmodel *model, Bstring &mode)
Calculates the views associated with each component.
vector< double > split_into_doubles(const Bstring &delim)
long model_reset_selection(Bmodel *model)
Resets the selection to all components.
Bmodel * model_create_dodecahedron(double radius, long divisions, double sphere_fraction)
Creates an dodecahedron point model.
int model_adjust_shell_to_guide(Bmodel *model, Bmodel *gmod, double fraction, int curv_flag)
Adjusts a shell model to the faces of a polyhedral guide 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_components_to_shells(Bmodel *model, double distance, Bstring &nutype, int twod)
Generates a new set of models by vonverting each component to a shell model.
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.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
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_set_component_radius(Bmodel *model, double comprad)
Set the display radius for all components to a specific value.
Bmodel * model_create_icosahedron(double radius, long divisions, double sphere_fraction)
Creates an icosahedron point model.
int model_shell_radial_profile(Bmodel *model)
Calculates a radial profile from a shell model.
Library routines used for shell model processing.
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.
long model_select(Bmodel *model, Bstring &comptype)
Selects models, components and component types.