Commit Graph

62 Commits

Author SHA1 Message Date
Rachel Walker
ab06671d0d Fix modern stereo performance issue for large structures (#9100) 2026-02-26 16:40:40 +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
7b7a8a4e17 Refactor iostreams includes (#8846)
* refactor iostreams includes

* restore ostream to MonomerInfo.cpp
2025-10-08 16:08:01 +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
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
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
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
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
Greg Landrum
63c7e85046 Update CI, remove some warnings (#6882)
* ci updates

* forgotten update

* inch by inch

* remove unused variable

* try a gcc bump

* get rid of a bunch of unused-but-set errors in clang16

* be more selective

* disable a test in an obsolete module which is mysteriously failing
2023-11-09 13:14:00 -05: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
Greg Landrum
a8c8e9a8e1 Add canonicalization of stereo groups (enhanced stereo) (#6051)
* add function to canonicalize enhanced stereo representations

* use enhanced stereo in canonicalization

* Fixes #6045
enables the doc tests for EnumerateStereoisomers.py
Re-enables the BRICS tests

* some things work... tests need to be updated

* c++ and python tests pass

* update expected psql results

* run the canonicalization on SMILES generation;
c++ and python tests pass

* cartridge and java tests pass

* update doctests
2023-02-08 04:21:51 +01: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
Greg Landrum
9fa1df1cf6 Drop usage of CIP information from the canonicalization code (#5385)
* stop using CIP codes in the atomic canonicalization

this will change results in some cases, so lots of tests need to be updated.

* stop breaking string literals... ARGH

* tests now pass

* update double bond canonicalization

* update a python test

* some cleanup

* update expected results for cartridge
2022-07-13 05:40:23 +02:00
Greg Landrum
85608555fe add ROMol::atomNeighbors() and ROMol::atomBonds() (#4573)
* add ROMol::atomBonds() and ROMol::atomNeighbors() methods

* remove some warnings

* start using the new code

* add default for those template params

* some more applications

* get the SWIG builds working

* get rid of extraneous ref

* remove extraneous comments
2021-10-02 07:28:24 +02:00
Greg Landrum
69b143edd0 Swap from RDUNUSED_PARAM to unnamed parameters (#4433)
* cleanup

* more cleanup
2021-08-24 17:19:46 -04:00
Ric
703fe5a225 Remove boost::foreach from public headers (#3820)
* remove include from headers

* update implementation files

* completely remove BOOST_FOREACH (#7)

* convert those changes to use auto

* get rid of all usage of BOOST_FOREACH

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-02-17 14:15:48 +01: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
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
Greg Landrum
45b9aef28b clang-tidy modernize-use-default-member-init and modernize-use-emplace (#3190)
* run clang-tidy with modernize-use-default-member-init

* results from modernize-use-emplace

* one uniform initialization per line
otherwise SWIG is unhappy

Co-authored-by: Brian Kelley <fustigator@gmail.com>
2020-05-28 09:07:58 +02:00
Greg Landrum
d41752d558 run clang-tidy with readability-braces-around-statements (#2899)
* run clang-tidy with readability-braces-around-statements
clang-format the results
clean up all the parts that clang-tidy-8 broke

* fix problem on windows
2020-01-25 14:19:32 +01:00
Eisuke Kawashima
5cd27a242f Fix typo (#2862)
* Fix typo

* Reflect the comments

* Fix more typos
2019-12-31 06:43:27 +01:00
Greg Landrum
d8c49e6dab Code cleanups from PVS/Studio (#2531)
* first round of cleanups based on PVS-studio suggestions

* a couple more

* a few more cleanups

* another round of cleanups

* undo one of those cleanups
we want the integer rounding behavior here

* add a comment to make that clear

* Fix for filter catalog PRECONDITION redundancy
2019-07-13 07:25:37 +02:00
Greg Landrum
ecf5a67acc Fixes #2437 (#2438)
* Fixes #2437

getting the canonical atom ranking no longer results in molecules have a
RingInfo structure that's been initialized but contains nothing.

* update expected results for the MMPA tests
2019-05-10 08:25:31 +02:00
Brian Kelley
373a89021e Change boost int types to std types (#2233) 2019-01-22 17:45:03 +01:00
Brian Kelley
87dda6acd2 Fixes #1735 (#1743)
* Fixes #1735

I’m unsure if this is the correct solution, it appears
empty molecules never initialize their rings.

* Return immediately when ranking empty molecules

* Make github issue the correct one

* Always resize results to the number of atoms
2018-02-15 05:39:02 +01:00
Greg Landrum
ba12d98ad0 Removes ATOM/BOND_SPTR in boost::graph in favor of raw pointers (#1713)
* Removes ATOM/BOND_SPTR in boost::graph in favor of raw pointers

* Actually delete atoms and bonds...

* RWMol::clear now calls destroy to handle atom/bond deletion

* Changes broken Atom lookup for windows/gcc

* Adds tests for running with valgrind

* Adds test designed for valgrind and molecule deletions

* Removes RNG, actually tests bond deletions

* update swig wrappers

* deal with most recent changes on the main branch
2018-01-07 14:19:47 -05:00
Greg Landrum
f94e277856 another pass of clang modernize 2017-10-12 06:35:51 +02:00
Greg Landrum
87786c08b5 Merge branch 'master' into modern_cxx
# Conflicts:
#	.travis.yml
#	Code/GraphMol/FileParsers/MolFileParser.cpp
#	Code/GraphMol/FileParsers/MolFileStereochem.cpp
#	Code/GraphMol/ForceFieldHelpers/UFF/testUFFHelpers.cpp
#	Code/GraphMol/MolAlign/testMolAlign.cpp
#	Code/GraphMol/MolDraw2D/MolDraw2D.cpp
#	Code/GraphMol/MolDraw2D/Wrap/rdMolDraw2D.cpp
#	Code/GraphMol/QueryOps.cpp
#	Code/GraphMol/ROMol.cpp
#	Code/GraphMol/SmilesParse/test.cpp
#	Code/GraphMol/Trajectory/Trajectory.cpp
#	Code/GraphMol/Wrap/Atom.cpp
#	Code/GraphMol/Wrap/Bond.cpp
#	Code/GraphMol/new_canon.cpp
#	Code/RDGeneral/testDict.cpp
#	Code/SimDivPickers/Wrap/MaxMinPicker.cpp
2017-10-05 05:58:38 +02:00
Greg Landrum
4862c920a5 Fixes github1567 (#1576)
* Fixes #1567

* update expected results

* some cleanup and documentation
2017-09-19 08:04:18 -04:00
Greg Landrum
915cf08faa run clang-format with c++-11 style over that 2017-04-22 17:19:10 +02:00
Greg Landrum
7c0bb0b743 clang-tidy output 2017-04-22 17:09:24 +02:00
Greg Landrum
e625c58bab Add cis/trans tags to double bonds (#1316)
* add cis and trans to bond stereo

* compiles, does not work

* tests all pass

* Whitespace cleanup to recent changes.

* C++ test case for Bond::setStereo using Bond::STEREOCIS and Bond::STEREOTRANS

* Adding a PRECONDITION to Bond::setStereo to make sure the stereo atoms
are already specified if CIS or TRANS is being specified.

E/Z is technically defined by the topology of the molecule so the
stereo atoms are redundant (easier to understand and use!), but
ultimately redundant with the graph. However, CIS and TRANS is _only_
defined in this usage as the orientation of the atoms in the
getStereoAtoms vector.

* Exposing Bond::setStereo to Python and adding test cases to make sure
it can be used to set CIS/TRANS stereochemistry.

* verify substructure matching works

* Adding Bond::setStereoAtoms to C++ Bond class.

This allows setting the atoms to be considered for CIS or TRANS
directly without a much more costly determination of ranking that E/Z
requires.

* Wrap Bond::SetStereoAtoms into python with a new type of test case.

* docs
2017-02-26 08:15:44 -05:00
Brian Kelley
2debdfde0d Adds RDAny (smaller generic holder) Updates all used dictionaries (#896)
* Adds RDAny (smaller generic holder) Updates all used dictionaries

This is an API compliant version of the current rdany system,
but uses a lot less memory in practice.

* Removes code duplication

* Converts CHECK_INVARIANT to TEST_ASSERT

* Fixes DoubleTag issue

* Adds Bool to DoubleMagic implementation

* Removes reference to property pickler
2016-05-29 17:04:21 +01:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Greg Landrum
e37296d7c7 post review 2015-11-14 08:08:14 +01:00
Greg Landrum
5618819c64 merge #641 2015-11-14 05:03:24 +01:00
Nadine Schneider
624dd72ad6 new canon: fix in special symmetry invariant 2015-11-06 18:05:04 +01:00
Brian Kelley
5f59333a56 Silences unused parameters 2015-10-18 14:02:29 -04:00
Nadine Schneider
0a9680edac new canon: tune special graph invariant 2015-06-15 15:43:02 +02:00
Nadine Schneider
1e62f1a083 New canonicalization: two small fixes 2015-04-21 13:24:53 +02:00
Nadine Schneider
0b8b6a3690 Some performance fixes for the new canonicalization
- handling molecules/proteins with multiple fragments
- add criteria for using special symmetry invariant
2015-04-15 18:42:29 +02:00
Greg Landrum
97c0bcc202 safety first 2015-04-10 09:47:17 +02:00
Nadine Schneider
69ceace885 Bugfix in SpecialChiralityAtomCompareFunctor and additional tests
Conflicts:

	Code/GraphMol/hanoitest.cpp
2015-04-10 09:47:09 +02:00
Nadine Schneider
7ddff9c71c Some performance fixes 2015-03-20 18:19:08 +01:00
Nadine Schneider
95dae49968 Some bugfixes in new_canon
- Order of comparison in SpecialChiralityAtomCompareFunctor
- Handling of Bond::STEREOANY in the bondholder vector
2015-03-20 16:38:23 +01:00
Nadine Schneider
b8492cb698 Bugfix in canonicalisation of fragments 2015-03-20 16:38:23 +01:00
Nadine Schneider
e013399bb9 Bugfixes and new invariant for chiralAtoms 2015-03-06 15:47:08 +01:00
Nadine Schneider
0d90e31c46 New canon: new atom invariant also including neighbors 2015-02-12 18:08:03 +01:00