API Reference

Cosymlib

class cosymlib.Cosymlib(structures, ignore_atoms_labels=False, ignore_connectivity=False, connectivity=None, connectivity_thresh=None)[source]

Main cosymlib class

Parameters:
  • structures (list) – List of Geometry or Molecule
  • ignore_atoms_labels (bool) – Ignore atomic element labels is symmetry calculations
  • ignore_connectivity (bool) – Ignore connectivity in symmetry calculations
  • connectivity (list) – List of pairs if atom indices that are considered connected
  • connectivity_thresh (bool) – Connectivity threshold (Ionic radius is used as reference)
get_geometries()[source]

Get the geometries

Returns:List of Geometry objects
Return type:list
get_molecule_path_deviation(shape_label1, shape_label2, central_atom=0)[source]

Get molecule path deviation

Parameters:
  • shape_label1 (str) – First shape reference label
  • shape_label2 (str) – Second shape reference label
  • central_atom (int) – Position of the central atom
get_n_atoms()[source]

Get the number of atoms if all structures contains the same number of atoms, else raise exception.

Returns:Number of atoms
Return type:int
get_point_group(tol=0.01)[source]

Get the point group of all structures

Parameters:tol (float) – Tolerance
Returns:a list of point group labels
Return type:list
get_shape_measure(label, kind, central_atom=0, fix_permutation=False)[source]

Get shape measure

Parameters:
  • label (str) – Reference shape label
  • kind (str) – function name suffix
  • central_atom (int) – Position of the central atom
  • fix_permutation (bool) – Do not permute atoms during shape calculations
Returns:

Shape measures

Return type:

list

molecules

Get the molecules

