Skip to content

Commit

Permalink
fixed get_connectivity function. Now returns None if no connectivity …
Browse files Browse the repository at this point in the history
…is found

added geometric symmetry measure n (=multi) values tot the print function in Cosymlib class
adapted the symgroup properties names to the new names of symgroupy version 0.5.7
  • Loading branch information
efrembernuz committed Apr 15, 2021
1 parent ba125f9 commit 6c265b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cosymlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ def print_geometric_measure_info(self, label, multi=1, central_atom=0, center=No
txt += '{:12.8f} {:12.8f} {:12.8f}\n'.format(array[0], array[1], array[2])
txt += '\n'
txt += 'Symmetry measure {:.5f}\n'.format(molecule.geometry.get_symmetry_measure(**kwargs))
txt += 'Symmetry {} lower values: '.format(multi)
txt += ' '.join(format(csm, '.5f') for csm in molecule.geometry._symmetry.csm_multi(label, multi)) + '\n'
txt += sep_line

output.write(txt)
Expand Down
7 changes: 4 additions & 3 deletions cosymlib/symmetry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def _get_symgroup_results(self, group):
"""

# Crude calculation call methods
key = _get_key_symgroup(group, self._center, self._central_atom, self._connectivity, self._multi, self._connect_thresh)
key = _get_key_symgroup(group, self._center, self._central_atom, self._connectivity, self._multi,
self._connect_thresh)
if key not in self._results:
self._results[key] = Symgroupy(self._coordinates,
group=group,
Expand Down Expand Up @@ -200,7 +201,7 @@ def reference_axis(self, label):
"""
return self._get_symgroup_results(label).reference_axis

def cms_multi(self, label, multi=1):
def csm_multi(self, label, multi=1):
"""
Get symmetry measure of the optimum N axis
Expand All @@ -212,7 +213,7 @@ def cms_multi(self, label, multi=1):
:rtype: list
"""
self._multi = multi
return self._get_symgroup_results(label).cms_multi
return self._get_symgroup_results(label).csm_multi

def axis_multi(self, label, multi=1):
"""
Expand Down
5 changes: 4 additions & 1 deletion cosymlib/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ def generate_connectivity_from_geometry(geometry, thresh=1.2):
warn('failed to generate connectivity')
return None

return (np.array(np.where(relative_differences < thresh - 1)).T + 1).tolist()
if not (np.array(np.where(relative_differences < thresh - 1)).T + 1).tolist():
return None
else:
return (np.array(np.where(relative_differences < thresh - 1)).T + 1).tolist()


def get_connectivity_matrix(connectivity, ndim):
Expand Down

0 comments on commit 6c265b6

Please sign in to comment.