API Reference

Cosymlib

class cosymlib.Cosymlib(structures, ignore_atoms_labels=False, ignore_connectivity=False, connectivity=None, connectivity_thresh=None, charge_eh=0, mode=0, precision=3)[source]

This class contains all the high level methods used in the command line interface scripts. The methods return formatted results of multiple molecules calculations

Parameters:
  • structures (list, Geometry, Molecule) – 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

property molecules

Get the molecules

Returns:

List of Molecule objects

Return type:

list

print_chirality_measure(order=1, central_atom=0, center=None, permutation=None, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Prints the chirality measure

Parameters:
  • order (int) – Order of the chirality measure (1: Cs, 2:Ci, n:S_n)

  • central_atom (int) – Position of the central atom

  • center (int) – Center of symmetry in Cartesian coordinates. If None center is optimized

  • permutation (list, tuple) – Define permutation

  • output (hook) – Display hook

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, tuple) – 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, permutation=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, tuple) – Center of symmetry in Cartesian coordinates. If None center is optimized

  • permutation (list, tuple) – Define permutation

  • 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=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[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_point_group(tol=0.01, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Print point group of all structures

Parameters:

tol (float) – Tolerance

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, permutation=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

  • permutation (list, tuple) – Define permutation

  • output (hook) – Display hook

Molecule

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

This is the main class that contains all the information and calculations methods that can a apply to a single molecule. The functionality is divided in two objects: Geometry and Electronic Structure. In the base class (Molecule) implements the methods thatrequire both the electronic structure and molecular geometry information such as the symmetry of the wave function.

Parameters:
property electronic_structure

Get the electronic structure

Returns:

The electronic structure

Return type:

ElectronicStructure

property geometry

Get the geometry

Returns:

The geometry

Return type:

Geometry

get_charge()[source]

Get the charge of the molecule

get_connectivity()[source]

Get the atoms connectivity

Returns:

the atoms 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

Parameters:

tol (float) – The tolerance

Returns:

The point group label

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]

This class contains the methods related to shape and geometric symmetry calculations

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

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_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, permutation=None)[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

  • permutation (list, tuple) – define permutation

Returns:

The symmetry measure

Return type:

float

get_symmetry_nearest_structure(label, central_atom=0, center=None, multi=1, permutation=None)[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

  • permutation (list, tuple) – Define permutation

Returns:

The structure

Return type:

Geometry

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

Get the optimum atoms permutation for geometrical symmetry measures

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

  • permutation (list, tuple) – define permutation

Returns:

The symmetry measure

Return type:

float

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]

This class contains basically the access to electronic structure data

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

property alpha_electrons

get the number of alpha electrons

Returns:

alpha electrons

property alpha_energies

get the energies of the alpha molecular orbitals

Returns:

the energies

property basis

get the basis set name

Returns:

basis set

property beta_electrons

get the number of beta electrons

Returns:

beta electrons

property beta_energies

get the energies of the beta molecular orbitals

Returns:

the energies

property coefficients_a

get the alpha molecular orbitals coefficients

Returns:

the alpha molecular orbitals

property coefficients_b

get the beta molecular orbitals coefficients

Returns:

the beta molecular orbitals

property multiplicity

get the multiplicity

Returns:

the multiplicity

property s2

get the expected value of spin square operator S2 = (s * (s + 1))

Returns:

S2