Returns:List of Molecule objects
Return type:list
print_esym_orientation(group, axis=None, axis2=None, center=None, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Prints down an xyz file of the molecule with the orientation_axis

Parameters:
  • group (string) – Symmetry group
  • axis (list) – Main symmetry axis of group
  • axis2 (list) – Secondary symmetry axis of group
  • center (list) – Center
  • output (hook) – Display hook
print_geometric_measure_info(label, multi=1, central_atom=0, center=None, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Prints geometric symmetry measure verbose

Parameters:
  • label (str) – Symmetry point group label
  • multi (int) – Number of symmetry axis to find
  • central_atom (int) – Position of the central atom
  • center (list) – Center of symmetry in Cartesian coordinates. If None center is optimized
  • output – Display hook
Type:

hook

print_geometric_symmetry_measure(label, central_atom=0, center=None, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Prints geometric symmetry measure in format

Parameters:
  • label (str) – Symmetry point group label
  • central_atom (int) – Position of the central atom
  • center (list) – Center of symmetry in Cartesian coordinates. If None center is optimized
  • output (hook) – Display hook
print_info()[source]

Prints general information about the structures

print_minimum_distortion_path_shape(shape_label1, shape_label2, central_atom=0, min_dev=None, max_dev=None, min_gco=None, max_gco=None, num_points=20, output=None)[source]

Print the minimum distortion path

Parameters:
  • shape_label1 (str) – First reference shape label
  • shape_label2 (str) – Second reference shape label
  • central_atom (int) – Position of the central atom
  • min_dev (float) –
  • max_dev (float) –
  • min_gco (float) –
  • max_gco (float) –
  • num_points (int) – Number of points
  • output1 (hook) – Display hook
print_shape_measure(shape_reference, central_atom=0, fix_permutation=False, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Prints the shape measure of all structures in format

Parameters:
  • shape_reference (list) – List of references and/or geometries
  • central_atom (int) – Position of the central atom
  • fix_permutation (bool) – Do not permute atoms during shape calculations
  • output (hook) – Display hook
print_shape_structure(shape_reference, central_atom=0, fix_permutation=False, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Prints the nearest shape structure in format

Parameters:
  • shape_reference (list) – List of references and/or geometries
  • central_atom (int) – Position of the central atom
  • fix_permutation (bool) – Do not permute atoms during shape calculations
  • output (hook) – Display hook
print_symmetry_nearest_structure(label, central_atom=0, center=None, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Prints the nearest structure to ideal symmetric structure

Parameters:
  • label (str) – Symmetry point group label
  • central_atom (int) – Position of the central atom
  • center (int) – Center of symmetry in Cartesian coordinates. If None center is optimized
  • output (hook) – Display hook

Symmetry

class cosymlib.symmetry.Symmetry(structure, central_atom=0, center=None, connect_thresh=1.2, multi=1, axis=None, axis2=None)[source]

Symmetry main class

Parameters:
  • structure (Geometry, Molecule, np.array) – a geometry, molecule or array type object
  • central_atom (int) – central atom position
  • center (list) – center of symmetry in Cartesian coordinates. By default center is optimized
  • connect_thresh (float) – Connectivity threshold (Ionic radius is used as reference)
  • multi (int) – Number of symmetry axis to find
  • axis (list) – Main symmetry axis (If None, then optimize)
  • axis2 (list) – secondary symmetry axis (If None, then optimize)
axis_multi(label, multi=1)[source]

Get the optimum N axis

Parameters:
  • label (str) – point group label
  • multi (int) – number of axis
Returns:

List of axis

Return type:

list

csm_multi(label, multi=1)[source]

Get symmetry measure of the optimum N axis

Parameters:
  • label (str) – point group label
  • multi (int) – number of axis
Returns:

The measures

Return type:

list

measure(label)[source]

Get symmetry measure

Parameters:label (str) – Point group label
Returns:The measure
Return type:float
nearest_structure(label)[source]

Get nearest structure

Parameters:label (str) – Point group label
Returns:The structure
Return type:Structure
optimum_axis(label)[source]

Get the optimum main symmetry axis

Parameters:label (str) – Point group label
Returns:The axis
Return type:list
optimum_permutation(label)[source]

Get the optimum atoms permutation

Parameters:label – point group label
Returns:The permutation
Return type:list
reference_axis(label)[source]

Get reference axis

Parameters:label (str) – point group label
Returns:The axis
Return type:list
set_parameters(parameters_dict)[source]

Set symmetry calculation related parameters

Parameters:parameters_dict (dict) – parameters in dictionary

Shape

class cosymlib.shape.Shape(structure)[source]

Shape main class

Parameters:structure (Geometry, Molecule, np.array) – a geometry, molecule or array type object
generalized_coordinate(shape_label1, shape_label2, central_atom=0)[source]

Get the generalized coordinate

Parameters:
  • shape_label1 (str, Geometry) – First shape reference label or Geometry object
  • shape_label2 (str, Geometry) – Second shape reference label or Geometry object
  • central_atom (int) – Central atom position
Returns:

The generalized coordinate

measure(reference, central_atom=0, fix_permutation=False)[source]

Get shape measure

Parameters:
  • reference (str) – Reference shape label or Geometry object
  • central_atom (int) – Central atom position
  • fix_permutation (bool) – Do not permute atoms during shape calculations
Returns:

The measure

Return type:

float

path_deviation(shape_label1, shape_label2, central_atom=0)[source]

Get the path deviation

Parameters:
  • shape_label1 (str, Geometry) – First shape reference label or Geometry object
  • shape_label2 (str, Geometry) – Second shape reference label or Geometry object
  • central_atom (int) – Central atom position
Returns:

The path deviation

Return type:

float

structure(reference, central_atom=0, fix_permutation=False)[source]

Get the nearest structure to reference

Parameters:
  • reference (str, Geometry) – Reference shape label or Geometry object
  • central_atom (int, Geometry) – Central atom position
  • fix_permutation (bool) – Do not permute atoms during shape calculations
Returns:

The structure

Return type:

Structure

Molecule

class cosymlib.molecule.Molecule(geometry, electronic_structure=None, name=None)[source]

Main molecule class

Parameters:
electronic_structure

Get the electronic structure

Returns:The electronic structure
Return type:ElectronicStructure
geometry

Get the geometry

Returns:The geometry
Return type:Geometry
get_charge()[source]

Get the charge of the molecule

get_n_atoms()[source]

Get the number of atoms

Returns:number of atoms
Return type:int
get_pointgroup(tol=0.01)[source]

Get the symmetry point group

Parameters:tol (float) – The tolerance
Returns:The point group
Return type:str
get_positions()[source]

Get the positions in Cartesian coordinates

Returns:the coordinates
Return type:list
get_symbols()[source]

Get the atomic elements symbols

Returns:the symbols
Return type:list

Geometry

class cosymlib.molecule.geometry.Geometry(positions, symbols=(), name='', connectivity=None, connectivity_thresh=1.2)[source]

Main geometry class

Parameters:
  • positions (list) – Cartesian coordinates
  • symbols (list) – Atomic elements symbols
  • name (str) – Geometry name
  • connectivity (list) – Connectivity list
  • connectivity_thresh (float) – Connectivity threshold
Example:
water = Geometry(positions=[[0.0, 0.0, 0.0],
                            [0.0, 1.0, 0.0],
                            [0.0, 0.0, 1.0],
                 symbols=['O', 'H', 'H'],
                 name='water molecule',
                 connectivity=[[1, 2], [1, 3]])
get_connectivity()[source]

Get connectivity as a list of pairs of connected atoms

Returns:The connectivity
Return type:list
get_n_atoms()[source]

Get the number of atoms

Returns:number of atoms
Return type:int
get_pointgroup(tol=0.01)[source]

Get the symmetry point group :param tol: The tolerance :type tol: float :return: The point group :rtype: str

get_positions()[source]

Get the positions in Cartesian coordinates

Returns:the coordinates
Return type:list
get_shape_measure(shape_label, central_atom=0, fix_permutation=False)[source]

Get the Shape measure

Parameters:
  • shape_label (str) – Reference shape label
  • central_atom (int) – the central atom position
  • fix_permutation (bool) – Do not permute atoms
Returns:

The measure

Return type:

float

get_symbols()[source]

Get the atomic elements symbols

Returns:the symbols
Return type:list
get_symmetry_measure(label, central_atom=0, center=None, multi=1)[source]

Get the symmetry measure

Parameters:
  • label (str) – Symmetry point group
  • central_atom (int) – central atom position (0 if no central atom)
  • center (list) – center of the measure in Cartesian coordinates
Returns:

The symmetry measure

Return type:

float

get_symmetry_nearest_structure(label, central_atom=0, center=None, multi=1)[source]

Returns the nearest ideal structure

Parameters:
  • label (str) – symmetry point group
  • central_atom (int) – central atom position (0 if no central atom)
  • center (list) – center of the measure in Cartesian coordinates
Returns:

The structure

Return type:

Geometry

Electronic structure

class cosymlib.molecule.electronic_structure.ElectronicStructure(basis, orbital_coefficients, multiplicity=None, alpha_energies=None, beta_energies=None, alpha_occupancy=None, beta_occupancy=None)[source]

Main Electronic structure class

Parameters:
  • basis (dict) – The basis set
  • orbital_coefficients (list) – Molecular orbital coefficients
  • multiplicity (int) – The multiplicity
  • alpha_energies (list) – Alpha molecular orbital energies in Hartree
  • beta_energies (list) – Beta molecular orbital energies in Hartree
  • alpha_occupancy (list) – Occupancy of alpha orbitals
  • beta_occupancy (list) – Occupancy of beta orbitals