3535import logging
3636import math
3737import os .path
38-
38+ import re
3939import numpy as np
4040
4141import rmgpy .constants as constants
@@ -309,9 +309,8 @@ def load_energy(self, zpe_scale_factor=1.):
309309 with open (self .path , 'r' ) as f :
310310 line = f .readline ()
311311 while line != '' :
312-
313312 if 'SCF Done:' in line :
314- e_elect = float (line .split ()[4 ]) * constants .E_h * constants .Na
313+ e_elect = float (re . findall ( r"SCF Done: E\(.+\) \=\s+[^\s]+" , line )[ 0 ] .split ()[- 1 ]) * constants .E_h * constants .Na
315314 elect_energy_source = 'SCF'
316315 elif ' E2(' in line and ' E(' in line :
317316 e_elect = float (line .split ()[- 1 ].replace ('D' , 'E' )) * constants .E_h * constants .Na
@@ -351,7 +350,7 @@ def load_energy(self, zpe_scale_factor=1.):
351350 # G4MP2 calculation without opt and freq calculation
352351 # Keyword in Gaussian G4MP2(SP), No zero-point or thermal energies are included.
353352 e_elect = float (line .split ()[2 ]) * constants .E_h * constants .Na
354-
353+
355354 # Read the ZPE from the "E(ZPE)=" line, as this is the scaled version.
356355 # Gaussian defines the following as
357356 # E (0 K) = Elec + E(ZPE),
@@ -376,6 +375,12 @@ def load_energy(self, zpe_scale_factor=1.):
376375 elect_energy_source = 'HF'
377376 except ValueError :
378377 pass
378+ elif 'Energy=' in line :
379+ # for xtb
380+ e_elect = float (line .split ()[1 ]) * constants .E_h * constants .Na
381+ elif 'Energy=' in line :
382+ # for xtb
383+ e_elect = float (line .split ()[1 ]) * constants .E_h * constants .Na
379384 # Read the next line in the file
380385 line = f .readline ()
381386
0 commit comments