From 7c2b82faa158ae911014133e72480b05c541d3ed Mon Sep 17 00:00:00 2001 From: "Matthew W. Thompson" Date: Wed, 2 Mar 2022 16:31:49 -0600 Subject: [PATCH 1/2] Cache generate_conformers with hash_molecule_args_and_kwargs approach --- src/smirnoff_hack.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/smirnoff_hack.py b/src/smirnoff_hack.py index 2734d91d4..4c17c99b3 100644 --- a/src/smirnoff_hack.py +++ b/src/smirnoff_hack.py @@ -125,10 +125,10 @@ def at_cached_assign_partial_charges(self, molecule, *args, **kwargs): # cache the OE generate_conformers function (save 15s) OE_TOOLKIT_CACHE_molecule_conformers = {} oe_original_generate_conformers = OpenEyeToolkitWrapper.generate_conformers - def oe_cached_generate_conformers(self, molecule, n_conformers=1, rms_cutoff=None, clear_existing=True): - cache_key = hash((hash_molecule(molecule), n_conformers, str(rms_cutoff), clear_existing)) + def oe_cached_generate_conformers(self, molecule, *args, **kwargs): + cache_key = hash_molecule_args_and_kwargs(molecule, args, kwargs) if cache_key not in OE_TOOLKIT_CACHE_molecule_conformers: - oe_original_generate_conformers(self, molecule, n_conformers=n_conformers, rms_cutoff=rms_cutoff, clear_existing=clear_existing) + oe_original_generate_conformers(self, molecule, *args, **kwargs) OE_TOOLKIT_CACHE_molecule_conformers[cache_key] = molecule._conformers molecule._conformers = OE_TOOLKIT_CACHE_molecule_conformers[cache_key] OpenEyeToolkitWrapper.generate_conformers = oe_cached_generate_conformers @@ -137,10 +137,10 @@ def oe_cached_generate_conformers(self, molecule, n_conformers=1, rms_cutoff=Non # cache the RDKit generate_conformers function RDK_TOOLKIT_CACHE_molecule_conformers = {} rdk_original_generate_conformers = RDKitToolkitWrapper.generate_conformers - def rdk_cached_generate_conformers(self, molecule, n_conformers=1, rms_cutoff=None, clear_existing=True): - cache_key = hash((hash_molecule(molecule), n_conformers, str(rms_cutoff), clear_existing)) + def rdk_cached_generate_conformers(self, molecule, *args, **kwargs): + cache_key = hash_molecule_args_and_kwargs(molecule, args, kwargs) if cache_key not in RDK_TOOLKIT_CACHE_molecule_conformers: - rdk_original_generate_conformers(self, molecule, n_conformers=n_conformers, rms_cutoff=rms_cutoff, clear_existing=clear_existing) + rdk_original_generate_conformers(self, molecule, *args, **kwargs) RDK_TOOLKIT_CACHE_molecule_conformers[cache_key] = molecule._conformers molecule._conformers = RDK_TOOLKIT_CACHE_molecule_conformers[cache_key] RDKitToolkitWrapper.generate_conformers = rdk_cached_generate_conformers From 7a38f51e853f9154ccc76441891a711f792cfc25 Mon Sep 17 00:00:00 2001 From: "Matthew W. Thompson" Date: Wed, 2 Mar 2022 16:34:07 -0600 Subject: [PATCH 2/2] Ensure openff-toolkit 0.10.3 is installed --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9202847cb..f948edfca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: if: ${{ matrix.python-version != 2.7}} shell: bash -l {0} run: | - conda install openff-toolkit -c conda-forge -y + conda install openff-toolkit=0.10.3 -c conda-forge -y # Need to replace ndcctools with this block # - name: Install Work Queue