pychemia.analysis package

The classes and methods of this package, take one or several structures and based only on geometrical properties, computes fingerprints, modify structures, match atoms from two structures, split and create surfaces. The functionality provided by this package is critical for many of the operations done by global search methods applied for structural search.

Submodules

pychemia.analysis.analysis module

class pychemia.analysis.analysis.StructureAnalysis(structure, supercell=(1, 1, 1), radius=50)[source]

Bases: object

The set of analysis provided by this class uses only structural information of one single structure. The kind of analysis includes coordination numbers, bonds, distances, hardness, fingerprints. Most of those analysis rely on a robust computation of inter-atomic distances. This class uses lazy evaluation for the distances and bonds to lower cpu and memory footprint.

all_distances()[source]
all_distances_by_species()[source]
bonds_coordination(initial_cutoff_radius=0.8, use_laplacian=True, jump=0.01, tol=1e-15)[source]
close_distances()[source]

Computes the closest distances for all the atoms

Returns:(tuple) Return a bond’s dictionary and distance’s list
distances
fp_oganov(delta=0.01, sigma=0.01)[source]
get_bonds(radius, noupdate=False, verbose=False, tolerance=0.05)[source]

Calculates bond lengths between all atoms within “radius”.

Parameters:
  • radius – (float) The radius of the sphere were the bonds will be computed
  • noupdate – (bool) If the original radius should be increased until a connected structure is obtained
  • verbose – (bool) Print some info about the number of bonds computed
  • tolerance – (float) Tolerance for creation of a bond

:rtype : dict The values of the bonds are stored in self.info[‘bonds’]

get_bonds_coordination(initial_cutoff_radius=0.8, ensure_conectivity=False, use_laplacian=True, verbose=False, tol=1e-15, jump=0.01, use_jump=True)[source]

Computes simultaneously the bonds for all atoms and the coordination number using a multiplicative tolerance for the sum of covalent radius

Parameters:
  • use_jump
  • jump
  • tol
  • verbose
  • use_laplacian
  • initial_cutoff_radius – (float) Tolerance factor (default is 1.2)
  • ensure_conectivity – (bool) If True the tolerance of each bond is adjusted to ensure that each atom is connected at least once
Returns:

tuple

hardness(verbose=True, initial_cutoff_radius=0.8, ensure_conectivity=False, use_laplacian=True, use_jump=True, tol=1e-15)[source]

Calculates the hardness of a structure based in the model of XX We use the covalent radii from pychemia.utils.periodic. If noupdate=False the Laplacian matrix method is not used and rcut is 2*max(cov_radii)

Parameters:
  • use_jump
  • ensure_conectivity
  • verbose – (bool) To print some debug info
  • initial_cutoff_radius – (float)
  • use_laplacian – (bool) If True, the Laplacian method is used
  • tol – (float) Tolerance for considering two atoms bonded

:rtype : (float)

hardness_XX(initial_cutoff_radius=0.8, use_laplacian=True)[source]
hardness_old(noupdate=False, verbose=False, tolerance=0.05)[source]

Calculates the hardness of a structure based in the model of XX We use the covalent radii from pychemia.utils.periodic. If noupdate=False the Laplacian matrix method is not used and rcut is 2*max(cov_radii)

Parameters:
  • noupdate – (bool) If True, the Laplacian method is used
  • verbose – (bool) To print some debug info
  • tolerance – (float)

:rtype : (float)

radius
structure_distances(delta=0.01, sigma=0.01, integrated=True)[source]

pychemia.analysis.changer module

class pychemia.analysis.changer.StructureChanger(structure)[source]

Bases: object

deform_cell(stress_eps)[source]
move_one_atom(index, vector)[source]
permutator(pair)[source]
random_change(epsilon)[source]
random_deform_cell(diag=True, nondiag=True, maxdelta=0.01)[source]
random_move_many_atoms(epsilon=0.01, forbidden_indices=None, forbidden_species=None)[source]
random_move_one_atom(mu=0.1, sigma=0.01)[source]
random_permutator(forbidden_list=None)[source]

pychemia.analysis.cluster module

class pychemia.analysis.cluster.ClusterAnalysis(structure)[source]

Bases: object

all_distances_by_species()[source]
discrete_radial_distribution_function(delta=0.01, sigma=0.01, integrated=True)[source]
distance_matrix()[source]

Compute the distance matrix, the distance between any two particles in the entire structure. For distance matrices related separated by species, use instead distance_matrix_by_species.

Returns:
distance_matrix_by_species(specie1, specie2)[source]
class pychemia.analysis.cluster.ClusterMatch(structure1, structure2)[source]

Bases: object

match()[source]

pychemia.analysis.matching module

class pychemia.analysis.matching.StructureMatch(structure1, structure2)[source]

Bases: object

cartesian_distances()[source]
cell_displacement()[source]
match_atoms()[source]
match_shape()[source]
match_size()[source]
reduced_displacement()[source]

pychemia.analysis.splitting module

class pychemia.analysis.splitting.SplitMatch(structure1, structure2)[source]

Bases: object

get_minimal_splitting()[source]
get_simple_match()[source]
pychemia.analysis.splitting.do_mixing(structure1, structure2, cut_planes1, cut_planes2, matching, match_index)[source]
pychemia.analysis.splitting.get_all_splitted_compositions(structure, cut_planes)[source]
pychemia.analysis.splitting.get_cut_planes(structure, delta_distance=0.1)[source]

Compute all the possible cutting planes defined on reduced coordinates for which the structure can be efectively cut considering that the perpendicular distance between two atoms is larger than ‘delta_distance’

Parameters:
  • structure
  • delta_distance
Returns:

pychemia.analysis.splitting.get_matching_options(structure1, structure2, delta_distance=0.1)[source]
pychemia.analysis.splitting.get_simple_split_sites(structure, cut_planes)[source]
pychemia.analysis.splitting.get_split_sites(structure, idim, cut_planes, indices)[source]

Return the indices of the sites corresponding to each partition of the structure

Parameters:
  • structure
  • idim
  • cut_planes
  • indices
Returns:

pychemia.analysis.surface module

pychemia.analysis.surface.attach_to_facet(structure, facet)[source]
pychemia.analysis.surface.ext_gcd(a, b)[source]
pychemia.analysis.surface.find_new_seed(st, surface, seed, natom_crystal)[source]

Find a new atom to serve as seed for deposition

Parameters:
  • st – Structure
  • surface – Indices of atoms on surface
  • seed – Current seed
  • natom_crystal – Number of atoms in crystal, cluster atoms are always at the end
Returns:

pychemia.analysis.surface.get_center_vector(structure, facet)[source]
pychemia.analysis.surface.get_facets(structure, surface, seed, distance_tolerance=2.0)[source]
pychemia.analysis.surface.get_onion_layers(structure)[source]

Returns the different layers of a finite structure

Parameters:structure
Returns:
pychemia.analysis.surface.get_surface_atoms(structure)[source]

Returns the list of atoms that belong to the surface of a given structure The surface atoms are computed as those atom for which the Voronoi tesselation is open, ie, their voronoi volume associated is infinite.

Parameters:structure – PyChemia Structure (Non-periodic in the current implementation)
Returns:(list) List of integers with the indices of the surface atoms
pychemia.analysis.surface.get_surface_atoms_new(structure, use_covalent_radius=False)[source]
pychemia.analysis.surface.print_vector(v)[source]
pychemia.analysis.surface.random_attaching(structure, seed, target_species, natom_crystal, radius=1.8, basetol=4.0)[source]
pychemia.analysis.surface.rotate_along_indices(structure, h, k, l, layers, tol=1e-05)[source]