Skip to content

Commit

Permalink
minor cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
abelcarreras committed Mar 9, 2021
1 parent c3edc41 commit 6352dd9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
9 changes: 1 addition & 8 deletions cosymlib/molecule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def __init__(self, geometry,
self._electronic_structure = electronic_structure
self._symmetry = geometry._symmetry
self._shape = geometry._shape
self._symmetry.set_electronic_structure(electronic_structure)

def molecule_copy(self):
return deepcopy(self)
Expand Down Expand Up @@ -80,7 +79,6 @@ def electronic_structure(self):
multiplicity=eh.get_multiplicity(),
alpha_occupancy=[1]*eh.get_alpha_electrons(),
beta_occupancy=[1]*eh.get_beta_electrons())
self.symmetry.set_electronic_structure(self._electronic_structure)

return self._electronic_structure

Expand All @@ -94,12 +92,6 @@ def symmetry(self):
def shape(self):
return self._shape

# TODO: Old method (to be deprecated)
@set_parameters
def OLD_get_mo_symmetry(self, group, axis=None, axis2=None, center=None):
warn('This method is deprecated', DeprecationWarning)
return self.symmetry._get_wfnsym_results(group)

# New ones (to substitute get_mo_symmetry)
@set_parameters
def get_mo_irreducible_representations(self, group, axis=None, axis2=None, center=None):
Expand Down Expand Up @@ -171,6 +163,7 @@ def get_symbols(self):
def get_pointgroup(self, tol=0.01):
"""
Get the symmetry point group
:param tol: The tolerance
:type tol: float
:return: The point group
Expand Down
16 changes: 10 additions & 6 deletions cosymlib/symmetry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,22 @@ def __init__(self,
):

try:
# Interpret as Geometry or molecule
self._coordinates = structure.get_positions()
self._symbols = structure.get_symbols()
self._connectivity = structure.get_connectivity()
except AttributeError:
# Interpret as numpy array of coordinates
# Interpret as numpy array of coordinates or list of lists
self._coordinates = structure
self._symbols = None
self._connectivity = None

# If molecule object add electronic structure
try:
self._electronic_structure = structure.electronic_structure
except AttributeError:
self._electronic_structure = None

self._central_atom = central_atom
self._center = center
self._connect_thresh = connect_thresh
Expand All @@ -71,11 +78,6 @@ def __init__(self,
self._axis2 = axis2
self._results = {}

try:
self._electronic_structure = structure.electronic_structure
except AttributeError:
self._electronic_structure = None

# Modifier methods
def set_parameters(self, parameters_dict):
"""
Expand Down Expand Up @@ -118,6 +120,8 @@ def _get_symgroup_results(self, group):
return self._results[key]

def _get_wfnsym_results(self, group):
if self._electronic_structure is None:
raise Exception('Electronic structure not set')

key = _get_key_wfnsym(group, self._axis, self._axis2, self._center, self._electronic_structure.alpha_occupancy,
self._electronic_structure.beta_occupancy)
Expand Down
4 changes: 2 additions & 2 deletions cosymlib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def plot_molecular_orbital_diagram(molecule, wfnsym, mo_range=None):


def swap_vectors(v1, v2, position):
vector1 = v1.copy()
vector2 = v2.copy()
vector1 = v1.get_copy()
vector2 = v2.get_copy()
for i in range(len(v1)):
if i >= position:
vector1[i] = v2[i]
Expand Down
2 changes: 1 addition & 1 deletion scripts/shape_map
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import argparse
import sys
import yaml

parser = argparse.ArgumentParser(description='Shape_map ')
parser = argparse.ArgumentParser(description='shape_map ')

# positional arguments
parser.add_argument(type=str,
Expand Down

0 comments on commit 6352dd9

Please sign in to comment.