Commit Graph

55 Commits

Author SHA1 Message Date
Nic Zonta
2096c7fe33 Enable templating for macrocycles (#9203)
* parse templates as smarts

* accept ring templates in SMARTS format

* undo CLAUDE mistake

* rename files

* enable templating for macrocycles

* enable macrocycle templating

* Add test for macrocycle templating

Tests that ring system templates are used only for macrocycles (rings
with size > 8). The test verifies the exact threshold by generating
coordinates with and without templates for rings of size 4-14.

Addresses review feedback on PR #9203.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-27 06:25:20 +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
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
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
Nic Zonta
746435527a Allow subsets of ring systems to match templates (#7468)
* CRDGEN-360

allow subset of rings to match templates

* also add a template check for the whole ring system

* wip

* fix build error

* fix test errors

* code review

* wip

* fix test

* avoid unnecessary calls to substructure search

* remove dead code

* backup

* further optimization

revert the accidentally committed changes to the tests

* comment cleanup

* some more optimization

* Update Code/GraphMol/Depictor/EmbeddedFrag.cpp

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

* fix an out-of-bounds write

* Update Code/GraphMol/Depictor/EmbeddedFrag.cpp

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

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-09-25 08:57:29 +02:00
Nic Zonta
9fc2c47817 reject template if it doesn't match bond stereo (#7567)
* reject template if it doesn't match bond stereo

* adding tests

* remove debug print

* Update Code/GraphMol/Depictor/EmbeddedFrag.cpp

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

* Update Code/GraphMol/Depictor/EmbeddedFrag.cpp

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

* code review suggestions

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-09-17 06:00:01 +02:00
Dan N
2761441b02 Add trans layout for double bonds in rings (#6709)
* Add trans layout for double bonds in rings

If there is a trans double bond in a ring, it's important to
add a trans 2d depiction! This is important for visualization,
but it is also important for chemical accuracy. SDF uses the 2D
coordinates to discern bond stereochemistry, and some 3D embedding
techniques may start from 2D.

Without this commit, trans double bonds in rings invert on
roundtrip through SDF.

Here's a very simple assertion that fails before this commit
and passes after:

    smi = "C1=C/CCCCCCCCCCCC/1"
    assert smi == Chem.MolToSmiles(Chem.MolFromMolBlock(Chem.MolToMolBlock(Chem.MolFromSmiles(smi))))

* Fix "or" keyword to "||".

* Make sure that `embedRing()` signature is unchanged.
2023-09-25 13:19:35 +02:00
Ric
bc8d2e7556 Fix build warnings (#6235)
* un/signed comparisons in molops

* reference in loop in EmbeddedFrag.cpp

* un/signed comparison in filtercatalogtest.cpp

* un/signed comparison in Descriptors/catch_tests.cpp

* un/signed comparisons in DetermineBonds.cpp

* drop unused 'params' arg from static functions in MolInterchange/Writer.cpp

* un/signed comparisons in MolDraw2D/catch_tests.cpp

* unused var in SubgraphUtils.cpp

* 'move' preventing copy ellision in CDXMLParser.cpp

* fix infinite recursive call in SubstructLibraryWrap.cpp
2023-03-30 19:21:51 +02:00
Rachel Walker
a4499ba51d Use templates in RDKit coordinate generation (#5643)
* DRAFT: Use templates in RDKit coordinate generation

* added option in python

* Addressed some comments and added tests

* removed unused code

* A few updates to templating code

* Added params struct for compute2DCoords
* Added several tests for multiple templates and templates + coord maps
* Addressed a few other comments from reviews

* addressed another comment

* remove extra line

* Update Code/GraphMol/Depictor/Wrap/rdDepictor.cpp

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

* Some cr suggestions

* forgot to remove original .smi file

* Update Code/GraphMol/Depictor/Wrap/testDepictor.py

Removed test

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

* the coordMap pointer can be to a const object

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-03-17 11:50:25 +01:00
Greg Landrum
b603d0d97e Some refactoring of the depictor code (#4865)
* some depictor cleanup

* more cleanup/refactoring

* Apply suggestions from code review

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

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
2022-01-20 05:20:01 +01: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
ff66398d5d Fixes #4504 (#4518)
* add test

* fix some of the horribly broken comment formatting

* a start at modernization

* more modernization

* more modernization

* more modernization

* add some actual regression testing
(such as it is)

* more modernization

* more modernization

* more modernization

* more modernization

* more modernization

* fixed, still some py failures to investigate

* fixed

* remove a bunch of debugging cruft

* changes in response to review

* Apply suggestions from code review

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

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
2021-09-17 13:03:08 +02: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
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
Eisuke Kawashima
75f03412ef Modernize deprecated header inclusion (#3137) 2020-05-04 10:40:57 +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
Eisuke Kawashima
dc7cc84a0c Fix typo [ci skip] 2019-10-17 17:45:50 +09: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
afe7e3492a Fixes #2027 (#2028)
Also includes a bit of modernization.
2018-09-08 15:31:48 -04:00
Greg Landrum
e396e35b4d Fixes #1691 (#1718)
* add the relevant tests

* Fixes #1691
2018-01-12 11:21:52 -05: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
636a0f6e69 Cleanup a bunch of compiler warnings (#1697)
* remove a bunch of compiler warnings

* remove some more warnings on windows (there are still plenty to go...)
2017-12-22 12:59:52 +01: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
e52cf5c666 Fix/github1286 (#1307)
* clean up the header a bit
clang-format

* clang-format

* add test for #1286

* backup

* fixes the specific failure, but needs more looking

* add an additional test

* update the inchi code to explicitly include queue

* fix a typo identified during the review
2017-03-04 12:35:26 -05: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
Greg Landrum
844ca32b70 Fixes #1112 (#1136) 2016-11-01 19:06:55 -04:00
Greg Landrum
126788e473 Fix/github910 (#913)
* A big step towards solving #910

1) Rank atoms by inverse atomic number (ensures Hs go last)
2) Use heavy-atom degree when doing layout (ensures Hs do not change gross geometry)

* basic testing

* take degree into account with ranks too

* further improvements of relative ranking.
definitely need some cleanup of this now

* some cleanup

* add an explicit test
2016-05-20 05:23:12 +01:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Greg Landrum
f5cf3322fe code cleanup: removing compiler warnings 2014-05-08 06:06:07 +02:00
Greg Landrum
60a68669da remove more clang warnings 2013-12-02 04:46:46 +01:00
ptosco
ec8eb5a1bf - Changed all occurrences of RDKit::PI into M_PI
- added #ifdef M_PI (...) #endif in all relevant places
- made length() and sqLength() method consistent
  with respect to usage of pow(x, 2) vs x*x in
  Code/Geometry/point.h
- removed gzip-related boost.iostreams dependency and
  replaced with portable "cmake -E tar xzf" command
  in Code/ForceField/MMFF/CMakeLists.txt
2013-09-20 17:45:41 +02:00
Greg Landrum
ab12207777 Fixes #78
This does not address the non-canonical rendering piece -- that will
be considerably more work -- but it does take care of the
epoxides being rendered inside the ring.
2013-08-15 05:52:34 +02:00
Greg Landrum
695ce7de2c fix some depictor cases; make testing a bit smarter 2012-07-02 09:47:45 +00:00
Greg Landrum
3b3d44db16 remove exe property from source files 2011-01-13 04:22:56 +00:00
Greg Landrum
681a30bd61 provisional fix for issue 3135833 2010-12-12 12:05:59 +00:00
Greg Landrum
981840980a fix and test bug 3122141 2010-11-29 11:24:20 +00:00
Greg Landrum
f3fbef45c5 update copyright statements 2010-09-26 17:04:37 +00:00
Greg Landrum
6c2a126f0a fix and test issue 2995724 2010-05-03 05:39:24 +00:00
Greg Landrum
d54a343066 fix issue 2822883 2009-07-17 04:13:01 +00:00
Greg Landrum
dec22b5cfd fix and test sf.net issue 2821647 2009-07-16 05:56:17 +00:00
Greg Landrum
e05580e495 This is a sizeable one: change the way BGL is used so that atoms and bonds are stored as bundled properties
instead of using the property map interface.
A nice side-effect is that the wart of having to use property maps to loop over bonds or atom neighbors
is now gone.
This potentially breaks lots of client C++ code.
2009-02-11 20:19:25 +00:00
Greg Landrum
7043949308 fix and test issue 2303566 2008-11-17 06:51:15 +00:00
Greg Landrum
753099aacb Fix and test sf.net issue 2219400
This includes a change to the behavior of MolOps::getShortestPaths()
2008-11-03 20:11:42 +00:00
Greg Landrum
5088d7fcb4 fix and test issue 2091304 2008-09-23 11:42:36 +00:00
Greg Landrum
e8f3536845 remove a bunch of compiler warnings 2008-05-26 20:05:57 +00:00
Greg Landrum
e201ba2b9e code cleanups 2008-02-19 07:25:39 +00:00
Greg Landrum
1d40302dcb This builds and tests correctly with msvc8. Linux and msvc7 tests are still required.
The primary changes consist of cleaning up edge cases that lead to memory errors (under VC8 with debugging turned out)
2008-02-16 05:25:53 +00:00
Greg Landrum
3c57caabfb partially tested fix for sf.net bug 1894348 2008-02-15 16:13:12 +00:00