Commit Graph

42 Commits

Author SHA1 Message Date
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
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
Ricardo Rodriguez
6da61ce9ac Fixes #8712 (#8736)
* fix secondary bug involving ring stereo clearing

* refactor test

* update ring stereo for last atom
2025-09-11 05:01:08 +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
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
tadhurst-cdd
2dbf83898d trimethylcyclohexane chirality error (#8272)
* Fix for trimethylcyclohexane error

* removed unused variable

* removed debugging code
2025-02-24 17:41:54 +01:00
Greg Landrum
fa048eacc5 Replace GetImplicitValence() and GetExplicitValence() with GetValence() (#7926) 2025-01-28 21:09:03 +01:00
tadhurst-cdd
bebd2ebbce Fix for removing bad stereo indications from Atropisomer parsing (#7984)
* Fix for removing bad stereo indications

* removed one unneed change

* removed mistaken change
2024-12-22 04:47:18 +01:00
Greg Landrum
350a8bcd05 Fixes #7598 (#7604)
* add test

* Fixes #7598
2024-07-15 14:15:32 -04: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
tadhurst-cdd
4ce1a5640a Ring stereo atropisomers (#7486)
* changed string_view to string in catch test

* fix for ring-stereo atropisomers

* removed debug cout

* removed change to build in debug mode

* change catch arg to a rerference

* changes as per PR review
2024-06-13 08:35:42 +02:00
Greg Landrum
748f36f7d8 Fixes #7434 (#7446) 2024-05-16 14:32:38 +02:00
Greg Landrum
a7ac25cbe8 Fixes #7300 (#7413) 2024-05-02 17:32:05 +02:00
Ric
e86c4e1fe1 speed up cleanMolStereo (#7244) 2024-03-14 04:52:43 +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
c9a46b34bc Fixes #6975 (#6972) 2023-12-11 17:40:30 +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
Greg Landrum
9158208cd5 some modernization of the memory handing in the canonicalization code (#6763)
* some modernizations w.r.t. memory

* get rid of more mallocs

* remove a clang warning

* missed one

* response to review
2023-10-03 12:07:14 +02: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
8c62a963fe Fixes #6640 (#6642) 2023-08-20 15:54:49 +02:00
Ric
8d95e1be5b fix issue in stereo bonds with only implicit H (#6527) 2023-07-27 19:00:21 +02:00
Greg Landrum
8ab356e266 Allow systems like C/C=N/[H] to be stereogenic with the new chirality perception (#6473)
This was raised in discussion #6291 here:
https://github.com/rdkit/rdkit/discussions/6291#discussioncomment-6214078
2023-06-22 10:53:58 +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
Ric
4e2e45baa3 Fixes #6217 (#6218)
* fix

* add a test
2023-03-22 17:14:03 +01: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
Greg Landrum
ec67021fa0 Fix #6011 and #6012 (#6013)
* stop finding potential nontetrahedral sites when nontetrahedral stereo is disabled
stop matching [PH3] as potential stereo

* add another test
2023-01-26 19:26:19 +01:00
Greg Landrum
3e3b7b8693 Support stereo for double bonds in rings from CXSMILES (#5636)
* initial support for wiggly and wedged bonds in cxsmiles
add CX_ALL_BUT_COORDS convenience option to CXSMILES writer

* move ClearSingleBondDirFlags to MolOps

* do a better job of handling the wiggly bonds

* mark 3D conformers from CXSMILES

* remove some extraneous printing

* test wD as well

* remove non-applicable test

* basic tests (not passing) for parsing t/c/ctu

* remove test for unimplemented feature

* basic tests (not passing) for parsing t/c/ctu

* backup

* parsing works

* Fixes #5585

* cleanup, use the constant instead of hardcoding

* write ctu block

* document new cxsmiles additions

* more stereo info in the docs

* changes in response to review

* this passes all tests
Need to still think a bit about whether the "basic writing" test results are actually correct

* happier with those results
2022-10-20 07:44:11 +02:00
Ric
aaf85e7d7c Fixes #5659 (#5660)
* fix issue, add test

* check all common rings
2022-10-18 15:16:26 +02:00
Greg Landrum
ce082ae96b Revert "Support ring-bond stereo flags in CXSMILES (#5595)" (#5629)
This reverts commit c6388a0ba7.
2022-10-08 17:33:23 +02:00
Greg Landrum
c6388a0ba7 Support ring-bond stereo flags in CXSMILES (#5595)
* initial support for wiggly and wedged bonds in cxsmiles
add CX_ALL_BUT_COORDS convenience option to CXSMILES writer

* move ClearSingleBondDirFlags to MolOps

* do a better job of handling the wiggly bonds

* mark 3D conformers from CXSMILES

* remove some extraneous printing

* test wD as well

* remove non-applicable test

* basic tests (not passing) for parsing t/c/ctu

* remove test for unimplemented feature

* basic tests (not passing) for parsing t/c/ctu

* backup

* parsing works

* Fixes #5585

* cleanup, use the constant instead of hardcoding

* write ctu block

* document new cxsmiles additions

* more stereo info in the docs

* changes in response to review
2022-10-07 17:52:37 +02:00
Ric
c946bb8a6d Fixes #2984 (#5560)
* fix issue

* add / reenable tests

* Do cheap test first

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

* remove underscores from function/variable names

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2022-09-15 04:55:31 +02:00
Ric
0d8ad69541 fix warnings (#5561) 2022-09-14 06:36:42 +02:00
Greg Landrum
c060e5de98 New version of AssignStereochemistry (#5442)
* bring over some new functionality

* adjust your expectations

* more tests

* additional cleanup and testing

* implement fix from #5407

* more testing

* a bit of optimization

* add the new func to the python wrappers

* cleanup

* findPossible working in the new code
NOTE: the combination of findPossible and cleanIt does not work and needs to be disallowed

* do some cleanup

* better handling of UNKNOWN (not unspecified) atoms and bonds

* update

* backup... we're close

* catch_chirality tests all pass

* all tests pass

* cleanup

* docs and a bit of optimization

* "optimization" which makes things slower... maybe revert this

* we don't need cleanExistingStereo() anymore... get rid of it

* cleanup

* changes in response to review
2022-09-06 12:53:02 +02:00
Ric
d5aa4f5b5c Fixes #5403 (#5407)
* add a test

* add potential fix
2022-07-07 14:42:28 +02:00
Greg Landrum
cd74dc2207 Initial support for non-tetrahedral stereochemistry (#5084)
* very basics: actually parsing the new atom stereochem features

* add some input verification for the chiral permutations

* fix a typo
add quadruple bond SMILES/SMARTS extension

* add forgotten files

* patch from Roger

* add Roger's parsing examples

* typo

* new tests

* adjusted version of next PR from Roger:
- add SP2D hybridization for square planar (this may change)
- some modernizationof Chirality.cpp
- stop using < HybridizationType in Chirality.cpp (should probably do this elsewhere too)
- improved handling of hybridization assignment for new stereochem
- handle new stereo/hybridization in UFF
- tests for the above

* perception of non-tetrahedral stereo from 3D (from Roger S)
Basic testing of SP and TB based on opensmiles docs

* potential fixes for octahedral assignment
more tests

* docs update
need way more!

* map the TH tags directly to @ tags

* very basics of SMILES writing
this does not work with anything that changes the permutation order
like canonicalization or writing things in rings.

* start to support the getChiralAcross API

* more testing

* consistency

* add hasNonTetrahedralStereo() and getIdealAngleBetweenLigands()

* assignStereochemistry should only remove non-tetrahedral stereo

* re-simplify those tests

* cleanup matrix stream output

* initial pass at supporting nontet stereo in distgeom

* backup

* start on the reference docs

* TBP reference

* first pass at Oh finished

* update SP section

* more doc updates

* fix a typo

* add param to not remove Hs connected to non-tetrahedral atoms

* VERY basic coord generation for square planar

* TBP basics

* basic OH depiction

* start testing missing ligands
allow non-tet stereo in rings (ugly, but correct)

* add new TBP functions from Roger

* update depiction code for new API

* backup, the new tests work so far

* Finish the TB tests

* OH tests pass too

* cleanup

* first pass at getting correct SMILES with reordering
need way more testing than this

* ensure permutation 0 is correctly preserved

* some progress towards adding non-tetrahedral stereo to StereoInfo

* doc update

* add non-tet chiral classes to python wrappers

* make sure removeAllHs also gets neighbors of non-tetrahedral centers
more testing

* a bit of depictor cleanup

* make the assignment from 3D more tolerant
more testing

* improve the bulk testing

* cleanup

* remove a bit of redundant code

* ensure we don't write bogus permutation values to SMILES

* fix some rebase problems

* allow assignStereochemistryFrom3D() to be called without sanitization

* allow disabling the non-tetrahedral stereo when it's not explicit

* get that working on windows too
2022-05-20 09:07:16 +02:00
Paolo Tosco
dfd7d18f27 Fixes multiple definitions of symbols (#5202)
* fixes multiple definitions of symbols

* changes in response to Greg's suggestion

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-04-16 07:21:15 +02:00
Greg Landrum
7e7fdb0f29 Fixes #5196 (#5201)
* Fixes #5196

This fixes the bug as reported, but there's more work to do in order to get the other cases

* cleanup

* fix assignStereochemistry()

* Fixes #5200

* move those functions to the public API

* fix assignStereochemistry

* cleanup

* refactoring in response to review
2022-04-15 05:13:45 +02:00
Greg Landrum
f47703e706 Fix some problems with perception of ring chirality in spiro-linked systems (#4280)
* add the tests

* backup

* cleanup

* Fixes #4279

* additional testing

* revert the changes to Chirality.cpp
they didn't solve the problem anyway
2021-07-02 14:14:02 -04:00
Greg Landrum
4ee7af88e6 Fixes #4155 (#4192)
removes the shared-bond restriction for potential chiral centers
add support for chiral bridgehead nitrogens
2021-06-03 05:10:15 +02:00
Greg Landrum
170796a175 Fixes some problems with findPotentialStereo() (#3499)
* backup, definitely does not work

* remove obsolete test
(not even really sure anymore that's a bug)

* remove code from a false path

* at this point the code passes all tests

* backup

* handle isotopes and h counts properly

* remove some compiler warnings

* all tests passing

* Use InChI minimimum ring size for bonds

* Fixes edge-case bug in canonicalization when bond labels are provided

* cleanup, no substance here

* fixes the last set of problems I've seen

* document that this is still experimental

* remove obsolete/testing comments

* stop considering charge and H count in chirality
2020-10-17 04:35:58 +02:00
Paolo Tosco
7d0d7df5f0 Fixes a number of issues flagged by clang (#3498)
* - fixes a number of issues flagged by clang

* - removed commented line
2020-10-15 15:03:34 +02: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