| Bsoft 2.0.5 Bernard's software package

Macros | Functions | Variables
model_poly.cpp File Reference

Functions to manipulate polyhedral coordinate files. More...

`#include "model_poly.h"`
`#include "model_transform.h"`
`#include "model_views.h"`
`#include "model_util.h"`
`#include "matrix_linear.h"`
`#include "model_links.h"`
`#include "model_compare.h"`
`#include "math_util.h"`
`#include "random_numbers.h"`
`#include "symmetry.h"`
`#include "Vector3.h"`
`#include "linked_list.h"`
`#include "utilities.h"`

Go to the source code of this file.

## Macros
#define | NSMAX 100

## Functions
int | model_poly_faces (Bmodel *model)
| Generates links between the vertices to define the polyhedron faces. More...
int | poly_get_connectivity (Bcomponent *comp, int ilink, int nlink, Bpolygon *poly)
int | model_poly_generate (Bmodel *model)
| Generates polygons based on a vertex network. More...
int | model_vertex_types (Bmodel *model)
| Determines the vertex type based on adjacent polygons. More...
Bstring | component_6digit_type (Bcomponent *comp)
int | model_extended_vertex_types (Bmodel *model)
| Determines the vertex type based on adjacent and opposed polygons. More...
Bmodel * | model_poly_dual (Bmodel *model, int order)
| Calculates the dual of a polyhedral network. More...
int | model_poly_analyze (Bmodel *model)
| Analyzes a model for polygon regularity and planarity. More...
int | model_poly_links (Bmodel *model)
| Calculates all the model links. More...
int | model_poly_angles (Bmodel *model)
| Calculates all the polygon angles. More...
double | model_poly_regularity (Bmodel *model)
| Analyzes a model for polygon regularity. More...
double | model_poly_planarity (Bmodel *model)
| Analyzes a model for polygon planarity. More...
double | model_poly_energy (Bmodel *model, double angle_ref)
| Calculates the different energy terms for all models. More...
int | model_poly_pentagon_adjacency (Bmodel *model)
| Calculates the number of edges shared by pentagons. More...
Bstring | model_poly_find_symmetry (Bmodel *model, double threshold)
| Finds the symmetry axes associated with polyhedral elements. More...
int | model_poly_hand (Bmodel *model)
| Calculates the polyhedron hand. More...
int | model_poly_compare (Bmodel *model, Bmodel *refmodel)
| Compares a model with reference models based on the eigenvalues of the adjacency matrix. More...
vector< double > | model_poly_eigenvalues (Bmodel *model, int show)
| Generates the eigenvalues of the adjacency matrix for a model. More...
int | comp_count_connected (Bcomponent *comp)
int | model_number_connected_clusters (Bmodel *model)
vector< double > | model_poly_sphere_coor (Bmodel *model)
| Generates coordinates for components based on the eigenvectors of the adjacency matrix. More...

## Variables
int | verbose

## Detailed Description

Functions to manipulate polyhedral coordinate files.

Author
  Bernard Heymann

Date
  Created: 20010828
  Modified: 20150208

Definition in file model_poly.cpp.

## Macro Definition Documentation

## ◆ NSMAX

#define NSMAX 100

Definition at line 1080 of file model_poly.cpp.

## Function Documentation

## ◆ comp_count_connected()

int comp_count_connected | ( | Bcomponent * | comp | ) |

Definition at line 1614 of file model_poly.cpp.

## ◆ component_6digit_type()

Bstring component_6digit_type | ( | Bcomponent * | comp | ) |

Definition at line 351 of file model_poly.cpp.

## ◆ model_extended_vertex_types()

int model_extended_vertex_types | ( | Bmodel * | model | ) |

Determines the vertex type based on adjacent and opposed polygons.

Parameters

  *model | model structure.

Returns
  int 0.

      The link flag of each component is asigned such that the order of the
      rigth adjacent polygon is in the first digit, that of the left adjacent
      polygon in the second digit, and that of the opposing polygon in the
      third digit.
      New component types are generated.

Definition at line 396 of file model_poly.cpp.

## ◆ model_number_connected_clusters()

int model_number_connected_clusters | ( | Bmodel * | model | ) |

Definition at line 1626 of file model_poly.cpp.

## ◆ model_poly_analyze()

int model_poly_analyze | ( | Bmodel * | model | ) |

Analyzes a model for polygon regularity and planarity.

Parameters

  *model | model structure.

Returns
  int 0.

Definition at line 538 of file model_poly.cpp.

