277 Commits

Author SHA1 Message Date
Ricardo Rodriguez
92d5d2c657 Refactor to stop using iterator definitions in types.h (#9275)
* clean up iterator defs in types.h

* do not use auto for inline constexpr

* restore undef max,min

* restore types.h declarations
2026-05-21 19:19:38 +02:00
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
9d1b988799 Fixes #9143 (#9195)
* Fixes #9143
There is still some weirdness in the matching of ET bonds in macrocycles, but it is not connected to this change.

* adjust test to work on win (and mac?)

* tweak expected results for win ci
2026-03-24 10:03:02 +01:00
Katharina Buchthal
f7a3f044ff Adjust lower bounds to allow intramolecular H-Bonds (#9188)
* added test case

* implemented lower bounds of potential h-bonds

* suggested changes

---------

Co-authored-by: Katharina Buchthal <katharina.buchthal@phys.chem.ethz.ch>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2026-03-20 04:36:28 +01:00
Katharina Buchthal
c5de9f8843 Fix issue 9165 & 9166 (#9184)
* added *S-S* and bounds overwriting tests

* fixed *S-S*

* added bounds overwriting test

* searching for the bug

* added test case

* improved tests + fixed bug 9166

* updated ref mols

* regenerated refs

* clean up

* changed ref data

* removed print statements

* Update Code/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.cpp

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

* Typo

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

* Incooperated suggestions

* applied remaining suggestions

* restored imports

---------

Co-authored-by: Katharina Buchthal <katharina.buchthal@phys.chem.ethz.ch>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2026-03-19 16:47:04 +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
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
David Cosgrove
dad4d39803 Change docs in Python EmbedMultipleConfs. (#8900)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-10-28 02:09:14 +01:00
David Cosgrove
dfdddb3fc9 Add extra info about return value. (#8860) 2025-10-10 14:58:20 +02:00
Niels Maeder
686ca3fd6e same docs for same behaviour (#8854) 2025-10-09 04:44:58 +02:00
Ricardo Rodriguez
7b7a8a4e17 Refactor iostreams includes (#8846)
* refactor iostreams includes

* restore ostream to MonomerInfo.cpp
2025-10-08 16:08:01 +02:00
Ricardo Rodriguez
a4b63d7df5 Minor refactor of the python wrappers (#8847)
* refactor python wrappers

* fix FilterHierarchyMatcher converted already registered warning
2025-10-05 09:42:31 +02:00
tadhurst-cdd
f00a8cbb4c ScsrHbondMrvError (#8646)
* fix MRV for Hbonds

* add test file

* add test file

* enforce chirality in DistGeom catch test

* Added test for correct hbond retention

* removed debug print statement

* retrigger checks

* testing  java AromaticTests

* testing java aromaticTests

* removed testing code
2025-09-29 17:30:50 +02:00
Niels Maeder
4f2e61cbd3 expose exceeded timeout (#8816) 2025-09-25 14:07:43 +02:00
Niels Maeder
5b1d04d23e Fix grad scaling (#8791)
* fix grad

* adapt tests to pass with fix

---------

Co-authored-by: Niels Maeder <maedern@ethz.ch>
2025-09-21 18:19:50 +02:00
Greg Landrum
00a9dc49f7 Fixes #8559 (#8560)
* Fixes #8559

Also includes some minor refactoring of set14Bounds()

* apply the same change to the cis/trans trackers

* cleanup

---------

Co-authored-by: = <=>
2025-06-06 15:30:07 +02:00
Niels Maeder
22dfa85110 Fix ETKDG double bond check from #8518 (#8528)
* only exclude multiple double bonds from check if degree of center atom is 2

* clang-format

* add test for fix

* try fixing DLL build

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

* fix Widnows build as suggested by @greglandrum

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-05-19 14:28:15 +02:00
David Cosgrove
49995f149c Change default ETversion. (#8414)
* Change default ETversion.

* add an ETDGv2 parameter set

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-05-14 07:42:48 +02:00
Greg Landrum
123875aadd add support for allene- and cumulene-like structures to KDG (#8518)
* add support for allene- and cumulene-like structures to the K terms in KDG

* Update Code/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.cpp

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

* Update Code/GraphMol/DistGeomHelpers/Embedder.cpp

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

---------

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
2025-05-12 06:32:54 +02:00
Niels Maeder
591748d019 add function to overwrite __setattr__ to only accept valid arguments (#8448) 2025-04-18 05:33:16 +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
Niels Maeder
718b0b9000 Expose basinThresh to the python layer (#8283)
* expose basinThresh to the python layer

* docs: add the line about client code

* docs: remove warning
2025-02-20 10:12:17 +01:00
Ricardo Rodriguez
1a67fefcc6 mem fixes (#8276) 2025-02-20 05:59:30 +01:00
Greg Landrum
c7169eb17c Fixes #8250 (#8254) 2025-02-10 10:04:26 -05:00
Greg Landrum
2fe7573807 support Ctrl-C in conformer generation (#8197) 2025-01-26 16:03:13 -05:00
Hussein Faara
44364fd982 remove no-op macros and dead code (pt 4) (#8037)
* remove no-op macros and dead code (pt 4)

* review comments
2025-01-26 07:49:50 +01:00
Nikitas Rontsis
f20b83bc64 Conformer embedding timeout (#8110)
* Conformer embedding timeout

* Add README for patching

* Don't raise Exception but set EmbedFailureCauses on timeout.

* Fix

* Remove wrongly added README

* Debug segfault

* Improve logging of failures

* Fix pointer reference

* Don't use optional
2025-01-13 10:08:25 +01:00
Hussein Faara
8411f4535e remove no-op macros and dead code (pt 2) (#8035)
* remove no-op macros and dead code (pt 2)

* test failures due to whitespace changes?

* actually run the testFeatures tests

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2025-01-11 14:10:00 +01:00
tadhurst-cdd
7474d2b603 relax two tolerances for ARM64 builds (#8148) 2025-01-09 07:19:36 +01:00
Nikitas Rontsis
e640915d4e Avoid unnecessary matching (#8111) 2024-12-17 16:11:40 +01:00
Greg Landrum
7872341b92 fixes #8001 (#8002) 2024-11-14 05:14:51 +01:00
John Mayfield
2553cfce73 Improved handling of SP/TB/OH reording in SMILES/SMARTS. (#6777)
* Improved handling of SP/TB/OH reording in SMILES/SMARTS.

- add a getMaxNbors(tag) utility function to avoid repeated logic in multiple places
- tweak getChiralPermutation() for handling implicit/missing ligands (uses -1), allow inverse lookup
- use the tweaked chiral ordering in the reading/writing from SMILES

* clang-format run

* Reviewer requested changes.
- curly braces on all if conditions
- null check raw pointers with precondition.

* Correct additional test case introduced in the last year
2024-10-21 04:55:08 +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
da6cd73168 Run clang-format across everything (#7849)
* run clang-format-18 across Code/*.cpp and Code/*.h

* run clang-format-18 across External
2024-09-26 13:39:02 +02:00
nmaeder
168b111fe3 Ensure 13 bounds constraints are added to angles that are part of an improper torsion (#7729)
* make sure 13 bounds constraints are added to angles that are part of an impropper torsion

* make sure angles are constrained with higher force constant to prevent rings from folding

* adapt tests to new behavior

* move comment to correct place

* add min bounds test

* make sure we are not terribly outside of the bounds matrix
2024-08-21 16:06:29 +02:00
nmaeder
3f3ff3858a Refactor distgeom minimizations (#7652)
* refactor skeleton

* fix contribs

* adapt documentation

* clarify function names

* make variable names more readable and update documentation

* switch boost dynamic bitset with std::vector<bool>

* clearer const name

* fix typo and go back to dynamic bitset

* go back to old function signature

* add inline overload with fewer arguments

* remove unecessary doc lines and add tol to distance directly in function call

* use constexpr for known distance force constant

* update documentation

* enhance documentation

* english

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

* make changes requested by @greglandrum

* make all constexprs

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-07-25 06:14:12 +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
nmaeder
6675315b85 Fix/kminimization (#7535)
* first try

* do over with @greglandrum: fix atomPairs, lower SP angle force constant.

* change test file for 'update parameters from JSON':'ETKDGv2'

* adapt length to fix

* remove overwritten random seed

* adapt test files to changes

* adapt amide test, check with Greg

* fix python tests and remove unused imports

* proposal for new test molecule

* remove double comparison, increase threshold. Check with greg

* remove TODO comments

* remove debugging statements

* same code for both since they are doing the same

* format docstring to make more readable

* remove todo comments

* add indentation to angle param

* adapt doctest to newly generated conformers

* fix test to pass with fewer failures and move mol to mol file for less cluttered test.

* a bit of modernization

* remove cerrs and format correcly

* reverted test to old behavior

* use insert and make force field contribs exception safe

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-07-08 15:29:45 +02:00
Greg Landrum
df0224fb7d Fixes #7552 (#7564)
* Fixes #7552

* Change in response to review

* suppress a warning
2024-06-26 04:42:33 +02:00
Greg Landrum
c0eaba0c3f ConfGen: fix a logic error in one of the chiral volume tests (#7560)
* fix a logic error in one of the chiral volume tests

* check the magnitude of the chiral volume in the atropisomer tests

* make the espression more readable

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-06-26 04:41:07 +02:00
Greg Landrum
81af0dbd63 add option to symmetrize conjugated terminal groups when RMS pruning conformers (#7270)
* expose symmetrizeTerminalAtoms() to the public API

* support symmetrizing terminal groups in RMS pruning in confgen

* add that to the python wrapper

* add backwards compatibility note

* allow JSON config of the new option
2024-03-19 04:38:29 +01:00
Greg Landrum
6f3275f927 Fixes #7181 (#7206)
* Fixes #7181

adds a new constrainedAtoms member to the etkdgdetails structure which is used to propagate info about the coordMap into the ETK minimizations

* Update Code/DistGeom/DistGeomUtils.cpp

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

* Update Code/DistGeom/DistGeomUtils.cpp

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

---------

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
2024-03-12 04:47:22 +01:00
Greg Landrum
5b89586de2 fix a memory overwrite (#7147) 2024-02-07 17:40:41 +01:00
Greg Landrum
6bede685e0 Support atropisomers in the conformer generator (#7098)
* change a define to a "using"

* basic atropiosomer support for confgen

currently only supports bonds with two exo substituents on each end

* support systems with two exo bonds

* cleanup

* add test for #7109

Fixes #7109

* clean the tests up a bit
2024-02-06 15:48:25 +01:00
Greg Landrum
9fb7d03960 expose EmbedParameters::coordMap to Python (#7086)
* first pass at allowing setting the coordmap from Python

* plug the memory leak

* implemented tidier coordMap memory management

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-02-06 04:22:49 +01:00
Franz Waibl
de67212fcd Update distance bounds calculation for conjugated double bonds in macrocycles (#7032)
* Fix macrocycle bounds calculation, and make it accessible from Python

* Previously, C=C([#1])-C([#1])=C groups in a macrocycle were always
  cis. Although the bounds within the group allowed cis or trans, the
  1-4 bounds of the H atoms were always set to trans, which forces the
  carbons into the cis position. This change fixes this behavior to
  allow cis or trans conformations
* Previously, the useMacrocycle14config flag could only be used from
  Python by creating an ETKDGv3 object, and defaulted to False
  otherwise. This change adds the flag to EmbedMolecule,
  EmbedMultipleConfs, and the EmbedParameters Python interface.
* The new default for useMacrocycle14config is True to be consistent
  with the default for useMacrocycleTorsions. Since the old default was
  False, this could change the output of existing scripts.

* Add test case for updated macrocycle distance bounds

* Remove 2 unused variables

* Fix a python test that set .seed instead of .randomSeed on an ETKDGv3

---------

Co-authored-by: Franz Waibl <waiblfranz@gmail.com>
2024-01-17 08:42:09 +01:00
tadhurst-cdd
d5d4d194ec atropisomer handling added (#6903)
* atropisomer handling added

* fixed non-used variables,  linking directives

* BOOST LIB start/stop fixes, linking fix

* Fixes for RDKIT CI errors

* minimalLib fix

* changed vector<enum> for java builds

* check for extra chars in CIP labeling

* removed wrong deprecated message

* fix ostrstream output error?

* restored _ChiralAtomRank to lowercase first letter

* changes for merged master

* Fixed catch label for new Catch package

* update expected psql results

* get swig wrappers building

* restore MolFileStereochem to FileParsers

* fix java wrapper for reapplyMolBlockWedging

* some suggestions

* move a couple functions out of Bond

* Merge branch 'master' into pr/atropisomers2

* merged master

* Renamed setStereoanyFromSquiggleBond

* atropisomers in cdxml, rationalize atrop wedging, stereoGroups in drawMol

* fix for CI build

* attempt to fix java build in CI

* attempt to fix java build in CI #2

* New routine to remove non-explicit  3D-geneated chirality

* changed to use pair for atrop atoms and related bonds

* Changes as per PR reviews

* PR review respnses

* PR review reponse - more

* Fix merge from master

* fixing java ci after merge

* Updated the help doc for atripisomers

* update the atropisomer docs

* improve the images

* add the source CXSMILES

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-12-22 04:58:18 +01:00
Greg Landrum
b6361ae684 Change the defaults for the conformer generation to be ETKDGv3 (#6985)
* fix a float comparison in a test

* make ETKDGv3 (i.e. v2 of the torsion parameters) the default.
This should have been done a long time ago.

* change default for onlyHeavyAtomsForRMS too

* release notes update
2023-12-19 04:25:55 +01:00
Paolo Tosco
2b4202867e Add Python modules to generate stubs and automatically patch docstrings (#6919)
* - added gen_rdkit_stubs Python module to generate rdkit-stubs
- added patch_rdkit_docstrings Python module to patch existing C++ sources to fix docstrings missing self parameter and add named parameters taken from C++ signatures where possible
- added rdkit-stubs/CMakeLists.txt to build rdkit-stubs as part of the RDKit build
- added an option to CMakeLists.txt to enable building rdkit-stubs as part of the RDKit build (defaults to OFF)

* fixed CMakeLists.txt, rdkit-stubs/CMakeLists.txt and a doctest

* - added missing cmp_func parameter
- fixed case with overloads with optional parameters
- do not trim params if expected_param_count == -1
- add dummy parameter names if we could not find any
- keep into account member functions when making up parameter names
- address __init__ and make_constructor __init__ functions
- fix incorrectly assigned staticmethods

* patched sources

* address residual few remarks

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-11-30 04:54:18 +01:00
Greg Landrum
2957ab4576 switch to catch2 v3 (#6898)
* switch to catch2 v3
Fixes #6894

* fix a couple of problems noticed in the CI builds

* more warning cleanup

* changes in response to review
2023-11-15 06:45:42 +01:00