Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing support for partial charge I/O in SDF #281

Merged
merged 46 commits into from
Apr 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f822a29
Implemented support for writing partial charges to SDF using RDKit
j-wags Apr 18, 2019
a96a492
Implemented simple SDF charge input functionality and IO tests for RDKit
j-wags Apr 19, 2019
dd6456f
Implemented SDF roundtrip test
j-wags Apr 20, 2019
98d2533
Merge branch 'master' into charges-from-sdf
j-wags Aug 9, 2019
fa9df26
Merge branch 'master' into charges-from-sdf
j-wags Jan 29, 2020
5c2a31c
Implement naive partial charge writing in OETKW
j-wags Jan 29, 2020
faeae20
prototype oechem SDF property reader
j-wags Jan 30, 2020
7485713
debugging OETK sdf props
j-wags Feb 3, 2020
eca3aa1
assume confs in multiconf sdf are different mols, add tests for same
j-wags Feb 4, 2020
500914a
checkpointing progress
j-wags Feb 6, 2020
e48f05c
Expand multiconformer sdf behavior tests
j-wags Feb 9, 2020
0630b7e
sell soul to devil, handle multiconformer sdf properties correctly
j-wags Feb 12, 2020
8326c03
change OETKW.to_file_obj reuse OETKW.to_file
j-wags Feb 12, 2020
407fe8f
fix copy-paste typo
j-wags Feb 12, 2020
f0404f3
revert change-now interpret all-0 pc on OEMol as pc=all zero, not None
j-wags Feb 12, 2020
2ba9510
add test files for multiconformer sdf and sd prop handling
j-wags Feb 12, 2020
514fd96
Start adding multiconf-saving test
j-wags Feb 12, 2020
4772fac
Merge branch 'master' into charges-from-sdf
j-wags Feb 13, 2020
1995ff0
test saving multiconf mol to sdf (only save first conf), fix oe behavior
j-wags Feb 14, 2020
018105a
Merge remote-tracking branch 'origin/charges-from-sdf' into charges-f…
j-wags Feb 14, 2020
77fba86
Draft release notes
j-wags Feb 14, 2020
5efc1ef
Fix several docstring typos
j-wags Feb 14, 2020
8e47b3c
Add chargeless roundtrip sdf test for OETK, reveal ambiguity between …
j-wags Feb 14, 2020
349091a
Clarify behavior around toolkit partial charge I/O
j-wags Feb 18, 2020
7dade6e
from_toolkit wont attach atom_map if all nonzero (not final behavior)
j-wags Feb 20, 2020
39a34d5
tests expect blank dict for properties (not None), other new behaviors
j-wags Feb 20, 2020
44dbdd1
Only remap charges if they are present
j-wags Feb 21, 2020
a10bd59
use oeatom.SetPartialCharge(nan) as equivalent for OFFMol.pcs=None
j-wags Feb 21, 2020
711d750
test for new OETK behavior with nan for partial charges
j-wags Feb 21, 2020
4f91e00
update release history for oetk partial charge/nan behavior
j-wags Feb 21, 2020
2e0b71a
Merge branch 'master' into charges-from-sdf
j-wags Feb 21, 2020
1eb15a0
cast offmol.properties keys/values to str during conversion to sd data
j-wags Feb 21, 2020
c2fa733
small releasenotes fix
j-wags Feb 21, 2020
6130887
Small cleanups for PR review.
j-wags Feb 21, 2020
184394c
clarify handling of nan partial charges in to/from_openeye
j-wags Mar 24, 2020
9f6b550
Update openforcefield/utils/toolkits.py
j-wags Apr 7, 2020
20e7bca
Update openforcefield/utils/toolkits.py
j-wags Apr 7, 2020
6b83586
improve test format and documentation
j-wags Apr 8, 2020
e8b073f
fix mol2 test partial charges
j-wags Apr 8, 2020
bf99762
Merge branch 'master' into charges-from-sdf
j-wags Apr 8, 2020
b26f19e
Remove use of _conformers in toolkit tests
j-wags Apr 9, 2020
b1859e8
Properly catch sanitization errors on nitro groups
j-wags Apr 9, 2020
476cdbd
fix incorrect docstrings in chargeless sdf writing tests
j-wags Apr 9, 2020
04b0eb6
revert how oe atom indices are handled
j-wags Apr 9, 2020
443bec3
remove uses of enumerate-style loops over oeatoms and oebonds
j-wags Apr 10, 2020
19f705c
revert deleting all but first OE conf in to_file for sdf to "for" loop
j-wags Apr 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions docs/releasehistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,50 @@ Releases follow the ``major.minor.micro`` scheme recommended by `PEP440 <https:/
* ``minor`` increments add features but do not break API compatibility
* ``micro`` increments represent bugfix releases or improvements in documentation

0.6.1 - Bugfixes
----------------
0.7.0 - Current development
---------------------------

Behavior changed
""""""""""""""""
- `PR #508 <https://github.com/openforcefield/openforcefield/pull/508>`_:
In order to provide the same results for the same chemical species, regardless of input
conformation, fractional bond order calculation methods now default to ignore input conformers
and generate a new conformer of the molecule before running semiempirical calculations.
Users can override this behavior by specifying the keyword argument
``use_conformers=molecule.conformers``
- `PR #281 <https://github.com/openforcefield/openforcefield/pull/281>`_: Closes
`Issue #250 <https://github.com/openforcefield/openforcefield/issues/250>`_
by adding support for partial charge I/O in SDF. The partial charges are stored as a property in the
SDF molecule block under the tag ``<atom.dprop.PartialCharge>``.
- `PR #281 <https://github.com/openforcefield/openforcefield/pull/281>`_: If an OFFMol's
``partial_charges`` attribute is set to ``None`` (the default value), calling ``to_openeye`` will
now produce a OE molecule with partial charges set to ``nan``. This would previously produce an OE
molecule with partial charges of 0.0, which was a loss of information, since it wouldn't be clear
whether the original OFFMol's partial charges were REALLY all-zero as opposed to ``None``. OpenEye toolkit
wrapper methods such as ``from_smiles`` and ``from_file`` now produce OFFMols with
``partial_charges = None`` when appropriate (previously these would produce OFFMols with
all-zero charges, for the same reasoning as above).
- `PR #281 <https://github.com/openforcefield/openforcefield/pull/281>`_: ``Molecule.to_rdkit``
now sets partial charges on the RDAtom's ``PartialCharges`` property (this was previously set
on the ``partial_charges`` property). If the OFFMol's partial_charges attribute is None, this property
will not be defined on the RDAtoms.
- `PR #281 <https://github.com/openforcefield/openforcefield/pull/281>`_:
Enforce the behavior during SDF I/O that a SDF may contain multiple MOLECULES, but that the OFF Toolkit
DOES NOT assume that it contains multiple CONFORMERS of the same molecule. This is an
important distinction, since otherwise there is ambiguity around whether properties of one
entry in a SDF are shared among several molecule blocks or not, or how to resolve conflicts if properties
are defined differently for several "conformers" of chemically-identical species (More info
`here <https://docs.eyesopen.com/toolkits/python/oechemtk/oemol.html#dude-where-s-my-sd-data>`_.
If the user requests the OFF
Toolkit to write a multi-conformer ``Molecule`` to SDF, only the first conformer will be written.
For more fine-grained control of writing properties, conformers, and partial charges, consider
using ``Molecule.to_rdkit`` or ``Molecule.to_openeye`` and using the functionality offered by
those packages.
- `PR #281 <https://github.com/openforcefield/openforcefield/pull/281>`_: Due to different
constraints placed on the data types allowed by external toolkits, we make our best effort to
preserve ``offmol.properties`` when converting molecules to other packages, but users should be aware that
no guarantee of data integrity is made. The only data format for keys and values in the property dict that
we will try to support through a roundtrip to another toolkit's Molecule object is ``string``.

API-breaking changes
""""""""""""""""""""
Expand Down Expand Up @@ -202,7 +244,7 @@ Bugfixes
Example added
"""""""""""""
- `PR #472 <https://github.com/openforcefield/openforcefield/pull/472>`_: Adds an example notebook
`QCarchive_interface.ipynb <https://github.com/openforcefield/openforcefield/blob/master/examples/QCArchive_interface/QCarchive_interface.ipynb>`
`QCarchive_interface.ipynb <https://github.com/openforcefield/openforcefield/blob/master/examples/QCArchive_interface/QCarchive_interface.ipynb>`_
which shows users how to instance the :py:class:`Molecule <openforcefield.topology.Molecule>` from
a QCArchive entry level record and calculate the energy using RDKit through QCEngine.

Expand Down
26 changes: 26 additions & 0 deletions openforcefield/data/molecules/ethanol_partial_charges.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
*****
OpenBabel02041915453D

9 8 0 0 0 0 0 0 0 0999 V2000
1.0616 -0.2681 -0.0006 C 0 0 0 0 0 0 0 0 0 0 0 0
1.9101 0.9126 -0.4220 C 0 0 0 0 0 0 0 0 0 0 0 0
1.5170 1.3236 -1.7228 O 0 0 0 0 0 0 0 0 0 0 0 0
2.0787 2.0794 -1.9612 H 0 0 0 0 0 0 0 0 0 0 0 0
1.3393 -0.6108 1.0001 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 -0.0002 -0.0006 H 0 0 0 0 0 0 0 0 0 0 0 0
1.1801 -1.0990 -0.7040 H 0 0 0 0 0 0 0 0 0 0 0 0
2.9684 0.6361 -0.4446 H 0 0 0 0 0 0 0 0 0 0 0 0
1.7730 1.7499 0.2687 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
1 5 1 0 0 0 0
1 6 1 0 0 0 0
1 7 1 0 0 0 0
2 3 1 0 0 0 0
2 8 1 0 0 0 0
2 9 1 0 0 0 0
3 4 1 0 0 0 0
M END
> <atom.dprop.PartialCharge> (1)
-0.40000000000000002 -0.29999999999999999 -0.20000000000000001 -0.10000000000000001 0.01 0.10000000000000001 0.20000000000000001 0.29999999999999999 0.40000000000000002

$$$$
32 changes: 32 additions & 0 deletions openforcefield/data/molecules/methane_multiconformer.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

-OEChem-02042019153D

5 4 0 0 0 0 0 0 0999 V2000
0.9999 1.0000 1.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.9433 2.0874 0.9141 H 0 0 0 0 0 0 0 0 0 0 0 0
1.6195 0.6029 0.1928 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.0043 0.5764 0.9304 H 0 0 0 0 0 0 0 0 0 0 0 0
1.4416 0.7334 1.9627 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
1 3 1 0 0 0 0
1 4 1 0 0 0 0
1 5 1 0 0 0 0
M END

$$$$

-OEChem-02042019153D

5 4 0 0 0 0 0 0 0999 V2000
2.2299 2.2300 2.2300 C 0 0 0 0 0 0 0 0 0 0 0 0
2.1733 3.3174 2.1441 H 0 0 0 0 0 0 0 0 0 0 0 0
2.8495 1.8329 1.4228 H 0 0 0 0 0 0 0 0 0 0 0 0
1.2257 1.8064 2.1604 H 0 0 0 0 0 0 0 0 0 0 0 0
2.6716 1.9634 3.1927 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
1 3 1 0 0 0 0
1 4 1 0 0 0 0
1 5 1 0 0 0 0
M END

$$$$
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

-OEChem-02042019153D

5 4 0 0 0 0 0 0 0999 V2000
0.9999 1.0000 1.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.9433 2.0874 0.9141 H 0 0 0 0 0 0 0 0 0 0 0 0
1.6195 0.6029 0.1928 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.0043 0.5764 0.9304 H 0 0 0 0 0 0 0 0 0 0 0 0
1.4416 0.7334 1.9627 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
1 3 1 0 0 0 0
1 4 1 0 0 0 0
1 5 1 0 0 0 0
M END
> <test_property_key>
test_property_value

> <atom.dprop.PartialCharge>
-0.108680 0.027170 0.027170 0.027170 0.027170

$$$$

-OEChem-02042019153D

5 4 0 0 0 0 0 0 0999 V2000
2.2299 2.2300 2.2300 C 0 0 0 0 0 0 0 0 0 0 0 0
2.1733 3.3174 2.1441 H 0 0 0 0 0 0 0 0 0 0 0 0
2.8495 1.8329 1.4228 H 0 0 0 0 0 0 0 0 0 0 0 0
1.2257 1.8064 2.1604 H 0 0 0 0 0 0 0 0 0 0 0 0
2.6716 1.9634 3.1927 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
1 3 1 0 0 0 0
1 4 1 0 0 0 0
1 5 1 0 0 0 0
M END
> <test_property_key>
test_property_value2

> <another_test_property_key>
another_test_property_value

> <atom.dprop.PartialCharge>
0.027170 0.027170 0.027170 0.027170 -0.108680

$$$$
Loading