Commit Graph

231 Commits

Author SHA1 Message Date
Ricardo Rodriguez
9e301c15d6 Normalize rings (#9208)
* normalize rings

* update tests

* update doctests

* update release notes
2026-04-01 05:37:02 +02:00
Greg Landrum
1657b788e9 prep for next release cycle (#9210) 2026-03-27 18:17:07 +01:00
Greg Landrum
351f8f378f release prep (#9206) 2026-03-27 10:37:45 +01:00
Greg Landrum
4fd55782cd ready for beta (#9196) 2026-03-22 17:53:05 +01:00
Yakov Pechersky
0986d22c58 Deterministic kekulize, independent of atom and bond order (#9125)
* Make kekulization deterministic

* Add tautomer order-independence regression (python)

* Adjust tautomer tests for deterministic kekulization

* Update graphmol wedged-bond kekulization checks

* SmilesParse: update aromatic bond index expectations

* SmilesParse: refresh cxsmilesTest expected files

* Depictor: update testDepictor expected MolBlocks

* Depictor: update depictorCatch expectations

* Depictor Wrap: update expected MolBlock for pyDepictor

* MarvinParse: update testMrvToMol expected outputs

* FileParsers: refresh testAtropisomers expected outputs

* FileParsers: update tests for deterministic kekulization

* MolDraw2D: refresh brittle bond assertions

* RascalMCES: update expected cluster size

* MinimalLib: make cffi wedging check order-independent

* documentation fix

* MinimalLib: update Kekulé bond table in aligned-coords test

* Hoist duplicated lambdas to TEST_CASE scope

* Remove unused originalWedges variable

* Remove redundant bounds check; clarify wedge-end preference

* Pre-sort allAtms by wedge-end + rank

* Use mol.atomNeighbors() for neighbor iteration

* Check inAllAtms before linear-scanning done

* Drop redundant optsV/wedgedOptsV sorts

* Remove unused Canon.h include

* Add canonical parameter to Kekulize; skip ranking during sanitization

* Test canonical re-kekulization preserves stereo across atom orderings

* MinimalLib: update Kekulé bond orders in invertedWedges

* Change Kekulize canonical default to false, expose in Python wrappers

* keep rank order, push_back

* Revert "RascalMCES: update expected cluster size"

This reverts commit a81bb39495.

* docstring change

* expose new flag to python wrapper

* document changes in ReleaseNotes.md

* revert minimallib test changes again

* canonical = true defaults

* Revert "revert minimallib test changes again"

This reverts commit 039e1d84da.

* Reapply "RascalMCES: update expected cluster size"

This reverts commit 7b83a7a3e8.

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2026-03-19 08:43:13 +01:00
Greg Landrum
fa011fe425 switch the Query infrastructure to use std::function instead of function pointers (#9169)
* switch the Query infrastructure to use std::function

* add releasenotes mention

* response to review

Removed commented-out function pointer declarations for match and data functions.
2026-03-14 05:57:02 +01:00
Ricardo Rodriguez
d5aa90e18f Fix for issue #8965 (#8968)
* add a test

* change stereo bond canonicalization

* update canonicalization watch test with fixed cases

* make canonicalization test stricter (compare CIP codes)

* add reverse symmetry condition

* rewrite double bond canonicalization code

* update tests

* fix multiline comment

* update java tests

* update python test

* nix switchBondDir (unused)

* fix and rename flipBondDir

* refactor comment

* fix shadowed var name, casting

* fix neighbor sorting

* make seen_bonds a vector

* abstract setDirectionFromNeighboringBond

* handle both sides of the bond have directions

* move getNeighboringStereoBond

* check seen_bonds after popping connectedBondsQ

* use references for arguments

* add release note

* add example required by Dan

* add example requested by Dan
2026-02-26 08:58:36 +01:00
Ricardo Rodriguez
86902488e9 Store CIP-ranked anchors after CIP labeling. (#9056)
* add the _CIPNeighborRanks property

* store CIP-ranked chiral neighbors

* store CIP-ranked SP2 bond and atropisomer anchors

* add a test

* boost headers in test

* add Atom::NOATOM

* add NOATOM test

* amend and clarify implicit H in Tetrahedral

* rename property

* rename property to _CIPNeighborOrder

* deprecate Chirality::StereoInfo::NOATOM
2026-01-29 18:23:44 +01:00
Greg Landrum
e786ca231d Stop using raw pointers in the canonicalization interface (#8990)
* change count-type from pointer to ints to vector

* change type from pointer to ints to vector

* change type from pointer to ints to vector

* change type from pointer to ints to vector

* change type from pointer to ints to vector

* use std::fill only when necessary

* delete unnecessary includes

* reformat

* re-enable a test that was accidentally disabled a few years ago

* finish getting rid of the raw pointers

* include chrono

* changes from review

---------

Co-authored-by: Anna Brünisholz <anna.bruenisholz@gmail.com>
2025-12-12 14:00:23 +01:00
Greg Landrum
b2f1eae1c3 Do not add a __computedProps property to molecules when initializing them (#8931)
The rest of the code already adds the property if/when it is needed, so
there's no need to add it to every molecule.
2025-11-18 19:09:36 -05:00
Greg Landrum
adf72c984f Do not reset the ringInfo information when adding bonds to RWMol (#8934)
* Do not reset the ringInfo information when adding bonds

This call was inconsistent (for example, the version of addBond() in ROMol did not do it)
and is unnecessary since the standard assumption is molecules need
to be re-sanitized after adding atoms and bonds

* response to review

clear the property cache on atoms after adding a bond.

* add a property cache update to the reaction runner

* add something to the release notes
2025-11-07 14:41:01 +01:00
Greg Landrum
0ee90279b5 Partial fix to a problem with implicit Hs being written to SMARTS (#8893)
* Partially resolve a problem with implicit Hs ending up in SMARTS

* update doctest

* document in release notes
2025-10-24 07:50:06 +02:00
Ricardo Rodriguez
d9850596aa Fixes #8726 (#8874)
* do not remove hydrides by default

* add a minimal test

* add release note about behavior change

* require Hydrides to have degree 1

* also allow hydrides with degree 0 (ionic bond)

* suggested changes

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2025-10-17 16:51:22 +02:00
Greg Landrum
93d0f8bb74 Fixes #8776 (#8875)
* Fixes #8776

don't call the pseudo-CIP perception code if we really don't need to

* allow calling the pseudo-CIP code from Python

* update doctests
2025-10-17 05:52:27 +02:00
Ricardo Rodriguez
7d1e662bc7 Use std::string_view for property keys (#8844)
* string_view props API

* wip

* fix leak

* add string_view to swig

* fix comment

* add backwards incompatibilty note

* fix rebase issue

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-10-09 16:14:48 +02:00
Ricardo Rodriguez
9eaa193186 Merge simple AND queries onto atoms. (#8830)
* duplicate parser code

* regenerate smarts.tab files

* update test

* add release note

* restore pregenerated header

* Suggested changes (#23)

* add a generic flags interface to atoms and bonds

* suggested changes

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-10-09 04:38:42 +02:00
Greg Landrum
66787fe604 new release prep (#8848) 2025-10-05 09:23:33 +02:00
Greg Landrum
c15eb1a143 Fixes #8633 (#8794)
* Fixes #8633

* changes in response to review
2025-09-26 05:33:13 +02:00
Greg Landrum
c7a92389d9 Beta release prep (#8804)
* partial artifact update

* update release notes

* update
2025-09-24 11:07:07 +02:00
Niels Maeder
d13b002d2d update default ET version to 2 in getExperimentalTorsions (#8798)
* update et version to 2

* Add comment in the release notes.
2025-09-24 05:56:35 +02:00
Greg Landrum
d12932f13e support bond property lists in SDF (#8778)
* backup
builds but no tests

* deprecate old form

* initial basic tests for bond property lists

* Tests pass

Fixes #8777

* add deprecations to release notes

* - avoid computing size of a constant at runtime
- replace multiple instances of a numeric constant with a literal constant
- avoid unnecessary copying of strings in iterations and function calls

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-09-17 16:17:12 +02:00
Greg Landrum
86141183c1 Moving towards getting all tests to pass when using the new stereo code (#8409)
* Fixes #8379

* check in some working tests

* test passes

* test passes

* test passes

* test passes

* test passes

* ensure that the invariants flush the streams on failure

* tests pass

* test passes

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* Fixes #8391

* tests pass

* fix a test with legacy
not clear why this was not causing problems before

* make a test work

* Fixes #8396

* gcc builds work

* fingerprint tests pass

* mention backwards incompatible change

* fix a problem with FindMolChiralCenters

* more testing details

* enable the test status output

* Fixes #8432

fix a bug in double-bond stereo handling for template matching

* all depictor tests pass

* use the new-stereo chiral ranks in the depiction code

* always assign new-stereo chiral ranks

* make _ChiralAtomRank a computed property
This is analogous to _CIPRank

* tweak to the way the atom ordering is computed for 2D coordinate generation

* update two expected results

* backup

* response to review

* tests pass

* tests pass

---------

Co-authored-by: = <=>
2025-04-15 14:00:32 +02:00
Greg Landrum
923483523e prep for next release cycle (#8402) 2025-04-03 05:25:12 +02:00
Greg Landrum
d32c919066 prep for release (#8397) 2025-03-31 20:11:10 +02:00
Greg Landrum
32608ae0b4 Atoms bonded to metal atoms should always have their H counts explicit in SMILES (#8318)
* refactor the code to determine whether or not an atom is in brackets

* move the definition of isMetal to QueryOps

* atoms bound to metals in SMILES should always be in square brackets

Implementation and some test updates

needs confirmation that all of tests run

* basic tests pass

* java tests pass

* update js tests

* doc updates

* Update Code/GraphMol/catch_graphmol.cpp

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>

* Update Code/GraphMol/SmilesParse/test.cpp

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>

* finish fixing tests

* bump yaehmop version to allow compilation to work

---------

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
2025-03-29 07:26:03 +01:00
Greg Landrum
a9e79d35ad tag beta (#8369)
doing a self merge since this is just a release tag
2025-03-21 17:59:57 +01:00
Greg Landrum
b64aea5082 apply query adjustments when makeAtomsGeneric is enabled (#8315)
* apply query adjustments when makeAtomsGeneric is enabled

* changes in response to review

* I got Python in my C++
2025-03-04 13:50:24 +01:00
Ricardo Rodriguez
12929849f5 Make MaeWriter to throw on errors. (#8297)
* allow MaeWriter to throw

* update tests

* throw ValueErrorException

* add note on backward incompatible change of behavior
2025-02-25 16:59:40 +01:00
Greg Landrum
7311390005 MolDraw2D: add separate colors for atom and bond annotations (#8249) 2025-02-15 08:28:00 +01:00
Jeremy Monat
103b22dd4b Use GetUniqueCombinations_new instead of GetUniqueCombinations (#8214)
* Remove GetUniqueCombinations, use instead GetUniqueCombinations_new for improved speed. Update related tests.

* Remove unused and uncalled parameter `which`

* Update tests for GetUniqueCombinations to be in numerical order. Remove unused variable `x`. "Alias" GetUniqueCombinations_new to GetUniqueCombinations for backwards compatibility. Add note about backwards incompatibility for GetUniqueCombinations to ReleaseNotes.md.

* Create _compareCombinationsOrderUnimportant and use for testGetUniqueCombinations for order-insensitive comparison

* Replace call to GetUniqueCombinations_new with GetUniqueCombinations in Gen2DFingerprint for consistency
2025-02-06 05:21:33 +01:00
Greg Landrum
fa048eacc5 Replace GetImplicitValence() and GetExplicitValence() with GetValence() (#7926) 2025-01-28 21:09:03 +01:00
Brian Kelley
eacc365b27 GitHub 7865 haspropwithvaluequery leaks (#7872)
* Properly cleanup Dict::Pair when serializing HasPropWithQueryValue

* Make sure pickling doesn't change original molecule

* Fix bad cut and paste

* Add PairHolder utility class for memory management of non Dict Dict::Pairs, fix mem leak in pickler

* Edit comment to force a rebuild

* Ignore PairHolder from Java/Swig builds

* Ignore PairHolder API from swig

* Reponses to review

* Add backward incompatible change

* Make release note a bullet point
2024-10-30 06:12:40 +01:00
Paolo Tosco
f66ad7e7c1 Replace awful enum reflection macros with Better Enums (#7913)
* - moved SMILES and RGroupDecomp JSON parsers to their own translation units
- added missing DLL export decorators that had been previously forgotten
- changed the signatures of MolToCXSmiles and updateCXSmilesFieldsFromJSON
to replace enum parameters with the underlying types
- updated ReleaseNotes.md

* make sure cxSmilesFields is only updated if the JSON string contains keys
belonging to the CXSmilesFields enum

* added missing copyright notices

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-10-25 08:17:07 +02:00
Greg Landrum
a7404cdd91 Do the announced deprecations (#7910)
* remove MMFF:setMMFFAromaticity()

* remove AtomPairs.Utils.NumPiElectrons()

* remove the deprecated DistGeom contrib files

* document removed stuff
2024-10-11 06:42:18 +02:00
Greg Landrum
fcf8b8eb16 ready next release cycle (#7858) 2024-09-27 14:02:43 +02:00
Greg Landrum
9b9392266a update README and tag release (#7855) 2024-09-27 13:52:16 +02:00
Greg Landrum
b5d6a3dba7 beta release prep (#7836) 2024-09-20 17:20:05 +02:00
Juuso Lehtivarjo
9824a9d964 Expose MMFF aromaticity model for SetAromaticity (#7765)
* Expose MMFF aromaticity model for SetAromaticity

* Test, backward compatibility, missing AromaticityModel wrapper
2024-09-18 05:59:02 +02:00
Greg Landrum
90c5334848 Fix aliasing bug in MultithreadedSDMolSupplier and move GeneralFileReader to v2 API (#7761)
* fix aliasing bug in MultithreadedSDMolSupplier

* update GeneralFileReader to v2 API

* add backwards incompatibility note

* forgot the tests

* allow non-threadsafe builds

* more generalfilereader cleanup
2024-08-29 15:53:28 +02:00
Greg Landrum
2c5ae534f2 Optimizations of the DistanceGeometry forcefield (#7600)
* First try at using DistViolationContribs

only the most basic of testing has been done

also add ForceField::distance2 to allow some optimizations

* allow testing using old approach

* optimization

At this point testUFFForceFieldHelpers fails since the check for std::max_element
in the e_contribs vector at Embedder.cpp:513 is now doing something totally different
(instead of a bunch of small distance violation contribs, we have one big one).
We'll need to come up with something for this.

With the benchmarking set that I'm using - 500 DG conformers for ~465 COD molecules
using 10 threads - this runs in almost 10% less time than master.

* backup;
builds, tests do not pass

* all tests pass except the old failure

* more constification

* backup/debugging

* add fourthdim contribs the same way

* tests now pass

* deprecations

* remove unused vars and code

* changes in response to review
2024-07-15 14:14:39 -04:00
Greg Landrum
724716b2c6 Switch to isoelectronic valence model (#7491)
* change valence model to use isolobal analogy

Remove support for five-coordinate C+ and, by analogy, five-coordinate N+2

Removes support for charge states that take atoms past the end of the periodic table
  i.e. [Lv-4] is no longer supported

* update the tests for that

* remove valence state of 6 for Al

* fix representation of phosphate in the mol2 parser

this is a correction of what was done during #5973

* cleanup the exceptions for P, S, As, and Se

* drop valence states:

Si 6, P 7, As 7

* a couple of additional changes from #7397

* update java tests

* fix an inconsistency: Rb now supports valence -1

* documentation

* - replace operator[] with at() for bounds check
- extract some code into a function to avoid duplication
- use TAB as separator throughout in the periodic table data for consistency

* removing the .at() usage

We know that these vectors aren't empty, so there's no need for the bounds check.

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-06-25 15:38:49 +02:00
Greg Landrum
93e8a746bf Shrink the tautomeric zone for the v2 hash of things like imines (#7502) 2024-06-07 05:09:57 +02:00
Greg Landrum
34e5569866 deprecations for the 2024.09 release (#7398)
* deprecations for the 2024.09 release

* update doctests

* Fixes #7402

* get tests passing when the cairo build is not there

* fix a problem in the tests
2024-05-05 07:30:00 -04:00
Paolo Tosco
2bb8952d7b Added JSON parameters to MinimalLib get_(cx)?sm(ile|art)s() functions (#7194)
* - renamed getParamsFromJSON() to updateSmilesWriteParamsFromJSON() and moved it from the anonymous namespace to the RDKit namespace such that it is publicly available
- implemented updateCXSmilesFieldsAndRestoreBondDirOptionFromJSON()
- added CFFI and JS tests
- get_smiles(), get_smarts(), get_cxsmiles() and get_cxsmarts() are now available in MinimalLib in both CFFI and JS layers and they can be passed JSON parameters
- CFFI get_qmol() now returns NULL if it fails to generate a RWMol rather than returning the "Error!" const char[] string, for consistency with what get_mol() and get_rxn() do. This was documented in release notes

* suggestions

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-04-18 06:28:36 +02:00
Greg Landrum
f7fb104e6e Correct unbranched alkane SMARTS to match the description given (#7255)
* Correct unbranched alkane SMARTS to match the description: must restrict to only carbon and allow for terminal alkanes

* Add backwards incompatible change notes

* move and edit incompatible changes note

---------

Co-authored-by: Daniel Levine <levineds@meta.com>
Co-authored-by: levineds-meta <159849019+levineds-meta@users.noreply.github.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-04-12 08:25:00 +02:00
Anna Brünisholz
82dbf4c66b switch to range-based for loops (#7278)
* switch to range-based for loops

* Update Code/GraphMol/testChirality.cpp

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>

* fix a leak in the new DCLV code (#7279)

* fixes #7295 (#7303)

* tag 2024.03 release (#7308)

* tag release

* attempt to solve constant MD5 problems

* switch to getting the ComicNeue font from github instead of as a zip

* open new release cycle (#7314)

* restrict the application of 1,3- 1,5- conjugated cation normalization (#7287)

* propagate yaehmop build status (#7316)

* Fixes #7299 (#7304)

* clean up of python and c++ for-loops

* clang formatted testChirality

* fix test file

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Co-authored-by: Riccardo Vianello <riccardo.vianello@gmail.com>
2024-04-08 14:16:27 +02:00
Ricardo Rodriguez
73e91a6344 Fixes #7318 (#7319)
* fix hybridization for atoms with outgoing dative bonds

* expose and wrap C++ numPiElectrons

* deprecate AtomPairs.Utils.NumPiElectrons

* add & update tests

* fix draw2d test

* update expected hash

* add hybridization test

* move numPiElectrons to Atom.h

* take reference instead of ptr
2024-04-03 15:34:37 +02:00
Greg Landrum
e34f1ffaa0 open new release cycle (#7314) 2024-03-30 05:12:02 +01:00
Greg Landrum
ba0b6f3baf tag 2024.03 release (#7308)
* tag release

* attempt to solve constant MD5 problems

* switch to getting the ComicNeue font from github instead of as a zip
2024-03-28 19:59:56 +01:00
Greg Landrum
4f1b88acbe deprecation (#7272) 2024-03-20 04:43:10 +01:00