52 Commits

Author SHA1 Message Date
Yakov Pechersky
7dec637a3f MolAlign: brace-init BestAlignmentParams in wrapper (#9042)
BestAlignmentParams is an aggregate; paren-init (T(...)) is rejected by Apple Clang (Xcode) and only works on some compilers.
Use brace-init (T{...}) for portable initialization.
2026-01-08 07:31:22 +01:00
Greg Landrum
436ecbebac Allow Hs to be ignored in the RMSD alignment functions (#8976)
* first pass at allowing Hs to be ignored in getBestRMS()

* add support in getAllConformersBestRMS()

* do getBestAlignmentTransform()

* cleanup, error checking, and a fix

* this is more painful than it seems like it should be

* add python wrappers and tests

* response to review
2025-12-04 18:37:59 +01:00
Ricardo Rodriguez
0164ac7fae Fix some more mem errors in 2024.09.1 (#7899)
* fixes

* do not leak MolCatalogParams

* do not leak points on align failures

* give python ownership of pointers returned in getFingerprintsHelper

* clean up ScaffoldNetwork ptr if createNetworkHelper fails

* manage FF ptrs during construction

* wire in ownsBondInvGenerator in getMorganGenerator

* manage weights in rdMolAlign CalcRMS

* fix ownership of matches list/tuple in generateRmsdTransMatchPyTuple

* manage stream in createForwardSupplier during construction

* drop redundant Point3D allocations in GetUSRDistributionsFromPoints

* fix signed comparison mismatch
2024-10-10 16:08:50 +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
16d2842f08 Add multithreading to getBestRMS and new getAllConformerBestRMS (#6896)
* first pass at multithreaded getBestRMS

* add that to the python wrappers

* add getAllConformerBestRMS()

* more testing

* doc strings

* add forgotten test file

* change in response to review
fix the dumb logic error in thread count determination

* update the tests for the new catch
2023-11-22 17:35:06 +01:00
Paolo Tosco
97bb4a7f37 Improvements to 2D depiction and alignment/RMSD calculation (#5598)
* update AvalonTools to version 2.0.1

* Improvements to 2D depiction and alignment/RMSD calculation
- Refactored the straightenDepiction code which is now much simpler and more readable and supports a minimizeRotation parameter
- added C++, Python and JS tests for the new minimizeRotation parameter
- refactored tests to use CalcRMS rather than an internal implementation to compute RMS deviations
- Removed duplicated code in CalcRMS() and getBestRMS() and made their APIs consistent with respect to supported parameters
  IMPORTANT NOTE: for backwards compatibility I set the CalcRMS() default for the  new symmetrizeConjugatedTerminalGroups
  to false as this parameter was not originally supported. @greg: I would be very much in favor of setting this to true instead
  if you agree, even though it might change results for existing scripts, as I think it is a much more sensible default.
- Improved documentation to clarify the difference between CalcRMS() and getBestRMS()
- Added unit tests for CalcRMS() as there was none previously
- Added tests for the additional CalcRMS() and getBestRMS() parameters
- Added a new getBestAlignmentTransform() function
- The CFFI function set_2d_coords_aligned() now returns the matching atoms similarly to the C++, Python and JS counterparts
  IMPORTANT NOTE: this required an API change for the additional char ** parameter used to return the match.
  Existing code using set_2d_coords_aligned() will fail to compile and will require a last NULL parameter to be added to compile again
- Removed duplicated code between CFFI set_2d_coords_aligned() and JS generate_aligned_coords()
- Added has_2d_coords() to the CFFI library
- generate_aligned_coords() now supports JSON parameters and the previous versions are deprecated
- set_2d_coords_aligned() and generate_aligned_coords() both support an alignOnly parameter (which defaults to false).
  If set to true, rather than re-generating a fresh 2D layout around templateMol, the existing coordinates (if any) are simply aligned
  to the provided templateMol. If the molecule has no coordinates, a set of 2D coordinates is generated independently of templateMol
  and then aligned to the provided templateMol
- avoid that when acceptFailure is false set_2d_coords_aligned() and generate_aligned_coords() overwrite existing coordinates

* - explicitly link testDepictor to MolAlign library

* - add MolAlign dependency to testDepictor (rather than to the catch test as in the previous commit)
- add a couple of tweaks

* suppress compiler warnings (1st pass)

* warnings: 2nd pass

* warnings: 3rd pass

* - alignOnly mode should also support allowRGroups

* - fixed C++ build
- added tests for allowRGroups+alignOnly combination

* changes in response to review

* added an entry to backward incompatible changes regarding set_2d_coords_aligned()

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-10-02 06:24:01 +02:00
Greg Landrum
f7a98cf718 Support conjugated terminal groups in GetBestRMS() (#5322)
* add symmetrizeConjugatedTerminalGroups to GetBestRMS()

* make the tests clearer
2022-06-21 15:08:47 +02:00
David Cosgrove
4692e29c78 Fix typos in docString. (#5377)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2022-06-20 06:08:50 +02:00
Eisuke Kawashima
11532089de Run clang-format against cpp (#4358) 2021-10-20 04:25:27 +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
Paolo Tosco
19c9a3905c Enhanced generateDepictionMatching2DStructure functionality (#3811)
* - generateDepictionMatching2DStructure can be used with referencePattern smaller than reference
  to only use part of a scaffold
- adds generateDepictionMatching2DStructure overload to pass a matchVect instead of doing a substructure match
- adds allowRGroups parameter to enable using a scaffold bearing R groups as reference

* changes in response to review

* added comments

* fixes failing doctest

* - reverted change committed accidentally
- fixed get_sss_json for the case where R groups are not included in the match
- added tests for the return value of generate_aligned_coords

* Documented the value returned by GenerateDepictionMatching2DStructure (Python)

* changes in response to review

* - changes in response to review
- fixed sortMatchesByDegreeOfCoreSubstitution that was not working
- added Python wrappers for sortMatchesByDegreeOfCoreSubstitution and getMostSubstitutedCoreMatch
- added C++ and Pyhon unit tests for the above

* added missing variable initialization

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2021-02-24 05:37:31 +01:00
Maria Kadukova
679550b2d0 Formatting fix of CalcRMS (#3203)
* GetBestRMS with turned off alignment for molecular docking

* sudden \)

* CalCRMS added

* nullptrs, ) in java wrappers, doAlignment removed

* range loop, distance computation, nullptrs

* whitespace to reinitialize pull request checks

* removed double wt to trigger the build check

* whitespaces micro-fix

* styled with clang-format
2020-06-19 05:19:45 +02:00
Maria Kadukova
b81fa926bc GetBestRMS with turned off alignment for molecular docking purposes (#3176)
* GetBestRMS with turned off alignment for molecular docking

* sudden \)

* CalCRMS added

* nullptrs, ) in java wrappers, doAlignment removed

* range loop, distance computation, nullptrs

* whitespace to reinitialize pull request checks

* removed double wt to trigger the build check
2020-06-02 05:53:54 +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
Matt Swain
e57b7a9bc8 Use numpy not numeric for boost 1.65+ - fixes #1581 (#1664)
boost python numeric no longer exists in boost 1.65, so check boost version and conditionally use boost python numpy.
2017-11-20 05:44:19 +01:00
Greg Landrum
1efa8e696e another clang-format run 2017-10-12 06:42:15 +02: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
Patrick Avery
f30dea195f Added C++ version of getBestRMS() (#1568)
getBestRMS() was previously a Python-only function. This
adds a C++ version of the function, and replaces the old version.
2017-09-16 04:44:06 +02:00
Greg Landrum
f6ced134f0 a number of other small changes from manually reviewing the PR 2017-04-22 17:24:57 +02: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
581d852c99 clean up a couple of missed files 2015-12-03 06:01:09 +01:00
Greg Landrum
79e1f8b1fa compiles without numpy warnings, all tests pass on ubuntu 15.04 with numpy 1.10 2015-11-28 06:49:34 +01:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Brian Kelley
daa7e62258 Fixes signed conversion issues (use rdcast) 2015-10-18 15:16:38 -04:00
Brian Kelley
403a3d6b7c Suppresses Boost warnings 2015-10-18 13:41:03 -04:00
Greg Landrum
87bfa334d6 add a central method for calculating the number of threads that supports negative numbers 2015-09-04 13:48:52 +02:00
Greg Landrum
37523dea33 update docs 2015-09-04 11:25:26 +02:00
Greg Landrum
3cd4001615 Support releasing the GIL during some of the longer operations we just sped up. 2015-03-15 05:20:30 +01:00
Greg Landrum
0d25bc1437 fix python wrapper 2015-03-13 03:12:13 +01:00
Greg Landrum
b5d13ad653 support multi-threaded O3A in python; needs testing 2015-03-12 07:32:11 +01:00
Greg Landrum
101513fe34 doc update 2015-03-12 03:30:34 +01:00
Greg Landrum
95038ef5ed fix the handling of the RMSlist optional argument 2014-08-06 03:01:28 +02:00
Sereina
ffd5df50e7 Changes for the calculation of the RMS between conformers 2014-08-05 14:56:33 +02:00
Sereina
cfd58fbace Changes for the calculation of the RMS between conformers 2014-08-05 14:53:36 +02:00
Sereina
bb4ea29081 Changes and additions for the calculation of the RMS between conformers 2014-08-05 14:46:14 +02:00
Riccardo Vianello
3358ec5925 initial set of changes introducing python3 support 2014-06-17 18:26:41 +02:00
ptosco
13bb831dd5 - removed a few spurious, though non harmful, "const" keywords from
Code/ForceField/MMFF/Params.h, Code/ForceField/UFF/Params.h,
  Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.cpp
  and Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h (I realized
  their uselessness thanks to a warning issued by Intel C++ compiler)
- refactored O3A code
- added the possibility to set weighted constraints on selected
  atom pairs
- added an option to carry out local-only optimization
2014-04-15 22:13:54 +01:00
Greg Landrum
9f4471f872 more on #204
A few other cleanups
2014-02-06 06:43:28 +01:00
Greg Landrum
c73792bb21 passing all tests 2014-01-24 05:16:56 +01:00
ptosco
18bfae88b7 - Refactored the O3A code to allow for different cost, weight
and scoring functions

- Added cost, weight and scoring functions using atom-based
  Crippen logP contributions

- Added relevant tests for the new functionality

Important points:
-----------------

- The constructors now accept optional pointers to
  MolHistogram objects instead of pointers to arrays of
  double. I think it is better for performance, since
  rebuilding the histogram involves running through two
  nested loops over all atoms, even though the
  3DDistanceMat is provided to the O3A constructor.
  This change breaks binary compatibility with previous
  C++ programs linking to RDKit MolAlign library; I do not
  think this is big issue, and while I was there I made
  other changes which cause binary incompatibility.
  If needed, we may preserve binary compatibility
  reverting the MolHistogram change and the other ones.

- From Python, nothing changed in the interface to previous
  MMFFO3A functionality. It MIGHT be more appropriate to
  change the "GetO3A()" function into "GetMMFFO3A()", but
  I have not done that to avoid breaking existing scripts;
  the choice is yours

- As of now, the code contains a number of conditional
  compilation directives checking for the
  USE_O3A_CONSTRUCTOR macro; if USE_O3A_CONSTRUCTOR is
  defined, then the code is built with an alternative O3A
  constructor which allows choosing whether one wishes
  to use MMFF or Crippen descriptors. Otherwise, no
  alternative constructor is built, but rather two
  functions which return a pointer to an O3A object.
  I prefer by far the first solution (namely, with
  USE_O3A_CONSTRUCTOR defined), but again, the choice is
  yours. The code is tested and works in both cases.

- Custom cost, weight and scoring functions can easily
  be defined in external programs without need to rebuild
  the RDKit, allowing flexibility. The new custom
  functionality can be accessed by calling the "bigger"
  O3A constructor.
2014-01-22 19:30:29 +01:00
Greg Landrum
b948da2c1f Fixes #158 2013-11-19 06:14:50 +01:00
Greg Landrum
31e310cd3a merge an O3A patch from Paolo T. 2013-10-12 06:35:21 +02:00
Greg Landrum
b6029fc3ee some small cleanups 2013-10-06 06:56:16 +02:00
ptosco
d557fc29cc - implemented Open3DALIGN-like alignment functionality (from both
C++ and Python)
- added relevant C++/Python tests
2013-09-29 17:03:14 +02:00
Greg Landrum
f3fbef45c5 update copyright statements 2010-09-26 17:04:37 +00:00
Greg Landrum
8b321cc5b4 fix 2318431: deprecation warnings from numpy 2008-11-21 05:55:08 +00:00
Greg Landrum
79b8a77f93 get rid of those irritating POSIX_C_SOURCE warnings 2008-07-08 06:59:59 +00:00
Greg Landrum
c9eb4e91e1 merge revs 736:741 from branch http://rdkit.svn.sourceforge.net/svnroot/rdkit/branches/NumPyPort_27June2008
This removes the numeric python dependency and switches to relying on numpy.
current status of tests from branch: pass on lin32 and 64 and win32.
2008-07-05 07:42:38 +00:00
Greg Landrum
fe6b29fec1 dos2unix 2008-02-22 17:57:57 +00:00