22 Commits

Author SHA1 Message Date
Chris Von Bargen
e5989aa446 Fix deprecated literal operators and macro redefinition warnings for modern compilers (#9055)
* Fix deprecated literal operator syntax for C++14 compliance

Remove whitespace between "" and identifier in user-defined literal
operators to comply with C++14 standard. Fixes warnings with newer
compilers (emscripten 4.0+, clang 15+) that treat this as deprecated.

Changed operator"" _name to operator""_name for:
- SmilesParse.h: _smiles, _smarts
- ReactionParser.h: _rxnsmarts, _rxnsmiles
- FileParsers.h: _ctab, _mol2, _pdb

* Fix BOOST_CONTAINER_NO_LIB macro redefinition warnings

Add #ifndef guards before defining BOOST_CONTAINER_NO_LIB in Writer.cpp
and Parser.cpp to avoid redefinition warnings when the macro is already
defined via compiler flags in emscripten 4.0+ builds.

Warnings fixed:
- Writer.cpp:32: 'BOOST_CONTAINER_NO_LIB' macro redefined
- Parser.cpp:38: 'BOOST_CONTAINER_NO_LIB' macro redefined
2026-01-19 08:14:52 +01:00
Ricardo Rodriguez
9160ef8943 Last leak fixes for 2025! (#9006)
* fix leaked atom on zero chiral permutation

* take bond ownership
2025-12-13 20:22:59 +01:00
Greg Landrum
45681a1c04 Switch from using RapidJSON to Boost::JSON for MolInterchange (#8859)
* First pass at port

Mostly auto-converted using claude sonnet 4

Things are a bit slower in this initial port. Here's some timing data for molecules from SMILES (no coords) and from SDF (with coords)

# MASTER
## smiles
read: 50000 mols.
 9.260000s wall, 8.650000s user + 0.600000s system = 9.250000s CPU (99.9%)
serialize
 3.060000s wall, 2.400000s user + 0.660000s system = 3.060000s CPU (100.0%)
deserialize
 1.350000s wall, 1.250000s user + 0.090000s system = 1.340000s CPU (99.3%)

## SDF
read: 50000 mols.
 9.340000s wall, 8.930000s user + 0.400000s system = 9.330000s CPU (99.9%)
serialize
 6.630000s wall, 5.960000s user + 0.680000s system = 6.640000s CPU (100.2%)
deserialize
 1.450000s wall, 1.450000s user + 0.000000s system = 1.450000s CPU (100.0%)

# Boost::JSON
## smiles
read: 50000 mols.
 9.250000s wall, 8.830000s user + 0.420000s system = 9.250000s CPU (100.0%)
serialize
 4.770000s wall, 4.410000s user + 0.350000s system = 4.760000s CPU (99.8%)
deserialize
 2.320000s wall, 2.100000s user + 0.230000s system = 2.330000s CPU (100.4%)

## SDF
read: 50000 mols.
 9.500000s wall, 9.100000s user + 0.400000s system = 9.500000s CPU (100.0%)
serialize
 8.760000s wall, 8.330000s user + 0.420000s system = 8.750000s CPU (99.9%)
deserialize
 2.540000s wall, 2.330000s user + 0.210000s system = 2.540000s CPU (100.0%)

* some json parser optimization

* around the edges

* optimizations for the writer

* hopefully get things compiling

* convert the MinimalLib stuff to use boost::json

Again, a lot of the lifting here was done using Claude Sonnet 4 in VS Code Copilot

* fix Windows DLL build

* response to review

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>

* better not to blindly accept suggestions

* fix the problems in MinimalLib

---------

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
Co-authored-by: = <=>
2025-11-11 11:54:44 +01:00
Greg Landrum
1215922df1 Fixes #8460 (#8468)
* Fixes #8460

Also updates JSON stereogroup handling to support bonds

* fix cartridge tests
2025-04-28 07:38:50 +02:00
Ricardo Rodriguez
ea7f51f3b1 Fix some mem errors in 2024.09.1 (#7867) 2024-10-03 16:05:43 +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
tadhurst-cdd
d5d4d194ec atropisomer handling added (#6903)
* atropisomer handling added

* fixed non-used variables,  linking directives

* BOOST LIB start/stop fixes, linking fix

* Fixes for RDKIT CI errors

* minimalLib fix

* changed vector<enum> for java builds

* check for extra chars in CIP labeling

* removed wrong deprecated message

* fix ostrstream output error?

* restored _ChiralAtomRank to lowercase first letter

* changes for merged master

* Fixed catch label for new Catch package

* update expected psql results

* get swig wrappers building

* restore MolFileStereochem to FileParsers

* fix java wrapper for reapplyMolBlockWedging

* some suggestions

* move a couple functions out of Bond

* Merge branch 'master' into pr/atropisomers2

* merged master

* Renamed setStereoanyFromSquiggleBond

* atropisomers in cdxml, rationalize atrop wedging, stereoGroups in drawMol

* fix for CI build

* attempt to fix java build in CI

* attempt to fix java build in CI #2

* New routine to remove non-explicit  3D-geneated chirality

* changed to use pair for atrop atoms and related bonds

* Changes as per PR reviews

* PR review respnses

* PR review reponse - more

* Fix merge from master

* fixing java ci after merge

* Updated the help doc for atripisomers

* update the atropisomer docs

* improve the images

* add the source CXSMILES

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-12-22 04:58:18 +01:00
Hussein Faara
c245eec8e6 Segfault in JSONToMols when "commonchem" is an int #6890 (#6940)
the DocToMols procedure assumes that the "commonchem" and "rdkitjson"
fields are nested json docs, but that is not true. This change updates the
procedure to stop relying on that wrong assumption and adds a test for
validation.
2023-11-24 05:29:55 +01:00
Ric
d033aee043 Optionally forward Enhanced Stereo Group ids (#6560)
* add id members to StereoGroup class

* add optional read id argument to StereoGroup constructors

* add functions forward Stereo Group Ids and assign the missing ones

* update ops updating stereogroups to forward read id

* update CX Smiles to parse/write stereogroup ids

* Add test cases for stereo group id forwarding/canonicalization

* update mol block (V3K only) to parse/write stereogroup ids

* update pickling to parse/write stereogroup ids

* update cdxml parser to store stereogroup ids

* update mol interchange to parse/write stereogroup ids

* update draw code with new stere group ids

* update test

* add some tests

* Update Code/GraphMol/Wrap/rdmolfiles.cpp

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

* Update Code/GraphMol/Wrap/rdmolfiles.cpp

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

* Update Code/GraphMol/Canon.cpp

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

* Update Code/GraphMol/SmilesParse/CXSmilesOps.cpp

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

* review

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-07-27 18:53:40 +02:00
David Cosgrove
42782d31cf Change IUPAC metal->non-metal single bonds to dative (#6038)
* Change atom to metal bonds from single to dative if appropriate.

* Pedantic change whilst I was in the area.

* Reinstate all tests, leave in debugging writes to see failing tests.

* Re-did it.  Failing tests now pass.

* Move any positive charge from the non-metal to the metal.
Fix expected test results.

* Write dative bond to JSON.

* Bump currentRDKitJSONVersion to 11, but allow parser to still read 10.

* Only move 1 unit of charge at a time from non-metal to metal.

* Greg's hack to not do it for O+ and N+ etc.
Explicitly exclude H, He, F, Ne from dative bonds.
Fix tests.

* Update expected PostGres json version to 11.

* suggestions for PR

* Correct comment.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-02-06 04:37:32 +01:00
Greg Landrum
e0b7fc298a Support SubstanceGroups and StereoGroups in JSON (#5909)
* write stereogroups

* Parse stereogroups

* add parameters to python wrappers

* more tests

* write substancegroups

* parse SubstanceGroups

* Fix a crashing bug with null molecules

* more testing

* add some docs

* update expected cffi results

* oh, this is delightful syntax

* adapt minimallib and the cartridge tests
some small cleanups

* stupid padding

* update expected

* changes in response to review
2023-01-04 16:29:36 +01:00
Greg Landrum
69b143edd0 Swap from RDUNUSED_PARAM to unnamed parameters (#4433)
* cleanup

* more cleanup
2021-08-24 17:19:46 -04:00
Greg Landrum
ee5176a557 Enable storing queries in JSON (#4003)
* start refactor query pickling

* further query pickling refactoring

* bit of modernization

* partial implementation of query writing

* serialize recursive queries

* new tests

* support QueryAtom and QueryBond with null queries

* more query cleanup

* tests pass

* switch from std::variant to boost::variant

* update clang version for CI

* explicit instantiation of templates

* get dll builds working on windows

* optionally skip h counts on parsing; more query tests

* change in response to review

* changes in response to review
2021-05-04 06:37:24 +02:00
Greg Landrum
f829c877d8 MinimalLib: add CFFI interface (#4018)
* hello world works

* more

* more
minimallib needs to be tested

* parse substructure parameters from JSON

* add substruct search and parameters

* add descriptors

* register more descriptors

* fingerprints, first pass

* stop outputting tiny coord vals

* support generating 2d coords

* coordgen testing

* return nulls

* initial 3d support; add/removeHs; cleanup

* Embedding parameters from JSON

* update

* pattern fp, fps as bytes

* use json to configure MFP

* use json to configure rdkit and pattern fps

* aligned 2d coords

* parsing options

* options for writers

* rename remove_hs

* get this working on windows (kind of)

* silence some msvc warnings

* cmake updates

* update python tests

* add the CFFI code to CI builds

* cleanup line ending mess?

* a couple small fixes

* make this work with URF

* support coordMap in the 3D coordinate generation

* updates in response to review
2021-04-15 21:33:52 +02: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
Greg Landrum
b55514806d bonds with "either' stereo cannot be read from JSON (#3290)
* do not require stereoAtoms for "either" stereochemistry

* add one more test
2020-07-14 10:06:12 -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
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
Ric
91008ff11d Address compile warnings & trivial improvements (#2097)
* Address compile warnings & trivial improvements

* revert unwanted initializers; use RDUNUSED_PARAM for unused params

* revert fix in testRDFcustom; marked with 'TO DO' comment
2018-10-12 06:39:32 -04:00
Greg Landrum
60b052fb73 fixes #2046 (#2047)
also fixes a problem with retrieving version info
2018-09-18 04:48:43 +02:00
Greg Landrum
5cf8a6a9b7 Support for a JSON-based molecule interchange format (#1798)
* expose addRing to python

* backup commit

* basics of atom and bond loading

* basics of atom and bond loading

* do bond stereo too

* Loads of cleanups
Read conformers and molecule properties
Better tests
update one of the test values so that we aren't always testing ccw

* enable auto-download of rapidjson distrib

* reader now mostly done (still missing atomic/bond properties)

* a bit of optimization

* a bit of cleanup

* a bit more optimization

* backup

* test zero-order bonds

* prep work for writer (not done)

* add isotope support

* backup

* getting there with the writing

* progress on writing; still need to do the RDKit part though

* can now roundtrip, including chirality.
double bond stereo needs to wait for backend fixes

* add a timing test for benchmarking

* add a timing test for benchmarking

* add another template

* add parse params; optionally set bond types to aromatic; add python wrapper

* disable benchmark run by default

* write conformers

* refactoring

* docs

* port to commonchem

* switch representation

* start reading and writing properties

* fix a memory problem

* set a common_property for gasteiger charges

* parse partial charges

* add partial charge writing

* reformatting

* add support for disabling parts of the parsing

* remove the "name" property from files

* editing

* more post-review changes

* make the molinterchange build optional

* make them really optional
2018-04-02 05:12:03 +02:00