* Remove Dict::getData() for a strict abstraction boundary
Replace direct access to Dict's internal std::vector<Pair> with
encapsulated methods: size(), empty(), const iteration via
begin()/end(), appendPair(), markNonPOD(), and getRawVal().
This enables future changes to Dict's internal representation
without breaking callers.
Ref: rdkit/rdkit#9112
* Harden Dict::appendPair to take a populated Pair by move
appendPair(Pair&&) now auto-detects non-POD status via
RDValue::needsCleanup(), eliminating markNonPOD() and the
risk of dangling references or uninitialized entries.
needsCleanup() is placed next to destroy() on RDValue to
keep the POD/non-POD distinction in one place.
* Remove vestigial dictHasNonPOD param from streamReadProp
Both callers ignored the output. Non-POD detection is now handled
by Dict::appendPair via RDValue::needsCleanup().
* unbork java build
* Address PR review: bulk append, rename getRawVal, add custom data test
- Add Dict::append(vector<Pair>&&) for bulk insertion with reserve
- Use bulk append in streamReadProps to restore pre-allocation
- Rename getRawVal -> getRDValue per reviewer preference
- Add test verifying custom AnyTag data is destroyed through Dict lifecycle
* heed self-review
* don't manually implement vec.insert
* Add test: ExplicitBitVect round-trip through Dict serialization
Exercises the full streamWriteProps/streamReadProps path with an
ExplicitBitVect in an RDProps Dict, confirming the custom handler
is invoked and no memory is leaked (verified under valgrind).
* in anyTag test, assert destructors ran a specific number of times.
---------
Co-authored-by: bddap (Coding Agent) <andrew+bot@dirksen.com>
* Defer numpy initialization to first use in rdchem, rdmolops, cDataStructs
`from rdkit import Chem` unconditionally bootstrapped numpy (~120ms) via
import_array()/boost::python::numpy::initialize() in module init functions,
even when no numpy-dependent APIs were called. This is costly in cold-start
environments like AWS Lambda.
Move numpy initialization behind lazy guards (static bool + first-call init)
in rdchem.so, rdmolops.so, and cDataStructs.so. Numpy now loads only when
an API that actually needs it is invoked (GetDistanceMatrix, GetPositions,
SetPositions, GetAdjacencyMatrix, ConvertToNumpyArray, etc.).
Also change Conformer::SetPos to accept python::object instead of
np::ndarray to prevent Boost.Python from requiring numpy type conversion
before the lazy guard runs.
Adds test_lazy_numpy.py with subprocess-based tests verifying:
- `from rdkit import Chem` does not load numpy
- SmilesToMol/MolToSmiles work without numpy
- numpy loads on demand when array APIs are called
* skip inchi tests if not available
* switch to threadsafe once_flag, like elsewhere
* finish ifdef style
* switch to magic static style
* Revert "switch to magic static style"
This reverts commit 7300188db7.
* 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>
* 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
* 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>
* 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>
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>
* - 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>
* 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
* 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
* 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
* 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
* 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>
* 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>
* Remove accidentally tracked files and unset x flag
* Ignore ComicNeue
* Unify test tag to `reader`
* Trivial destructors
* Bump CMAKE_CXX_STANDARD to 14 (#4165)
* 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>
* 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>
* 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
* 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
* 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>
* 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
* 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