Commit Graph

62 Commits

Author SHA1 Message Date
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
Paolo Tosco
d9d1fe2838 Fixes #6773 (#6785)
* fixes #6773

* removed unused captures

* update release notes and cmakelists for beta (#6788)

* Removed some code duplication between Depictor.cpp and common.h (#6368)

* - implemented alignOnly mode into RDDepict::generateDepictionMatching2DStructure()
- the allowRGroups option now also supports potentially missing R groups (i.e., R groups that do not match any atom, such as those connected to generic aromatic atoms)
- added the adjustMolBlockWedging parameter (which defaults to true)   to invert/clear molblock wedging information as appropriate
- added unit tests for the above new features
- added RDDepict::generateDepictionMatching2DStructure() overloads taking RDDepict::ConstrainedDepictionParams parameter for convenience
- removed some redundant RDDepict:: namespace specifications

* Fix chirality handling when the chiral atom is the first one in a SMARTS (#6730)

* Set _SmilesStart when parsing SMARTS.

* SmartsWriter should also invert first atoms, like SMILES.

* Update test cases now these SMILES match themselves as SMARTS.

* rerun bison

* cleanup a possible repeated define

* When an atom moves from the first to second position winding should flip in SMARTS (i.e. same as SMILES).

---------

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

* Some small cleanups from the UGM Hackathon (#6744)

* move definition of a couple global constants from a .h to a .cpp

* careful removal of some redundant atom PRECONDITIONS

* careful remove of some redundant ROMol PRECONDITIONS
a bit of additional cleanup

* optimization masquerading as modernization

* some more tidying

* a bit more atom cleanup

* change in response to review

* Fixes #6756 (#6780)

* update release notes and cmakelists for beta (#6788)

* move problematic functions to Chirality namespace

* - implemented alignOnly mode into RDDepict::generateDepictionMatching2DStructure()
- the allowRGroups option now also supports potentially missing R groups (i.e., R groups that do not match any atom, such as those connected to generic aromatic atoms)
- added the adjustMolBlockWedging parameter (which defaults to true)   to invert/clear molblock wedging information as appropriate
- added unit tests for the above new features
- added RDDepict::generateDepictionMatching2DStructure() overloads taking RDDepict::ConstrainedDepictionParams parameter for convenience
- removed some redundant RDDepict:: namespace specifications

* move problematic functions to Chirality namespace

* added missing dependency

* let's check what is going wrong

* CoordGen tests should not run if CoordGen support is not available in the build

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
Co-authored-by: John Mayfield <john@nextmovesoftware.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>

* Revert "Removed some code duplication between Depictor.cpp and common.h (#6368)" (#6797)

This reverts commit ddfe708b37.

* All 3d des (#6741)

* add function to calc all 3D descriptors

* fix indentation in CalcMolDescriptors3D

* add error handling for 2D molecules

* suggested changes

* change exception type

* add unit tests

* add random seed to conf gen in unit tests

* fix function call in unit tests

* fix expected PMI1 value in tests

---------

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

* _moltoimg() should honor drawOptions.prepareMolsBeforeDrawing (#6792)

* _moltoimg() should honor drawOptions.prepareMolsBeforeDrawing and not run PrepareMolForDrawing if requested not to

* _moltoimg() and _moltoSVG() should honor drawOptions.prepareMolsForDrawing and not call PrepareMolForDrawing if asked not to

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>

* Bad lasso (#6751)

* Better separation of lines.

* Only put atoms in colour list once.

* Test.

* Hash codes.

* Response to review.

* First attempt at fixing stray line.

* Tidier.

* Squared distances.

* tag release (#6801)

* fixes #6773

* removed unused captures

* - fixed comment
- fixed bug found in checkIfRingsAreClosed()

* - removed redundant NRing queries
- added ring size queries to avoid incorrect matches with MCS results originated with MatchFusedRingsStrict

* fixed doctests

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Co-authored-by: John Mayfield <john@nextmovesoftware.com>
Co-authored-by: Rachael Pirie <56546141+RPirie96@users.noreply.github.com>
Co-authored-by: David Cosgrove <davidacosgroveaz@gmail.com>
2023-10-19 05:01:27 +02:00
Ric
8176f5c962 Fail CI builds on compiler warnings + some fixes (#6675)
* enable Werror on Mac and Linux

* do not fail on boost multiprecision pessimizing move

* fix eigen array_bounds warning

* Fix unused arg in Rascal MCS

* fix range-loop-construct warning in Rascal MCES

* fix sign mismatched comparison

* drop unused lambda capture

* allow FMCS timeout test more time under Debug (not a warning!)

* fix fwd declaration of struct RascalClusterOptions

* fix deallocator mismatch

* fix two minor leaks

* fix a real leak

* more minor leaks

* fix another real leak, plus some potential ones

* fix std::move preventing copy ellision

* allow longer run time for debug builds

* make maxBondMatchPairs and getLargestFragSize unsigned int

* make snake case camel case

* update to current master, fix new warnings

* update again and more fixes

* add #include <optional>

* fix char array deallocation

* update and fixes in Marvin writer

* unsigned int

* more copy ellision fixes

* more copy ellision fixes, and typos

* and some more
2023-09-02 04:38:45 +02:00
Paolo Tosco
350370abe3 - Changed all unsigned to unsigned int for clarity (#6646)
- Switched from dynamic to static allocation for an instance of `MCSParameters`
- Switched to using `auto` where possible
- Added a few `CHECK_INVARIANT` where appropriate before dereferencing pointers
- Moved some inline comments to the previous line to improve readability
- Added a early check for `CompleteRingsOnly` in `checkBondRingMatch()` to improve computational efficiency
- Removed `RingMatchTableSet` entirely as 1) it is unnecessary since its functionality is already provided by `RingInfo` 2) it abused the `userData` pointer. This allows cleaning up and simplifying the code, particularly the Python wrappers which had a significant amount of added complexity to support it
- Removed all the code that was deprecated several releases ago
- Reimplemented ringFusionCheck() from scratch to address several bug reports; also switched from std::set to boost::dynamic_bitset for better efficiency
- Replaced boost::tie with boost::make_iterator_range
- Modernized `for` loops where possible
- Removed entirely the QueryRings structure as its functionality is already available in RingInfo
- Removed entirely the _DFS() function since the same algorithm can be implemented in a simpler and more efficient way using RingInfo (from 2m28.441s to 2m9.859s for the same task)
- Replaced std::vector<bool> with boost::dynamic_bitset
- Replaced C-style casts with C++ casts
- Replaced some size_t with unsigned int
- Refactored checkIfRingsAreClosed() such that checkNoLoneRingAtoms() is not needed anymore
- Added a test for slow runtimes with CompleteRingsOnly
- Setting Timeout to 0 means no timeout, as it should be
- Removed unused `steps` variable from `MaximumCommonSubgraph::growSeeds`
- Storing both Atom and Bond pointers and their indices on Seed and MCS data structures is time-consuming and a potential source of incons
istencies; storing pointers is sufficient
- Promoted `MaximumCommonSubgraph::match` from `private` to `public`
- `NewBonds` was declared `mutable`, but `Seed::fillNewBonds()` was incorrectly declared as `non-const`, which caused the need for an ugly
(and unnecessary) `const_cast`.
I have now removed the `const_cast` and correctly declared functions that alter `NewBonds` as `const`, since `NewBonds` is explicitly `mut
able`
- Removed some useless random scoping that was peppering the MCS code
- Removed a significant amount of duplicate code from the Python wrappers by inheriting from a base `PyMCSWrapper` class
- Fixed #6082
- Fixed #5510
- Fixed #5457
- Fixed #5440
- Fixed #5411
- Fixed #3965
- Fixed #6578

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-08-25 06:09:19 +02:00
Ric
7ecfc20b0c fix potential bug (#5205) 2022-04-17 05:22:50 +02:00
Eisuke Kawashima
ba6d8e0d3b clang-tidy: readability-simplify-boolean-expr (#4639) 2022-03-17 13:50:50 +01:00
Eisuke Kawashima
11532089de Run clang-format against cpp (#4358) 2021-10-20 04:25:27 +02:00
Ric
6fbcaef135 Fixes #4498 (#4499)
* add fix

* add test

* change fix

* Update Code/GraphMol/FMCS/MaximumCommonSubgraph.cpp

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

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-09-13 17:17:29 +02:00
Greg Landrum
69b143edd0 Swap from RDUNUSED_PARAM to unnamed parameters (#4433)
* cleanup

* more cleanup
2021-08-24 17:19:46 -04:00
Paolo Tosco
2433982386 avoid that lone atoms which are part of a ring in one of the molecules become part of the MCS (#4065)
Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-04-27 11:10:29 +02:00
Greg Landrum
41a4625eca Fixes #3938 (#3954)
suppress boost deprecated warnings

broaded use of BoostStartInclude
2021-03-22 13:14:10 -04:00
Paolo Tosco
a93dc21599 Fixes #3886 (#3900)
* fixes #3886

* remove the Python check in response to Greg's request

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-03-11 05:15:18 +01:00
Paolo Tosco
7fc8feee9e Addresses #3693 (#3695)
* addresses #3693

* change in response to review

* applied clang -format

* changes in response to discussion
2021-01-07 18:25:08 +01:00
Paolo Tosco
3c3efd80d0 fixes #3458 (#3472) 2020-10-08 06:22:22 +02: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
Greg Landrum
9892f4740b remove usage of auto_ptr (#3188) 2020-05-26 08:45:26 -04:00
Paolo Tosco
3d831d8809 Fixes #3095 (single-atom MCSs are not captured) (#3109)
* - fixes #3095 (single-atom MCSs are not captured)

* - fixed doctest

* - changes in response to review

* - fixed typos

* - fix Windows compiler error
2020-05-05 13:58:33 +02:00
Eisuke Kawashima
75f03412ef Modernize deprecated header inclusion (#3137) 2020-05-04 10:40:57 +02:00
Paolo Tosco
a6cafc4635 Added support for Python FMCS functors (#3023)
* Added support for Python FMCS functors

* - changes in response to review
2020-03-23 11:20:57 +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
Eisuke Kawashima
5cd27a242f Fix typo (#2862)
* Fix typo

* Reflect the comments

* Fix more typos
2019-12-31 06:43:27 +01:00
Paolo Tosco
c6503e9f8e Use query molecule rather than ambiguous SMARTS for MCS matching (#2759)
* - MatchFusedRings does not imply CompleteRingsOnly anymore

* - use a more specific query molecule rather than an ambiguous SMARTS string in MCSResult

* - changes in response to review
2019-12-16 04:57:54 +01:00
Paolo Tosco
864fdab349 - MatchFusedRings does not imply CompleteRingsOnly anymore (#2748) 2019-11-29 13:35:39 +01:00
Paolo Tosco
ab021aa960 Add consideration of ring fusion to the MCS algorithm (#2731)
* - Adds consideration of ring fusion to the MCS algorithm

* - removed some commented out lines
2019-10-25 04:35:10 +02:00
Paolo Tosco
589c98c3af Fixes #2714 (The MCS smartsString may still be ambiguous) (#2715)
* - fixes #2714 (The MCS smartsString may still be ambiguous)

* documentation update
2019-10-17 11:19:37 +02:00
Paolo Tosco
22b0540cdd Fixes #2662 and #2663 (#2665)
* - fixes #2663 (The C++ MCS code generates ambiguous SMARTS strings)

* - fixes #2662 (C++ MCS code returns a null MCS between
methylcyclopentane and methylcyclohexane)
2019-10-01 16:25:46 +02:00
Lester Hedges
1daed4d163 Remove arbitrary lower bound on the number of steps. [closes #2581] (#2583) 2019-08-06 16:31:17 +02:00
Greg Landrum
4db0bade46 Fixes $945
Fixes #2420

Tests updated to reflect changes.

The existing CompleteRingsOnly code wasn't actually guaranteeing CompleteRingsOnly at all, it was just causing #2420.
The updated code actually makes sure that bonds that were ring bonds in one of the queries are ring bonds in the final MCS.
This is done via a relatively simple DFS.
2019-04-24 14:30:38 +02:00
Greg Landrum
50d2328251 Fixes #2034 (#2035)
* Fixes #2034

* update release notes to describe that
2018-09-17 06:50:54 +02:00
Greg Landrum
f94e277856 another pass of clang modernize 2017-10-12 06:35:51 +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
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
Paolo Tosco
dd871c3536 Modifications to enable building with MinGW compilers (#960)
* - added -DBOOST_SYSTEM_NO_DEPRECATED to definitions for MINGW builds
- modified a few #ifdef's to discriminate better between MINGW and MSVC
- added a ios::binary to Code/GraphMol/FileParsers/testMolSupplier.cpp
  (I already had to add some of those in the past to avoid the CR+LF issues on Windows)
- modified Code/GraphMol/FMCS/MaximumCommonSubgraph.cpp and
  Code/GraphMol/FMCS/FMCS.h because checking the function pointer does not
  work with DLLs as the function pointer changes upon different calls
- builds under MinGW with -DRDK_USE_BOOST_SERIALIZATION=OFF and
  RDK_BUILD_THREADSAFE_SSS=OFF

* - added the possibility to define MSVC_RUNTIME_DLL to point to the
  absolute path of an appropriate MSVC runtime DLL to enable
  multi-threaded builds with MinGW
- modified C++ and Python tests of the multi-threaded conformation
  embedder as under 32-bit MinGW lower numeric precision introduces minimal
  coordinate differences with result in ~1-kcal energy difference.
  Therefore the energy criterion has been made more lenient, and a
  coordinate MSD criterion has been introduce to compare substantial
  identity of conformations

* - reverted Code/GraphMol/DistGeomHelpers/Wrap/testDistGeom.py and Code/GraphMol/DistGeomHelpers/testDgeomHelpers.cpp
  to the upstream/master version
2016-06-25 09:12:40 +02:00
Doliath Gavid
1729c90748 Fix crazy out of range dereference 2016-04-12 19:42:24 -04:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Brian Kelley
633ac22b51 Silences unused params and casting issues 2015-10-18 21:16:17 -04:00
Brian Kelley
5abca9473c Moves -1 magic number into const unsigned int (warning suppression) 2015-10-18 16:09:05 -04:00
Brian Kelley
a146c3826a Remove unused variables/functions and register keyword 2015-10-18 10:01:00 -04:00
Alexander Savelyev
11105660c8 fmcs: fixes #631 with chiralirty 2015-10-07 14:40:31 +03:00
Alexander Savelyev
e331a57791 fmcs: implement adding an initial seed structure 2015-08-25 14:21:04 +03:00
Alexander Savelyev
654ae2b682 issue #481 was fixed 2015-04-17 18:27:26 +03:00
Alexander Savelyev
ec6ecdd3bc request notes were fixed. chirality algorithm was slighlty improved 2015-04-06 19:53:19 +03:00
Alexander Savelyev
dc208b0829 chirality flag was implemented for fmcs() function 2015-03-30 18:17:57 +03:00
Alexander Savelyev
51e886d89d fmcs cosmetic changes. code clean-up. unit tests 2014-08-14 22:11:44 +04:00
Greg Landrum
7a2687e0c1 reformat code 2014-07-22 03:34:19 +02:00
Greg Landrum
c9b91cd744 code formatting changes (indentation and untabify) 2014-07-01 05:48:51 +02:00
Greg Landrum
150c963630 fix a build problem 2014-06-28 15:01:13 +02:00
Alexander Savelyev
21b2ea4a68 improve prune() heuristic. the search speed was increased. mem leaks fixed 2014-06-26 19:05:55 +04:00