* - setenv() should be defined also for MinGW builds, not just MSVC
- fixed getBestRMS signature (ROMol& should be const)
- expose normalizeDepiction(), straightenDepiction(), getBestRMS(), CalcRMS() and getBestAlignmentTransform() to SWIG wrappers
- expose MolFromSmiles() overload taking SmilesParserParams parameter to SWIG wrappers
- expose DoubleVector class to SWIG wrappers as it is needed by alignment functions
- replace std::string with const std::string& in several SWIG wrapper signatures
- build RDKit2DotNet.dll as a 64-bit library on MinGW 64-bit
- add Java tests for the newly exposed SWIG functions
- fixed inconsistent indentation in Chemv2Tests.java
* changes in response to review
* fix typo
* reverted file committed by mistake
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
* initial support for wiggly and wedged bonds in cxsmiles
add CX_ALL_BUT_COORDS convenience option to CXSMILES writer
* move ClearSingleBondDirFlags to MolOps
* do a better job of handling the wiggly bonds
* mark 3D conformers from CXSMILES
* remove some extraneous printing
* test wD as well
* remove non-applicable test
* basic tests (not passing) for parsing t/c/ctu
* remove test for unimplemented feature
* changes in response to review
* changes in response to review
check for attempt to set the wedging more than once
testing for invalid w blocks
fix a bad comment
* bring over some new functionality
* adjust your expectations
* more tests
* additional cleanup and testing
* implement fix from #5407
* more testing
* a bit of optimization
* add the new func to the python wrappers
* cleanup
* findPossible working in the new code
NOTE: the combination of findPossible and cleanIt does not work and needs to be disallowed
* do some cleanup
* better handling of UNKNOWN (not unspecified) atoms and bonds
* update
* backup... we're close
* catch_chirality tests all pass
* all tests pass
* cleanup
* docs and a bit of optimization
* "optimization" which makes things slower... maybe revert this
* we don't need cleanExistingStereo() anymore... get rid of it
* cleanup
* changes in response to review
* Started on ACS 1996 drawing mode.
Significant change (not by itself, sadly) is that MolDrawOptions::lineWidth has changed from int to double to allow for ACS requirement of 0.6px bond widths.
* Wavy lines and dashed wedges.
* Better dashed wedges.
* Rounder wavy bonds, same as SVG.
* Added FreeSans font for ACS1996 mode.
* Add help functions to write enum classes to ostream.
* Dashed wedge separation now 2.5px between line edges rather than line middles. Therefore wider gap between lines.
* Increase offset for wavy bond. Get classes for atoms and bonds in wavy bond correct.
* For SMILES input, option to force wavy and crossed bonds for unspecified stereochem.
* Tidy debugging.
* Extra space round atom labels.
* Extra space between chars in freetype string.
* Reformats.
* Change double bond offset.
* Improve ring double bonds.
* Simple non-ring double bonds all working.
* Tidy.
* All double bonds seem good.
* Remove redundant function.
Move calcTripleBondLines into DrawMol for consistency with calcDoubleBondLines.
Use doubleBondOffset for wavy lines.
* Correct spacing between FT chars.
* Tidying.
* Use MolBlock wedging if there is any. Needs to be made an option.
* If dashed wedge thick end has bonds of it, stop one dash short.
* Adjust solid wedge ends to line with attached bonds.
* Width of wedge ends now based on double bond separation.
* Change catch_tests.cpp
* Rounder waves in wavy lines.
* Dashed wedges same width even if one dash less..
* Embedded Roboto-Regular font in code.
* Fix docstrings.
* doubleBondTerminal swapped ends.
Deal with O2 - 2 terminal atoms of degree 1.
* Fix terminal double bonds.
* Slightly fatter truncated wedge bonds.
* Fix crash on complicated double bonds.
* Control more assert tests with DO_TEST_ASSERT.
* Fix 2 colour solid wedges.
Fix slanted wedge for morphine (test1_5).
* Change definittion of multipleBondOffset to fraction of mean bond length.
* Don't slant end of solid wedge to atom symbol.
* Fix wiggle separation.
* Fix 2-colour terminal double bonds.
* Fix colours on triple bonds.
* Don't attempt to draw non-existent points in triangle..
* Symmetric bond for P=O and like.
* Fix query bonds.
* Reformatting.
* Tidy up use of font.
* Add FreeSans font and license to $RDBASE/Data/Fonts.
* Draw unspecified stereo as unknown.
* Add check_file_hash.
* Tidying.
* Tidying.
* Start Python wrappers.
* Fix solid wedges for 3-connected atoms.
* Docstrings.
* Tidying.
* Alter width of bond highlights in ACS 1996 mode.
* Expose setACS1996Options and mean BondLength in Python.
* Expose drawMolACS1996Cairo in Python.
Docstrings.
* Extra padding between legend and picture in flexicanvas.
* Python tests.
* Tidy catch tests.
* Tidying.
* Fix catch tests.
* Fix no Freetype tests.
* Draw solid wedge more sensibly..
* Fix bond end at solid wedge.
* Tidy.
* Fix Python Cairo build issues.
* Fix wedge end shape for terminal double bonds.
* Hide the joins at the bond ends.
* Fix gcc pickiness.
* Extra test for no atom labels.
* Change where it looks for FreeSans.ttf for ACS1996 drawings.
* Same number of waves for wavy bonds in SVG and Cairo.
* Same number of waves for wavy bonds in SVG and Cairo.
* rename unspecifiedStereoIsUnknown to markUnspecifiedStereoAsUnknown and move to MolFileStereochem.h
* refactor use of iterators
* py docs update
* undo a bunch of bad formatting changes
* remove FreeSans
* get windows builds working
* Fix problem with Windows build.
* Changes in response to review.
* Align description of unspecifiedStereoIsUnknown in C++ to match Python.
* Still working on file open modes.
* Took out extraneous functions for drawing in ACS1996 mode, including the one that was breaking the windows build.
* Add RDKIT_MOLDRAW2D_EXPORT.
* Fix expected test results.
* Clarified warning.
* RDKIT_MOLDRAW2D_EXPORT missing.
* Windows!
* Update Code/GraphMol/MolDraw2D/rxn_test1.cpp
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
* add a global feature flag to control use of the new chirality code
* expose that flag to minimallib
* add getters for allowNontetrahedralChilrality and useLegacyStereoPerception
* switch to using environment variables to store the values
* document that
correct the documentation about nontetrahedral stereo
* yay visual c++
* in response to review
* very basics: actually parsing the new atom stereochem features
* add some input verification for the chiral permutations
* fix a typo
add quadruple bond SMILES/SMARTS extension
* add forgotten files
* patch from Roger
* add Roger's parsing examples
* typo
* new tests
* adjusted version of next PR from Roger:
- add SP2D hybridization for square planar (this may change)
- some modernizationof Chirality.cpp
- stop using < HybridizationType in Chirality.cpp (should probably do this elsewhere too)
- improved handling of hybridization assignment for new stereochem
- handle new stereo/hybridization in UFF
- tests for the above
* perception of non-tetrahedral stereo from 3D (from Roger S)
Basic testing of SP and TB based on opensmiles docs
* potential fixes for octahedral assignment
more tests
* docs update
need way more!
* map the TH tags directly to @ tags
* very basics of SMILES writing
this does not work with anything that changes the permutation order
like canonicalization or writing things in rings.
* start to support the getChiralAcross API
* more testing
* consistency
* add hasNonTetrahedralStereo() and getIdealAngleBetweenLigands()
* assignStereochemistry should only remove non-tetrahedral stereo
* re-simplify those tests
* cleanup matrix stream output
* initial pass at supporting nontet stereo in distgeom
* backup
* start on the reference docs
* TBP reference
* first pass at Oh finished
* update SP section
* more doc updates
* fix a typo
* add param to not remove Hs connected to non-tetrahedral atoms
* VERY basic coord generation for square planar
* TBP basics
* basic OH depiction
* start testing missing ligands
allow non-tet stereo in rings (ugly, but correct)
* add new TBP functions from Roger
* update depiction code for new API
* backup, the new tests work so far
* Finish the TB tests
* OH tests pass too
* cleanup
* first pass at getting correct SMILES with reordering
need way more testing than this
* ensure permutation 0 is correctly preserved
* some progress towards adding non-tetrahedral stereo to StereoInfo
* doc update
* add non-tet chiral classes to python wrappers
* make sure removeAllHs also gets neighbors of non-tetrahedral centers
more testing
* a bit of depictor cleanup
* make the assignment from 3D more tolerant
more testing
* improve the bulk testing
* cleanup
* remove a bit of redundant code
* ensure we don't write bogus permutation values to SMILES
* fix some rebase problems
* allow assignStereochemistryFrom3D() to be called without sanitization
* allow disabling the non-tetrahedral stereo when it's not explicit
* get that working on windows too
* Fixes#5196
This fixes the bug as reported, but there's more work to do in order to get the other cases
* cleanup
* fix assignStereochemistry()
* Fixes#5200
* move those functions to the public API
* fix assignStereochemistry
* cleanup
* refactoring in response to review
* 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
* RWMol: replace atom in stereo groups
Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36998, a
use-after-free in initFromOther.
* Fix out-of-bounds write in iterateCIPRanks
If the rank has not changed in the current iteration, the cipEntries
vectors might not have increased in size. Accessing `numIts + 1`
resulted in an out-of-bounds write. This commit skip the cipEntries
update when the rank is unchanged.
Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28660
* Fix use of uninitialized values in MolSGroupParsing
`stream >> count` may silently fail without an exception. In that case,
`count` was uninitialized but used. This commit initalizes `count` to 0,
as well as other variables that may be read without being initialized.
Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25220
Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25225
* Fix vector size cast in streamReadVec
In 32-bit systems, the implicit conversions from 64-bit to a 32-bit
size_t could lead to an underallocation of the vector. This would follow
by a out-of-bounds write while trying to populate the vector. Now, the
code throws an exception in case of a cast that would change the size.
Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28034
* RWMol: improve atom replacement in stereo groups
This code is cleaner and more efficient.
* Add test for replaceAtom and stereo groups
* add ROMol::atomBonds() and ROMol::atomNeighbors() methods
* remove some warnings
* start using the new code
* add default for those template params
* some more applications
* get the SWIG builds working
* get rid of extraneous ref
* remove extraneous comments
* remove include from headers
* update implementation files
* completely remove BOOST_FOREACH (#7)
* convert those changes to use auto
* get rid of all usage of BOOST_FOREACH
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* Speed up GraphMol/Chirality.cpp/iterateCIPRanks
The changes in this patch increases throughput of `iterateCIPRanks` by
about 61.8%. This patch consists of many changes that all combine to
contribute to the performance gains, and these are the major changes:
* Introduce Bond.getTwiceBondType to avoid floating point operations in
`floor(2*bond->getBondTypeAsDouble() + .1)`
* In RDGeneral/Ranking.h/rankVect, just store the last index (instead of
the last vector) and avoid creating a copy at the current index.
* In GraphMol/Chirality.cpp/iterateCIPRanks, reserve more capacity ahead
of time.
* In GraphMol/Chirality.cpp/iterateCIPRanks, avoid materializing
localEntry and then copying; instead, track the data to be added in a
`counts` vector and a `updatedNbrIdxs` vector.
In GraphMol/Chirality.cpp/iterateCIPRanks, we also make several
micro-optimizations that were individually measured to give a small
performance improvement.
* Chirality.cpp/iterateCIPRanks: avoid materializing allIndices vec
* misc cleanup
* add new test (it fails, of course)
* isAtomPotentialTetrahedralCenter() there and tested
tests cases for molecular stereo written (but failing, of course)
create new_chirality.cpp, we will probably want to change this at some point
new StereoInfo structure
* more infrastructure
- isBondPotentialStereoBond()
- two getStereoInfo() functions
- associated unit tests
* backup
* oops
* backup
* switch to always using four atoms for bonds
* backup
* add new test (it fails, of course)
* isAtomPotentialTetrahedralCenter() there and tested
tests cases for molecular stereo written (but failing, of course)
create new_chirality.cpp, we will probably want to change this at some point
new StereoInfo structure
* more infrastructure
- isBondPotentialStereoBond()
- two getStereoInfo() functions
- associated unit tests
* backup
* oops
* backup
* switch to always using four atoms for bonds
* backup
* this now actually works
* doc update
* add a test to demo that ring stereo is not working
* more testing
* add a fun CIP test
* add review note
* debugging
* remove extraneous debugging
turn off tests for ring-double bond stereo
* disable the ring-stereo fix... this breaks a few tests, but we will recover
* works, needs cleanup, chirality code needs re-testing
* nothing works
* Fixes#3322
* Python and C++ tests now pass
* clang-format
* first pass at python wrappers
* improve doctest
* basic optimization...
stop with the copying
* rename
* all tests passing again
* optimization
* fix the sort in the tests
* looks like this might fix the windows-dll build problems
* update tests
* the fun never ends
* comment cleanup
* handle deliberately unspecified atoms/bonds
* add cleanIt option
* add flagPossible
* add option to use the new code to the SMILES parser
* additional testing
* additional testing
* a bit of additional testing never hurts
* changes in response to review
* fixes a bug with potential parastereo not being cleared
other changes in response to review
* update docs
* add port of centres
* Several changes:
- Added a test based on RDKit issue 2984
(default RDKit fails it, this gets it right)
- Use bond directions for bond stereo (label is no longer required)
- Fix bugs in rules 4b and 5new
- Fix some mem errors
- clang-formatted
- some other minor cleanups
* Several changes and some improvements:
- Added LGPL license, as well as a mention in the doc.
- Fix/update/add some comments
- Fix typo/bug in Mancude calculation
- Fix bug in rules 4b, 5New
- Fix Sp2 Bond dir reference
- Re clang-format
- other minor changes suggested by Dan
* Another bunch of changes:
- require integer-order bonds; kekulize when required
- fix fraction comparison
- rename sq Cis/Trans e/z
- replace queues with vectors
- update copyright notices
- revert LGPL changes
- fix Asymmetric typo
* move to separate lib/mod, add python validation test
* Moving away from the original implementation:
- Rename to CIPLabeler
- Remove the abstraction layer
- Remove some stats stuff
- Push some CIPMol functions down to Node
- Use RDKit's isotope info
* Another bundle of changes. The most relevant ones:
- fix parity translation
- use cis trans as bond reference -- breaks #2984 test
- kill a lot of unused code
- use lists for queues
- store nodes and edges in digraph
- add prefixes to class data member names
- update changeRoot() test
- use fastFindRings() for mancude rings
- update docs
- add references to the scientific paper
- Document the Mancude functions
- Fix Mancude atom types and their comments
- remove mol data member from SequenceRule
- replace Fraction with boost::rational
- update comments, docstrings and the doc
* fix building the test
* Changes here include:
- adding bitset overload for the labeling function
- python wrap of the overload
- handling trigonal pyramids with implicit H
- setting bond labels sets stereo atoms, cis/trans
- nix LEFT/RIGHT/TOGETHER/OPPOSITE constants
- don't use GLOB in cmake
- a decent amount of refactoring
* Minor edits to new_CIP_labeling (#6)
* Some changes for clarity
Added some documentation and changed some variable names to match
my understanding. Also a ran clang-tidy to ensure that all blocks
were brace-enclosed.
* Return a reference instead of a copy for performance
This is called many times and showed up after some light
profiling. This change bumped throughput by about 20%
* move out of Graphmol
* move .hpp headers to .h
* update documentation; add label set of atoms test
* Address comments:
- Added references to centres to CIPLabeler.h and Python Wrap.
- Update validation test to skip sanitization.
- Document mancude fractional atomic number calculation.
- Use unittest assertions in python test.
- Update mancude docstrings to 'resonance' instad of 'tautomers'.
- Rename prioritise() to prioritize().
- Add postcondition to check carriers size in Tetrahedral.cpp.
- Use getNeighbors() in Tetrahedral.cpp.
- Move findStereoAtoms to Chirality namespace.
- Move code back into GraphMol.
- Fix typos and reformat doc.
* More comments:
- Mention why we use boost's unordered map rather than the std one.
- Fix include in Python wrapper.
* Addressed second batch of comments:
- fix the bug in rule 4b
- fix docstring for rule 2
- move atomic mass calculation from rule 2 to node
- addressed some build warnings
- simplify sp2bond::label(comp)
- add start/end atoms to Sp2Bond constructor
- update system/local includes
Co-authored-by: Dan N <dan.nealschneider@schrodinger.com>
* 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>
- Add tests for phosphine and arsine chirality
- Add support to isAtomPotentialChiralCenter()
Accept both 2 (implicit H), 3 and 4 coordinate P and As atoms as potential
chiral centers
* 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
* backup
* output bond stereoAtoms in debugMol()
* stop removing STEREOCIS/STEREOTRANS markers in setDoubleBondNeighborDirections()
* Re-establish bond dirs in reaction products.
* test all that
(the first set of tests, should do more)
* cleanups
* add SetDoubleBondNeighborDirections() to python API and test it
* add more tests
* changes in response to review
* add another c++ test, fix the java tests
* Fixes a molblock writing problem
with undervalent atoms from the organic subset
* Fixes#2649
Also ensures that allenes are not written as crossed bonds
(which does not make sense at the moment anyway)
* clang-format run
* first round of cleanups based on PVS-studio suggestions
* a couple more
* a few more cleanups
* another round of cleanups
* undo one of those cleanups
we want the integer rounding behavior here
* add a comment to make that clear
* Fix for filter catalog PRECONDITION redundancy
* Move DetectAtomStereoChemistry to Molops::assignChiralTypesFromBondDirs
DetectAtomStereoChemistry in MolFileStereochem is more broadly
useful. Additionally, it was not named very clearly for what
it was actually doing.
* Wraps assignChiralTypesFromBondDirs for use in Python
Makes assignChiralTypesFromBondDirs available in Python
and adds a test demonstrating that availability.