/Users/bernard/b20/bsoft/src/model/model_select.cpp(3)

NAME
/Users/bernard/b20/bsoft/src/model/model_select.cpp - Library routines used for model and component selection.

SYNOPSIS

#include 'rwmodel.h'
#include 'model_poly.h'
#include 'model_views.h'
#include 'model_compare.h'
#include 'model_util.h'
#include 'rwimg.h'
#include 'qsort_functions.h'
#include 'linked_list.h'
#include 'utilities.h'

  Functions
long model_select (Bmodel *model, Bstring &selstr)
Selects models, components and component types.
long model_select (Bmodel *model, long number)
Resets the selection to all models.
long model_select_all (Bmodel *model)
Resets the selection to all models.
long model_select_unknowns (Bmodel *model)
Resets the selection to all unknown models.
long model_reset_selection (Bmodel *model)
Resets the selection to all components.
long model_unset_selection (Bmodel *model)
Unsets the selection to all components but not models.
long model_invert_selection (Bmodel *model)
Inverts the selection of all components.
long model_select_sets (Bmodel *model, int size, int flag)
Selects sets of components, each set with the same size.
long model_select_number_of_components (Bmodel *model, int ncomp_min, int ncomp_max)
Selects models within a range of the number of components.
long model_select_closed (Bmodel *model, int closure_rule, int val_order)
Determines if a polyhedron is closed given a rule.
long model_select_fullerene (Bmodel *model)
Selects fullerene type models.
long model_select_non_fullerene (Bmodel *model)
Selects non-fullerene type models.
long model_select_valence (Bmodel *model, int valence)
Selects fullerene type models.
long model_select_polygons (Bmodel *model, int order)
Selects model polygons with a given order.
long model_select_first (Bmodel *model, int first)
Selects the first number of components.
long model_select_in_mask (Bmodel *model, Bimage *pmask)
Selects components within a mask.
long model_delete (Bmodel **model)
Deletes tagged models, components and links.
long model_delete_comp_type (Bmodel *model, Bstring &comptype)
Deletes components based on their types.
long model_delete_non_selected (Bmodel **model)
Deletes selected components and associated links from the model.
long model_selection_stats (Bmodel *model)
Calculates selection statistics.
long model_type_from_selection (Bmodel *model, Bstring *comp_type, Bstring &filename)
Converts selection numbers to different types.
long model_fom_deselect (Bmodel *model, double fom_cutoff)
Deselects components based on the FOM.
long model_fom_max_fraction_deselect (Bmodel *model, double fom_fraction)
Deselects components based on the FOM relative to the maximum FOM.
long models_radius_deselect (Bmodel *model, double minrad, double maxrad)
Deselects components based on the distance from the origin.
long model_fom_histogram (Bmodel *model, double fom_step)
Selects components based on the FOM.
long model_fom_ranking (Bmodel *model, int nrank)
Ranks components based on the FOM.
long model_delete_overlapped_components (Bmodel **model, double distance)
Deletes components that are too close to others.
long model_average_overlapped_components (Bmodel *model, double distance)
Averages components within a distance.
long model_prune_simple (Bmodel *model, double mindist)
Prunes overlapping components based on a distance criterion.
long model_prune_fom (Bmodel *model, double distance)
Deselects components based on overlap distance and the FOM.
long model_prune_similar (Bmodel *model)
Averages similar components and reduces redundancy.
Bimage * model_composite_map (Bmodel *model, Vector3< int > size, Vector3< double > origin, Vector3< double > sampling)
long comp_select_one (Bcomponent *comp, long i, long n, double *ovm)
double * model_overlap_matrix (Bmodel *model, double distance)
long model_prune_fit (Bmodel *model, double distance)
Deselects components based on overlap distance and the FOM.
long model_prune_large (Bmodel *model, double sampling)
Deselects components based on overlap distance and the FOM.
long model_find_overlap (Bmodel *model, Bstring &reffile, double distance)
Finds the components that overlap with the reference.

  Variables
