Skip to content

Commit a99b4a4

Browse files
committed
Prevent symmetrized nbo input from running
1 parent f84adfb commit a99b4a4

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

exatomic/molcas/output.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import numpy as np
1717
from six import StringIO
1818
from exa import TypedMeta
19+
import exatomic
1920
from .editor import Editor
2021
from exatomic import Atom
2122
from exatomic.algorithms.numerical import _flat_square_to_triangle, _square_indices
@@ -152,19 +153,25 @@ class Output(six.with_metaclass(OutMeta, Editor)):
152153

153154
def add_orb(self, path, mocoefs='coef', orbocc='occupation'):
154155
"""
155-
Add a MOMatrix and Orbital table to a molcas.Output.
156+
Add a MOMatrix and Orbital table to a molcas.Output. If path is
157+
an Editor containing momatrix and orbital tables then adds them
158+
directly, otherwise assumes it is a molcas.Orb file.
156159
157160
Args:
161+
path (str, Editor): path to file or Editor object
158162
mocoefs (str): rename coefficients
159163
orbocc (str): rename occupations
160164
"""
161-
orb = Orb(path)
165+
if isinstance(path, exatomic.Editor): orb = path
166+
else: orb = Orb(path)
162167
if mocoefs != 'coef' and orbocc == 'occupation':
163168
orbocc = mocoefs
164169
# MOMatrix
165170
curmo = getattr(self, 'momatrix', None)
166171
if curmo is None:
167172
self.momatrix = orb.momatrix
173+
if mocoefs != 'coef':
174+
self.momatrix.rename(columns={'coef': mocoefs}, inplace=True)
168175
else:
169176
if mocoefs in self.momatrix.columns:
170177
raise ValueError('This action would overwrite '
@@ -177,6 +184,8 @@ def add_orb(self, path, mocoefs='coef', orbocc='occupation'):
177184
curorb = getattr(self, 'orbital', None)
178185
if curorb is None:
179186
self.orbital = orb.orbital
187+
if orbocc != 'occupation':
188+
self.orbital.rename(columns={'occupation': orbocc}, inplace=True)
180189
else:
181190
if orbocc in self.orbital.columns:
182191
raise ValueError('This action would overwrite '

exatomic/nbo/inputs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ def _obtain_arrays(uni):
144144
# Exponents per basis set
145145
expnts = bases.apply(lambda x: x.shape[0])
146146
# mapped onto the atoms with each basis set
147-
if 'irrep' in uni.basis_set_order:
148-
raise Exception("Need basis desymmetrization figured out.")
147+
if uni.basis_set_order.irrep.max():
148+
raise Exception("Need to figure out basis desymmetrization.")
149149
else:
150150
center = uni.basis_set_order['center'].values.copy()
151151
kwargs = {'center': uni.basis_set_order['center'].values.copy(),

exatomic/nbo/output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def parse_momatrix(self, nbas, nmo=None, column=None, os=False,
8585
column = 'coef' if column is None else column
8686
nmo = nbas if nmo is None else nmo
8787
start = 0
88-
while True:
88+
while start < len(self):
8989
try:
9090
float(self[start].split()[0])
9191
break

0 commit comments

Comments
 (0)