Skip to content

Commit

Permalink
Update docstrings of Geometry class
Browse files Browse the repository at this point in the history
  • Loading branch information
abelcarreras committed Dec 28, 2020
1 parent fed7b4c commit a712112
Showing 1 changed file with 54 additions and 7 deletions.
61 changes: 54 additions & 7 deletions cosymlib/molecule/geometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
from cosymlib.symmetry.pointgroup import PointGroup
from cosymlib.tools import generate_connectivity_from_geometry
import numpy as np
from functools import wraps


def set_parameters(func):
@wraps(func)
def wrapper(*args, **kwargs):
args[0]._symmetry.set_parameters(kwargs)
return func(*args, **kwargs)
Expand Down Expand Up @@ -125,19 +127,49 @@ def set_positions(self, central_atom=0):
self._shape._positions= self._positions

def get_positions(self):
"""
Get the positions in Cartesian coordinates
:return: the coordinates
:rtype: list
"""
return self._positions

def get_n_atoms(self):
"""
Get the number of atoms
:return: number of atoms
:rtype: int
"""
return len(self.get_positions())

def get_symbols(self):
"""
Get the atomic elements symbols
:return: the symbols
:rtype: list
"""
return self._symbols

def generate_connectivity(self, thresh=1.2):
self._connectivity = generate_connectivity_from_geometry(self, thresh=thresh)

# Shape methods
def get_shape_measure(self, shape_label, central_atom=0, fix_permutation=False):
"""
Get the Shape measure
:param shape_label: Reference shape label
:type shape_label: str
:param central_atom: the central atom position
:type central_atom: int
:param fix_permutation: Do not permute atoms
:type fix_permutation: bool
:return: The measure
:rtype: float
"""
return self._shape.measure(shape_label, central_atom=central_atom, fix_permutation=fix_permutation)

def get_shape_structure(self, shape_label, central_atom=0, fix_permutation=False):
Expand All @@ -158,12 +190,16 @@ def get_generalized_coordinate(self, shape_label1, shape_label2, central_atom=0)
@set_parameters
def get_symmetry_measure(self, label, central_atom=0, center=None, multi=1):
"""
Returns the symmetry measure
Get the symmetry measure
:param label: symmetry group
:param label: Symmetry point group
:type label: str
:param central_atom: central atom position (0 if no central atom)
:param center: center of the measure
:return: the measure
:type central_atom: int
:param center: center of the measure in Cartesian coordinates
:type center: list
:return: The symmetry measure
:rtype: float
"""

return self._symmetry.measure(label)
Expand All @@ -173,10 +209,14 @@ def get_symmetry_nearest_structure(self, label, central_atom=0, center=None, mu
"""
Returns the nearest ideal structure
:param label: symmetry group
:param label: symmetry point group
:type label: str
:param central_atom: central atom position (0 if no central atom)
:param center: center of the measure
:return: the structure
:type central_atom: int
:param center: center of the measure in Cartesian coordinates
:type center: list
:return: The structure
:rtype: Structure
"""
return Geometry(symbols=self.get_symbols(),
positions=self._symmetry.nearest_structure(label),
Expand All @@ -188,6 +228,13 @@ def get_symmetry_optimum_axis(self, label, central_atom=0, center=None):
return self._symmetry.optimum_axis(label)

def get_pointgroup(self, tol=0.01):
"""
Get the symmetry point group
:param tol: The tolerance
:type tol: float
:return: The point group
:rtype: str
"""
return PointGroup(self, tolerance=tol).get_point_group()


Expand Down

0 comments on commit a712112

Please sign in to comment.