int verbose

Detailed Description

Library routines used for model and component selection.

Author:
    Bernard Heymann

Date:
    Created: 20060908

    Modified: 20191011

Definition in file model_select.cpp.

Function Documentation

  long comp_select_one (Bcomponent * comp, long i, long n, double * ovm)

Definition at line 1725 of file model_select.cpp.

  long model_average_overlapped_components (Bmodel * model, double distance)

Averages components within a distance.

Parameters:
    *model model.
    distance overlap distance.

Returns:
    long 0.

    Components within the given distance are averaged and the first
    instance is retained while the others are deleted.

Definition at line 1425 of file model_select.cpp.

  Bimage* model_composite_map (Bmodel * model, Vector3< int > size, Vector3< double > origin, Vector3< double > sampling)

Definition at line 1675 of file model_select.cpp.

  long model_delete (Bmodel ** model)

Deletes tagged models, components and links.

Parameters:
    **model pointer to model parameters.

Returns:
    long remaining number of components.

    A model, component or link is tagged for deletion by a negative selection flag.

Definition at line 623 of file model_select.cpp.

  long model_delete_comp_type (Bmodel * model, Bstring & comptype)

Deletes components based on their types.

Parameters:
    *model model parameters.
    &comptype component type.

Returns:
    long number of components remaining.

Definition at line 720 of file model_select.cpp.

  long model_delete_non_selected (Bmodel ** model)

Deletes selected components and associated links from the model.

Parameters:
    **model pointer to model parameters.

Returns:
    long remaining number of components.

Definition at line 781 of file model_select.cpp.

  long model_delete_overlapped_components (Bmodel ** model, double distance)

Deletes components that are too close to others.

Parameters:
    **model model handle.
    distance distance to test for.

Returns:
    long 0.

    If a component is too close to another, the component further down
    in the list is deleted.

Definition at line 1396 of file model_select.cpp.

  long model_find_overlap (Bmodel * model, Bstring & reffile, double distance)

Finds the components that overlap with the reference.

Parameters:
    *model model parameters.
    &reffile reference molecule file name.
    distance distance for overlap.

Returns:
    long number of components selected.

    All components that are within the distance criterion of the components
    in the reference model are deselected.

Definition at line 2056 of file model_select.cpp.

  long model_fom_deselect (Bmodel * model, double fom_cutoff)

Deselects components based on the FOM.

Parameters:
    *model model parameters.
    fom_cutoff FOM threshold.

Returns:
    long number of components selected.

    The FOM is assumed to be a value from 0 to 1 and components with
    FOM's below the given cutoff are deselected.

Definition at line 1154 of file model_select.cpp.

  long model_fom_histogram (Bmodel * model, double fom_step)

Selects components based on the FOM.

Parameters:
    *model model parameters.
    fom_step FOM step size.

Returns:
    long number of components.

    The FOM is assumed to represent energy and therefore values below
    the given cutoff are selected.

Definition at line 1254 of file model_select.cpp.

  long model_fom_max_fraction_deselect (Bmodel * model, double fom_fraction)

Deselects components based on the FOM relative to the maximum FOM.

Parameters:
    *model model parameters.
    fom_fraction FOM threshold.

Returns:
    long number of components selected.

    The FOM/FOMmax ratio is calculated and components with ratios below
    the given fraction are deselected.

Definition at line 1180 of file model_select.cpp.

  long model_fom_ranking (Bmodel * model, int nrank)

Ranks components based on the FOM.

Parameters:
    *model model parameters.
    nrank number of levels.

Returns:
    long number of selected components.

    Each selected component is ranked into one of a number of levels.

Definition at line 1307 of file model_select.cpp.

  long model_invert_selection (Bmodel * model)

Inverts the selection of all components.

Parameters:
    *model model parameters.

Returns:
    long number of components selected.

