From 8d1b3b0b1913d4119ee8f8963c35615f8d2768f5 Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Thu, 23 May 2024 14:13:11 -0400 Subject: [PATCH 1/3] Removed import, etc. to make pass black, since this code is not used at all. --- psi4_step/accelerated_optimization.py | 31 +++++++++++++++------------ 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/psi4_step/accelerated_optimization.py b/psi4_step/accelerated_optimization.py index 6f06be8..6b49106 100644 --- a/psi4_step/accelerated_optimization.py +++ b/psi4_step/accelerated_optimization.py @@ -11,7 +11,8 @@ import traceback import numpy as np -import optking + +# import optking from scipy.optimize import minimize, OptimizeResult from scipy.optimize._optimize import ( _prepare_scalar_function, @@ -263,7 +264,7 @@ def run(self, node0, memory, n_threads): printer.normal("NOT Converged!!!!!!") else: # Iterate - molecule = configuration.to_qcschema_dict() + # molecule = configuration.to_qcschema_dict() optking_options = { "step_type": P["optimization method"], "g_convergence": P["geometry convergence"], @@ -283,7 +284,8 @@ def run(self, node0, memory, n_threads): # "rms_force_g_convergence": 3.0e-04, # "intrafrag_hess": "SIMPLE", - optimizer = optking.CustomHelper(molecule, optking_options) + # optimizer = optking.CustomHelper(molecule, optking_options) + optimizer = None # The initial coordinates as NUMPY array. Psi4 may reorient, so need # to run and cache the first results @@ -377,18 +379,19 @@ def _surrogate_optimization(self, directory): # Handle the system _, configuration = self.get_system_configuration() - molecule = configuration.to_qcschema_dict() - # "g_convergence": "gau", - optking_options = { - "opt_coordinates": "cartesian", - "g_convergence": "cfour", - "max_force_g_convergence": 4.5e-04, - "rms_force_g_convergence": 3.0e-04, - "FULL_HESS_EVERY": 1, - "intrafrag_hess": "SIMPLE", - } + # molecule = configuration.to_qcschema_dict() + # # "g_convergence": "gau", + # optking_options = { + # "opt_coordinates": "cartesian", + # "g_convergence": "cfour", + # "max_force_g_convergence": 4.5e-04, + # "rms_force_g_convergence": 3.0e-04, + # "FULL_HESS_EVERY": 1, + # "intrafrag_hess": "SIMPLE", + # } # "hess_update": "none", - optimizer = optking.CustomHelper(molecule, optking_options) + # optimizer = optking.CustomHelper(molecule, optking_options) + optimizer = None # First calculate the derivatives with both Psi4 and MOPAC xyz0 = np.array(optimizer.geom).flatten() From 30156084a1f56c7e19fa9b4d48df604ce5e6ed67 Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Thu, 23 May 2024 14:14:18 -0400 Subject: [PATCH 2/3] Fixed bug in naming of gradients, and units for E and dE --- psi4_step/energy.py | 8 +++++--- psi4_step/psi4_metadata.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/psi4_step/energy.py b/psi4_step/energy.py index 24bcf82..4c6e48a 100644 --- a/psi4_step/energy.py +++ b/psi4_step/energy.py @@ -336,9 +336,11 @@ def get_input(self, calculation_type="energy", restart=None): variables["Eelec"] = Eelec variables["energy"] = Eelec try: - variables["gradient"] = np.array(G).tolist() -except Exception: - pass + variables["gradients"] = np.array(G).tolist() +except Exception as e: + print("Problem with gradients!") + print(e) + variables["_method"] = "{method}" variables["_method_string"] = "{method_string}" diff --git a/psi4_step/psi4_metadata.py b/psi4_step/psi4_metadata.py index 6139ea2..44cb9aa 100644 --- a/psi4_step/psi4_metadata.py +++ b/psi4_step/psi4_metadata.py @@ -1629,13 +1629,13 @@ "dimensionality": "scalar", "property": "total energy#Psi4#{model}", "type": "float", - "units": "kJ/mol", + "units": "E_h", }, "gradients": { "description": "The gradients", "dimensionality": "[3, n_atoms]", "type": "float", - "units": "kJ/mol/Å", + "units": "E_h/a_0", }, "(T) CORRECTION ENERGY": { "calculation": ["energy", "optimization", "thermochemistry", "vibrations"], From d5fc55b4d53a878cb5c7d00f4be6a488f14cdec8 Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Thu, 23 May 2024 14:16:12 -0400 Subject: [PATCH 3/3] Fixed bug in naming of gradients, and units for E and dE --- HISTORY.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 43ef798..57cfcfb 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,11 @@ ======= History ======= +2024.5.23.2 -- Bugfix: incorrect name for gradients + * There was a typo in the name for the gradients, such that they could not be output + to Results.json. + * The units for the energy and gradients in Results.json were incorrect. + 2024.5.23.1 -- Internal fix for creating Docker image. 2024.5.23 -- Added standard energy and gradients to results