Skip to content

Commit

Permalink
Merge pull request #624 from openforcefield/conformer-energies-single…
Browse files Browse the repository at this point in the history
…-mol

Update conformer energy notebook and CLI to work for single conf molecule
  • Loading branch information
j-wags committed Jun 25, 2020
2 parents eac8087 + e1a8590 commit 131d86c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/conformer_energies/conformer_energies.ipynb
Expand Up @@ -58,6 +58,12 @@
"# Load in the molecule and its conformers.\n",
"# Note that all conformers of the same molecule are loaded as separate Molecule objects\n",
"loaded_molecules = Molecule.from_file('ruxolitinib_conformers.sdf', toolkit_registry=rdktkw)\n",
"\n",
"# The logic below only works for lists of molecules, so if a\n",
"# single molecule was loaded, cast it to list\n",
"if type(loaded_molecules) is not list:\n",
" loaded_molecules = [loaded_molecules]\n",
"\n",
"# Collatate all conformers of the same molecule\n",
"# NOTE: This isn't necessary if you have already loaded or created multi-conformer molecules;\n",
"# it is just needed because our SDF reader does not automatically collapse conformers.\n",
Expand Down
4 changes: 4 additions & 0 deletions examples/conformer_energies/conformer_energies.py
Expand Up @@ -12,6 +12,10 @@ def compute_conformer_energies_from_file(filename):
# different behavior in some cases. So, here we force loading through RDKit to ensure the correct behavior
rdktkw = RDKitToolkitWrapper()
loaded_molecules = Molecule.from_file(filename, toolkit_registry=rdktkw)
# The logic below only works for lists of molecules, so if a
# single molecule was loaded, cast it to list
if type(loaded_molecules) is not list:
loaded_molecules = [loaded_molecules]
# Collatate all conformers of the same molecule
# NOTE: This isn't necessary if you have already loaded or created multi-conformer molecules;
# it is just needed because our SDF reader does not automatically collapse conformers.
Expand Down

0 comments on commit 131d86c

Please sign in to comment.