Definition at line 286 of file model_select.cpp.

  double* model_overlap_matrix (Bmodel * model, double distance)

Definition at line 1744 of file model_select.cpp.

  long model_prune_fit (Bmodel * model, double distance)

Deselects components based on overlap distance and the FOM.

Parameters:
    *model model parameters.
    distance overlap distance.

Returns:
    long number of components selected.

    The selected component with the highest FOM is chosen as the first
    component in the solution set and all components within the distance
    criterion from it are deselected. The selected component with the next
    highest FOM is then chosen and again, all components within the distance
    criterion from it are deselected.
    This is repeated until there are no more selected components to choose.
    Only the first model is processed.

Definition at line 1805 of file model_select.cpp.

  long model_prune_fom (Bmodel * model, double distance)

Deselects components based on overlap distance and the FOM.

Parameters:
    *model model parameters.
    distance overlap distance.

Returns:
    long number of components selected.

    The selected component with the highest FOM is chosen as the first
    component in the solution set and all components within the distance
    criterion from it are deselected. The selected component with the next
    highest FOM is then chosen and again, all components within the distance
    criterion from it are deselected.
    This is repeated until there are no more selected components to choose.
    Only the first model is processed.

Definition at line 1518 of file model_select.cpp.

  long model_prune_large (Bmodel * model, double sampling)

Deselects components based on overlap distance and the FOM.

Parameters:
    *model model parameters.
    sampling grid sampling.

Returns:
    long number of components selected.

    Each component location is mapped to a grid point and the component FOM
    is assigned to the grid point if it is larger.
    Peaks are determined within each 3x3x3 kernel: a peak is defined as
    having a higher value than any of its 26 neigbors.
    The component associated with the value at a peak is selected.
    Only the first model is processed.

Definition at line 1936 of file model_select.cpp.

  long model_prune_similar (Bmodel * model)

Averages similar components and reduces redundancy.

Parameters:
    *model model parameters.

Returns:
    lon number of clusters.

    A view distance matrix is calculated for all the components.
    All components within a small distance (~10% of model radius) are averaged
    into the first component and the rest are deselected.
    Only the first model is processed.

Definition at line 1610 of file model_select.cpp.

  long model_prune_simple (Bmodel * model, double mindist)

Prunes overlapping components based on a distance criterion.

Parameters:
    *model model structure to be modified.
    mindist distance criterion.

Returns:
    long number of remaining components.

    The first component in any pair of overlapping components is kept.

Definition at line 1468 of file model_select.cpp.

  long model_reset_selection (Bmodel * model)

Resets the selection to all components.

Parameters:
    *model model parameters.

Returns:
    long number of components selected.

    Only one model is modified.

Definition at line 232 of file model_select.cpp.

  long model_select (Bmodel * model, Bstring & selstr)

Selects models, components and component types.

Parameters:
    *model model parameters.
    &selstr selection string.

Returns:
    long number of selections made.

    The selection string can have one of the following formats:
        #model@component
        #model%comp_type
        ^model_type@component
        ^model_type%comp_type
    Only elements originally selected is considered, except where the "." is used.

Definition at line 36 of file model_select.cpp.

  long model_select (Bmodel * model, long number)

Resets the selection to all models.

Parameters:
    *model model parameters.
    number selection number to select.

Returns:
    long number of components selected.

Definition at line 163 of file model_select.cpp.

  long model_select_all (Bmodel * model)

Resets the selection to all models.

Parameters:
    *model model parameters.

Returns:
    long number of models selected.

Definition at line 193 of file model_select.cpp.

  long model_select_closed (Bmodel * model, int closure_rule, int val_order)

Determines if a polyhedron is closed given a rule.

Parameters:
    *model model parameters.
    closure_rule 1=valency, 2=order.
    val_order magnitude of valency or order.

