diff --git a/HISTORY.rst b/HISTORY.rst index 716e79f..2c84591 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -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. diff --git a/psi4_step/energy.py b/psi4_step/energy.py index 0aafd90..3c5bf2c 100644 --- a/psi4_step/energy.py +++ b/psi4_step/energy.py @@ -6,6 +6,8 @@ import logging from pathlib import Path +from openbabel import openbabel + import psi4_step import seamm import seamm.data @@ -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" @@ -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): diff --git a/psi4_step/optimization.py b/psi4_step/optimization.py index d65124c..6fa7abc 100644 --- a/psi4_step/optimization.py +++ b/psi4_step/optimization.py @@ -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" diff --git a/psi4_step/psi4.py b/psi4_step/psi4.py index b0ca38d..868d185 100644 --- a/psi4_step/psi4.py +++ b/psi4_step/psi4.py @@ -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 @@ -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" @@ -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."""