1616import numpy as np
1717from six import StringIO
1818from exa import TypedMeta
19+ import exatomic
1920from .editor import Editor
2021from exatomic import Atom
2122from 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 '
0 commit comments