Bsoft 2.1.4
Bernard's software package
model_views.cpp File Reference

Library routines used for analyzing the views of components in models. More...

#include "rwimg.h"
#include "model_views.h"
#include "model_util.h"
#include "model_neighbors.h"
#include "mol_compare.h"
#include "Matrix3.h"
#include "linked_list.h"
#include "utilities.h"

Functions

list< View2< float > > views_from_model (Bmodel *model)
 Returns a list of component views. More...
 
list< View2< float > > views_from_models (Bmodel *model)
 Returns a list of component views. More...
 
long model_set_views (Bmodel *model, View2< float > view)
 Sets views. More...
 
long model_invert_views (Bmodel *model)
 Invert views. More...
 
long model_find_views (Bmodel *model, Bstring &reffile, Bstring &paramfile)
 Finds the molecule views with respect to a reference. More...
 
Vector3< double > component_normal (Bcomponent *comp)
 
View2< float > component_view (Bcomponent *comp)
 
long model_calculate_views (Bmodel *model, Bstring &mode)
 Calculates the views associated with each component. More...
 
long model_calculate_local_views (Bmodel *model)
 Calculates the views associated with each component based on neighbors. More...
 
long model_view_directions (Bmodel *model, int bin_width, int ref_flag)
 Analyzes view directions in a model. More...
 
int component_hand (Bstring s)
 Determines the hand of a component. More...
 

Variables

int verbose
 

Detailed Description

Library routines used for analyzing the views of components in models.

Author
Bernard Heymann
Date
Created: 20081120
Modified: 20210205

Function Documentation

◆ component_hand()

int component_hand ( Bstring  s)

Determines the hand of a component.

Parameters
&sstring with encoded order.
Returns
int the hand.
Requirement: The string must be either a 3 or 6-digit code.
The reverse of the string is generated and the canonical version 
compared to the canonical version of the original string.
The handedness is then returned as the sign of the comparison.
The reverse of the 6-digit code is defined as reversing the
first and last 3 digits separately.

◆ component_normal()

Vector3< double > component_normal ( Bcomponent comp)

◆ component_view()

View2< float > component_view ( Bcomponent comp)

◆ model_calculate_local_views()

long model_calculate_local_views ( Bmodel model)

Calculates the views associated with each component based on neighbors.

Parameters
*modelmodel structure (views modified).
Returns
long number of selected components.
The view for a vertex is calculated from the vertex vector and the first link.
The vertex vector points away from the origin and is calculated as follows:
Angles defined for the vertex:
    vv = normalized sum of the cross products for each pair of links
        constituting an angle
Angles not defined:
    vv = component coordinates - origin
The origin is defined as the current zero coordinates, the center-of-mass,
or from the map.

◆ model_calculate_views()

long model_calculate_views ( Bmodel model,
Bstring mode 
)

Calculates the views associated with each component.

Parameters
*modelmodel structure (views modified).
&modenone=current, com, map, local.
Returns
long number of selected components.
The view for a vertex is calculated from the vertex vector and the first link.
The vertex vector points away from the origin and is calculated as follows:
Angles defined for the vertex:
    vv = normalized sum of the cross products for each pair of links
        constituting an angle
Angles not defined:
    vv = component coordinates - origin
The origin is defined as the current zero coordinates, the center-of-mass,
or from the map.

◆ model_find_views()

long model_find_views ( Bmodel model,
Bstring reffile,
Bstring paramfile 
)

Finds the molecule views with respect to a reference.

Parameters
*modelmodel parameters.
&reffilereference molecule file name.
&paramfileatomic parameter file.
Returns
long number of molecules selected.
The positioning of each molecule is based on the center of mass of the reference.

◆ model_invert_views()

long model_invert_views ( Bmodel model)

Invert views.

Parameters
*modelmodel parameters.
Returns
long number of selected components.
It calculates the inverse of each component view.
Only the first model is processed.

◆ model_set_views()

long model_set_views ( Bmodel model,
View2< float >  view 
)

Sets views.

Parameters
*modelmodel parameters.
viewset view.
Returns
long number of selected components.
Each component view is set tot the given view.

◆ model_view_directions()

long model_view_directions ( Bmodel model,
int  bin_width,
int  ref_flag 
)

Analyzes view directions in a model.

Parameters
*modelmodel parameters.
bin_widthbin width in degrees.
ref_flagflag to select the reference vector (0=z-axis, 1=component location)
Returns
long number of molecules selected.
The angle between the component view and a reference vector is calculated.
A histogram of the angles is constructed and reported.
The reference vector can be the z-axis, or the component location.

◆ views_from_model()

list< View2< float > > views_from_model ( Bmodel model)

Returns a list of component views.

Parameters
*modelmodel parameters.
Returns
list<View2<float>> list of views.
Only the first model is processed.

◆ views_from_models()

list< View2< float > > views_from_models ( Bmodel model)

Returns a list of component views.

Parameters
*modelmodel parameters.
Returns
View* list of views.
All models are processed.

Variable Documentation

◆ verbose

int verbose
extern