Commit Graph

196 Commits

Author SHA1 Message Date
Ricardo Rodriguez
db025bd6b0 make sorting more consistent (#9239) 2026-04-16 05:05:14 +02:00
tadhurst-cdd
0b5172b62d cleanup of stereogroups and wedges for non-chiral sites (#9051)
* cleanup of stereogroups and wedges for non-chiral sites

* fixed testShapeHelpers for Arm64 build

* reorg the tests a bit

* rename and document option

* add to the python wrappers

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2026-01-30 04:20:32 +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
tadhurst-cdd
2ae0a75a25 Handle chiral atoms with 2 hydrogens in SCSR parser (#8939)
* added flag to allow chiral settings on Atoms with 2 hydrogens for SCSR treatment

* added parameter to allow chiral 2Hs on template mols in SCSR parser

* fixed testShapeHelpers for arm64 build

* Remove checking for two Hs in chiral atom in atomChiralTypeFromBondDirPseudo3D

* removal of flag for allow2Hs

* remove setup.bat file
2026-01-29 08:08:14 +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
Greg Landrum
60940f5e53 Fixes a bug with chirality perception of T-shaped centers in very large rings (#8930)
* Fixes a bug with chirality perception of T-shaped centers in very large rings

* remove those files from the chemdraw tests
should be added later once we figure out and fix what the problem on the chemdraw side is (it is not directly connected to this PR)

* be more systematic about the tolerance values
carry the same tolerances over into the bond wedging code

* re-enable those chemdraw tests

* typo
2025-11-10 13:02:42 -05:00
Ricardo Rodriguez
e4c8ed7765 remove (#8872) 2025-10-23 11:21:36 +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
Greg Landrum
6d8fca2fbf Fixes #8689 (#8738)
* add test

* potential fix

* whops\!

* support disabling ring stereo in rankMolAtoms

* pass atom ranks into the ring-stereo detection code

* all tests pass

* forgot a file

---------

Co-authored-by: Ric R. <ricrogz@gmail.com>
2025-09-03 12:15:09 +02:00
Greg Landrum
7a9265b103 Fixes #8420 (#8428)
* Fixes #8420

* Update Code/GraphMol/Chirality.cpp

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

---------

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
2025-04-10 19:15:34 +02:00
Greg Landrum
5c1fa74495 Fixes github #8364 and #8365 (#8366)
* Fixes #8365

* Fixes #8364
2025-03-31 15:58:47 +02:00
Greg Landrum
8ea8ec5e3f Fixes #7983 (#8342)
* Fixes #7983

move the call to cleanupAtropisomerStereoGroups() into assignStereochemistry()

* Additional tests from @susanhleung in #8323

* more testing

* changes in response to review

* changes for review
2025-03-20 07:40:33 +01:00
Greg Landrum
fa048eacc5 Replace GetImplicitValence() and GetExplicitValence() with GetValence() (#7926) 2025-01-28 21:09:03 +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
Greg Landrum
607912a579 fixes #8060 (#8087)
* fixes #8060

* check the new stereo code too
2024-12-12 18:13:29 +01:00
Brian Kelley
d0fcbdac0d Need to reserve space before assignment (#7964) 2024-10-28 14:11:06 +01:00
Kevin Boyd
54025259d3 Only save the most recent CIP rank for sorting (#7932)
* Only save the most recent rank for sorting

* Remove padding code
2024-10-19 07:17:54 +02:00
Ricardo Rodriguez
077493b209 Fixes #7929 (#7930)
* add a test

* fix issue

* Update Code/GraphMol/Chirality.cpp

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

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-10-18 05:34:50 +02:00
Kevin Boyd
5d840450be Sort CIP entries in place using a lightweight wrapper, only sort tied entries (#7911)
* Sort CIP entries in place using a lightweight wrapper, only sort tied regions

* Address review comments

* Clang-format
2024-10-17 05:42:07 +02:00
tadhurst-cdd
0de215a1f8 Fix canonicalization of stereogroups (#7041)
* 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

* test changes

* 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

* Merge branch 'master' into pr/specialQueries

* changes from previous PR

* Iclude false chiral

* rigorous enhnced stereo canoncalization

* Added more tests and clenup

* removed commented out code

* corrected init of SmilesWriteParams

* added MolFileStereoChem.h to the header files

* Renamed Rxn parser to MrvBlockToChemicalReaction

* To make catch2 work, and match the checksum

* Fixed Structchecker errors

* fix CI for DetermineBonds catch test

* error in catch_test for CI

* Allow custom  smileWriteParams  in GetMolLayers

* misnamed entry point

* ReactionFromMrvString change name

* remove adding writeParams to GetMolLayers

* make rigorous enhanced stereo the default, and fix tests

* only one abs group no longer needs Rigorous Enhanced treatment

* changed string_view to string in catch test

* Canonicalize Enhnaced Stereo only resturne unique smiles

* Now allows or and and groups together

* internal routines inside detail scope

* fix test error

* changed string back to string_view and fixed a CHECK

* Fixes for PR review tests

* Fix RDKit_Book.rst failure on build test

* fix xqm sql test

* updated expected files for cxsmiles_test

* Fixed removal of atom attrs

* Fixed tests after merge of master

* More efficient version of Stereo Groups Canonicalization

* Fixes for ctests

* removed debug code

* readded cipLabel test

* fix generalizedSubstruct/catch_tests.cpp error

* hueristics to improve speed

* Rationaized control of abs groups

* removed unused routine

* added rigorous stereo group treatment to test

* some suggested changes

* Changes per PR review and removed some changes to smiles

* Fixed CI errors

* changes per PR review

* more PR review vhanges and cleanup

* Fixed PSql PKL change

* changes as per PR review

* Restored error type for bad mols for canonicalizeStereoGroups and added a test

* Merge master and fix test in MolDraw2D

* Fix for randomize test error and other PR review comments

* Removed unsued variable to fix mac CI

* do not force aromatization in canonicalizeStereoGroups

* changes as per PR review

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-10-11 17:09:18 +02:00
Kevin Boyd
875596eb12 [IterateCIPRanks] Precompute neighbor indices and counts, sort them together for each atom (#7889)
* Precompute neighbor indices and counts, sort them together for each atom

* Fix copyright

* Fix sort signature, not sure how that ever compiled
2024-10-10 16:27:33 +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
Greg Landrum
8e57151157 Fixes #6757 (#7664)
* assignStereochemistry() should call updatePropertyCache() if it is needed

* Fixes #6757

* update expectations in current tests

* add another test
2024-07-25 15:26:22 +02:00
Greg Landrum
ad3e570dea add findMesoCenters (#7574)
* add option to use chiral presence in atom ranking

* add findMesoCenters

* add includeChiralPresence to python wrapper

* add python wrapper for that

* backup, not working

* backup

* all tests pass

* add tests for partial coverage of stereo groups

all tests pass

* backout the cleanup operations for the initial merge

* track the meso atoms with atom properties.

this is an optimization for later.

* changes in response to review
2024-06-28 04:55:49 +02:00
Ricardo Rodriguez
d6171aaade Fixes #7509 (#7513)
* add a test

* scale pseudo 3d offset

* update inchi test

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-06-14 05:39:48 +02:00
Greg Landrum
ba5f43fa6f Fixes #7438 (#7474)
This moves the function into the Chirality namespace.
2024-05-31 14:41:22 +02:00
Greg Landrum
748f36f7d8 Fixes #7434 (#7446) 2024-05-16 14:32:38 +02:00
Ricardo Rodriguez
ba7deb89a0 Fixes #7346 (#7347)
* add a test

* fix issue
2024-04-11 16:16:47 +02:00
Riccardo Vianello
722cbba894 cleanup RDKit::MolOps::detectBondStereochemistry (#7329) 2024-04-04 19:28:32 +02:00
Ric
3187496d59 make _NonExplicit3DChirality a public property (#7258) 2024-03-16 06:25:22 +01:00
Greg Landrum
6981cb0a39 allow perception of stereo from T-shaped structures (#7183)
* allow perception of stereo from T-shaped structures

* document that in the release notes
2024-03-05 15:59:11 +01:00
Greg Landrum
716b38a2d8 Fixes #7140 (#7150)
* Fixes #7140

deprecates the old version and creates a new one in Chirality.h
adds it to the python wrappers

* changes in response to review

* backup

* support custom labels with templates
2024-02-12 15:50:02 +01:00
Ric
d4fa4c5aed Fixes #7131 (#7132)
* Add a test

* do not consider wedge/dash bonds when choosing controlling bonds
2024-02-06 15:55:42 +01:00
Brian Kelley
eef5aa648e Fixes #7115 (#7117)
Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2024-02-01 05:02:46 +01:00
Greg Landrum
b9a345157e Fixes #7076 (#7092) 2024-01-25 19:31:18 +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
Ric
3c494e3425 Fixes #6981 (#6982) 2023-12-16 08:01:33 +01:00
Brian Kelley
4200047dc0 Set squiggle bonds to STEREOANY with stereo atoms (#6877)
* Set squiggle bonds to STEREOANY with stereo atoms

* STEREOANY from squigglebonds is set regardless of sanitization now

* Ensure we have stereo atoms

* Add comment for new behavior

* See if a newer version of cmake works

* rev cmake to a slightly new version

* rev cmake to a slightly older version

* Response to review

* Allow setting of CIS/TRANS in set from squiggle bond

* Fix missing paren

* Add test for the actual enumeration

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2023-11-29 04:52:39 +01:00
Paolo Tosco
36deaefb07 Fixes #6816 (#6827)
* fixes #6816

* cover the case where `CFG=0` is specified, which was missing

* roundtripping a CTAB should not change a cis/trans double bond into a crossed bond after calling reapplyMolBlockWedging(), no matter if the molecule is sanitized or not

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-11-10 20:23:15 +01:00
tadhurst-cdd
d7c01af9c8 Fixes for canonicalization, and stereochemistry (#6743)
* Fixes for canonicalization, and stereochemistry

* chnages from code review

* test that was omitted for canon correction

* PR review changes

* changes as per PR review

* missed file checkint to make PR tests compile

* PR conflict resolution

* change to fix PR buld errors (hopefully)

* line delete to force re-running of tests

* changes as per PR review

* resolve merge conflicts with master

* some suggestions

* revert chirality modifications when sanitization isn't being done

* addl changes: no stereo percept when no sanitize

* missing test expected files added

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-11-06 07:40:23 +01:00
Ric
3720c2ceaf Fixes #6703 (#6705)
* add test

* fix the issue

* make imines w/ implicit H unspecified, but allow unknown

* improve test in 6527

* do not mark double bonds as EITHERDOUBLE if no neighbors
2023-09-28 05:16:17 +02:00
Ric
8176f5c962 Fail CI builds on compiler warnings + some fixes (#6675)
* enable Werror on Mac and Linux

* do not fail on boost multiprecision pessimizing move

* fix eigen array_bounds warning

* Fix unused arg in Rascal MCS

* fix range-loop-construct warning in Rascal MCES

* fix sign mismatched comparison

* drop unused lambda capture

* allow FMCS timeout test more time under Debug (not a warning!)

* fix fwd declaration of struct RascalClusterOptions

* fix deallocator mismatch

* fix two minor leaks

* fix a real leak

* more minor leaks

* fix another real leak, plus some potential ones

* fix std::move preventing copy ellision

* allow longer run time for debug builds

* make maxBondMatchPairs and getLargestFragSize unsigned int

* make snake case camel case

* update to current master, fix new warnings

* update again and more fixes

* add #include <optional>

* fix char array deallocation

* update and fixes in Marvin writer

* unsigned int

* more copy ellision fixes

* more copy ellision fixes, and typos

* and some more
2023-09-02 04:38:45 +02:00
Greg Landrum
5086391cdb Fix a bunch of edge cases in the pseudo 3d chiral assignment code. (#6669)
* handle bonds with zero length around chiral centers

* chirality perception fixes
- fix handling of T-shaped chirality
- catch zero-length bonds
- catch opposing bonds with opposite wedging

* another special case

* more quasi-linear handling

* more progress

* backup

* update

* remove some complication with the neighbor order sorting by just doing a sort
🤦
passing all tests again

* oh, isn't this fun?

* no more t-shaped three-coordinate chirality

* still a couple of tests failing

* all tests pass

* overlapping neighbors without wedges remove stereo

* add test for overlapping atoms with wedged bonds

* make warnings consistent to allow easy parsing

* more testing

* docs
2023-08-31 17:30:16 +02:00
Ric
d033aee043 Optionally forward Enhanced Stereo Group ids (#6560)
* add id members to StereoGroup class

* add optional read id argument to StereoGroup constructors

* add functions forward Stereo Group Ids and assign the missing ones

* update ops updating stereogroups to forward read id

* update CX Smiles to parse/write stereogroup ids

* Add test cases for stereo group id forwarding/canonicalization

* update mol block (V3K only) to parse/write stereogroup ids

* update pickling to parse/write stereogroup ids

* update cdxml parser to store stereogroup ids

* update mol interchange to parse/write stereogroup ids

* update draw code with new stere group ids

* update test

* add some tests

* Update Code/GraphMol/Wrap/rdmolfiles.cpp

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

* Update Code/GraphMol/Wrap/rdmolfiles.cpp

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

* Update Code/GraphMol/Canon.cpp

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

* Update Code/GraphMol/SmilesParse/CXSmilesOps.cpp

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

* review

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-07-27 18:53:40 +02:00
Brian Kelley
7698842373 Minimal update to fix hang in the legacy stereo checker (#6531)
* Minimal update to fix hang in the legacy stereo checker

* a small amount of cleanup and some refactoring

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-07-13 18:30:15 +02:00
Greg Landrum
fee12b0aa6 Switch to determining atom chiral types from pseudo 3D instead of bond dirs (#6456)
* backup

* backup

* passes a lot of tests

* cleanup; still failing some tests

* pay attention to bond starting points... duh

* all tests pass

* invert y coords

* Scale bonds, make the Wedge detection cleaner, add more tests

* Readd comment

* Use document bond length

* Adds roundtrip test through a molblock

* a bit of cleanup

* remove the old code since we aren't using it any more.

* changes in response to review

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2023-07-04 04:48:55 +02:00
Ric
36c4ec9e2b Fixes #6239 (#6240)
* check for protium nbrs

* Add a test

* fix test id

* fix H detection
2023-04-11 10:42:56 +02:00
Greg Landrum
58b79c6f8e BondDir not cleared from bonds that aren't stereoactive (#6162)
* backup

* update .gitignore

* passes tests

* all tests now pass

* update release notes

* cleanup

* changes in response to review
2023-03-07 15:15:11 +01:00
David Cosgrove
20be664b57 Remove spurious full stops from warnings. (#6124) 2023-02-24 05:07:09 +01:00
Paolo Tosco
177c09cd6b Expose additional functionality to SWIG wrappers (#5614)
* - setenv() should be defined also for MinGW builds, not just MSVC
- fixed getBestRMS signature (ROMol& should be const)
- expose normalizeDepiction(), straightenDepiction(), getBestRMS(), CalcRMS() and getBestAlignmentTransform() to SWIG wrappers
- expose MolFromSmiles() overload taking SmilesParserParams parameter to SWIG wrappers
- expose DoubleVector class to SWIG wrappers as it is needed by alignment functions
- replace std::string with const std::string& in several SWIG wrapper signatures
- build RDKit2DotNet.dll as a 64-bit library on MinGW 64-bit
- add Java tests for the newly exposed SWIG functions
- fixed inconsistent indentation in Chemv2Tests.java

* changes in response to review

* fix typo

* reverted file committed by mistake

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-10-04 05:04:28 +02:00