Returns:
    long number of models selected.

    Polyhedron closure is arbitrarily decided by a rule:
    1.  Fixed valency.
    3.  Fixed polygon order.
    Models that fail the given rule are deselected.
    If the given valency or order is zero, it is set to the value for
    the first component or polygon.

Definition at line 397 of file model_select.cpp.

  long model_select_first (Bmodel * model, int first)

Selects the first number of components.

Parameters:
    *model model parameters.
    first first number of components to select.

Returns:
    long number of components selected.

Definition at line 566 of file model_select.cpp.

  long model_select_fullerene (Bmodel * model)

Selects fullerene type models.

Parameters:
    *model model structure.

Returns:
    long number of models selected.

    Each model is tested for the presence of polygons that have orders
    only of five or six.

Definition at line 448 of file model_select.cpp.

  long model_select_in_mask (Bmodel * model, Bimage * pmask)

Selects components within a mask.

Parameters:
    *model model parameters.
    pmask first number of components to select.

Returns:
    long number of components selected.

Definition at line 590 of file model_select.cpp.

  long model_select_non_fullerene (Bmodel * model)

Selects non-fullerene type models.

Parameters:
    *model model structure.

Returns:
    long number of models selected.

    Each model is tested for the presence of polygons that have orders
    different from five or six.

Definition at line 477 of file model_select.cpp.

  long model_select_number_of_components (Bmodel * model, int ncomp_min, int ncomp_max)

Selects models within a range of the number of components.

Parameters:
    *model model parameters.
    ncomp_min minimum number of components.
    ncomp_max maximum number of components.

Returns:
    long number of models selected.

Definition at line 359 of file model_select.cpp.

  long model_select_polygons (Bmodel * model, int order)

Selects model polygons with a given order.

Parameters:
    *model model to color.
    order polygon order.

Returns:
    long 0.

Definition at line 535 of file model_select.cpp.

  long model_select_sets (Bmodel * model, int size, int flag)

Selects sets of components, each set with the same size.

Parameters:
    *model parameter structure with all parameters.
    size number of components in each set.
    flag flag to not count across model boundaries.

Returns:
    long number of components selected.

    Sets up sets of components, each set identified as a number in the
    selection array.

Definition at line 312 of file model_select.cpp.

  long model_select_unknowns (Bmodel * model)

Resets the selection to all unknown models.

Parameters:
    *model model parameters.

Returns:
    long number of models selected.

Definition at line 208 of file model_select.cpp.

  long model_select_valence (Bmodel * model, int valence)

Selects fullerene type models.

Parameters:
    *model model structure.
    valence component valence

Returns:
    long number of models selected.

    Each model is tested for the presence of polygons that have orders
    only of five or six.

Definition at line 508 of file model_select.cpp.

  long model_selection_stats (Bmodel * model)

Calculates selection statistics.

Parameters:
    *model model parameters.

Returns:
    long number of components selected.

    The FOM is assumed to be a value from 0 to 1.

Definition at line 870 of file model_select.cpp.

  long model_type_from_selection (Bmodel * model, Bstring * comp_type, Bstring & filename)

Converts selection numbers to different types.

Parameters:
    *model model parameters.
    *comp_type linked list of strings.
    &filename component type file name.

Returns:
    long number of component types assigned.

Definition at line 1063 of file model_select.cpp.

  long model_unset_selection (Bmodel * model)

Unsets the selection to all components but not models.

Parameters:
    *model model parameters.

Returns:
    long number of components deselected.

Definition at line 261 of file model_select.cpp.

  long models_radius_deselect (Bmodel * model, double minrad, double maxrad)

Deselects components based on the distance from the origin.

Parameters:
    *model model parameters.
    minrad minimum distance from origin.
    maxrad maximum distance from the origin.

Returns:
    long number of components selected.

    All components inside a minmum radius and beyond a maximum radius are deselected.

Definition at line 1215 of file model_select.cpp.

Variable Documentation

  int verbose

Author

Generated automatically by Doxygen for Bsoft from the source code.