## ◆ model_poly_angles()

int model_poly_angles | ( | Bmodel * | model | ) |

Calculates all the polygon angles.

Parameters

  *model | model structure.

Returns
  int number of angles.

      The angles for each polygon is calculated and averaged. The overall
      statistics for every polygon order is shown.

Definition at line 646 of file model_poly.cpp.

## ◆ model_poly_compare()

int model_poly_compare | ( | Bmodel * | model,
|  | Bmodel * | refmodel
| ) |  |

Compares a model with reference models based on the eigenvalues of the adjacency matrix.

Parameters

  *model | model structure.
  *refmodel | reference model(s) to compare.

Returns
  int 0.

      The comparison is based on the eigenvectors of the adjacency matrix,
      which are related to spherical harmonics.
      There are 3 P(sigma) eigenvectors giving the vertex coordinates.
      These are usually (but not always) vectors 2, 3, and 4 ordered by eigenvalue.
      The eigenvalues are characteristic for a polyhedron, although they may not be unique.
      For every model identified, the model type is set from the reference ID.
      The reference model selection is incremented to indicate the count.

      Dover Publications, Inc., Mineola, New York, pages 101 - 104.

  Reference: Fowler, P.W. and Manolopoulos, D.E. (2006) An Atlas of Fullerenes.

Definition at line 1495 of file model_poly.cpp.

## ◆ model_poly_dual()

Bmodel* model_poly_dual | ( | Bmodel * | model,
|  | int | order
| ) |  |

Calculates the dual of a polyhedral network.

Parameters

  *model | model structure.
  order | order of polygons to convert to vertices, < 3 = all.

Returns
  Bmodel* new model structure with the dual.

      The polygons are first defined to calculate the dual network that
      has vertices at the polygon centers.

Definition at line 454 of file model_poly.cpp.

## ◆ model_poly_eigenvalues()

vector<double> model_poly_eigenvalues | ( | Bmodel * | model,
|  | int | show
| ) |  |

Generates the eigenvalues of the adjacency matrix for a model.

Parameters

  *model | model structure (modified with the topological coordinates).
  show | flag to show eigenvalues.

Returns
  vector<double> eigenvalues.

      The eigenvectors of the adjacency matrix are related to spherical harmonics.
      The eigenvalues are characteristic for a polyhedron, although they may not be unique.
      Only the first model in the list is processed.

      Dover Publications, Inc., Mineola, New York, pages 101 - 104.

  Reference: Fowler, P.W. and Manolopoulos, D.E. (2006) An Atlas of Fullerenes.

Definition at line 1580 of file model_poly.cpp.

## ◆ model_poly_energy()

double model_poly_energy | ( | Bmodel * | model,
|  | double | angle_ref
| ) |  |

Calculates the different energy terms for all models.

Parameters

  *model | model structure.
  angle_ref | reference angle (<=0 to use the polygon angle).

Returns
  double 0.

      The angular energy is calculated either with a given reference angle,
      or with the nominal polygon inner angle as reference.
      Regularity is defined as the adherence to a constant distance of each
      vertex from the polygon center. The polygon area is:
           n * s^2       1 + cos(2*PI/n)
      A = ------- sqrt(-----------------)
             4           1 - cos(2*PI/n)
      where n is the number of vertices in the polygon.
      The contribution of each polygon to the polyhedral volume is:
      V = A * dc / 3
      where dc is the distance of the polygon center to the polyhedral center.

Definition at line 915 of file model_poly.cpp.

## ◆ model_poly_faces()

int model_poly_faces | ( | Bmodel * | model | ) |

Generates links between the vertices to define the polyhedron faces.

Parameters

  *model | model structure.

Returns
  int 0.

      Two vertices are linked only when they are on the surface of the
      polyhedron, i.e., all other vertices are on one side of the pair
      of vertices. This is only true if there are no other vertices v
      with the following property:
          v•v0 > v0•v0
      where v0 is the average of the two vertices considered for linkage.
      Only the first model is processed.

Definition at line 39 of file model_poly.cpp.

## ◆ model_poly_find_symmetry()

Bstring model_poly_find_symmetry | ( | Bmodel * | model,
|  | double | threshold
| ) |  |

Finds the symmetry axes associated with polyhedral elements.

Parameters

  *model | model structure.
  threshold | cutoff to flag a symmetry axis.

Returns
  Bstring symmetry string.

      Symmetry axes are associated with specific elements:
          link        reflection and 2-fold axis.
          vertex      n-fold axis based on vertex order.
          polygon     n-fold axis based on polygon order.
      Only the first model in the list is processed.

