@@ -660,26 +660,9 @@ def parse_gradient(self):
660660 self .gradient = grad
661661
662662 def parse_excitation (self ):
663- _reexc = "no. E/a.u. E/eV f"
664- found = self .find (_reexc , keys_only = True )
665- if not found :
666- return
667- # there should only be one in the entire output
668- start = found [0 ] + 2
669- stop = start
670- while self [stop ].strip (): stop += 1
671- df = self .pandas_dataframe (start , stop , ncol = 6 )
672- df .columns = ['excitation' , 'energy' , 'energy_ev' , 'osc' , 'tau' , 'symmetry' ]
673- nan = np .where (list (map (lambda x : any (x ), df .isna ().values )))[0 ]
674- df .loc [nan , 'symmetry' ] = df .loc [nan , 'tau' ].copy ()
675- df .loc [nan , 'tau' ] = 0.0
676- df ['tau' ] = df ['tau' ].astype (float )
677- df ['excitation' ] = [int (x [:- 1 ]) for x in df ['excitation' ].values ]
678- df .index = df ['excitation' ] - 1
679- df .drop ('excitation' , axis = 1 , inplace = True )
680- df ['frame' ] = 0
681- df ['group' ] = 0
682- self .excitation = df
663+ # the output has not changed from the last few iterations
664+ # of ADF
665+ ADF .parse_excitation (self )
683666
684667 def parse_electric_dipole (self ):
685668 _reexc = "Excitation energies E in a.u. and eV, dE wrt prev. cycle"
@@ -716,7 +699,7 @@ def parse_electric_dipole(self):
716699 diff = np .setdiff1d (df ['excitation' ].values .flatten (),
717700 tdm ['excitation' ].values .flatten ())
718701 if len (diff ) > 0 :
719- for idx , d in enumerate ( diff ) :
702+ for d in diff :
720703 df1 = tdm .loc [range (d )]
721704 df2 = tdm .loc [range (d , tdm .shape [0 ])]
722705 new_line = [d , df .loc [d , 'energy_ev' ],
0 commit comments