for idx,line in enumerate(output_lines):
if "FINAL ENERGY" in line:
properties["scf_total_energy"] = float(line.strip("\n").split()[2])
last_scf_line = output_lines[idx-2]
properties["scf_iterations"] = int(last_scf_line.split()[0])
if "XC Energy" in output_lines:
properties["scf_xc_energy"] = float(last_scf_line.split()[4])
elif "Total atoms" in line:
After Change
properties["scf_total_energy"] = float(line.strip("\n").split()[2])
line_final_energy = idx
elif "Start SCF Iterations" in line:
line_scf_header = idx
elif "Total atoms" in line:
natom = int(line.split()[-1])
elif "DIPOLE MOMENT" in line:
newline = line.replace(",","").replace("}","").replace("{","")
properties["scf_dipole_moment"] = [ float(x) for x in newline.split()[2:5] ]
elif "Nuclear repulsion energy" in line:
properties["nuclear_repulsion_energy"] = float(line.split()[-2])
elif "Gradient units are Hartree/Bohr" in line:
//Gradient is stored as (dE/dx1,dE/dy1,dE/dz1,dE/dx2,dE/dy2,...)
for i in range(idx+3,idx+3+natom):
grad = output_lines[i].strip("\n").split()
for x in grad:
gradients.append( float(x) )
// Look for the last line that is the SCF info
last_scf_line = ""
for idx in reversed(range(line_scf_header, line_final_energy)):
current_line = output_lines[idx]
if self.is_scf_line(current_line):
last_scf_line = current_line
break
if len(last_scf_line) > 0:
properties["scf_iterations"] = int(last_scf_line.split()[0])
if "XC Energy" in output_lines:
properties["scf_xc_energy"] = float(last_scf_line.split()[4])