 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
26 "Usage: bsf [options] out.pdb out.hkl",
27 "------------------------------------",
28 "Calculates structure factors from atomic models.",
29 "A coordinate file is required.",
30 "If a structure factor file is given, it is compared to the calculated structure factors.",
33 "-select CA Atom selection (default all).",
34 "-chains B,G,O,Z Select chains or molecules by ID (default all).",
37 "-center Center coordinates before calculations.",
38 "-realspace Transform the output back to real space.",
39 "-scatter 300 Correct scattering intensities for the given acceleration voltage.",
42 "-verbose 7 Verbosity of output.",
43 "-size 100,80,70 Size (default automatic voxels).",
44 "-origin 0,0,0 Origin placement within image (default 0,0,0).",
45 "-sampling 2.5,2.5,2.5 Sampling (default 1 angstrom/voxel).",
46 "-resolution 3 Resolution (default 0.1 angstrom).",
47 "-wrap Wrap around periodic boundaries (default off).",
48 "-Bfactor 30 Global B-factor (default 0 angstrom squared).",
49 "-symmetry 1 Space group (default 1).",
50 "-unitcell 50,50,50,90,90,90 Unit cell parameters (angstrom & degrees).",
51 "-curves C,Au,Mn,H Selection of elements for scattering curve output.",
54 "-coordinates file.pdb Input coordinate file.",
55 "-hkl file.hkl Input structure factor file.",
56 "-parameters scat.star Scattering factor parameter file.",
59 "-output outfile.txt File for scattering curve output (use with -curves option).",
64 int main(
int argc,
char **argv)
70 int set_backtransform(0);
76 double resolution(0.1);
90 for ( curropt = option; curropt; curropt = curropt->
next ) {
91 if ( curropt->
tag ==
"select" ) {
92 atom_select = curropt->
value;
93 if ( atom_select.
length() < 1 )
94 cerr <<
"-select: A selection must be specified!" << endl;
96 if ( curropt->
tag ==
"chains" ) {
97 chain_select = curropt->
value;
98 if ( chain_select.
length() < 1 )
99 cerr <<
"-chains: A selection must be specified!" << endl;
101 if ( curropt->
tag ==
"center" ) center = 1;
102 if ( curropt->
tag ==
"realspace" )
103 set_backtransform = 1;
104 if ( curropt->
tag ==
"scatter" ) {
105 if ( ( volt = curropt->
value.
real() ) < 1 )
106 cerr <<
"-scatter: A voltage must be specified!" << endl;
108 if ( volt < 1e3 ) volt *= 1e3;
110 if ( curropt->
tag ==
"size" )
111 size = curropt->
size();
112 if ( curropt->
tag ==
"origin" ) {
113 if ( curropt->
value[0] ==
'c' ) {
116 origin = curropt->
origin();
120 if ( curropt->
tag ==
"sampling" )
121 sam = curropt->
scale();
122 if ( curropt->
tag ==
"resolution" )
123 if ( ( resolution = curropt->
value.
real() ) < 0.001 )
124 cerr <<
"-resolution: Resolution must be specified!" << endl;
125 if ( curropt->
tag ==
"wrap" )
127 if ( curropt->
tag ==
"Bfactor" )
128 if ( ( Bfactor = curropt->
value.
real() ) < 0.001 )
129 cerr <<
"-Bfactor: The B-factor must be specified!" << endl;
130 if ( curropt->
tag ==
"unitcell" )
132 if ( curropt->
tag ==
"symmetry" )
134 cerr <<
"-symmetry: The space group number must be specified!" << endl;
135 if ( curropt->
tag ==
"curves" )
136 curves = curropt->
value;
137 if ( curropt->
tag ==
"coordinates" )
138 coorfile = curropt->
value;
139 if ( curropt->
tag ==
"map" )
141 if ( curropt->
tag ==
"parameters" )
143 if ( curropt->
tag ==
"output" )
159 if ( coorfile.
length() ) {
161 file_list = coorfile.
split(
",");
162 molgroup =
read_molecule(file_list, 0, box, atom_select, paramfile);
164 if ( !molgroup->
mol || !molgroup->
mol->
res ) {
165 cerr <<
"Error: Problem with coordinate file " << coorfile <<
", exiting!" << endl;
170 if ( molgroup == NULL ) {
171 cerr <<
"No coordinates read!" << endl;
181 cerr <<
"Error: Map file " << mapfile <<
" not read!" << endl;
192 if ( size[0] <= 0 || size[1] <= 0 || size[2] <= 0 ) {
200 if ( set_origin == 2 ) origin = {double(size[0]/2), double(size[1]/2), double(size[2]/2)};
202 if ( chain_select.
length() )
207 sam, resolution, spacegroup, uc, wrap, Bfactor, paramfile);
212 fftwf_init_threads();
221 double b2 =
beta2(volt);
222 double scale = 2*lambda/sqrt(1 - b2);
224 cout <<
"Scaling to correct scattering amplitudes:" << endl;
225 cout <<
"Voltage: " << volt*1e-3 <<
" kV" << endl;
226 cout <<
"Wavelength: " << lambda <<
" A" << endl;
227 cout <<
"Beta: " << sqrt(b2) << endl;
228 cout <<
"Scale: " << scale << endl;
234 if ( set_backtransform ) {
235 pcalc->
fft(FFTW_BACKWARD, 0);
242 fftwf_cleanup_threads();
246 while ( optind < argc ) {
251 }
else if ( pcalc ) {
258 if ( pcalc )
delete pcalc;
A class for a command line input option.
Vector3< double > real_size()
Vector3< double > scale()
int molgroup_kill(Bmolgroup *molgroup)
Destroys a molecule group.
size_t system_processors()
Returns the number of processors.
Library routines to select atomic coordinates.
int write_scattering_curves(Bstring ¶mfile, Bstring &outfile, Bstring &selection)
Calculates and writes atomic scattering profiles to a file.
int bexit(int value)
Exit function for cleanup and debugging.
Vector3< double > default_origin()
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Bmolgroup * read_molecule(const char *filename, const char *select, const char *paramfile)
The generalized function for reading molecular files.
Header file for option handlers.
Vector3< double > origin()
double mass_threshold(long img_num, double mol_weight, double rho)
Finds the density threshold associated with a particular molecular weight.
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
void origin(double x, double y, double z)
void multiply(long j, Complex< double > cv)
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
Header file for reading reflection files.
double molgroup_calculate_weight(Bmolgroup *molgroup)
Calculates the weight of each molecule.
Header file for CTF (contrast transfer function) functions.
General image parameter class.
Utilities for timing functions.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
int write_molecule(char *filename, Bmolgroup *molgroup)
Writes a molecule group.
Header file for 2D and 3D image I/O.
int molgroup_select_chains(Bmolgroup *molgroup, Bstring chains)
Selects molecules.
double electron_wavelength(double volt)
Calculates the wavelength in angstrom from the acceleration voltage.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
int main(int argc, char **argv)
void sampling(long nn, Vector3< double > u)
double beta2(double volt)
Calculates the square of the relative electron velocity.
bool contains(const Bstring &s)
Header file for functions to calculate a 3D map from atomic coordinates.
void complex_to_real()
The real part of a complex image is written to a simple image.
Bimage * img_sf_from_molecule(Bmolgroup *molgroup, Vector3< double > origin, Vector3< long > size, Vector3< double > sam, double resolution, int spacegroup, UnitCell unit_cell, int wrap, double Bfactor, Bstring ¶mfile)
Calculates a 3D set of structure factors from a set of atomic coordinates.
Library routines used for atomic coordinates.