41 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
Rachel Walker
94c902ba54 Postpone clearing computed properties until after all Hs removed (#7241) 2024-03-16 06:14:24 +01:00
Brian Kelley
499700ff1d optimize batch operations when editing molecules (#7145)
* Add private functions for batch removal of atoms/bonds

* Reset the unique_ptr not the bitvector

* Remove unused variable

* Forgot to reset stero atoms

* Remove unecessary post batch edit check

* Set min_idx to the number of bonds, this makes it a sentinel

* Don't need rdcast

* Responses to review

* Removed unused variable

* Add missing braces

* Consolidate bond removal loops

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2024-03-05 16:03:34 +01: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
Eisuke Kawashima
77db9ede80 fix doxygen comments (#5254) 2022-07-11 13:55:35 +02:00
Greg Landrum
555ab6f1fe Start adding move constructors and move-assignment operators (#4909)
* some initial work...
Still some real questions here about what should be done with dp_mol data members

* add some tests for move semantics of Dict and Props
remove extraneous clear()

* more in-depth testing of the molecule results

* test refactoring

* improve the molecule move test

* fix some leaks found by valgrind
the new tests are now all clean in valgrind

* additional classes
QueryAtom, QueryBond, RingInfo, Conformer

* get swig working again.
Not sure why this is necessary, but SWIG is a mysterious beast

* fixes in response to review

* updates in response to review
2022-02-09 14:20:49 +01:00
Greg Landrum
7e575db3c4 AssignStereochemistry should remove nonchiral atoms from StereoGroups (#4986)
* Nonchiral atoms should be removed from StereoGroups

This fixes a bug where atoms which have no chirality were left in StereoGroups

In order to make this work, ROMol::setStereoGroups() needed to be made public.
That shouldn't be a problem since it doesn't change connectivity.

* fix some broken old tests

* update cartridge tests
2022-02-08 05:17:34 +01:00
Greg Landrum
58e6743df0 Fixes #4468 and #4476 (#4482)
* stop removing substance groups with replaceAtom()
change default for keepSGroups argument to replaceBond()

* enable logging output for the fileparserscatch

* basics of parsing SMARTSQ SubstanceGroups

* Fixes #4476
test coming in the next commit

* handle multi-atom SMARTS as recursive
more testing
Test #4476

* a bit of cleanup

* get the tests working

* additional testing

* Update Code/GraphMol/FileParsers/MolFileParser.cpp

Co-authored-by: Ric <ricrogz@users.noreply.github.com>

Co-authored-by: Ric <ricrogz@users.noreply.github.com>
2021-09-05 05:43:13 +02:00
Ric
6b1a2eead3 Turn MRV_COORDINATE_BOND_TYPE data Substance Groups into coordinate bonds (#4299)
* add test

* add fix

* document wrapper

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-07-07 06:13:17 +02:00
Eisuke Kawashima
78aac3c1bc Run clang-format against header files (#4143) 2021-06-08 07:57:51 +02:00
Greg Landrum
056efc8e55 RWMol cleanup (#4198)
- remove d_partialBonds data member - never used
- remove RWMol::destroy()  - redundant with ROMol::destroy()
2021-06-02 13:09:49 -04:00
Greg Landrum
e69ab627e9 fix a leak in RWMol (#3970) 2021-03-24 20:16:00 +01:00
Greg Landrum
2e3f31990d Allow batch editing of molecules: removal only (#3875)
* backup

* simple first pass, passes all tests

* cleanup a bunch of existing uses

* ensure that we can safely add atoms/bonds while in edit mode

* add context manager on python side

* handle exceptions properly in those

* changes in response to review
2021-03-11 05:10:43 +01:00
Greg Landrum
fa27a5e40a Fixes #2144 (#2147)
* Fixes #2144

* clean up a couple test leaks
clang formatting
2018-11-18 10:41:33 -05:00
Dan N
eaa44b40c2 Enhanced stereo read/write support in SDF files. (#2022)
* add a couple test files

* backup

* first pass at some theory documentatin

* it's a draft

* Update enhanced stereochemistry documentation

Adds initial target use case and caveats about the tentative
nature of the current implementation.

* Support read/write of molfile enhanced stereochemistry

This includes reading and writing of enhanced stereochemistry
from v3000 molfiles (sdf). Enhanced stereochemistry encodes
the relative configuration of stereocenters, allowing
representation of racemic mixtures and compounds with
unknown absolute stereochemistry.

It does not include:
* Python wrapping
* invalidation of the enhanced stereochemistry
* use of enhanced stereochemistry in search
* depiction of enhanced stereochemistry.

* Update to reflect changes from #1971

* change names of enum elements to allow compilation in VS2017

I think it's also clearer to do things this way

* Addressed most review comments.

* Run missed test "testEnhancedStereoChemistry"
* In tests, added size checks to group equality checks
* Updated copyright statements
* Deleted mol created for a test
* Use perfect forwarding in RWMol::setStereoGroups()
* use references for stereo groups that are checked in write and pickle
* Updated stereogroup.h in hopes of fixing compilation on Windows.
* clang-format

* try allowing a switch to boost regex and requiring it for g++-4.8

* do a better job of that

* typo

* Code review comments. Updated Copyright notice.

* When an atom is deleted, delete stereo groups containing it.

Also updates StereoGroup toUse accessors instead of
constant member attributes. This allows move of StereoGroups.

* RDKit style guide

* Add header required on Windows.

* get the SWIG wrappers to build
2018-09-26 15:44:23 +02:00
Greg Landrum
2738c35178 Fixes #1903 (#1971)
* Fixes #1903

* update SWIG bindings too
2018-07-25 09:14:17 +02: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
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
Greg Landrum
1efa8e696e another clang-format run 2017-10-12 06:42:15 +02:00
Brian Kelley
4eca6e7f5c Fixes atom documentation (#1505) 2017-07-22 06:42:03 +02:00
Brian Kelley
b76af93513 Dev/add update props api (#1479)
* Adds RDProps updateProps API point

* AdjustQuery now copies over original atom data to the query ato

* Preserves existing data on the replacing atom

* Exposes preserveProps to Python replaceAtom/Bond
2017-07-10 04:36:12 +02:00
Greg Landrum
570d403e24 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-06-28 09:31:58 -04: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
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
455c188b00 Fixes #940 (#941)
* Fixes #940

* ensure RWMol ctors also initialize properly

* cleanup when replacing non-POD with POD
2016-06-14 07:47:15 +02:00
Brian Kelley
2debdfde0d Adds RDAny (smaller generic holder) Updates all used dictionaries (#896)
* Adds RDAny (smaller generic holder) Updates all used dictionaries

This is an API compliant version of the current rdany system,
but uses a lot less memory in practice.

* Removes code duplication

* Converts CHECK_INVARIANT to TEST_ASSERT

* Fixes DoubleTag issue

* Adds Bool to DoubleMagic implementation

* Removes reference to property pickler
2016-05-29 17:04:21 +01:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Greg Landrum
b78bb40ca5 Fixes #384 2015-03-30 07:20:24 +02:00
Greg Landrum
9dca8636b7 Fixes #175 2013-12-07 08:26:58 +01:00
Greg Landrum
c91b5b5ee1 Fixes #176 2013-12-07 03:18:40 +01:00
Greg Landrum
d768875648 add RWMol.clear() 2013-05-01 07:51:03 +00:00
Greg Landrum
bf2416032e docstring cleanup 2012-01-07 15:10:42 +00:00
Greg Landrum
f3fbef45c5 update copyright statements 2010-09-26 17:04:37 +00:00
Greg Landrum
052ec66542 cleanups:
remove x bit from headers and sources;
remove a couple empty files from Code/GraphMol
2010-09-08 04:25:57 +00:00
Greg Landrum
e05580e495 This is a sizeable one: change the way BGL is used so that atoms and bonds are stored as bundled properties
instead of using the property map interface.
A nice side-effect is that the wart of having to use property maps to loop over bonds or atom neighbors
is now gone.
This potentially breaks lots of client C++ code.
2009-02-11 20:19:25 +00:00
Greg Landrum
045b09d293 tja, it's better if the code compiles before we commit it. 2008-07-14 04:46:45 +00:00
Greg Landrum
855a14a82e (re)organize some of the documentation 2008-07-14 03:53:20 +00:00
Greg Landrum
6aeeca797d fix a small memory leak 2008-01-26 04:34:45 +00:00
Greg Landrum
4e7d182fcc Support editable molecules in Python.
This is Feature Request #1764162
http://sourceforge.net/tracker/index.php?func=detail&aid=1764162&group_id=160139&atid=814653

This implementation has been tested on Windows
2007-07-31 05:30:11 +00:00
Greg Landrum
75a79b6327 initial import 2006-05-06 22:20:08 +00:00