Commit Graph

15 Commits

Author SHA1 Message Date
Ric
2afb4fbac4 Mem checkup & fixes (#3510)
* fix leak in testConformerParser

* fix leaks in testMultithreadedMolSupplier

* fix leak in catch_graphmol

* pass build type to YAEHMOP

* cleanup fragments in CoordGen minimizeOnly

* fix leaking ConjElectrons stack in res mol supplier

* avoid double delete

* do not delete 'this'; clean ce not added to map

* delete mol if Multithreaded SD readMolProps throws

* fix typo

* fix typo in comment
2020-11-09 12:08:36 -05:00
Greg Landrum
f1bbc319b5 Fixes #3531 (#3545)
* Fixes #3531

* remove the new Br valences too
2020-11-08 07:17:37 +01:00
Greg Landrum
bba71631b8 fix problem with H+ caused by #3473 (#3503)
* fix problem with H+ caused by #3473

* changes in response to review
2020-10-19 12:45:00 -04:00
Greg Landrum
b86b2364c2 add new oxidation states for Cl, Br, I, Xe, Po, At (#3486)
* add new oxidation states for Br, I, Xe, Po, At

Changes the allowed value 2->3 for I

* add Cl too

* update expected test results
2020-10-12 15:26:18 +02:00
Greg Landrum
acf318c188 Fixes #3470 (#3473) 2020-10-11 08:44:52 -04:00
Greg Landrum
19bdd21de1 Updated code for chirality perception (#3324)
* add new test (it fails, of course)

* isAtomPotentialTetrahedralCenter() there and tested
tests cases for molecular stereo written (but failing, of course)
create new_chirality.cpp, we will probably want to change this at some point
new StereoInfo structure

* more infrastructure
- isBondPotentialStereoBond()
- two getStereoInfo() functions
- associated unit tests

* backup

* oops

* backup

* switch to always using four atoms for bonds

* backup

* add new test (it fails, of course)

* isAtomPotentialTetrahedralCenter() there and tested
tests cases for molecular stereo written (but failing, of course)
create new_chirality.cpp, we will probably want to change this at some point
new StereoInfo structure

* more infrastructure
- isBondPotentialStereoBond()
- two getStereoInfo() functions
- associated unit tests

* backup

* oops

* backup

* switch to always using four atoms for bonds

* backup

* this now actually works

* doc update

* add a test to demo that ring stereo is not working

* more testing

* add a fun CIP test

* add review note

* debugging

* remove extraneous debugging
turn off tests for ring-double bond stereo

* disable the ring-stereo fix... this breaks a few tests, but we will recover

* works, needs cleanup, chirality code needs re-testing

* nothing works

* Fixes #3322

* Python and C++ tests now pass

* clang-format

* first pass at python wrappers

* improve doctest

* basic optimization...
stop with the copying

* rename

* all tests passing again

* optimization

* fix the sort in the tests

* looks like this might fix the windows-dll build problems

* update tests

* the fun never ends

* comment cleanup

* handle deliberately unspecified atoms/bonds

* add cleanIt option

* add flagPossible

* add option to use the new code to the SMILES parser

* additional testing

* additional testing

* a bit of additional testing never hurts

* changes in response to review

* fixes a bug with potential parastereo not being cleared

other changes in response to review

* update docs
2020-09-02 15:00:29 +02:00
Dan N
b5dcb21fef Improve performance of aromaticity detection for large molecules (#3253)
* remove trailing spaces

* 3256: Envelope aromaticity not detected in complex fused system

Removes stopping point in aromaticity detection when all atoms
are "done". This also markedly improves the performance of
aromaticity detection for very large molecules - for example,
aromitization of 3EOH from the PDB was dominated by done atom
checking before this commit.

Some aromatic bonds were missed before this commit in complex fused
systems. This happened if all atoms in the fused system were also
in some smaller aromatic ring and there was at least one fused edge
that was single in the kekule form.

Some example molecules for which envelope aromaticity failed
before this commit:

c1cc2n(c1)c1cccn1c1cccn21
-> became c1cc2n(c1)-c1cccn1-c1cccn1-2 before this commit
c1cc2c3cc[nH]c3n3cccc3n2c1
-> became c1cc2n(c1)-c1cccn1-c1[nH]ccc1-2 before this commit
c1cc2c3cc[nH]c3c3cc[nH]c3n2c1
-> became c1cc2n(c1)-c1[nH]ccc1-c1[nH]ccc1-2 before this commit

Here's a similar example that didn't fail even before this
commit. The central ring only shares double bonds with the
exterior rings.
* c1cc2c([nH]1)c1cc[nH]c1c1cc[nH]c21

Requires updates to some MQN descriptors tests because some
bonds become aromatic (MQN includes counts of single and
double bonds of kekule form).

FWIW, for the molecule that had a change in counts, the counts
were incorrect both before and after this commit, because
MQN uses an approximation (dividing aromatic bonds evenly
between single and double bonds) to avoid kekulization.
This approximation is invalid when there are oodles of
nitrogens lone pairs participating in the aromatic
bonds.

(the failing line was 2558 in aromat_regress.txt: Cc1cc2n(n1)c1cc(C)nn1c1c(C=O)c(C)nn21)

* Detect envelope aromaticity in fused systems

In #3253, we proposed removing doneAtoms for performance, and it was
noted that it also fixed detection of envelope aromaticity in some
fused systems. However, when I completely removed doneAtoms, I saw
hangs in sanitization of things like nanotubes. Using doneBonds
allows envelope aromaticity, while preserving a reasonable break
on runaway work for crazy molecules.

The performance issue was addressed by caching the ring bond
count.

Here are some sanitize timings on proteins from the RCSB PDB:
Before this commit:
* 3eoh 1.21s
* 2j3n 0.77s
* 1nks 0.053s

Afterwards:
* 3eoh 0.42s
* 2j3n 0.15s
* 1nks 0.046s

* Use boost::dynamic_bitset instead of unordered_set

To cound ring bonds.
2020-08-13 05:57:16 +02:00
Greg Landrum
967c4bf824 Stop trying to assign hybridization to actinides (#3281)
* Stop trying to assign hybridization to actinides

There's also some cleanup in this commit

* Apply suggestions from code review

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
2020-07-25 05:04:54 +02:00
Greg Landrum
b55376f284 Adds more options to adjustQueryProperties (#3235)
* add documentation

* backup

* first pass at 5-rings working

* add a static method to initialize an empty parameter object

* expose static method to python

* additional testing

* support the single bond adjustments

* cleanup

* preserve the symbol used in the query from a CTAB

* support the way the MDL code adjusts five-ring aromaticity in query rings

* in-code documentation

* while we're at it, cleanup the way Q and A atoms are handled in the v3k parser

* changes in response to review

* make this C++14 again.

* change in response to review
2020-06-22 09:17:50 -04:00
Greg Landrum
edd922c99c Cleanup warnings from clang-10 (#3238)
* stop returning local memory in exceptions

* remove a couple unnecessary copies in loops

* fix a bug in the way the default MMFF aromatic parameters are constructed

* remove a bunch of loop-variable warnings

* remove a bunch of clang warnings

* disable clang warnings in python wrappers

* remove some warnings when building the python wrappers
2020-06-19 17:16:22 -04:00
Manan Goel
2a413a9399 Fixes #3150 (#3166)
* Fixes #3150
Fixes removeHs removing Hydrides by adding a removeHydrides flag to RemoveHsParameters.
If removeHydrides is false, Hydrogen atoms with formal charge -1 and degree less than or equal to 1 are kept
removeHydrides is kept true by default

* Made suggested changes
Removed extraneous comments and redundant code
Added tests for both ```removeHydrides = true``` and ```removeHydrides = false```
Added tests that ```removeAllHs()``` also removes hydrides
Exposed ```removeHydrides``` parameter to python

* Explicity Added removeHydrides=true in removeAllHs
Corrected typo for removeHydrides

* make formatting consistent

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2020-05-19 14:12:53 +02:00
Eisuke Kawashima
be9349b3bb Correct TEST_CASE tags for Catch2 (#3069)
https://github.com/catchorg/Catch2/blob/v2.1.2/docs/test-cases-and-sections.md#tags
2020-04-08 15:43:38 +02:00
Ric
8dd2ce446c Address issue #2890 (#3015)
* add fix

* add tests
2020-03-21 14:01:54 +01:00
wvandertoorn
005688c157 phosphine&arsine chirality support isAtomPotentialChiralCenter() (#3018)
- Add tests for phosphine and arsine chirality
- Add support to isAtomPotentialChiralCenter()
  Accept both 2 (implicit H), 3 and 4 coordinate P and As atoms as potential
chiral centers
2020-03-21 04:59:16 +01:00
Greg Landrum
abadada1a2 Parse and handle the stereoCare or STBOX flags in CTABs (#2917)
* get fileparsers catch tests building faster
should use this same approach across all of the catch2 tests

* Fixes #2916

* support parsing of STBOX for atoms and bonds in v3K mol files
add molStereoCare to common_properties

STBOX is translated to the molStereoCare property

* add stereocare support to adjustQueryProperties
make building the catch2 tests faster for the GraphMol package

* copy in AdjustQueryParameters JSON parsing from adapter.cpp
(That still needs to be ported to use the new code)

* get the cartridge using the new parsing code

* update test to reflect new parser behavior

* add a v2000 test

* changes in response to review
2020-02-03 15:55:57 -05:00