Definition at line 1095 of file model_poly.cpp.

## ◆ model_poly_generate()

int model_poly_generate | ( | Bmodel * | model | ) |

Generates polygons based on a vertex network.

Parameters

  *model | model structure.

Returns
  int 0.

      The search startegy is to start at a vertex and then search always turning into
      the same direction. First the outward pointing normal for each vertex is
      calculated. Then the connectivity is followed always turning in the same
      direction at each vertex.

Definition at line 145 of file model_poly.cpp.

## ◆ model_poly_hand()

int model_poly_hand | ( | Bmodel * | model | ) |

Calculates the polyhedron hand.

Parameters

  *model | model structure.

Returns
  int hand sign.

      The hand of a polyhedron is based on the sign of the rotational strength
      element associated with the first two eigenvectors of the adjacency matrix.
      It is assumed that the symmetry has been determined.
      The hand sign is:
          0   no handedness.
          1   one enantiomorph.
          -1  other enantiomorph.

Definition at line 1427 of file model_poly.cpp.

## ◆ model_poly_links()

int model_poly_links | ( | Bmodel * | model | ) |

Calculates all the model links.

Parameters

  *model | model structure.

Returns
  int number of links.

Definition at line 597 of file model_poly.cpp.

## ◆ model_poly_pentagon_adjacency()

int model_poly_pentagon_adjacency | ( | Bmodel * | model | ) |

Calculates the number of edges shared by pentagons.

Parameters

  *model | model structure.

Returns
  int number of edges shared by pentagons for last model.

Definition at line 1041 of file model_poly.cpp.

## ◆ model_poly_planarity()

double model_poly_planarity | ( | Bmodel * | model | ) |

Analyzes a model for polygon planarity.

Parameters

  *model | model structure.

Returns
  double standard deviation from planarity.

      A plane is fit through the polygon vertices and the normal calculated from:
          n•p = d
      where n is the normal vector, p is a point in the plane, and d is the offset.
      The polygon planarity is defined as the root-mean-square-deviation from
      the fitted plane.

Definition at line 835 of file model_poly.cpp.

## ◆ model_poly_regularity()

double model_poly_regularity | ( | Bmodel * | model | ) |

Analyzes a model for polygon regularity.

Parameters

  *model | model structure.

Returns
  double standard deviation from regularity.

      Regularity is defined as the adherence to a constant distance of each
      vertex from the polygon center. The polygon area is:
           n * s^2       1 + cos(2*PI/n)
      A = ------- sqrt(-----------------)
             4           1 - cos(2*PI/n)
      where n is the number of vertices in the polygon.
      The contribution of each polygon to the polyhedral volume is:
      V = A * dc / 3
      where dc is the distance of the polygon center to the polyhedral center.

Definition at line 750 of file model_poly.cpp.

## ◆ model_poly_sphere_coor()

vector<double> model_poly_sphere_coor | ( | Bmodel * | model | ) |

Generates coordinates for components based on the eigenvectors of the adjacency matrix.

Parameters

  *model | model structure.

Returns
  dvector<double> eigenvalues.

      The eigenvectors of the adjacency matrix are related to spherical harmonics.
      There are 3 P(sigma) eigenvectors giving the vertex coordinates.
      These are usually (but not always) vectors 2, 3, and 4 ordered by eigenvalue.
      The actual 3 P(sigma) eigenvectors are identified as those having exactly
      a single node, i.e., closely connected vertices cluster together in every dimension.
      The eigenvalues are characteristic for a polyhedron, although they may not be unique.

      Dover Publications, Inc., Mineola, New York, pages 101 - 104.

  Reference: Fowler, P.W. and Manolopoulos, D.E. (2006) An Atlas of Fullerenes.

Definition at line 1659 of file model_poly.cpp.

## ◆ model_vertex_types()

int model_vertex_types | ( | Bmodel * | model | ) |

Determines the vertex type based on adjacent polygons.

Parameters

  *model | model structure.

Returns
  int 0.

      The polygon order is written into flags for vertex links in one
      direction for each polygon.
      New component types are generated.

Definition at line 313 of file model_poly.cpp.

## ◆ poly_get_connectivity()

int poly_get_connectivity | ( | Bcomponent * | comp,
|  | int | ilink,
|  | int | nlink,
|  | Bpolygon * | poly
| ) |  |

Definition at line 85 of file model_poly.cpp.

## Variable Documentation

## ◆ verbose

int verbose