Skip to content

Commit

Permalink
Update manual
Browse files Browse the repository at this point in the history
  • Loading branch information
abelcarreras committed Dec 28, 2020
1 parent cf6157e commit dd13523
Showing 1 changed file with 88 additions and 50 deletions.
138 changes: 88 additions & 50 deletions cosymlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ class Cosymlib:
"""
Main cosymlib class
:param structures: list of Geometry or Molecule type objects
:param ignore_atoms_labels: If True ignore atomic element labels is symmetry calculations
:param ignore_connectivity: If True ignore connectivity in symmetry calculations
:param structures: List of Geometry or Molecule type objects
:type structures: list
:param ignore_atoms_labels: Ignore atomic element labels is symmetry calculations
:type ignore_atoms_labels: bool
:param ignore_connectivity: Ignore connectivity in symmetry calculations
:type ignore_connectivity: bool
:param connectivity: List of pairs if atom indices that are considered connected
:type connectivity: list
:param connectivity_thresh: Connectivity threshold (Ionic radius is used as reference)
:type connectivity_thresh: bool
"""

Expand Down Expand Up @@ -70,10 +75,11 @@ def __init__(self,

def get_n_atoms(self):
"""
Returns the number of atoms if all structures contains the same number of atoms,
Get the number of atoms if all structures contains the same number of atoms,
else raise exception.
:return: number of atoms
:return: Number of atoms
:rtype: int
"""
n_atoms_unique_list = np.unique([mol.geometry.get_n_atoms() for mol in self._molecules])
if len(n_atoms_unique_list) > 1:
Expand All @@ -83,17 +89,16 @@ def get_n_atoms(self):

def get_geometries(self):
"""
Returns the geometry of all structures
Get the geometries
:return: list of Geometry objects
:return: List of Geometry objects
:rtype: list
"""
return [mol.geometry for mol in self._molecules]

def print_info(self):
"""
Prints general information about the structures
:return:
"""
print('\033[1m{:20} {:^5}\033[0m'.format('name', 'atoms'))
for molecule in self._molecules:
Expand All @@ -103,20 +108,23 @@ def print_info(self):
@property
def molecules(self):
"""
Returns the molecules
Get the molecules
:return: List of Molecule objects
:rtype: list
"""
return self._molecules

def print_shape_measure(self, shape_reference, central_atom=0, fix_permutation=False, output=sys.stdout):
"""
Prints the shape measure of all structures in format
:param shape_reference: reference label
:param central_atom: position of the central atom
:param output: defines the output pipe (default: standard output) #TODO: search proper name for "output pipe"
:return:
:param shape_reference: Reference label
:type shape_reference: str
:param central_atom: Position of the central atom
:type central_atom: int
:param output: Display hook
:type output: hook
"""

if shape_reference == 'all':
Expand Down Expand Up @@ -174,11 +182,14 @@ def print_shape_structure(self, shape_reference, central_atom=0, fix_permutation
"""
Prints the nearest shape structure in format
:param shape_reference: reference label
:param central_atom: position of the central atom
:param shape_reference: Reference label
:type shape_reference: str
:param central_atom: Position of the central atom
:type central_atom: int
:param fix_permutation: Do not permute atoms during shape calculations
:param output: defines the output pipe (default: standard output) #TODO: search proper name for "output pipe"
:return:
:type fix_permutation: bool
:param output: Display hook
:type output: hook
"""

if shape_reference == 'all':
Expand Down Expand Up @@ -219,12 +230,16 @@ def print_geometric_measure_info(self, label, multi=1, central_atom=0, center=No
"""
Prints geometric symmetry measure verbose
:param label: symmetry group
:param multi: number of symmetry axis to find
:param central_atom: position of the central atom
:param center: center of symmetry. By default center is optimized
:param output: defines the output pipe (default: standard output) #TODO: search proper name for "output pipe"
:return:
:param label: Symmetry point group label
:type label: str
:param multi: Number of symmetry axis to find
:type multi: int
:param central_atom: Position of the central atom
:type central_atom: int
:param center: Center of symmetry in Cartesian coordinates. If None center is optimized
:type center: list
:param output: Display hook
:type: hook
"""
kwargs = _get_symgroup_arguments(locals())
sep_line = '..................................................\n'
Expand Down Expand Up @@ -268,11 +283,14 @@ def print_geometric_symmetry_measure(self, label, central_atom=0, center=None, o
"""
Prints geometric symmetry measure in format
:param label: symmetry group
:param central_atom: position of the central atom
:param center: center of symmetry. By default center is optimized
:param output: defines the output pipe (default: standard output) #TODO: search proper name for "output pipe"
:return:
:param label: Symmetry point group label
:type label: str
:param central_atom: Position of the central atom
:type central_atom: int
:param center: Center of symmetry in Cartesian coordinates. If None center is optimized
:type center: list
:param output: Display hook
:type output: hook
"""
kwargs = _get_symgroup_arguments(locals())

Expand All @@ -293,11 +311,14 @@ def print_symmetry_nearest_structure(self, label, central_atom=0, center=None, o
"""
Prints the nearest structure to ideal symmetric structure
:param label: symmetry group
:param central_atom: position of the central atom
:param center: center of symmetry. By default center is optimized
:param output: defines the output pipe (default: standard output) #TODO: search proper name for "output pipe"
:return:
:param label: Symmetry point group label
:type label: str
:param central_atom: Position of the central atom
:type central_atom: int
:param center: Center of symmetry in Cartesian coordinates. If None center is optimized
:type center: int
:param output: Display hook
:type output: hook
"""
kwargs = _get_symgroup_arguments(locals())

Expand Down Expand Up @@ -609,11 +630,16 @@ def get_shape_measure(self, label, kind, central_atom=0, fix_permutation=False):
"""
Get shape measure
:param label: reference label
:param kind:
:param central_atom: position of the central atom
:param fix_permutation: do not permute atoms during shape calculations
:return: shape measures list
:param label: Reference shape label
:type label: str
:param kind: function name suffix
:type kind: str
:param central_atom: Position of the central atom
:type central_atom: int
:param fix_permutation: Do not permute atoms during shape calculations
:type fix_permutation: bool
:return: Shape measures
:rtype: list
"""
get_measure = 'get_shape_' + kind

Expand All @@ -624,10 +650,12 @@ def get_molecule_path_deviation(self, shape_label1, shape_label2, central_atom=0
"""
Get molecule path deviation
:param shape_label1: first shape reference label
:param shape_label2: second shape reference label
:param central_atom: position of the central atom
:return:
:param shape_label1: First shape reference label
:type shape_label1: str
:param shape_label2: Second shape reference label
:type shape_label2: str
:param central_atom: Position of the central atom
:type central_atom: int
"""
return [geometry.get_path_deviation(shape_label1, shape_label2, central_atom) for geometry
in self.get_geometries()]
Expand Down Expand Up @@ -666,16 +694,24 @@ def print_minimum_distortion_path_shape(self, shape_label1, shape_label2, centra
"""
Print the minimum distortion path
:param shape_label1: first reference shape label
:param shape_label2: second reference shape label
:param central_atom: position of the central atom
:param shape_label1: First reference shape label
:type shape_label1: str
:param shape_label2: Second reference shape label
:type shape_label2: str
:param central_atom: Position of the central atom
:type central_atom: int
:param min_dev:
:type min_dev: float
:param max_dev:
:type max_dev: float
:param min_gco:
:type min_gco: float
:param max_gco:
:param num_points: number of points
:param output: defines the output pipe (default: standard output) #TODO: search proper name for "output pipe"
:return:
:type max_gco: float
:param num_points: Number of points
:type num_points: int
:param output: Display hook
:type output: hook
"""

if output is not None:
Expand Down Expand Up @@ -750,7 +786,9 @@ def get_point_group(self, tol=0.01):
"""
Get the point group of all structures
:param tol: tolerance
:param tol: Tolerance
:type tol: float
:return: a list of point group labels
:rtype: list
"""
return [molecule.geometry.get_pointgroup(tol) for molecule in self._molecules]

0 comments on commit dd13523

Please sign in to comment.