Skip to content

Commit

Permalink
Merge pull request #23 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Fixed bug with ncores, and added structure to orbital plots.
  • Loading branch information
seamm authored Oct 23, 2023
2 parents 80c6e4b + fa57548 commit e219f86
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
History
=======

2023.8.22 -- Enhancement of orbital plots
* Added structure to the orbital plots
* Fixed a bug if the default nouber of cores was not 'available'

2023.6.4 -- Enhancements
* Added thermochemistry substep to compute the vibrational and other corrections for
thermochemistry.
Expand Down
18 changes: 13 additions & 5 deletions psi4_step/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import logging
from pathlib import Path

from openbabel import openbabel

import psi4_step
import seamm
import seamm.data
Expand Down Expand Up @@ -295,11 +297,6 @@ def analyze(self, indent="", data={}, out=[]):
"""Parse the output and generating the text output and store the
data in variables for other stages to access
"""

# P = self.parameters.current_values_to_dict(
# context=seamm.flowchart_variables._data
# )

# Read in the results from json
directory = Path(self.directory)
json_file = directory / "properties.json"
Expand All @@ -324,6 +321,17 @@ def analyze(self, indent="", data={}, out=[]):
printer.normal(__(text, **data, indent=self.indent + 4 * " "))
raise RuntimeError(text)

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

printer.normal(__(text, **data, indent=self.indent + 4 * " "))

def plot_input(self):
Expand Down
7 changes: 1 addition & 6 deletions psi4_step/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,10 @@ def get_input(self, calculation_type="optimize"):

return "\n".join(lines)

def analyze(self, indent="", data={}, out=[]):
def analyze_sv(self, indent="", data={}, out=[]):
"""Parse the output and generating the text output and store the
data in variables for other stages to access
"""

# P = self.parameters.current_values_to_dict(
# context=seamm.flowchart_variables._data
# )

# Read in the results from json
directory = Path(self.directory)
json_file = directory / "properties.json"
Expand Down
31 changes: 15 additions & 16 deletions psi4_step/psi4.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def run(self):
if n_threads < 1:
n_threads = 1
if seamm_options["ncores"] != "available":
n_threads = min(n_threads, int(options["max_cores"]))
n_threads = min(n_threads, int(options["ncores"]))
self.logger.info(f"Psi4 will use {n_threads} threads.")

# How much memory to use
Expand Down Expand Up @@ -531,21 +531,6 @@ def analyze(self, indent="", **kwargs):
indent: str
An extra indentation for the output
"""

# Get the first real node
node = self.subflowchart.get_node("1").next()

# Loop over the subnodes, asking them to do their analysis
while node is not None:
for value in node.description:
printer.important(value)

node.analyze()

printer.normal("")

node = node.next()

# Update the structure
directory = Path(self.directory)
structure_file = directory / "final_structure.json"
Expand All @@ -571,6 +556,20 @@ def analyze(self, indent="", **kwargs):
)
printer.important("")

# Get the first real node
node = self.subflowchart.get_node("1").next()

# Loop over the subnodes, asking them to do their analysis
while node is not None:
for value in node.description:
printer.important(value)

node.analyze()

printer.normal("")

node = node.next()

def _convert_structure(self, name=None, no_com=True, no_reorient=True):
"""Convert the structure to the input for Psi4."""

Expand Down

0 comments on commit e219f86

Please sign in to comment.