Commit Graph

264 Commits

Author SHA1 Message Date
Greg Landrum
6ee39bd992 Fixes #9033 (#9036)
Also fixes the other similarity metrics.
A very small amount of refactoring

Co-authored-by: = <=>
2026-01-30 05:00:05 +01:00
Ricardo Rodriguez
e3f2e4651e Refactor iostreams includes (#8846)
* refactor iostreams includes

* restore ostream to MonomerInfo.cpp
2025-10-31 13:42:16 +01:00
Ricardo Rodriguez
c63ddaffa2 Minor refactor of the python wrappers (#8847)
* refactor python wrappers

* fix FilterHierarchyMatcher converted already registered warning
2025-10-31 13:41:18 +01:00
Greg Landrum
ebd7dad122 Switch a bunch of C++ tests to use catch2 (#8625) 2025-07-18 11:50:38 +02:00
Hussein Faara
44364fd982 remove no-op macros and dead code (pt 4) (#8037)
* remove no-op macros and dead code (pt 4)

* review comments
2025-01-26 07:49:50 +01:00
Greg Landrum
c90cee9b77 Add Molecular Interaction Fields (#7993)
* Add RealValueVect.

* Add UniformRealValueGrid3D

* Add Molecular Interaction Fields (MIFs)

* line endings

* cherry-pick f1bc94a4c8

* format

* Adapt tests for python3.

* Adapt RealValueVector pickling for python3.

* Speed-up of MIF calculations.

* Bugfix in MIFDescriptors.cpp.

* all tests pass

* clean up some memory leaks

* update copyrights

* rename

* rename the library

* complete the rename

* lost file

* another forgotten file

* cleanup

* clang-tidy

* clang-tidy

* windows DLL builds work

* python wrapper and tests cleanup

* convert to catch2 testing

* switch RealValueVect to use std::vector

* remove obsolete friend

* - Replace explicit loops with stdlib implicit equivalents
- Replace explicit types with auto where possible
- Avoid unnecessary copy operations where possible
- Replace raw pointers with exception-safe unique_ptr
- Replace C-style #define with constexpr
- Replace C-style casts with C++ casts
- Replace C-style arrays with std::vector
- Avoid code duplication with templated operators
- Replace VdWaals class taking multiple atom type definitions and force-field name as string parameter with force-field-specific classes deriving from an abstract VdWaals class
- Replace x,y,z doubles with Point3D class where possible
- Removed unused (and untested) DistanceToClosestAtom class
- Renamed some variables and functions for better clarity
- Converted tabs to spaces
- Made the mol parameter in cube read/write functions optional for convenience
- Made the Python wrappers more pythonic (e.g., avoid C++-style passing objects as parameters which are modified in place)
- Implemented alternative Python class constructors using boost::python::make_constructor rather than with external non-class functions
- The Python wrappers taking a sequence of Point3D now take a sequence of sequences, such that the output of Conformer.GetPositions() can be passed
- Made the Python wrapper sequence parsing more robust
- Removed duplicated code from Python wrappers

* - avoid an unnecessary copy

* progress

* works

* more cleanup

* all tests pass

* changes in response to review

---------

Co-authored-by: dfhahn <dfhahn@users.noreply.github.com>
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-12-14 17:08:43 +01:00
Ricardo Rodriguez
db0df54347 Fix some minor issues reported by ubsan and the compiler (#8015)
* initialize chiralityPossible

* fix build warning

* Fix integer overflow

* fix downcasting MarvinMolBase to MarvinMol

* Fix buildwarning

* increase PairList container to 64 bit

* fix testDict

* Update Code/RDGeneral/testDict.cpp

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

* Update Code/GraphMol/CIPLabeler/rules/Pairlist.h

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

* Update Code/GraphMol/CIPLabeler/rules/Pairlist.h

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

* Fix catch_tests.cpp

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-11-20 09:09:22 +01:00
David Cosgrove
07bcf45126 Use smart pointer for bits. (#7884)
Add move c'tor/operator=.

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-10-05 07:30:55 +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
d3061b03ef Fixes github #7533 (#7539)
* Fixes #7533

Fixes problem with SparseIntVect and SparseBitVect where the intention is to
be able to store all possible values of the index type: in these cases
you could not store (or access) the final element.

* increase the verbosity of the DataStructs tests
so that we can see what's going on
2024-06-20 09:27:27 +02:00
Anna Brünisholz
a06c921a79 Cleanup of Code/DataStructs (#7365)
* for-loop modernization

* declaration and initialization together

* switch statements, min&max from std

* switch statement

* use of std min&max

* fixed unsigned int to int comparison

* implement switch statement

* fix unsigned int to int comparison

* revert previous mistake

* Update Code/DataStructs/DiscreteValueVect.cpp

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

* implemented suggestions

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-04-21 06:41:52 +02:00
Anna Brünisholz
82dbf4c66b switch to range-based for loops (#7278)
* switch to range-based for loops

* Update Code/GraphMol/testChirality.cpp

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

* fix a leak in the new DCLV code (#7279)

* fixes #7295 (#7303)

* tag 2024.03 release (#7308)

* tag release

* attempt to solve constant MD5 problems

* switch to getting the ComicNeue font from github instead of as a zip

* open new release cycle (#7314)

* restrict the application of 1,3- 1,5- conjugated cation normalization (#7287)

* propagate yaehmop build status (#7316)

* Fixes #7299 (#7304)

* clean up of python and c++ for-loops

* clang formatted testChirality

* fix test file

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Co-authored-by: Riccardo Vianello <riccardo.vianello@gmail.com>
2024-04-08 14:16:27 +02:00
Anna Brünisholz
1734ef8071 Cleaner forloops, deleting of empty header file (#7320)
* clean up of python and c++ for-loops

* readd assignement

* Remove misleading walrus operators (#7323)

* Run installed tests if applicable (#7325)

* simpler check for equality

* Revert "simpler check for equality"

py assert does not work pointwise on lists on all platforms,
we need to iterate through all elements

This reverts commit 03cc0ad1a6.

* fix ambiguity on truth value of np arrays

* compare list elementwise

---------

Co-authored-by: Matt Swain <m.swain@me.com>
2024-04-07 05:41:29 +02:00
Paolo Tosco
c43f6d363a - enable building stubs in both in-tree and out-of-tree builds (#6980)
with cmake --build . --target stubs (also make stubs on *NIX)
- improved the patching script to do a better assignment of
  overloaded constructor parameters, whcih results in a number
  of docstring fixes

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-12-13 04:49:34 +01:00
Paolo Tosco
2b4202867e Add Python modules to generate stubs and automatically patch docstrings (#6919)
* - added gen_rdkit_stubs Python module to generate rdkit-stubs
- added patch_rdkit_docstrings Python module to patch existing C++ sources to fix docstrings missing self parameter and add named parameters taken from C++ signatures where possible
- added rdkit-stubs/CMakeLists.txt to build rdkit-stubs as part of the RDKit build
- added an option to CMakeLists.txt to enable building rdkit-stubs as part of the RDKit build (defaults to OFF)

* fixed CMakeLists.txt, rdkit-stubs/CMakeLists.txt and a doctest

* - added missing cmp_func parameter
- fixed case with overloads with optional parameters
- do not trim params if expected_param_count == -1
- add dummy parameter names if we could not find any
- keep into account member functions when making up parameter names
- address __init__ and make_constructor __init__ functions
- fix incorrectly assigned staticmethods

* patched sources

* address residual few remarks

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-11-30 04:54:18 +01:00
Greg Landrum
22ac03329d switch from boost::any to std::any (#6662)
* switch from boost::any to std::any

* changes in response to review

* handle the slightly different error messages from different compilers

* document changed error message

* try to use g++10 for the linux builds

* remove those CXX defns

* another spelling

* stupid typo

* bump all linux builds to g++-10

* some day this will be done

* small steps

* increase mac ci builds runtime
2023-08-25 17:55:33 +02:00
Ric
880a8e5725 Reformat Python code for 2023.03 release (#6294)
* run yapf

* run isort

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-04-28 06:53:56 +02:00
Greg Landrum
79e8295586 Support Python 3.11 (#5994)
* remove some more deprecated numpy stuff

* workaround for changes to random.shuffle in python 3.11

* fix pickling of rdkit mols in python 3.11

* add py311 build to CI

* update py311 CI

* remove qt for py311 for the moment

* only use the new code with pyversion >=3.11

* use the new logic for all pickle_suites

* need to work with older py too
2023-01-24 18:16:26 +01:00
Greg Landrum
e322928028 swap boost::tuple to std::tuple (#5851) 2022-12-16 16:01:19 +01:00
Brian Kelley
da55ed2943 Fixes #5677 (#5714)
* Fixes #5677

* Response to review

* Fix bad push

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2022-11-04 06:19:08 +01:00
Greg Landrum
1f4584b2ca run clang_format (#5676) 2022-11-01 04:14:26 +01:00
Greg Landrum
0147cd8201 Fixes #5210 (#5408)
* revert duplicate chunk in release notes

* replace deprecated ifdefs
This one gets rid of USE_BUILTIN_POPCNT and RDK_THREADSAFE_SS
use RDK_OPTIMIZE_POPCNT or RDK_BUILD_THREADSAFE_SSS instead

* get rid of BUILD_COORDGEN_SUPPORT from ROMol.i

* fix a stupid typo

* update release notes
2022-07-11 11:20:03 +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
939d8c3c02 Move to C++17 (#5155)
* bump to c++17

* remove binary_function

* update our boost::hash implementation too
2022-04-12 13:53:07 +02:00
Eisuke Kawashima
ba6d8e0d3b clang-tidy: readability-simplify-boolean-expr (#4639) 2022-03-17 13:50:50 +01:00
Eisuke Kawashima
27f711a658 Run clang-tidy (readability-braces-around-statements) (#4977)
https://github.com/rdkit/rdkit/pull/3024#discussion_r526549843
2022-03-10 08:00:10 +01:00
Eisuke Kawashima
11532089de Run clang-format against cpp (#4358) 2021-10-20 04:25:27 +02:00
Greg Landrum
bca3e747f2 Improvements to some constructors in python wrappers (#4581)
* documentation typos

* better handling of overloaded constructors in python wrappers
2021-10-06 04:17:53 +02: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
Brian Kelley
549f318f29 Add ToList method to Sparse/ExplicitBitVector (#4467)
* Add ToList method to Sparse/ExplicitBitVector

* Pushed a change to an older version of the file, reverting

* Fix function name

* Merge with the change that actually compiles

* Add SparseIntVect ToList, Update tests

* Fix test

* Update Code/DataStructs/Wrap/SparseIntVect.cpp

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

* Update Code/DataStructs/Wrap/wrap_SparseBV.cpp

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

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-09-09 06:26:15 +02:00
jasondbiggs
5065340b20 a few doxygen comment fixes (#4368)
* collection of doxygen fixes

* more files with fixed doxygen comments

* more doxygen fixes

* more doxygen fixes

* last set of doxygen comment fixes

Co-authored-by: Jason Biggs <jasonb@wolfram.com>
2021-08-09 04:58:01 +02:00
Eisuke Kawashima
b9a5be5a2d miscellaneous updates (#4284)
* Remove accidentally tracked files and unset x flag

* Ignore ComicNeue

* Unify test tag to `reader`

* Trivial destructors

* Bump CMAKE_CXX_STANDARD to 14 (#4165)
2021-07-13 06:57:29 +02:00
Eisuke Kawashima
013ba4f21d Run clang-tidy (modernize-use-override) (#4251) 2021-07-01 05:18:56 +02:00
Eisuke Kawashima
48f4f3ee82 Run clang-tidy (modernize-pass-by-value) (#4224) 2021-06-14 06:57:08 +02:00
Eisuke Kawashima
78aac3c1bc Run clang-format against header files (#4143) 2021-06-08 07:57:51 +02:00
Greg Landrum
38548bebfa Fixes #3944 (#4049) 2021-04-19 14:39:25 +02:00
Greg Landrum
8bd68be098 Add bit information to generalized FP generator (#3858)
* Split bonds to per-atom parts for interaction

* It would help to commit test fixes also

* Update Code/GraphMol/MolDraw2D/MolDraw2D.h

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

* Update Code/GraphMol/MolDraw2D/MolDraw2DSVG.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2DSVG.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2DSVG.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2D.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2D.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2D.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2D.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2D.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2D.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2D.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2D.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2D.cpp

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

* Update Code/GraphMol/MolDraw2D/MolDraw2D.cpp

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

* Refactored code

* bit info works for Morgan fps and is tested
get the stubs in place everywhere else

* add RDKitFP bit info too

* expand atom pair info

* add info for TTs

* atom pairs

* enable shared_ptrs for SparseBitVects in python

* fix core leaks in the bulk operations

* simplify the AdditionalOutput API

* first pass at a useable AtomOutput from Python
needs "a bit" more testing.

* documentation

* response to review

Co-authored-by: SPKorhonen <samuli-petrus.korhonen@iki.fi>
2021-03-06 04:25:51 +01: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
d8afc9f027 A couple changes to speedup bulk similarity calculations from Python (#3574)
* add a wrapper for bulk nearest-neighbor calculations
A bit of minor refactoring

* header fix

* add tests for new neighbor functionality

* add the rest of the similarity metrics
2020-12-10 05:33:32 +01:00
Greg Landrum
c0a62388a2 switch to using target_compile_definitions instead of add_definitions (#3350)
* switch to using target_compile_definitions instead of add_definitions

* missed one
2020-08-21 04:49:07 +02:00
Greg Landrum
edd922c99c Cleanup warnings from clang-10 (#3238)
* stop returning local memory in exceptions

* remove a couple unnecessary copies in loops

* fix a bug in the way the default MMFF aromatic parameters are constructed

* remove a bunch of loop-variable warnings

* remove a bunch of clang warnings

* disable clang warnings in python wrappers

* remove some warnings when building the python wrappers
2020-06-19 17:16:22 -04: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
e86e2c1d5d Modernization: use nullptr (#3143) 2020-05-25 09:40:01 +02:00
Eisuke Kawashima
535d8a2f35 Avoid C preprocessor macros (#3138) 2020-05-05 08:08:20 +02:00
Eisuke Kawashima
75f03412ef Modernize deprecated header inclusion (#3137) 2020-05-04 10:40:57 +02:00
Ric
39bcee635e Mem checkup (#3083)
* clean up in testDatastructs

* avoid jump on unassigned mem in rxns

* set valgrind error exit code

* update suppressions

* clean up RDValue in testDict

* don't leak mol if parsing Maestro file fails

* don't leak mol if parsing PDB block fails

* cleanup leftover rxns in testReaction

* cleanup mol if CX extensions cannot be parsed

* cleanup leftover mols in smiTest1

* cleanup leftover mols in moldraw2DTest1

* cleanup leftover mols in testSubstructMatch

* make testEnumeration go easier on valgrind

* reduce R counts
2020-04-17 17:48:58 +02:00
Ric
66a38d3751 Address build warnings (#3082)
* do not throw in desctructor

* remove unused var; reserve

* provide operator= for DiscreteValueVect

* provide operator= for SparseIntVect

* remove unknown 'omp' #pragmas; refactor loop

* remove unused var

* remove unused variables

* give EmbeddedAtom a default constructor & early exit on self assignç

* handle unused vars/args

* catch exception by ref

* address unused args

* fix signed type comparison; refactor extra checks

* remove unused variable

* suppress switch fallthtough warning

* handle signed type comparison

* handle signed type comparison

* potentially uninitialized vars

* fix abs() of bool

* unused vars in catch statements

* remove unused variables

* python::list returns will be copied

* give ValidationMethod constructor & virtual destructor

* remove extra semicolon
2020-04-17 14:40:15 +02:00
Greg Landrum
45bf58754a Cleanup some cmake dependencies (#3077)
* change minimal cmake version to a consistent 3.5

* progress towards a cleanup

* get the basic python deps working

* two more libs

* another round of changes
all tests pass at this point

* next round of changes
all tests pass at this point

* close to done
all tests pass

* very close

* almost done

* shift the RDBoost dependencies around a bit

* remove an extraneous python linkage
this is trying to get the mac builds working again

* Only link to python if it was built shared (#3091)

* change in response to review

Co-Authored-By: Ric <ricrogz@users.noreply.github.com>

* move that suppression of the maybe-uninitialized warning to BoostStartInclude.h

Co-authored-by: Brian Kelley <fustigator@gmail.com>
Co-authored-by: Ric <ricrogz@users.noreply.github.com>
2020-04-17 14:34:23 +02:00
Greg Landrum
5712176605 Implement the two deprecations that were planned for the 2020.09 release cycle (#3047)
* Deprecation: planned removal of .message() and .getMessage() methods

* Deprecation: planned removal of old MolHash code

* document deprecations

* output the diffs when the psql tests fail

* remove .message() from SWIG wrappers

note that the KeyError doesn't work properly. We should clean up the the exceptions here anyway

* typo
2020-04-01 14:30:07 +02:00
Ric
9188c70a64 Override what() in exceptions (Addresses #2920) (#2928)
* add overrides for what()

* translation fot KeyErrorException; update tests

* Switch all exceptions to `const char *` as a return type from message() (#4)

* switch return type of message() from std::string to const char *

* adjust one test to the new return type from message()
remove unnecessary verbosity from some tests

* fix cartridge build: update call to message().c_str()

* rebase agains master; fix another issue in cartridge build

* add deprecation note for message() and getMessage()

* amend Release notes

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2020-02-05 08:20:17 +01:00