Bsoft 2.1.4
Bernard's software package
model_poly.h File Reference

Functions to manipulate polyhedral coordinate files. More...

#include "rwmodel.h"

Functions

int model_poly_faces (Bmodel *model)
 Generates links between the vertices to define the polyhedron faces. More...
 
int model_poly_generate (Bmodel *model)
 Generates polygons based on a vertex network. More...
 
Bmodelmodel_poly_dual (Bmodel *model, int order)
 Calculates the dual of a polyhedral network. More...
 
int model_vertex_types (Bmodel *model)
 Determines the vertex type based on adjacent polygons. More...
 
int model_extended_vertex_types (Bmodel *model)
 Determines the vertex type based on adjacent and opposed polygons. 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 find)
 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...
 
vector< double > model_poly_sphere_coor (Bmodel *model)
 Generates coordinates for components based on the eigenvectors of the adjacency matrix. More...
 

Detailed Description

Functions to manipulate polyhedral coordinate files.

Author
Bernard Heymann
Date
Created: 20010828
Modified: 20100329

Function Documentation

◆ model_extended_vertex_types()

int model_extended_vertex_types ( Bmodel model)

Determines the vertex type based on adjacent and opposed polygons.

Parameters
*modelmodel 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.

◆ model_poly_analyze()

int model_poly_analyze ( Bmodel model)

Analyzes a model for polygon regularity and planarity.

Parameters
*modelmodel structure.
Returns
int 0.

◆ model_poly_angles()

int model_poly_angles ( Bmodel model)

Calculates all the polygon angles.

Parameters
*modelmodel structure.
Returns
int number of angles.
The angles for each polygon is calculated and averaged. The overall 
statistics for every polygon order is shown.

◆ 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
*modelmodel structure.
*refmodelreference 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.

◆ model_poly_dual()

Bmodel * model_poly_dual ( Bmodel model,
int  order 
)

Calculates the dual of a polyhedral network.

Parameters
*modelmodel structure.
orderorder 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.

◆ model_poly_eigenvalues()

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

Generates the eigenvalues of the adjacency matrix for a model.

Parameters
*modelmodel structure (modified with the topological coordinates).
showflag 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.

◆ model_poly_energy()

double model_poly_energy ( Bmodel model,
double  angle_ref 
)

Calculates the different energy terms for all models.

Parameters
*modelmodel structure.
angle_refreference 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.

◆ model_poly_faces()

int model_poly_faces ( Bmodel model)

Generates links between the vertices to define the polyhedron faces.

Parameters
*modelmodel 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.

◆ model_poly_find_symmetry()

Bstring model_poly_find_symmetry ( Bmodel model,
double  threshold 
)

Finds the symmetry axes associated with polyhedral elements.

Parameters
*modelmodel structure.
thresholdcutoff 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.

◆ model_poly_generate()

int model_poly_generate ( Bmodel model)

Generates polygons based on a vertex network.

Parameters
*modelmodel 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.

◆ model_poly_hand()

int model_poly_hand ( Bmodel model)

Calculates the polyhedron hand.

Parameters
*modelmodel 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.

◆ model_poly_links()

int model_poly_links ( Bmodel model)

Calculates all the model links.

Parameters
*modelmodel structure.
Returns
int number of links.

◆ model_poly_pentagon_adjacency()

int model_poly_pentagon_adjacency ( Bmodel model)

Calculates the number of edges shared by pentagons.

Parameters
*modelmodel structure.
Returns
int number of edges shared by pentagons for last model.

◆ model_poly_planarity()

double model_poly_planarity ( Bmodel model)

Analyzes a model for polygon planarity.

Parameters
*modelmodel 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.

◆ model_poly_regularity()

double model_poly_regularity ( Bmodel model)

Analyzes a model for polygon regularity.

Parameters
*modelmodel 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.

◆ 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
*modelmodel 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.

◆ model_vertex_types()

int model_vertex_types ( Bmodel model)

Determines the vertex type based on adjacent polygons.

Parameters
*modelmodel 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.