 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
37 if ( !view ) view = v;
62 if ( !view ) view = v2 = v;
88 cout <<
"Setting views" << endl << endl;
91 for ( comp = mp->
comp; comp; comp = comp->
next )
if ( comp->
sel > 0 ) {
116 cout <<
"Inverting views" << endl << endl;
118 for ( comp = mp->
comp; comp; comp = comp->
next )
if ( comp->
sel > 0 ) {
143 cerr <<
"Error: No component types found!" << endl;
152 cout <<
"Molecule\tDist\t\t\tAxis\t\t\tAngle" << endl;
176 if ( !comp->
link[1] )
return normal;
181 for ( i=1; comp->
link[i]; i++ ) {
182 for ( j=0; j<i; j++ ) {
223 for ( i=1, im=0; i<
MAXLINK && comp->
link[i]; i++ ) {
224 if ( comp->
flag[i] == 1 ) {
231 if ( comp->
flag[im] ) {
241 View view(w[0], w[1], w[2], a);
265 if ( mode.
length() < 1 ) {
266 cerr <<
"Error: The view calculation mode must be specified!" << endl << endl;
280 cout <<
"Calculating views based on origin-component vectors" << endl << endl;
283 if ( mode[0] ==
'c' )
286 cout <<
"DEBUG model_calculate_views: origin=" << origin << endl;
287 for ( comp = mp->
comp; comp; comp = comp->
next )
if ( comp->
sel > 0 ) {
288 normal = comp->
loc - origin;
290 cout <<
"Old view: " << comp->
view << endl;
291 comp->
view =
View(normal[0], normal[1], normal[2], 0);
294 cout <<
"New view: " << comp->
view << endl;
328 cout <<
"Calculating views based on neighbors" << endl << endl;
332 for ( comp = mp->
comp; comp; comp = comp->
next ) {
335 cout <<
"Old view: " << comp->
view << endl;
336 comp->
view =
View(normal[0], normal[1], normal[2], 0);
339 cout <<
"New view: " << comp->
view << endl;
340 if ( comp->
sel > 0 ) nsel++;
361 long i, j, im, nsel(0);
367 cerr <<
"Error: No component types found!" << endl;
372 for ( comp = mp->
comp; comp; comp = comp->
next )
if ( comp->
sel > 0 ) nsel++;
380 double width = (
M_PI/180.0) * (int) (1800.0/nsel);
381 if ( bin_width ) width = bin_width *
M_PI/180.0;
383 int bins = (int) (
M_PI/width + 0.999);
384 int a3t[3] = {0,0,0};
385 int* a =
new int[bins];
386 int* a3 =
new int[3*bins];
388 for ( i=0; i<bins; i++ ) a[i] = 0;
389 for ( i=0; i<3*bins; i++ ) a3[i] = 0;
392 cout <<
"Model\tComp\tDist\tAngle\tvx\tvy\tvz" << endl;
395 for ( comp = mp->
comp; comp; comp = comp->
next )
if ( comp->
sel > 0 ) {
398 if ( ref_flag ) vr = comp->
loc;
401 i = (int) (da/width);
402 if ( i >= bins ) cout <<
"i too large: " << i << endl;
404 for ( j=im=0, max = 0; j<3; j++ ) {
405 if ( max < fabs(comp->
loc[j]) ) {
406 max = fabs(comp->
loc[j]);
414 comp->
loc = mat * vr;
420 comp->
loc[1] <<
tab << comp->
loc[2] << endl;
424 for ( i=0; i<bins; i++ )
425 for ( j=0; j<3; j++ ) a3t[j] += a3[j*bins+i];
428 cout <<
"\nHistogram:\nAngle\tCount\tExpect\tRatio" << endl;
429 for ( i=0; i<bins; i++ ) {
430 da = nsel*(cos(width*i) - cos(width*(i+1)))/2.0;
431 cout << (i+0.5)*width*180.0/
M_PI <<
tab << a[i] <<
tab << da <<
tab << a[i]/da << endl;
433 cout <<
"\nHistogram for three directions of component locations:" << endl;
434 cout <<
"Angle\txCount\tyCount\tzCount\txRatio\tyRatio\tzRatio" << endl;
435 for ( i=0; i<bins; i++ ) {
436 da = (cos(width*i) - cos(width*(i+1)))/2.0;
437 cout << (i+0.5)*width*180.0/
M_PI;
438 for ( j=0; j<3; j++ ) cout <<
tab << a3[j*bins+i];
439 for ( j=0; j<3; j++ ) cout <<
tab << a3[j*bins+i]/(a3t[j]*da);
443 for ( j=0; j<3; j++ ) cout <<
tab << a3t[j];
444 cout << endl << endl;
468 int h(0), len = s.
length();
472 if ( len < 3 )
return (0);
473 else if ( len == 3 ) {
477 }
else if ( len == 6 ) {
Vector3< double > component_plane(Bcomponent **comparray, double &offset)
Calculates a plane through an array of components.
int molgroup_kill(Bmolgroup *molgroup)
Destroys a molecule group.
Bstring swap(const long i, const long j)
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
Matrix3 transpose() const
long compare(const Bstring &s)
int bexit(int value)
Exit function for cleanup and debugging.
3x3 Matrix manipulation functions
long model_set_views(Bmodel *model, View view)
Sets views.
Bmolgroup * read_molecule(const char *filename, const char *select, const char *paramfile)
The generalized function for reading molecular files.
Vector3< double > model_center_of_mass(Bmodel *model)
double angle_set_negPI_to_PI(double angle)
Returns an angle between -PI and PI.
long model_invert_views(Bmodel *model)
Invert views.
View component_view(Bcomponent *comp)
Vector3 normal(Vector3 &v1, Vector3 &v2)
Transform molgroup_find_transformation(Bmolgroup *molgroup1, Bmolgroup *molgroup2)
Determines the transformation between two groups of identical molecules.
View * views_from_model(Bmodel *model)
Returns a list of component views.
long model_find_views(Bmodel *model, Bstring &reffile, Bstring ¶mfile)
Finds the molecule views with respect to a reference.
Library routines used to compare sets of atomic coordinates.
Header file for general utilities.
ostream & tab(ostream &out)
Vector3< double > component_normal(Bcomponent *comp)
int component_hand(Bstring &s)
Determines the hand of a component.
Library routines used for analysing model component views.
long model_view_directions(Bmodel *model, int bin_width, int ref_flag)
Analyzes view directions in a model.
int model_set_neighbors(Bmodel *model, int number)
Sets the desired number of components as neighbors for each component.
Header file for 2D and 3D image I/O.
double angle(Vector3< T2 > &v)
long model_calculate_views(Bmodel *model, Bstring &mode)
Calculates the views associated with each component.
Header file for generalized linked list functions.
Functions to manipulate model component neighbors.
Library routines used for model processing.
Bcomponent * link[MAXLINK]
long model_calculate_local_views(Bmodel *model)
Calculates the views associated with each component based on neighbors.
View * views_from_models(Bmodel *model)
Returns a list of component views.
Bcomponent * neighbor[MAXLINK]
Vector3 cross(const Vector3 &v)