Skip to content

Commit

Permalink
Merge pull request #3 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Fixed issue of orbital numbers off by one, and truncated output to Job.out
  • Loading branch information
seamm authored Oct 22, 2023
2 parents 9a88f1f + 55d956a commit 98ccaf7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
History
=======

2023.10.22 Bug fixes: orbital plots and output
* The plots of the HOMO and LUMO were shifted by one orbital due to some code
counting from 1 and other, from 0. Sigh.
* The output to Job.out was inadvertently truncated.

2023.10.7 Added structure file for plots of density and orbitals.
* Always write the current structure as 'structure.sdf' in the directory where the
cube files for orbitals and densities are written. The Dashboard picks up this
Expand Down
9 changes: 5 additions & 4 deletions gaussian_step/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def analyze(self, indent="", data={}, table=None):
metadata = gaussian_step.metadata["results"]
if "Total Energy" not in data:
text += "Gaussian did not produce the energy. Something is wrong!"
printer.normal(__(text, indent=self.indent + 4 * " "))

for key in (
"Total Energy",
Expand Down Expand Up @@ -518,17 +519,17 @@ def analyze(self, indent="", data={}, table=None):
text += "\n\n"
text += textwrap.indent("\n".join(text_lines), self.indent + 7 * " ")

printer.normal(text)

# Write the structure locally for use in density and orbital plots
obConversion = openbabel.OBConversion()
obConversion.SetOutFormat("sdf")
obMol = configuration.to_OBMol(properties="all")
title = f"SEAMM={system.name}/{configuration.name}"
obMol.SetTitle(title)
text = obConversion.WriteString(obMol)
sdf = obConversion.WriteString(obMol)
path = directory / "structure.sdf"
path.write_text(text)

printer.normal(text)
path.write_text(sdf)

text = self.make_plots(data)
if text != "":
Expand Down
4 changes: 2 additions & 2 deletions gaussian_step/substep.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def make_plots(self, data):
tmp = orbitals
orbitals = []
for x in tmp:
if x > 0 and x <= n_orbitals:
if x >= 0 and x < n_orbitals:
orbitals.append(x)

if spin_polarized:
Expand All @@ -282,7 +282,7 @@ def make_plots(self, data):
filename = f"{l2}LUMO.cube"
else:
filename = f"{l2}LUMO+{mo - homo - 1}.cube"
args = f"1 {l1}MO={mo} gaussian.fchk {filename} {npts} h"
args = f"1 {l1}MO={mo + 1} gaussian.fchk {filename} {npts} h"

# And run CUBEGEN
try:
Expand Down

0 comments on commit 98ccaf7

Please sign in to comment.