Skip to content

Commit

Permalink
Merge pull request #16 from rfkspada/master
Browse files Browse the repository at this point in the history
Update libmsym.py
  • Loading branch information
mcodev31 committed Apr 17, 2023
2 parents c4e1b8f + 6235048 commit 2e09ea8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions bindings/python/libmsym/libmsym.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ def __str__(self):
orientation = self._proper_rotation_type_names[self.orientation]
elif self.type == self.REFLECTION:
orientation = self._reflection_type_names[self.orientation]
axis = " with normal vector " + repr(self.vector)
axis = " with normal vector " + "[ {: >.3f}, {: >.3f}, {: >.3f}]".format(self.vector[0],self.vector[1],self.vector[2])

if self.type in [self.PROPER_ROTATION, self.IMPROPER_ROTATION]:
order = str(self.order)
power = "^" + str(self.power)
axis = " around " + repr(self.vector)
axis = " around " + "[ {: >.3f}, {: >.3f}, {: >.3f}]".format(self.vector[0],self.vector[1],self.vector[2])

return __name__ + "." + self.__class__.__name__ + "( " + self._names[self.type] + order + orientation + power + axis + ", conjugacy class: " + str(self.conjugacy_class) + " )"
def __repr__(self):
Expand Down Expand Up @@ -365,6 +365,9 @@ def init(library_location=None):

_lib.msymSymmetrizeElements.restype = _ReturnCode
_lib.msymSymmetrizeElements.argtypes = [_Context]

_lib.msymAlignAxes.restype = _ReturnCode
_lib.msymAlignAxes.argtypes = [_Context]

_lib.msymSetBasisFunctions.restype = _ReturnCode
_lib.msymSetBasisFunctions.argtypes = [_Context, c_int, POINTER(BasisFunction)]
Expand Down Expand Up @@ -610,6 +613,15 @@ def symmetrize_elements(self):
self._assert_success(_lib.msymSymmetrizeElements(self._ctx, byref(cerror)))
self._update_elements()
return self._elements

def align_axes(self):
if not self._ctx:
raise RuntimeError
cerror = c_double(0)
self._assert_success(_lib.msymAlignAxes(self._ctx))
self._update_elements()
return self._elements


@property
def subrepresentation_spaces(self):
Expand Down

0 comments on commit 2e09ea8

Please sign in to comment.