Commit Graph

150 Commits

Author SHA1 Message Date
David Cosgrove
88ff241407 Support double* in Transform3D::TransformPoint (#9176)
* Accept non-kekulisable molecules.

* Add Transform3D::TransformPoint(double *)

* Reformat.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2026-03-19 09:34:22 +01:00
David Cosgrove
73682f3700 Add explicit operator= and copy c'tors. (#9133)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2026-03-01 07:18:20 +01:00
David Cosgrove
e598f608fe Transform::SetRotationFromQuaternion takes const. (#9063) 2026-01-24 07:18:41 +01:00
David Cosgrove
21b3c4e6f1 Shape overlay initial start aligned to principal axes (#8999)
* Add MolTransforms library.

* Transform to inertial frame of reference before overlay.

* Vital fix of typo in comment.

* Tidy up debugging cruft.

* Comment in CMakeLists.txt.

* Fix python wrappers.

* Extra tidy.

* Response to review.

* Tidy includes.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-12-20 08:35:28 +01:00
Greg Landrum
e625bdb95c make Point2D and Point3D constexpr (#8882)
* constexpr Point, Point2D, and Point3D

* constexpr Vector

* cleanup

* rollback overzealous constexpring

* dial back the constexpr to get windows builds working

the math stuff isn't constexpr with MSVC++

* add [[nodiscard]]
2025-10-23 10:57:33 +02:00
Ricardo Rodriguez
7b7a8a4e17 Refactor iostreams includes (#8846)
* refactor iostreams includes

* restore ostream to MonomerInfo.cpp
2025-10-08 16:08:01 +02:00
Ricardo Rodriguez
a4b63d7df5 Minor refactor of the python wrappers (#8847)
* refactor python wrappers

* fix FilterHierarchyMatcher converted already registered warning
2025-10-05 09:42:31 +02: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
39d4662ae7 Throw when attempting to normalize a Zero RDGeom::Point (#8008)
* throw if close to zero

* fix moldraw2DTestCatch

* Fix testRGroupDecomp

* fix one test in distGeomHelpersCatch

* fix tests in distGeomHelpersCatch

* retry finding a dir vector when adding Hs

* push UFF fixes to calculateCosY

* fix the setTerminalAtomCoords deg 4 patch

* add a test

* reduce zero tolerance
2024-11-19 04:33:22 +01: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
Anna Brünisholz
d96bf3712c Geometry (#7433)
* fix unsigned int to int comparison

* revert previous mistake

* declaration & init together, sinthetaSq in [0, 1]

* range based for-loops

* switch-statements

* declaration position changed

* declaration position changed

* declaration position changed

* declaration position changed, switch statements

* declaration position changed

* declaration position changed

* change in if statement

* now with const iterators

* declaration at initialization

* convert to static casts

* use switch when possible, no breaks

* Update Code/Geometry/point.h

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

* change from review

remove redundant PRECONDITION

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-07-08 15:29:14 +02: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
2957ab4576 switch to catch2 v3 (#6898)
* switch to catch2 v3
Fixes #6894

* fix a couple of problems noticed in the CI builds

* more warning cleanup

* changes in response to review
2023-11-15 06:45:42 +01: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
Ric
58d135a874 Reformat C/C++ code ahead of 2023.03 release (#6295)
* format files

* format template files too
2023-04-28 04:42:35 +02:00
Dan N
b98f79fc99 Remove and from C++ headers (#6003)
`and` is a C++ keyword, but it isn't supported by default on
some compilers (msvc). I'd like to disable it on _all_ platforms
in Schrodinger builds so that people don't accidentally post
code that fails on a single platform.

However, that means external headers need to use `&&` and `||`
instead of `and` and `or`, even in platform-specific code.
2023-01-25 13:44:24 +01: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
Eisuke Kawashima
77db9ede80 fix doxygen comments (#5254) 2022-07-11 13:55:35 +02:00
Greg Landrum
594c58f86c make the catch tests build faster (#5284)
* reorg the catch tests
the goal here is to make the builds faster

* make that easier
2022-05-17 04:39:33 +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
Steve Roughley
ede860ae31 Transform3d documentation (#4997)
* Fixed missing documentation

* Update Code/Geometry/Transform3D.h

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

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2022-02-10 08:03:10 +01:00
Eisuke Kawashima
11532089de Run clang-format against cpp (#4358) 2021-10-20 04:25:27 +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
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
Greg Landrum
97eb59003d double bonds now have EITHER stereo if no coordinates are present (#4239)
speedup for Point3D::angleTo
patch from Roger Sayle
2021-06-15 04:25:24 +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
acb73f876b remove an MSVC++ warning caused by #3849 (#3927) 2021-03-15 15:58:04 +01:00
Greg Landrum
0e89b2dbea cleanup a bunch of compiler warnings (#3849)
* cleanup a bunch of g++ warnings

* make it work with clang

* remove some additional warnings based on CI builds

* fix that version number

* stop being verbose when building
2021-02-26 05:10:02 +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
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
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
David Cosgrove
774892a9ab 2ddrawenhancements2931 (#2979)
* First pass of fixing layout of OH/NH type drawing.

* Fixed scale for N/S NH type groups.

* Fixed bond end points with new display of heteroatoms.

* Fixed case where it drew aromatic dashed bonds in wrong ring for morphine.

* Minor edit.

* Fixed non-drawing of chiral bonds.

* Removed use of boost for_each.

* Modern atom traversal.

* Put in fixed scale for drawings.
Made drawMolecule() take note of prepareMolsBeforeDrawing.
Updated more iterators to modern idiom.

* Added fixed bond length for drawing.

* Fixed drawing of CH4, NH3 etc.

* Stash of working but ugly, prior to re-work.

* Better, simpler splitting of atom symbols.

* Took clang-tidy's advice about use of override.

* Tidied up drawing of text strings.

* Tweaked what is classed as vertical bond in drawing.

* fixedBondLength now down-scales if it would overflow the draw window.

* Some tidying.

* Tests for new parameters in JSON.
Fixed some existing tests where, for example, scale on picture is now different.

* Added option to rotate 2D draw coords before drawing.

* First pass at highlighting atoms in multiple colours.  Circles only at the moment.

* Line width scales if big enough.

* Tweaked SVG text drawing.

* Added highlighting with more than 1 colour on an atom.  C++ only.

* Fixed some issues with widths of highlights in a frustrating game of whackamole.
Updated some tests accordingly.

* Added Python wrapper for new drawing code.

* Removed debugging writes.

* Added C++ test for multi-coloured highlights.

* Added python test for multi-coloured highlights.

* Attempt to show radicals.

* Tidied up radicals in drawing, including a bullet instead of full stop in SVG.

* Fixed catch_tests.cpp for MolDraw2D.

* Fixed crash in Python wrappers on OSX.

* Fixed test5_2.svg bug (trailing </tspan>).
Made wavy line width scale as other lines do.

* Improved placing of charges.

* We're already in the future.

* Fixed a number of bugs that made drawMolecules not set the scales properly.

* Fixed Cairo wavy line width.

* Fixed non-closure of collision boxes.

* Added maximum font size for text, with tests.

* Addressed all Greg's first PR change requests.

* Fixed crash in extractAtomsymbols.

* stop using coordgen and adjust tests to reflect that
there's a bit of reformatting in here too

* Fixed layout of reactions.

* Fiddled with moldraw2DTest1 tests again.

* Fiddled with catch test.

* Fixed istope postion in W atom labels.

* Minor tweak to cairo,

* update expected results

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2020-03-10 17:33:59 +01: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
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
ec366c1ab7 Dev/pvs studio cleanups2 (#2877)
* a round of cleanups courtesy of PVS studio

* add a test to make sure that a warning is a false alarm

* bug fix

* Fix a UFF bug

* more PVS studio cleanups

* next round of PVS studio cleanups

* completely remove the chances for that bug

* changes in response to review

* add an additional test
+ a bit of reformatting that snuck in
2020-01-22 15:10:58 +01:00
Greg Landrum
a75018fe38 Cleanups and additional tests to improve test coverage (#2852)
* disable builds of the StructChecker code by default

* operator"" _smarts() doesn't need to catch sanitization errors

* remove unused function

* turn back on some tests that shouldn't have been disabled

* Remove unused code from SMARTS parser and simplify a bit

SmilesParseOps::AddFragToMol is now used only from the SMARTS parser, so we can simplify the API

* Removes obsolete special case code for SMARTS

This was relevant when organic atoms in SMARTS queries were stored as two-part queries.

* improve SMARTS testing

make sure we can generate SMARTS from all the examples and then parse that again.

* Fixes #2814

* Fixes #2815

* some additional smarts tests to improve coverage

* test copy ctor and getPos

* remove obsolete test_list files

* include tests for the morgan invariant generators

* more cleanups and coverage improvements

* remove files that were mistakenly added
2020-01-09 16:07:55 -05: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
7599b5fb14 Tidy Up (#2834)
* Replace obsolete `throw()` with `noexcept`

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0003r4.html

* Avoid deprecated tempfile.mktemp

https://docs.python.org/3/library/tempfile.html#deprecated-functions-and-variables

* Fix "warning: control reaches end of non-void function"
2019-12-18 16:44:55 +01:00
Eisuke Kawashima
dc7cc84a0c Fix typo [ci skip] 2019-10-17 17:45:50 +09:00