33 Commits

Author SHA1 Message Date
Ricardo Rodriguez
813cd85ecc The precondition in Bond::getOtherAtomIdx() is redundant (#9092) 2026-02-06 16:09:23 +01:00
Ricardo Rodriguez
9eaa193186 Merge simple AND queries onto atoms. (#8830)
* duplicate parser code

* regenerate smarts.tab files

* update test

* add release note

* restore pregenerated header

* Suggested changes (#23)

* add a generic flags interface to atoms and bonds

* suggested changes

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-10-09 04:38:42 +02:00
tadhurst-cdd
ca41fa5bfd Add SCSR parsing to RDKit (#8147)
* Parsing SCSR

* add scsrol to mol

* removed bad include file

* loosen distGeom test slightly

* add wrap test for SCSRMol

* Add test for scsr in python

* tests added for scsr and strict parsing removed

* remove extra stuff

* More fully specified use of SCSRMol for PR CI build

* Added flags for SCSR expansion to not include any leaving groups

* Added MolFromScsrParams to Wrap for python

* added SCSRMol destructor

* Added two tests for RNA macromols, and fixed a bug they revealed

* Added new tests abd expected files

* changes as per PR review

* SCSR Chnages for leaving groups

* fixed testScsr.py

* hydrogen bond treatment

* in SCSR expand, allow Hbond to be autoatically detected

* changes as per code review

* Adding new test file

* chages for SCSR contructors, destructors for CI build

* fixed pyton for SCSR hydrogen bond modes, and added tests

* Added new test files

* fixed edge case for SCSR

* fix checksum for inchi

* consistent capitalization of SCSR throughout

* switch to enum class

* make things shorter

* simplify

* get rid of the ATTCHORD class

* New section for SCSR in RDKit_book

* addeed section to RDKit_Book

* SCSRMol is no longer exposed in Python

* fix leak in MolFromSCSRFile()
light refactoring

* expose MolFromSCSRFile() to python
make the MolFromSCSR functions work with default args
a bit more testing

* removed C++ access to SCSRMol

* CXMsiles now ouputs hbonds, fix to template matching, and a few other things

* Addl fix for bad aromaticity in Hbond rings

* Test files needed

* Test files needed

* try to fix a CI build errors

* CI error fix

* Added missing test file

* CMake version - for CI build

* remove full file compoarison from macromol test file

* accidental change to debug restored to release

* Code review changes

* As per PR review

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-05-14 13:37:59 +02:00
Greg Landrum
6664dd7fe4 Some modernization of core GraphMol classes (#7228)
* simple modernization

* more

* done with RWMol for this pass

* the ROMol.cpp variant

* Atom

* minor change to bond

* simplify Conformer

* monomerinfo, queryatom, querybond

queryatom and querybond cpp files still need to be done

* typos

* revert a dumb change

* suggestion from review
2024-03-17 06:04:04 +01:00
Greg Landrum
8b8ae1561d Improve output of debugMol (#7172)
* better bond output with debugMol

* update atom output

* fix typo in the StereoGroup output
2024-02-25 17:46:21 +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
df72c241c5 Improve test coverage and some bug fixes (#4536)
* test getIdOfEntryWithBitId()

* remove unused functions

* improve bv tests in python wrapper

* more UniformGrid tests

* improve deprotect coverage

* improve abbreviations coverage

* add operator!= to DeprotectData

* more testing for adjustQueryProperties

* fix a copy-paste bug

* copy-paste bug

* more testing

* more testing

* more testing

* fix an edge case bug in getValenceContrib

* more bond tests

* add operator!= to StereoInfo
tests StereoInfo::operator==

* make some internal functions testable

* more testing

* minor code cleanup

* fix some bad caching behavior in getDistanceMat() and get3DDistanceMat()

testing

* test FixeMolSizeMolBundle() copy ctor

* deprecate BalabanJ

* more testing

* testing

* mods to get things working for windows DLL builds
(don't bother running some of the tests there)

* fix a typo
2021-09-26 07:45:06 +02:00
Greg Landrum
69b143edd0 Swap from RDUNUSED_PARAM to unnamed parameters (#4433)
* cleanup

* more cleanup
2021-08-24 17:19:46 -04:00
Greg Landrum
4c2a580ad1 Fixes github #4311 (#4312)
* a bit of simple refactoring

* Fixes #4311

- adds getValenceContrib() to QueryBond
- adds hasBondTypeQuery() and hasComplexBondTypeQuery() to QueryOps namespace
- atoms with complex bond type queries now have explict and implicit valences of 0
- adds tests for the above

* add a test
2021-07-09 15:06:54 +02:00
Greg Landrum
36c7c04344 basic h bond support (#3871) 2021-03-06 09:39:13 -05:00
Jin Pan
ab6b164924 Speed up GraphMol/Chirality.cpp/iterateCIPRanks (#3482)
* Speed up GraphMol/Chirality.cpp/iterateCIPRanks

The changes in this patch increases throughput of `iterateCIPRanks` by
about 61.8%.  This patch consists of many changes that all combine to
contribute to the performance gains, and these are the major changes:

* Introduce Bond.getTwiceBondType to avoid floating point operations in
`floor(2*bond->getBondTypeAsDouble() + .1)`
* In RDGeneral/Ranking.h/rankVect, just store the last index (instead of
the last vector) and avoid creating a copy at the current index.
* In GraphMol/Chirality.cpp/iterateCIPRanks, reserve more capacity ahead
of time.
* In GraphMol/Chirality.cpp/iterateCIPRanks, avoid materializing
localEntry and then copying; instead, track the data to be added in a
`counts` vector and a `updatedNbrIdxs` vector.

In GraphMol/Chirality.cpp/iterateCIPRanks, we also make several
micro-optimizations that were individually measured to give a small
performance improvement.

* Chirality.cpp/iterateCIPRanks: avoid materializing allIndices vec

* misc cleanup
2020-12-10 05:36:51 +01: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
Greg Landrum
c988dc4c68 Cleanup some unintended consequences of #2553 (#2735)
* backup

* output bond stereoAtoms in debugMol()

* stop removing STEREOCIS/STEREOTRANS markers in setDoubleBondNeighborDirections()

* Re-establish bond dirs in reaction products.

* test all that
(the first set of tests, should do more)

* cleanups

* add SetDoubleBondNeighborDirections() to python API and test it

* add more tests

* changes in response to review

* add another c++ test, fix the java tests
2019-10-25 04:31:06 +02: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
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
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
Brian Kelley
7488840ac4 Fix/urange check (#1506)
* Fixes atom documentation

* Fixes #1461

This is a complicated one.  Basically URANGE_CHECK when
used on unsigned integers has a problem when the size of
the range it’s checking is 0.  The standard operations is
to check

URANGE(num, size-1)

Which (for unsigned integers) obviously rolls over.

This fixes all usage cases to be

URANGE(num+1, size)

And fixes the bugs found.  (addBond and the mmff tests)

* Fixes #1461 - Updates URANGE_CHECK to be 0<=x<hi
2017-09-11 21:17:33 +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
Brian Kelley
fb84c9f0b7 Switches to URANGE_CHECK when appropriate 2015-10-18 21:14:02 -04:00
Brian Kelley
5f59333a56 Silences unused parameters 2015-10-18 14:02:29 -04:00
Greg Landrum
577f5fb4c8 convert ringInfo to a pointer 2015-03-22 16:46:36 +01:00
Greg Landrum
75be63fd6b merge with trunk 2014-02-09 05:00:18 +01:00
Greg Landrum
9f4471f872 more on #204
A few other cleanups
2014-02-06 06:43:28 +01:00
Greg Landrum
3b0c72c4bf initial pass at ZBO support.
does not yet handle the HYD and ZCH lines
2013-11-30 06:58:03 +01:00
Greg Landrum
f3fbef45c5 update copyright statements 2010-09-26 17:04:37 +00:00
Greg Landrum
052ec66542 cleanups:
remove x bit from headers and sources;
remove a couple empty files from Code/GraphMol
2010-09-08 04:25:57 +00:00
Greg Landrum
0c22ca0951 some speedups 2010-02-15 19:20:24 +00:00
Greg Landrum
4e7d182fcc Support editable molecules in Python.
This is Feature Request #1764162
http://sourceforge.net/tracker/index.php?func=detail&aid=1764162&group_id=160139&atid=814653

This implementation has been tested on Windows
2007-07-31 05:30:11 +00:00
Greg Landrum
5d03333c22 setup svn keywords (should have done this before import... grn) 2006-05-06 22:54:39 +00:00
Greg Landrum
75a79b6327 initial import 2006-05-06 22:20:08 +00:00