Commit Graph

5699 Commits

Author SHA1 Message Date
Ricardo Rodriguez
d3d4170e7c CXSMILES: do not add separators for unserializable Substance Groups (#9048)
* do not write extra separators

* add a test

* update tests

* Update Code/GraphMol/SmilesParse/CXSmilesOps.cpp

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2026-01-27 12:35:18 +01:00
David Cosgrove
e598f608fe Transform::SetRotationFromQuaternion takes const. (#9063) 2026-01-24 07:18:41 +01:00
Ricardo Rodriguez
d4641c1f58 Fix removing (non)redundant bond dir specs when exporting SMILES (#9066)
* increase counts to avoid removing non-redundant bond dirs

* update tests
2026-01-24 07:15:00 +01:00
Greg Landrum
21225e63b3 Move some more tests over to catch2 (#9058)
* move testSubstructMatch to catch2

* modernization

* modernization

* switch to catch2

* modernize

* convert to catch2

* update

* move to catch

* please be quiet

* move to catch2

* changes in response to review

---------

Co-authored-by: = <=>
2026-01-24 07:03:04 +01:00
Ricardo Rodriguez
163dd42d4c implement hasPrimaryLabel (#9052) 2026-01-19 14:53:03 +01:00
Chris Von Bargen
e5989aa446 Fix deprecated literal operators and macro redefinition warnings for modern compilers (#9055)
* Fix deprecated literal operator syntax for C++14 compliance

Remove whitespace between "" and identifier in user-defined literal
operators to comply with C++14 standard. Fixes warnings with newer
compilers (emscripten 4.0+, clang 15+) that treat this as deprecated.

Changed operator"" _name to operator""_name for:
- SmilesParse.h: _smiles, _smarts
- ReactionParser.h: _rxnsmarts, _rxnsmiles
- FileParsers.h: _ctab, _mol2, _pdb

* Fix BOOST_CONTAINER_NO_LIB macro redefinition warnings

Add #ifndef guards before defining BOOST_CONTAINER_NO_LIB in Writer.cpp
and Parser.cpp to avoid redefinition warnings when the macro is already
defined via compiler flags in emscripten 4.0+ builds.

Warnings fixed:
- Writer.cpp:32: 'BOOST_CONTAINER_NO_LIB' macro redefined
- Parser.cpp:38: 'BOOST_CONTAINER_NO_LIB' macro redefined
2026-01-19 08:14:52 +01:00
Philip Ullmann
c8f274f0d3 Update deprecation messages for valence methods (#9050) 2026-01-19 08:12:53 +01:00
tadhurst-cdd
14c66817ea added FABS to test for issue #4364 (#9053) 2026-01-19 08:10:15 +01:00
Raul Sofia
4b92c2fa8c Performance improvement: Implement buffered reading for SDMolSupplier (#9010) 2026-01-10 18:29:56 +01:00
Ricardo Rodriguez
658a1af8b2 Read SD property names till the last '>' (#9047)
* add a test

* fix
2026-01-09 05:23:26 +01:00
Yakov Pechersky
7dec637a3f MolAlign: brace-init BestAlignmentParams in wrapper (#9042)
BestAlignmentParams is an aggregate; paren-init (T(...)) is rejected by Apple Clang (Xcode) and only works on some compilers.
Use brace-init (T{...}) for portable initialization.
2026-01-08 07:31:22 +01:00
Brian Kelley
9558cb8114 Check for correctly sized propertylists to avoid dropping molecules (#8921)
* Fixes #8918

* Use only the one check for compatible sizes

---------

Co-authored-by: Brian Kelley <bkelley@glysade.com>
2026-01-08 06:08:54 +01:00
David Cosgrove
cef43e8aef In verbose output, check that the query molecule exists before using it. (#9040)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2026-01-08 06:06:52 +01:00
Greg Landrum
da08e8d954 Allow molzip to position fragments when joining them (#9021)
* move molzip to its own file

* basics working

* more testing

* another test

* minor

* fix doxygen comment format

* fix alignment with co-directional exit vectors;
some modernization

* JSON parsing
python wrapper

* response to review

* response to review

* explicitly test that the first frag does not move

---------

Co-authored-by: = <=>
2026-01-07 10:33:03 -05:00
Greg Landrum
e0f3ada0d7 Fixes #9033 (#9036)
Also fixes the other similarity metrics.
A very small amount of refactoring

Co-authored-by: = <=>
2026-01-03 06:42:29 +01:00
Greg Landrum
f8b6776af1 Fixes #9020 (#9025)
* Fixes #9020

* add another test

---------

Co-authored-by: = <=>
2026-01-03 06:42:09 +01:00
David Cosgrove
8ef091f306 Github9007 (#9022) 2025-12-29 21:08:10 +01:00
Yakov Pechersky
08552e56b1 atropisomer bond atoms are checked explicitly for SP2 hybridization (#8974)
* atropisomer bond atoms are checked explicitly for SP2 hybridization

before, we checked only on totalDegree = 2 or 3,
but this causes false positives for something like a chiral sulfoxide
since the S is tetrahedral (sp3) but has only 3 substituents.
the hybridization code relies on totalDegree,
but modified to include and making sure to include conjugation
so while this is more expensive per molecule, it is closer to intent

Closes #8973

* assert we got no warnings on sulfinamides

* cleanup

* bring back degree based check, quick pass so that we don't run expensive calc on all mols with wedge bonds

* bring conformer back
2025-12-29 18:04:40 +01:00
tadhurst-cdd
0f03609221 Allow spaces and special chars in SCSR fullname attrs (#8982) 2025-12-29 17:54:56 +01:00
Ricardo Rodriguez
1c16a91730 Some more cleaning up in SMILES Writing (#8991)
* refactor getting initial bond directions

* fix atom dir counts

* move lambdas to separate functions

* restore increments

These are ok: they mean how many double bonds care about this direction,
not just whether it has been set or not.
2025-12-29 07:00:45 +01:00
Greg Landrum
b4164ea2f2 Support serializing/deserializing FP generators to JSON (#9000) 2025-12-24 19:09:05 +01:00
Ricardo Rodriguez
47f2b7c1b5 Fixes #9014 (#9016)
* add a test

* add a fix
2025-12-23 06:43:05 +01:00
Greg Landrum
d6cf5c4a01 move molzip to its own file (#9013) 2025-12-22 10:42:23 -05:00
Ricardo Rodriguez
2921deb254 Convert testMolSupplier to catch2 (#9015)
* update CMake file

* convert to catch
2025-12-22 07:33:36 +01:00
David Cosgrove
4883485ac5 Fixes Github9009 (#9012)
* Mostly working.

* Clear out debugging writes.

* Avoid a mol copy.

* Left some debugging in.

* Move the fix into fragmentOnBonds.

* Add test.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-12-22 06:26:23 +01:00
David Cosgrove
21b3c4e6f1 Shape overlay initial start aligned to principal axes (#8999)
* Add MolTransforms library.

* Transform to inertial frame of reference before overlay.

* Vital fix of typo in comment.

* Tidy up debugging cruft.

* Comment in CMakeLists.txt.

* Fix python wrappers.

* Extra tidy.

* Response to review.

* Tidy includes.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-12-20 08:35:28 +01:00
Greg Landrum
dc84967df2 A bunch of modernization of the ShapeHelpers code (#8954)
* modernize testShapeHelpers

* a bunch of modernization of the shape helper code
2025-12-15 15:49:00 -05:00
Ricardo Rodriguez
9160ef8943 Last leak fixes for 2025! (#9006)
* fix leaked atom on zero chiral permutation

* take bond ownership
2025-12-13 20:22:59 +01:00
Ricardo Rodriguez
fa68ea2ef2 convert smiTest1 to catch (#9004) 2025-12-13 20:21:00 +01:00
Ricardo Rodriguez
7c2a6f4a3b rename test, convert to catch (#9003) 2025-12-13 20:18:40 +01:00
Greg Landrum
c2e48f41d8 Stop writing so many atom properties to cxsmiles (#9002)
* fix a bug in copySelectedAtomsAndBonds()
we need to clear computed properties on the atoms here

* prune back the atom properties written to CXSMILES

* update minimallib tests
2025-12-13 04:35:57 +01:00
Greg Landrum
ef90a4bedf Allow adding custom atom and bond matcher functions for substructure searching (#8994)
* extra SSS match functions for atoms/bonds
initial implementation and testing

* add baseline to test

* add a functor for matching atom coords

* support the extra checks in python

* refactor the way the python callbacks are handled

* test tolerances

* expose the AtomCoordsMatcher to python

* allow the extra checks to override the default matching

---------

Co-authored-by: = <=>
2025-12-12 20:03:31 +01:00
Ricardo Rodriguez
b6655a136d Refactor atomVisitOrders and bondVisitOrders in SMILES Writer canonicalization (#8972)
* refactor calculation of atomVisitOrders/bondVisitOrders

* refactor checkBondsInSameBranch

* fix
2025-12-12 14:07:26 +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
Ricardo Rodriguez
a8a00a1d99 Small fix in ring stereo/canonicalization (#8962)
* fix

* update canonicalization watch test

* add ring chirality test

* prune duplicates
2025-12-12 13:56:01 +01:00
Brian Kelley
70540c2eed Add extract mol fragment api (#8811)
* Create a function to extract some specified atoms from a ROMol as a new ROMol by creating new graph (#8742)

This adds a new api, `RDKit::MolOps::ExtractMolFragment`, to allow efficient
extractions of mol fragments from large mols. Compared to the approach where
we delete "unwanted" atoms/bonds from the input mol, this api is faster for
small mols (about 2x faster) and at least 3x faster for big mols
(was 10x faster for "CCC"*1000).

* clang-format

* review comments

* cleanup

* Consolidate copying subsets of molecules

* Readd missing tests

* Update comment to restart build

* Remove missing test

* Remove debugging comment, fix warnings

* Fix warnings on gcc11

* Add docs

* Make vector<bool> dynamic_bitset<>

* Update copyright

* Add swig wrappers

* Use new designated constructor API

* Fix windows builds

* Change enum values from unsigned int to integer

* Fix unsigned int variable

* Update Code/GraphMol/Wrap/test_subset.py

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

* Update Code/GraphMol/Subset.cpp

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

* Update Code/JavaWrappers/gmwrapper/src-test/org/RDKit/ChemTransformsTests.java

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

* Reponse to review

* Fix documentation

* Remove comments

* Remove unnecessary comments

* Fix one liners

* Change assertion to be clearer (and not one-liners)

* Run clang-format

---------

Co-authored-by: Your Name <you@example.com>
Co-authored-by: Hussein Faara <hussein.faara@schrodinger.com>
Co-authored-by: Brian Kelley <bkelley@glysade.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-12-09 15:06:29 +01:00
Chi Cheng
2d25752fe0 Improve DetermineBonds and DetermineBondOrders performance (#8888)
* try to reduce the number of valence combinations by checking neighbour valence and bonding

* fixed error message. Remove test that fails now because determineBondOrders finishes too quickly.

* cleanup

* adjust checking

* fix building

* add interrupt test back in but use a molecule that still takes a bit of time.

* improve error messaging

* change "test interrupt" to use xyz

* fix for atoms without valence information. and apply suggestions

* Update Code/GraphMol/DetermineBonds/DetermineBonds.cpp

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

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-12-08 06:17:41 +01:00
Greg Landrum
436ecbebac Allow Hs to be ignored in the RMSD alignment functions (#8976)
* first pass at allowing Hs to be ignored in getBestRMS()

* add support in getAllConformersBestRMS()

* do getBestAlignmentTransform()

* cleanup, error checking, and a fix

* this is more painful than it seems like it should be

* add python wrappers and tests

* response to review
2025-12-04 18:37:59 +01:00
Greg Landrum
af4e6c05ec strip whitespace from embedParametersToJSON() (#8989)
* strip whitespace from embedParametersToJSON()

* update expected results in python tests

---------

Co-authored-by: = <=>
2025-12-04 06:57:08 +01:00
Ricardo Rodriguez
39c4083bbf Minor clean up in SMILES Writing double bond canonicalization (#8971)
* move firstVisitOrder into lambda

* remove extra bond switch

* modernize loop
2025-12-03 17:38:56 +01:00
Greg Landrum
6e331accc0 some optimizations of AlignPoints() (#8987)
* some optimizations of AlignPoints()
still should do some benchmarking to see how much of a difference the changes make

* remove unused variable

---------

Co-authored-by: = <=>
2025-12-03 16:59:11 +01:00
Ricardo Rodriguez
22a9814655 Convert graphmolMolOpsTest to catch2 (#8978)
* move test to catch2

* fix one broken test

* make some stuff constexpr

* refactor some checks involving exceptions

* replace CHECK_INVARIANT

* replace CHECK_INVARIANT

* clean up commented out debug logging

* initialize var

* remove redundant REQUIRE_MSG
2025-12-03 06:28:56 +01:00
Niels Maeder
bc4fffda7b Embed Parameters to JSON (#8977)
* add function to convert embedParams to json

* add catch test

* add function to python wrapper

* test python function

* update copyright

* undo formatting and cleanup

* more cleanup

* remove the map flag and added round trip

* add bounds mat output

* run clang-format
2025-11-29 05:19:44 +01:00
Andrew Dirksen
2adf5211e6 add more benchmarking (#8878)
* Add many new c++ catch2 performance benchmarks.

* inline splitmix64 from boost, splitmix64 is not always available in boost. fun fact, this version is ~twice as fast

* reduce intensity of memory pressure test, target 200MB usage.

* new bench compound; accept suggestion from code review

* bench MolToCXSmiles

* Update Code/Bench/stereo.cpp

* impl first part of the suggestions from code reveiw

* impl second part of the suggestions from code reveiw
2025-11-27 14:25:57 +01:00
Ricardo Rodriguez
f2e0e5c440 count stereo features (#8963) 2025-11-23 07:15:30 +01:00
Rachel Walker
3320d7b454 Modern stereo: fix stereo inversion in rings (#8957)
* Modern stereo: fix stereo inversion in rings

* Update Code/GraphMol/catch_chirality.cpp

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

* Update Code/GraphMol/catch_chirality.cpp

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

* Update Code/GraphMol/catch_chirality.cpp

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

* review comments

* Update Code/GraphMol/catch_chirality.cpp

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

* gregs comment

---------

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
2025-11-21 07:50:16 +01:00
Ricardo Rodriguez
79b595de20 Add test to watch the state of canonicalization problems reported in #8775 (#8958)
* add test

* add 8862, rename var

* rename variables
2025-11-20 19:21:06 +01:00
paconius
bea9b11a34 Python Bond Inversion (#8951)
* Exposed Bond::invertChirality() to Python

* Add Bond InvertChirality Test

* Fix test code

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

* Fix unittest

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-11-19 05:54:04 +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
tadhurst-cdd
20aeb386e7 Valence error when parsing SCSR (#8948)
* turn off strict valence check for SCSR Templates

* fix to test molecule ValenceErrorScsr.mol

* Add test mols
2025-11-18 17:09:04 +01:00