Commit Graph

78 Commits

Author SHA1 Message Date
Greg Landrum
b2f1eae1c3 Do not add a __computedProps property to molecules when initializing them (#8931)
The rest of the code already adds the property if/when it is needed, so
there's no need to add it to every molecule.
2025-11-18 19:09:36 -05:00
Ricardo Rodriguez
7b7a8a4e17 Refactor iostreams includes (#8846)
* refactor iostreams includes

* restore ostream to MonomerInfo.cpp
2025-10-08 16:08:01 +02:00
Greg Landrum
86141183c1 Moving towards getting all tests to pass when using the new stereo code (#8409)
* Fixes #8379

* check in some working tests

* test passes

* test passes

* test passes

* test passes

* test passes

* ensure that the invariants flush the streams on failure

* tests pass

* test passes

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* Fixes #8391

* tests pass

* fix a test with legacy
not clear why this was not causing problems before

* make a test work

* Fixes #8396

* gcc builds work

* fingerprint tests pass

* mention backwards incompatible change

* fix a problem with FindMolChiralCenters

* more testing details

* enable the test status output

* Fixes #8432

fix a bug in double-bond stereo handling for template matching

* all depictor tests pass

* use the new-stereo chiral ranks in the depiction code

* always assign new-stereo chiral ranks

* make _ChiralAtomRank a computed property
This is analogous to _CIPRank

* tweak to the way the atom ordering is computed for 2D coordinate generation

* update two expected results

* backup

* response to review

* tests pass

* tests pass

---------

Co-authored-by: = <=>
2025-04-15 14:00:32 +02:00
Greg Landrum
fa048eacc5 Replace GetImplicitValence() and GetExplicitValence() with GetValence() (#7926) 2025-01-28 21:09:03 +01:00
Ricardo Rodriguez
ea7f51f3b1 Fix some mem errors in 2024.09.1 (#7867) 2024-10-03 16:05:43 +02:00
Greg Landrum
724716b2c6 Switch to isoelectronic valence model (#7491)
* change valence model to use isolobal analogy

Remove support for five-coordinate C+ and, by analogy, five-coordinate N+2

Removes support for charge states that take atoms past the end of the periodic table
  i.e. [Lv-4] is no longer supported

* update the tests for that

* remove valence state of 6 for Al

* fix representation of phosphate in the mol2 parser

this is a correction of what was done during #5973

* cleanup the exceptions for P, S, As, and Se

* drop valence states:

Si 6, P 7, As 7

* a couple of additional changes from #7397

* update java tests

* fix an inconsistency: Rb now supports valence -1

* documentation

* - replace operator[] with at() for bounds check
- extract some code into a function to avoid duplication
- use TAB as separator throughout in the periodic table data for consistency

* removing the .at() usage

We know that these vectors aren't empty, so there's no need for the bounds check.

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-06-25 15:38:49 +02:00
MarioAndWario
9ca7a2e00d Sanitize number of radical electrons in case of invalid value assigned by CXSMILES (#6842)
* Sanitize number of radical electrons in case of invalid value assigned by CXSMILES (#6370)

* static_cast<int> for integer comparison

* Add unittests for 0 explicit hydrogens

* Fix unittests of radical count in fileParsersTest1

* Fix testMolWriter

* Fix testMrvToMol

* Address Greg's comments
2024-01-23 06:21:26 +01:00
cdvonbargen
45c88e4e1e Add Atom::hasValenceViolation (Take 2) (#7030)
* Refactor Atom.cpp to create a hasValenceViolation method that uses existing valence checking code

* work without exceptions

* get rid of the snake_case

* put free functions in an unnamed namespace

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-01-18 05:06:57 +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
Paolo Tosco
a9da05570e Fixes a couple of query-related bugs (#3398)
* - fixes a bug with the MDL MolParser (M  ALS queries clobber previously existing queries)
- fixes a regression introduced by #3389 (duplicate formal charge queries may arise)

* changes in response to review

* forgot to commit
2020-09-17 08:16:43 +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
Ric
6224a42516 Build warnings revisited (#2318)
* unused vars in bison parser cleanup

* initialization order in TopologicalTorsionGenerator

* unused params in SLN bison

* sln flex unused params

* throwing destructor in TDTWriter

* signed comparison in substructmethods

* unused input param in smiles/smarts bison

* unused ms param in sln bison

* signed comparison in FingerprintGenerator

* store return of fscanf in StructCheckerOptions

* unreferenced var in catch

* uninitialized value in FileParserUtils

* avoid override overload warning in MolDraw2DSVG

* non-final overrides in Validate.h

* unused static var in Avalon

* unused vars in catch blocks

* make AvalonTools avalonSimilarityBits & avalonSSSBits const int

* assert fscanf result in StructCheckerOptions
2019-03-08 16:42:54 +01:00
Greg Landrum
8c9795f535 Fix #2225 (#2228)
* Fixes #2225

* A bit of extra cleanup

* forgotten file

* Make this thread safe and add support for v3K mol blocks

* add the file

* update expected results
2019-01-17 11:44:23 -05:00
Ric
a6b26253ff Fix (most of) mem problems (#2123)
* do not use new on loggers

* del pointers in testDistGeom

* Update Dict hasNonPOD status on bulk update

* delete new Dicts in memtest1.cpp

* fixes in MolSuppliers and testFMCS

* PeriodicTable singleton as unique_ptr

* fix EEM_arrays leak

* fix leaks in testPBF

* fix ParamCollection leak in test UFF

* fix leaks in MMFF

* clear prop dict before read in in pickler

* fix leaks in testFreeSASA

* fix leaks in test3D

* modernize Dict.h & SmilesParse.cpp

* fix leaks in testQuery

* fix leaks in testCrystalFF

* fix leaks in cxsmilesTest

* fix leaks in Catalog & mol cat test

* fix leaks in ShapeUtils & tests

* fix leaks in testSubgraphs1

* fix leaks testFingerprintGenerators

* fix leaks in Catalog/FilterCatalog

* fix leaks in graphmolqueryTest

* these changes reduce bison parse leaks

* fixed leaks in testChirality.cpp

* fix leaks + 2 tests in testMolWriter

* fix 4m leaks in substructLibraryTest

* small improvements to molTautomerTest; still leaks

* fix leaks in testRGroupDecomp

* fix leaks in test; parser still leaks

* fix leaks in itertest

* fix 4m leaks in testDepictor

* fixes in smatest; still leaking due to parser

* fixes in testSLNParse; still leaking due to parser

* flex/bison: always add atoms with ownership; smarts error cleanup

* fix leaks in testReaction

* fix leaks in testSubstructMatch

* fix leaks in resMolSupplierTest

* fix leaks in testChemTransforms + bug in ChemTransforms

* fix leaks in testPickler

* fix leaks in testMolTransform

* fix leaks in testFragCatalog

* fix leak in testSLNParse. Still leaks due to Smiles

* fixed most leaks in testMolSupplier

* pre bison fix

* fix some atom & bond parse problems; others still fail

* bison smiles & smarts, atoms & bonds more or less fixed

* fix leaks in molopstest.cpp

* fix leaks in testFingerprints, MACCS.cpp & AtomPairs.cpp

* fix leaks in moldraw2Dtest1

* fix leaks in testDescriptors

* fix leaks in testInchi

* fix leaks in testUFFForceFieldHelpers

* fix leaks in hanoiTest & new_canon.h

* fix leaks in testMMFFForceField

* fix leaks in graphmolTest1

* fix leaks in testMMFFForceFieldHelpers

* fix leaks in testDistGeomHelpers

* fix leaks in testMolAlign

* initialize occupancy & temp facto with default values

* fix leak in TautomerTransform

* updated suppressions

* fix testStructChecker

* fix logging & py tests

* fix TautomerTransform class/struct issue

* remove misplaced delete in testSLNParse

* deinit in testAvalonLib1

* fix Avalon-triggered(?) bug in StructChecker/Pattern.cpp

* fix random testMolWriter/Supplier fails

- diversify output file names to avoid clashing.
- unify Writers close/destruct behavior.
- flushing/closing in tests.

* use reset in FFs Params.cpp

* comments on testMMFFForceField

* unrequired 'if's added to mol suppliers

* correct cast in FilterCatalog.h

* use unique_ptr in MACCS Patterns

* remove unrequred if in new_canon

* update & move suppressions
2018-10-29 14:33:26 +00:00
Paolo Tosco
f7c888844d moved test.h from RDBoost to RDGeneral for consistency with export.h (#2074) 2018-10-11 17:35:23 -04:00
Paolo Tosco
c08ea49bda - enable building DLLs on Windows (#1861)
* - enable building DLLs on Windows

* - export.h and test.h are now auto-generated by CMake
2018-05-16 08:42:41 +02:00
Brian Kelley
cdb516aa88 RWMol::destroy now calls ROMol::iniMol (#1844) 2018-05-05 04:40:45 +02:00
Greg Landrum
0c530637f2 Stop dereferencing end() iterators (#1748)
* cleanup the build requirements for test-valgrind

* cleanup a recently added test

* the new iterators would dereference end() iterators. Fix that.
2018-02-22 03:43:28 +01:00
Greg Landrum
108d84ab1e Switch from boost::thread to std::thread (#1745)
* boost::thread mostly gone... still need to get rid of once
everything compiles

* replace boost::call_once

* remove link-time dependency on boost::thread

* first pass at using async

* switch to using async everywhere
2018-02-22 03:43:07 +01:00
Greg Landrum
8c43f2d6f2 Use uint32 atom and bond indices (#1742)
* Switch to uint32 for atom index to support more atoms

* Test adding and removing big number of atoms (70k)

* Change order of properites in Atom class
2018-02-10 09:43:49 +01:00
Greg Landrum
39ee6966fb new examples for looping over atom neighbors and bonds (#1709) 2018-01-09 12:22:38 -05:00
Greg Landrum
ba12d98ad0 Removes ATOM/BOND_SPTR in boost::graph in favor of raw pointers (#1713)
* Removes ATOM/BOND_SPTR in boost::graph in favor of raw pointers

* Actually delete atoms and bonds...

* RWMol::clear now calls destroy to handle atom/bond deletion

* Changes broken Atom lookup for windows/gcc

* Adds tests for running with valgrind

* Adds test designed for valgrind and molecule deletions

* Removes RNG, actually tests bond deletions

* update swig wrappers

* deal with most recent changes on the main branch
2018-01-07 14:19:47 -05:00
Brian Kelley
0a871bd72e Dev/modern cxx ranges (#1701)
Enable range-based for loops for molecules
2018-01-05 06:09:51 +00:00
Greg Landrum
6c99bce18e Fix/github1453 (#1463)
* Reset the numBonds count.

NumBonds needs to be reset in clear(). This has been around for a while (Nov 16?) and took Noel a couple of days to track down.

* add a test
2017-07-02 11:29:39 +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
1b946794f0 replaceBond and generic atoms and bonds in adjustQueryProperties() (#1141)
* first pass at RWMol::replaceBond()

* get ready for the changes

* rename some options
add bond options (not doing anything with them yet)
update tests to reflect new options

* backup

* re-enable the rest of the tests
2016-11-04 12:41:06 +01:00
Greg Landrum
99efdd2bd3 Fixes #1041 (#1070) 2016-09-22 14:38:13 +02:00
Brian Kelley
ddf7c73b50 Adds Atom atom map and rlabel apis (#1004)
* Adds Atom atom map and rlabel apis

* Moves RLabels to their own namespace, adds other properties.

* Removes namespaces, liberally adds Atom to function names.

* move detail::computedPropName to RDKit::detail::computedPropName
2016-08-11 04:46:41 +02:00
Greg Landrum
31b3bc7da4 Fixes #381 (#924)
* Fixes #381

* switch to using boost::call_once

* initialize the once_flag properly
2016-05-30 19:58:39 -04:00
Paolo Tosco
2b3a818f84 - removed the dependency on Trajectory from ROMol and ForceField 2016-05-11 19:37:09 +01:00
Paolo Tosco
8b5176f8c9 - initial work to put the Trajectory code into a separate object 2016-05-09 19:05:15 +01:00
Paolo Tosco
a2eca41365 - the Trajectory object now holds a vector of Snapshots rather than
a vector of shared_ptr to Snapshots
- The PySnapshot class was removed
- the Trajectory::readAmber and Trajectory::readGromos member functions
  were converted into non-member functions
- tests were modified accordingly
2016-05-04 18:42:23 +01:00
Paolo Tosco
d16b312ee6 - Completely revised coordinate ownership
- Implemented Python wrappers
- prepared relevant test cases
2016-04-24 23:30:25 +01:00
Paolo Tosco
6f8071f7a5 - Progress on Python wrappers
- Some adjustments to the C++ API
2016-04-19 20:53:39 +01:00
Paolo Tosco
249ae83694 - Implemented Trajectory::readGromos() and added relevant tests 2016-04-16 22:27:37 +01:00
Paolo Tosco
c05cf6da55 - removed debugging info 2016-04-16 20:43:29 +01:00
Paolo Tosco
b35538599f - Added AMBER trajectory reader and relevant tests 2016-04-16 20:28:45 +01:00
Paolo Tosco
9d5e56fcd2 - added a test for testAddConformersFromTrajectory()
- added some documentation
2016-04-14 23:45:24 +01:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Brian Kelley
210f2951e0 Silences warnings in tests 2015-10-18 21:20:11 -04:00
Brian Kelley
54311dff9c Suppresses warnings in tests 2015-10-18 16:09:58 -04:00
Greg Landrum
1a6fafdec3 Fixes #610 2015-09-09 18:39:56 +02:00
Greg Landrum
07c9c10e26 Fixes #608 2015-09-08 09:52:06 +02:00
Brian Kelley
48a7549773 Travis Tests could not find the mol file 2015-04-06 10:07:11 -04:00
Brian Kelley
85e2e94d20 Fix MolFile Atom Line List Writer
Only the first element in the atom one was being
written correctly, the remainder were not being
padded correctly and could not be round tripped.
2015-04-05 20:47:02 -04:00
Greg Landrum
220e2bbdcf add few more atom.getProp tests 2015-02-28 06:38:21 +01:00
Brian Kelley
95a92282d1 Dictionary access is saniztized and optimized.
o rdkit gains a RDKit::common_properties namespace that contains common string value properties

 o Dict.h and below gain getPropIfPresent that attempts to retrieve a property and returns
  true/false on success or failure.  This is used to optimize access.

 o rdkit learns how to pass property keys by reference, not value.

A new namespace has been added to RDKit, common_properties
that contains the std::string values for commonly used
properties.  This helps to avoid typos in string values
but also avoids a creation of std::strings from character
values.  All accessors (has/get/clear and getPropIfPresent) now pass
the key by reference.

Additionally, getPropIfPresent removes the double lookup
of hasProp/getProp which can be a significant speedup
in the smiles and smarts parsers (10-20%)
2015-01-15 12:23:29 -05:00
Greg Landrum
5b7b3b3d3d fix problem with Atom->needsUpdatePropertyCache() and noImplicit 2014-12-29 08:00:40 +00:00
Nadine Schneider
0bbf3ec79b Add function to test if UpdatePropertyCache is necessary 2014-12-19 13:59:42 +01:00