From ec31bea97b15c0aaf1d07b5166c325b78416eacc Mon Sep 17 00:00:00 2001 From: Greg Landrum Date: Tue, 16 Apr 2019 18:05:47 +0200 Subject: [PATCH] clang-tidy-7 pass (#2408) --- Code/Catalogs/Catalog.h | 12 +- Code/Catalogs/CatalogEntry.h | 4 +- Code/Catalogs/CatalogParams.h | 2 +- Code/ChemicalFeatures/ChemicalFeature.h | 2 +- Code/ChemicalFeatures/FreeChemicalFeature.h | 5 +- Code/DataManip/MetricMatrixCalc/MetricFuncs.h | 2 +- .../MetricMatrixCalc/MetricMatrixCalc.h | 2 +- Code/DataStructs/BitOps.h | 76 +- Code/DataStructs/BitVectUtils.h | 3 +- Code/DataStructs/DatastructsStreamOps.h | 15 +- Code/DataStructs/DiscreteDistMat.h | 2 +- Code/DataStructs/DiscreteValueVect.h | 14 +- Code/DataStructs/ExplicitBitVect.h | 3 +- Code/DataStructs/FPBReader.h | 14 +- Code/DataStructs/MultiFPBReader.h | 8 +- Code/DataStructs/SparseBitVect.h | 10 +- Code/DataStructs/SparseIntVect.h | 4 +- Code/DataStructs/base64.h | 3 +- .../RDKit/Basement/TemplEnum/TemplEnum.h | 2 +- .../RDKit/Basement/xpcom/RDMolSupplierImpl.h | 2 +- Code/DistGeom/BoundsMatrix.h | 5 +- Code/DistGeom/ChiralSet.h | 2 +- Code/DistGeom/ChiralViolationContrib.h | 7 +- Code/DistGeom/DistViolationContrib.h | 5 +- Code/DistGeom/FourthDimContrib.h | 7 +- Code/DistGeom/TriangleSmooth.h | 8 +- Code/Features/Feature.h | 2 +- Code/ForceField/Contrib.h | 2 +- Code/ForceField/ForceField.h | 2 +- Code/ForceField/MMFF/AngleBend.h | 30 +- Code/ForceField/MMFF/AngleConstraint.h | 7 +- Code/ForceField/MMFF/BondStretch.h | 17 +- Code/ForceField/MMFF/DistanceConstraint.h | 7 +- Code/ForceField/MMFF/Nonbonded.h | 43 +- Code/ForceField/MMFF/OopBend.h | 18 +- Code/ForceField/MMFF/Params.h | 220 ++--- Code/ForceField/MMFF/PositionConstraint.h | 7 +- Code/ForceField/MMFF/StretchBend.h | 6 +- Code/ForceField/MMFF/TorsionAngle.h | 31 +- Code/ForceField/MMFF/TorsionConstraint.h | 7 +- Code/ForceField/UFF/AngleBend.h | 20 +- Code/ForceField/UFF/AngleConstraint.h | 7 +- Code/ForceField/UFF/BondStretch.h | 16 +- Code/ForceField/UFF/DistanceConstraint.h | 7 +- Code/ForceField/UFF/Inversion.h | 12 +- Code/ForceField/UFF/Nonbonded.h | 14 +- Code/ForceField/UFF/Params.h | 8 +- Code/ForceField/UFF/PositionConstraint.h | 7 +- Code/ForceField/UFF/TorsionAngle.h | 24 +- Code/ForceField/UFF/TorsionConstraint.h | 7 +- Code/ForceField/Wrap/PyForceField.h | 15 +- Code/Geometry/Grid3D.h | 2 +- Code/Geometry/GridUtils.h | 25 +- Code/Geometry/Transform2D.h | 9 +- Code/Geometry/Transform3D.h | 13 +- Code/Geometry/UniformGrid3D.h | 12 +- Code/Geometry/Utils.h | 12 +- Code/Geometry/point.h | 54 +- Code/GraphMol/Atom.h | 8 +- Code/GraphMol/AtomIterators.h | 2 +- Code/GraphMol/Basement/FeatTrees/FeatTree.h | 7 +- .../Basement/FeatTrees/FeatTreeUtils.h | 4 +- Code/GraphMol/Bond.h | 5 +- Code/GraphMol/BondIterators.h | 2 +- Code/GraphMol/Canon.h | 14 +- .../Enumerate/CartesianProduct.h | 17 +- .../ChemReactions/Enumerate/Enumerate.h | 32 +- .../ChemReactions/Enumerate/EnumerateBase.h | 4 +- .../ChemReactions/Enumerate/EnumerateTypes.h | 4 +- .../Enumerate/EnumerationPickler.h | 21 +- .../Enumerate/EnumerationStrategyBase.h | 15 +- .../ChemReactions/Enumerate/EvenSamplePairs.h | 11 +- .../ChemReactions/Enumerate/RandomSample.h | 19 +- .../Enumerate/RandomSampleAllBBs.h | 17 +- Code/GraphMol/ChemReactions/PreprocessRxn.h | 39 +- Code/GraphMol/ChemReactions/Reaction.h | 48 +- .../ChemReactions/ReactionFingerprints.h | 15 +- Code/GraphMol/ChemReactions/ReactionParser.h | 32 +- Code/GraphMol/ChemReactions/ReactionPickler.h | 11 +- Code/GraphMol/ChemReactions/ReactionRunner.h | 32 +- Code/GraphMol/ChemReactions/ReactionUtils.h | 37 +- Code/GraphMol/ChemReactions/SanitizeRxn.h | 32 +- Code/GraphMol/ChemTransforms/ChemTransforms.h | 93 +- Code/GraphMol/ChemTransforms/MolFragmenter.h | 18 +- Code/GraphMol/Chirality.h | 7 +- Code/GraphMol/Conformer.h | 25 +- Code/GraphMol/Depictor/Basement/Depictor.h | 2 +- Code/GraphMol/Depictor/DepictUtils.h | 60 +- Code/GraphMol/Depictor/EmbeddedFrag.h | 4 +- Code/GraphMol/Depictor/RDDepictor.h | 24 +- Code/GraphMol/Descriptors/AUTOCORR2D.h | 9 +- Code/GraphMol/Descriptors/AUTOCORR3D.h | 9 +- .../Descriptors/ConnectivityDescriptors.h | 15 +- Code/GraphMol/Descriptors/Crippen.h | 18 +- Code/GraphMol/Descriptors/EEM.h | 34 +- Code/GraphMol/Descriptors/GETAWAY.h | 9 +- Code/GraphMol/Descriptors/Lipinski.h | 60 +- Code/GraphMol/Descriptors/MORSE.h | 5 +- Code/GraphMol/Descriptors/MQN.h | 3 +- .../Descriptors/MolData3Ddescriptors.h | 3 +- Code/GraphMol/Descriptors/MolDescriptors.h | 11 +- Code/GraphMol/Descriptors/PBF.h | 18 +- Code/GraphMol/Descriptors/Property.h | 87 +- Code/GraphMol/Descriptors/RDF.h | 5 +- .../GraphMol/Descriptors/RegisterDescriptor.h | 57 +- Code/GraphMol/Descriptors/USRDescriptor.h | 34 +- Code/GraphMol/Descriptors/WHIM.h | 5 +- Code/GraphMol/DistGeomHelpers/Embedder.h | 9 +- Code/GraphMol/FMCS/Composition2N.h | 4 +- Code/GraphMol/FMCS/DebugTrace.h | 4 +- Code/GraphMol/FMCS/DuplicatedSeedCache.h | 4 +- Code/GraphMol/FMCS/Graph.h | 7 +- Code/GraphMol/FMCS/MatchTable.h | 9 +- Code/GraphMol/FMCS/MaximumCommonSubgraph.h | 2 +- Code/GraphMol/FMCS/RingMatchTableSet.h | 16 +- Code/GraphMol/FMCS/Seed.h | 7 +- Code/GraphMol/FMCS/SeedSet.h | 4 +- Code/GraphMol/FMCS/SubstructMatchCustom.h | 9 +- Code/GraphMol/FMCS/SubstructureCache.h | 17 +- Code/GraphMol/FMCS/Target.h | 4 +- Code/GraphMol/FMCS/TargetMatch.h | 4 +- Code/GraphMol/FileParsers/MolFileStereochem.h | 21 +- Code/GraphMol/FileParsers/MolSupplier.h | 8 +- Code/GraphMol/FileParsers/ProximityBonds.h | 8 +- Code/GraphMol/FileParsers/SequenceParsers.h | 37 +- Code/GraphMol/FileParsers/SequenceWriters.h | 2 +- Code/GraphMol/FilterCatalog/FilterCatalog.h | 9 +- .../FilterCatalog/FilterCatalogEntry.h | 5 +- .../FilterCatalog/FilterMatcherBase.h | 11 +- Code/GraphMol/FilterCatalog/FilterMatchers.h | 54 +- Code/GraphMol/FilterCatalog/Filters.h | 2 +- .../FilterCatalog/FunctionalGroupHierarchy.h | 9 +- Code/GraphMol/Fingerprints/FingerprintUtil.h | 4 +- Code/GraphMol/Fingerprints/Fingerprints.h | 24 +- Code/GraphMol/Fingerprints/MACCS.h | 7 +- .../Fingerprints/MorganFingerprints.h | 16 +- .../TopologicalTorsionGenerator.h | 3 +- .../CrystalFF/TorsionAngleM6.h | 14 +- .../ForceFieldHelpers/MMFF/AtomTyper.h | 47 +- .../GraphMol/ForceFieldHelpers/MMFF/Builder.h | 64 +- Code/GraphMol/ForceFieldHelpers/MMFF/MMFF.h | 4 +- .../ForceFieldHelpers/UFF/AtomTyper.h | 42 +- Code/GraphMol/ForceFieldHelpers/UFF/Builder.h | 51 +- Code/GraphMol/ForceFieldHelpers/UFF/UFF.h | 2 +- Code/GraphMol/FragCatalog/FragCatGenerator.h | 2 +- Code/GraphMol/FragCatalog/FragCatParams.h | 8 +- Code/GraphMol/FragCatalog/FragCatalogEntry.h | 5 +- Code/GraphMol/FragCatalog/FragCatalogUtils.h | 14 +- Code/GraphMol/FragCatalog/FragFPGenerator.h | 4 +- Code/GraphMol/MMPA/MMPA.h | 33 +- Code/GraphMol/MolAlign/AlignMolecules.h | 36 +- Code/GraphMol/MolAlign/O3AAlignMolecules.h | 44 +- Code/GraphMol/MolBundle.h | 2 +- Code/GraphMol/MolCatalog/MolCatalog.h | 2 +- Code/GraphMol/MolCatalog/MolCatalogEntry.h | 2 +- Code/GraphMol/MolCatalog/MolCatalogParams.h | 5 +- .../MolChemicalFeatures/FeatureParser.h | 25 +- .../MolChemicalFeatures/MolChemicalFeature.h | 5 +- .../MolChemicalFeatureDef.h | 4 +- Code/GraphMol/MolDraw2D/MolDraw2DCairo.h | 2 +- Code/GraphMol/MolDraw2D/MolDraw2DDetails.h | 8 +- Code/GraphMol/MolDraw2D/MolDraw2DQt.h | 2 +- Code/GraphMol/MolDraw2D/MolDraw2Dwx.h | 2 +- Code/GraphMol/MolDraw2D/MultiMolDraw2D.h | 14 +- Code/GraphMol/MolHash/MolHash.h | 15 +- Code/GraphMol/MolInterchange/MolInterchange.h | 15 +- Code/GraphMol/MolInterchange/details.h | 4 +- Code/GraphMol/MolPickler.h | 10 +- .../TautomerCatalog/TautomerCatalogUtils.h | 1 - Code/GraphMol/MolTransforms/MolTransforms.h | 78 +- Code/GraphMol/MonomerInfo.h | 6 +- .../PartialCharges/GasteigerCharges.h | 15 +- .../GraphMol/PartialCharges/GasteigerParams.h | 2 +- Code/GraphMol/PeriodicTable.h | 10 +- Code/GraphMol/QueryAtom.h | 4 +- Code/GraphMol/QueryBond.h | 4 +- Code/GraphMol/QueryOps.h | 30 +- .../RGroupDecomposition/RGroupDecomp.h | 24 +- Code/GraphMol/ReducedGraphs/ReducedGraphs.h | 13 +- Code/GraphMol/Resonance.h | 4 +- Code/GraphMol/RingInfo.h | 2 +- Code/GraphMol/SLNParse/SLNAttribs.h | 6 +- Code/GraphMol/SanitException.h | 2 +- Code/GraphMol/ShapeHelpers/ShapeEncoder.h | 22 +- Code/GraphMol/ShapeHelpers/ShapeUtils.h | 115 ++- Code/GraphMol/SmilesParse/SmartsWrite.h | 10 +- Code/GraphMol/SmilesParse/SmilesWrite.h | 2 - Code/GraphMol/SmilesParse/primes.h | 2 +- Code/GraphMol/StructChecker/Pattern.h | 39 +- Code/GraphMol/StructChecker/ReCharge.h | 22 +- Code/GraphMol/StructChecker/Stereo.h | 64 +- .../StructChecker/StripSmallFragments.h | 7 +- Code/GraphMol/StructChecker/StructChecker.h | 19 +- .../StructChecker/StructCheckerOptions.h | 7 +- Code/GraphMol/StructChecker/Tautomer.h | 4 +- Code/GraphMol/StructChecker/Utilites.h | 16 +- Code/GraphMol/Subgraphs/SubgraphUtils.h | 20 +- Code/GraphMol/Subgraphs/Subgraphs.h | 45 +- Code/GraphMol/Substruct/SubstructMatch.h | 33 +- .../SubstructLibrary/SubstructLibrary.h | 45 +- .../SubstructLibrarySerialization.h | 58 +- Code/GraphMol/Trajectory/Snapshot.h | 92 +- Code/GraphMol/Trajectory/Trajectory.h | 150 ++-- Code/GraphMol/Wrap/MolSupplier.h | 2 +- Code/GraphMol/atomic_data.h | 4 +- Code/GraphMol/new_canon.h | 4 +- Code/JavaWrappers/DiversityPick.h | 12 +- Code/JavaWrappers/GenericRDKitException.h | 2 +- Code/JavaWrappers/MorganFingerprints.h | 20 +- Code/ML/Cluster/Murtagh/f2c.h | 12 +- Code/ML/InfoTheory/CorrMatGenerator.h | 8 +- Code/ML/InfoTheory/InfoBitRanker.h | 2 +- Code/ML/InfoTheory/InfoGainFuncs.h | 2 +- Code/Numerics/Alignment/AlignPoints.h | 15 +- Code/Numerics/EigenSolvers/PowerEigenSolver.h | 14 +- Code/Numerics/Matrix.h | 2 +- Code/Numerics/Optimizer/BFGSOpt.h | 12 +- Code/Numerics/SquareMatrix.h | 2 +- Code/Numerics/SymmMatrix.h | 2 +- Code/PgSQL/rdkit/bitstring.h | 45 +- Code/PgSQL/rdkit/cache.h | 22 +- Code/Query/AndQuery.h | 2 +- Code/Query/EqualityQuery.h | 4 +- Code/Query/GreaterEqualQuery.h | 2 +- Code/Query/GreaterQuery.h | 2 +- Code/Query/LessEqualQuery.h | 2 +- Code/Query/LessQuery.h | 2 +- Code/Query/OrQuery.h | 2 +- Code/Query/RangeQuery.h | 2 +- Code/Query/SetQuery.h | 2 +- Code/Query/XOrQuery.h | 2 +- Code/RDGeneral/BadFileException.h | 2 +- Code/RDGeneral/BoostStartInclude.h | 8 +- Code/RDGeneral/Dict.h | 3 +- Code/RDGeneral/FileParseException.h | 2 +- Code/RDGeneral/Invariant.h | 7 +- Code/RDGeneral/LocaleSwitcher.h | 9 +- Code/RDGeneral/RDAny.h | 15 +- Code/RDGeneral/RDLog.h | 22 +- Code/RDGeneral/RDProps.h | 2 +- Code/RDGeneral/RDThreads.h | 4 +- Code/RDGeneral/RDValue-doublemagic.h | 242 +++--- Code/RDGeneral/RDValue-taggedunion.h | 36 +- Code/RDGeneral/RDValue.h | 126 +-- Code/RDGeneral/Ranking.h | 10 +- Code/RDGeneral/StreamOps.h | 145 ++-- Code/RDGeneral/hanoiSort.h | 4 +- Code/RDGeneral/types.h | 21 +- Code/RDGeneral/utils.h | 4 +- Code/RDStreams/streams.h | 12 +- Code/SimDivPickers/DistPicker.h | 6 +- .../SimDivPickers/HierarchicalClusterPicker.h | 2 +- Code/SimDivPickers/MaxMinPicker.h | 2 +- External/AvalonTools/AvalonTools.cpp | 796 +++++++++--------- External/AvalonTools/test1.cpp | 8 +- External/FreeSASA/RDFreeSASA.cpp | 20 +- External/FreeSASA/RDFreeSASA.h | 27 +- External/FreeSASA/testFreeSASA.cpp | 1 - External/INCHI-API/inchi.cpp | 39 +- External/INCHI-API/inchi.h | 153 ++-- External/INCHI-API/test.cpp | 44 +- 261 files changed, 3020 insertions(+), 2661 deletions(-) mode change 100755 => 100644 External/AvalonTools/test1.cpp diff --git a/Code/Catalogs/Catalog.h b/Code/Catalogs/Catalog.h index 492783f7b..0aba37f85 100644 --- a/Code/Catalogs/Catalog.h +++ b/Code/Catalogs/Catalog.h @@ -149,7 +149,8 @@ class HierarchCatalog : public Catalog { boost::vecS, // FIX: should be using setS for edges so that parallel // edges are never added (page 225 BGL book) // but that seems result in compile errors - boost::bidirectionalS, EntryProperty> CatalogGraph; + boost::bidirectionalS, EntryProperty> + CatalogGraph; typedef boost::graph_traits CAT_GRAPH_TRAITS; typedef typename CAT_GRAPH_TRAITS::vertex_iterator VER_ITER; @@ -281,7 +282,9 @@ class HierarchCatalog : public Catalog { } //------------------------------------ - unsigned int getNumEntries() const { return static_cast(boost::num_vertices(d_graph)); } + unsigned int getNumEntries() const { + return static_cast(boost::num_vertices(d_graph)); + } //------------------------------------ //! fills the contents of this object from a string containing a \c pickle @@ -311,7 +314,8 @@ class HierarchCatalog : public Catalog { fpl++; this->setFPLength(fpl); } - unsigned int eid = static_cast(boost::add_vertex(EntryProperty(entry), d_graph)); + unsigned int eid = static_cast( + boost::add_vertex(EntryProperty(entry), d_graph)); orderType etype = entry->getOrder(); // REVIEW: this initialization is not required: the STL map, in // theory, will create a new object when operator[] is called @@ -474,6 +478,6 @@ class LinearCatalog : public Catalog { private: std::vector d_vector; }; -} +} // namespace RDCatalog #endif diff --git a/Code/Catalogs/CatalogEntry.h b/Code/Catalogs/CatalogEntry.h index 57b614dd5..50a2a608f 100644 --- a/Code/Catalogs/CatalogEntry.h +++ b/Code/Catalogs/CatalogEntry.h @@ -41,8 +41,8 @@ class RDKIT_CATALOGS_EXPORT CatalogEntry { private: int d_bitId; //!< our bit Id. This needs to be signed so that we can mark - //uninitialized entries. + // uninitialized entries. }; -} +} // namespace RDCatalog #endif diff --git a/Code/Catalogs/CatalogParams.h b/Code/Catalogs/CatalogParams.h index 68f4c11f8..0f4dd8d19 100644 --- a/Code/Catalogs/CatalogParams.h +++ b/Code/Catalogs/CatalogParams.h @@ -37,6 +37,6 @@ class RDKIT_CATALOGS_EXPORT CatalogParams { protected: std::string d_typeStr; //!< our type string }; -} +} // namespace RDCatalog #endif diff --git a/Code/ChemicalFeatures/ChemicalFeature.h b/Code/ChemicalFeatures/ChemicalFeature.h index 61261c7e2..92640eed0 100644 --- a/Code/ChemicalFeatures/ChemicalFeature.h +++ b/Code/ChemicalFeatures/ChemicalFeature.h @@ -33,6 +33,6 @@ class ChemicalFeature { // returns the position of the feature virtual RDGeom::Point3D getPos() const = 0; }; -} +} // namespace ChemicalFeatures #endif diff --git a/Code/ChemicalFeatures/FreeChemicalFeature.h b/Code/ChemicalFeatures/FreeChemicalFeature.h index 6b8815a37..c25b2aae1 100644 --- a/Code/ChemicalFeatures/FreeChemicalFeature.h +++ b/Code/ChemicalFeatures/FreeChemicalFeature.h @@ -19,7 +19,8 @@ namespace ChemicalFeatures { //------------------------------------------------------ //! Class for chemical features that do not orignate from molecules // e.g. pharamcophores, site-maps etc. -class RDKIT_CHEMICALFEATURES_EXPORT FreeChemicalFeature : public ChemicalFeature { +class RDKIT_CHEMICALFEATURES_EXPORT FreeChemicalFeature + : public ChemicalFeature { public: //! start with everything specified FreeChemicalFeature(const std::string &family, std::string type, @@ -89,6 +90,6 @@ class RDKIT_CHEMICALFEATURES_EXPORT FreeChemicalFeature : public ChemicalFeature std::string d_type; RDGeom::Point3D d_position; }; -} +} // namespace ChemicalFeatures #endif diff --git a/Code/DataManip/MetricMatrixCalc/MetricFuncs.h b/Code/DataManip/MetricMatrixCalc/MetricFuncs.h index 69e96a0c9..b4220af29 100644 --- a/Code/DataManip/MetricMatrixCalc/MetricFuncs.h +++ b/Code/DataManip/MetricMatrixCalc/MetricFuncs.h @@ -49,6 +49,6 @@ double TanimotoSimilarityMetric(const T1 &bv1, const T2 &bv2, return SimilarityWrapper( bv1, bv2, (double (*)(const T1 &, const T2 &))TanimotoSimilarity); }; -} +} // namespace RDDataManip #endif diff --git a/Code/DataManip/MetricMatrixCalc/MetricMatrixCalc.h b/Code/DataManip/MetricMatrixCalc/MetricMatrixCalc.h index 8c8cb3cf6..19db0916f 100644 --- a/Code/DataManip/MetricMatrixCalc/MetricMatrixCalc.h +++ b/Code/DataManip/MetricMatrixCalc/MetricMatrixCalc.h @@ -101,6 +101,6 @@ class MetricMatrixCalc { */ double (*dp_metricFunc)(const entryType &, const entryType &, unsigned int); }; -}; +}; // namespace RDDataManip #endif diff --git a/Code/DataStructs/BitOps.h b/Code/DataStructs/BitOps.h index 6d6ae65c9..cd44a3f80 100644 --- a/Code/DataStructs/BitOps.h +++ b/Code/DataStructs/BitOps.h @@ -67,13 +67,16 @@ double SimilarityWrapper(const T& bv1, const T& bv2, double a, double b, return res; } -RDKIT_DATASTRUCTS_EXPORT bool AllProbeBitsMatch(const char* probe, const char* ref); -RDKIT_DATASTRUCTS_EXPORT bool AllProbeBitsMatch(const std::string& probe, const std::string& ref); +RDKIT_DATASTRUCTS_EXPORT bool AllProbeBitsMatch(const char* probe, + const char* ref); +RDKIT_DATASTRUCTS_EXPORT bool AllProbeBitsMatch(const std::string& probe, + const std::string& ref); RDKIT_DATASTRUCTS_EXPORT bool AllProbeBitsMatch(const ExplicitBitVect& probe, - const ExplicitBitVect& ref); + const ExplicitBitVect& ref); template -RDKIT_DATASTRUCTS_EXPORT bool AllProbeBitsMatch(const T1& probe, const std::string& pkl); +RDKIT_DATASTRUCTS_EXPORT bool AllProbeBitsMatch(const T1& probe, + const std::string& pkl); template RDKIT_DATASTRUCTS_EXPORT bool AllProbeBitsMatch(const T1& probe, const T1& ref); @@ -85,14 +88,16 @@ RDKIT_DATASTRUCTS_EXPORT bool AllProbeBitsMatch(const T1& probe, const T1& ref); template RDKIT_DATASTRUCTS_EXPORT int NumOnBitsInCommon(const T1& bv1, const T2& bv2); -RDKIT_DATASTRUCTS_EXPORT int NumOnBitsInCommon(const ExplicitBitVect& bv1, const ExplicitBitVect& bv2); +RDKIT_DATASTRUCTS_EXPORT int NumOnBitsInCommon(const ExplicitBitVect& bv1, + const ExplicitBitVect& bv2); //! returns the Tanimoto similarity between two bit vects /*! \return (bv1&bv2)_o / [bv1_o + bv2_o - (bv1&bv2)_o] */ template -RDKIT_DATASTRUCTS_EXPORT double TanimotoSimilarity(const T1& bv1, const T2& bv2); +RDKIT_DATASTRUCTS_EXPORT double TanimotoSimilarity(const T1& bv1, + const T2& bv2); //! returns the Cosine similarity between two bit vects /*! @@ -106,7 +111,8 @@ RDKIT_DATASTRUCTS_EXPORT double CosineSimilarity(const T1& bv1, const T2& bv2); \return (bv1&bv2)_o * [bv1_o + bv2_o] / [2 * bv1_o * bv2_o] */ template -RDKIT_DATASTRUCTS_EXPORT double KulczynskiSimilarity(const T1& bv1, const T2& bv2); +RDKIT_DATASTRUCTS_EXPORT double KulczynskiSimilarity(const T1& bv1, + const T2& bv2); //! returns the Dice similarity between two bit vects /*! @@ -126,7 +132,8 @@ RDKIT_DATASTRUCTS_EXPORT double DiceSimilarity(const T1& bv1, const T2& bv2); */ template -RDKIT_DATASTRUCTS_EXPORT double TverskySimilarity(const T1& bv1, const T2& bv2, double a, double b); +RDKIT_DATASTRUCTS_EXPORT double TverskySimilarity(const T1& bv1, const T2& bv2, + double a, double b); //! returns the Sokal similarity between two bit vects /*! @@ -141,21 +148,24 @@ RDKIT_DATASTRUCTS_EXPORT double SokalSimilarity(const T1& bv1, const T2& bv2); bv2_o) */ template -RDKIT_DATASTRUCTS_EXPORT double McConnaugheySimilarity(const T1& bv1, const T2& bv2); +RDKIT_DATASTRUCTS_EXPORT double McConnaugheySimilarity(const T1& bv1, + const T2& bv2); //! returns the Asymmetric similarity between two bit vects /*! \return (bv1&bv2)_o / min(bv1_o,bv2_o) */ template -RDKIT_DATASTRUCTS_EXPORT double AsymmetricSimilarity(const T1& bv1, const T2& bv2); +RDKIT_DATASTRUCTS_EXPORT double AsymmetricSimilarity(const T1& bv1, + const T2& bv2); //! returns the Braun-Blanquet similarity between two bit vects /*! \return (bv1&bv2)_o / max(bv1_o,bv2_o) */ template -RDKIT_DATASTRUCTS_EXPORT double BraunBlanquetSimilarity(const T1& bv1, const T2& bv2); +RDKIT_DATASTRUCTS_EXPORT double BraunBlanquetSimilarity(const T1& bv1, + const T2& bv2); //! returns the Russel similarity between two bit vects /*! @@ -174,7 +184,8 @@ RDKIT_DATASTRUCTS_EXPORT double RusselSimilarity(const T1& bv1, const T2& bv2); + (bv1_n - bv1_o - bv2_o + (bv1&bv2)_o) / (2*bv1_n - bv1_o - bv2_o) */ template -RDKIT_DATASTRUCTS_EXPORT double RogotGoldbergSimilarity(const T1& bv1, const T2& bv2); +RDKIT_DATASTRUCTS_EXPORT double RogotGoldbergSimilarity(const T1& bv1, + const T2& bv2); //! returns the on bit similarity between two bit vects /*! @@ -190,7 +201,8 @@ RDKIT_DATASTRUCTS_EXPORT double OnBitSimilarity(const T1& bv1, const T2& bv2); template RDKIT_DATASTRUCTS_EXPORT int NumBitsInCommon(const T1& bv1, const T2& bv2); -RDKIT_DATASTRUCTS_EXPORT int NumBitsInCommon(const ExplicitBitVect& bv1, const ExplicitBitVect& bv2); +RDKIT_DATASTRUCTS_EXPORT int NumBitsInCommon(const ExplicitBitVect& bv1, + const ExplicitBitVect& bv2); //! returns the common-bit similarity (on and off) between two bit vects //! This is also called Manhattan similarity. @@ -217,7 +229,8 @@ RDKIT_DATASTRUCTS_EXPORT IntVect OffBitsInCommon(const T1& bv1, const T2& bv2); - (bv1&bv2)_o / bv2_o */ template -RDKIT_DATASTRUCTS_EXPORT DoubleVect OnBitProjSimilarity(const T1& bv1, const T2& bv2); +RDKIT_DATASTRUCTS_EXPORT DoubleVect OnBitProjSimilarity(const T1& bv1, + const T2& bv2); //! returns the on-bit projected similarities between two bit vects /*! @@ -229,7 +242,8 @@ RDKIT_DATASTRUCTS_EXPORT DoubleVect OnBitProjSimilarity(const T1& bv1, const T2& */ template -RDKIT_DATASTRUCTS_EXPORT DoubleVect OffBitProjSimilarity(const T1& bv1, const T2& bv2); +RDKIT_DATASTRUCTS_EXPORT DoubleVect OffBitProjSimilarity(const T1& bv1, + const T2& bv2); //! folds a bit vector \c factor times and returns the result /*! @@ -242,7 +256,8 @@ RDKIT_DATASTRUCTS_EXPORT DoubleVect OffBitProjSimilarity(const T1& bv1, const T2 Note: The caller is responsible for deleteing the result. */ template -RDKIT_DATASTRUCTS_EXPORT T1* FoldFingerprint(const T1& bv1, unsigned int factor = 2); +RDKIT_DATASTRUCTS_EXPORT T1* FoldFingerprint(const T1& bv1, + unsigned int factor = 2); //! returns a text representation of a bit vector (a string of 0s and 1s) /*! @@ -283,7 +298,8 @@ RDKIT_DATASTRUCTS_EXPORT std::string BitVectToBinaryText(const T1& bv1); */ template -RDKIT_DATASTRUCTS_EXPORT void UpdateBitVectFromFPSText(T1& bv1, const std::string& fps); +RDKIT_DATASTRUCTS_EXPORT void UpdateBitVectFromFPSText(T1& bv1, + const std::string& fps); //! updates a bit vector from a binary string representation of a bit vector (an // array of bytes) @@ -294,18 +310,24 @@ RDKIT_DATASTRUCTS_EXPORT void UpdateBitVectFromFPSText(T1& bv1, const std::strin */ template -RDKIT_DATASTRUCTS_EXPORT void UpdateBitVectFromBinaryText(T1& bv1, const std::string& fps); +RDKIT_DATASTRUCTS_EXPORT void UpdateBitVectFromBinaryText( + T1& bv1, const std::string& fps); // FIX: docs and tests please -RDKIT_DATASTRUCTS_EXPORT unsigned int CalcBitmapPopcount(const unsigned char* bv1, unsigned int nBytes); +RDKIT_DATASTRUCTS_EXPORT unsigned int CalcBitmapPopcount( + const unsigned char* bv1, unsigned int nBytes); -RDKIT_DATASTRUCTS_EXPORT double CalcBitmapTanimoto(const unsigned char* bv1, const unsigned char* bv2, - unsigned int nBytes); -RDKIT_DATASTRUCTS_EXPORT double CalcBitmapDice(const unsigned char* bv1, const unsigned char* bv2, - unsigned int nBytes); -RDKIT_DATASTRUCTS_EXPORT double CalcBitmapTversky(const unsigned char* bv1, const unsigned char* bv2, - unsigned int nBytes, double ca, double cb); -RDKIT_DATASTRUCTS_EXPORT bool CalcBitmapAllProbeBitsMatch(const unsigned char* probe, - const unsigned char* ref, unsigned int nBytes); +RDKIT_DATASTRUCTS_EXPORT double CalcBitmapTanimoto(const unsigned char* bv1, + const unsigned char* bv2, + unsigned int nBytes); +RDKIT_DATASTRUCTS_EXPORT double CalcBitmapDice(const unsigned char* bv1, + const unsigned char* bv2, + unsigned int nBytes); +RDKIT_DATASTRUCTS_EXPORT double CalcBitmapTversky(const unsigned char* bv1, + const unsigned char* bv2, + unsigned int nBytes, + double ca, double cb); +RDKIT_DATASTRUCTS_EXPORT bool CalcBitmapAllProbeBitsMatch( + const unsigned char* probe, const unsigned char* ref, unsigned int nBytes); #endif diff --git a/Code/DataStructs/BitVectUtils.h b/Code/DataStructs/BitVectUtils.h index 2e228d88d..d6d77207a 100644 --- a/Code/DataStructs/BitVectUtils.h +++ b/Code/DataStructs/BitVectUtils.h @@ -30,5 +30,6 @@ RDKIT_DATASTRUCTS_EXPORT void FromBitString(T &sbv, const std::string &s); Note: the caller is responsible for deleteing this. */ -RDKIT_DATASTRUCTS_EXPORT ExplicitBitVect *convertToExplicit(const SparseBitVect *sbv); +RDKIT_DATASTRUCTS_EXPORT ExplicitBitVect *convertToExplicit( + const SparseBitVect *sbv); #endif diff --git a/Code/DataStructs/DatastructsStreamOps.h b/Code/DataStructs/DatastructsStreamOps.h index 1091b57da..1b854bf58 100644 --- a/Code/DataStructs/DatastructsStreamOps.h +++ b/Code/DataStructs/DatastructsStreamOps.h @@ -37,12 +37,12 @@ namespace RDKit { class DataStructsExplicitBitVecPropHandler : public CustomPropHandler { -public: + public: const char *getPropName() const { return "ExplicitBVProp"; } bool canSerialize(const RDValue &value) const { return rdvalue_is(value); } - + bool read(std::istream &ss, RDValue &value) const { std::string v; int version = 0; @@ -51,13 +51,14 @@ public: value = bv; return true; } - + bool write(std::ostream &ss, const RDValue &value) const { try { - std::string output = rdvalue_cast(value).toString(); + std::string output = + rdvalue_cast(value).toString(); streamWrite(ss, output); return true; - } catch ( boost::bad_any_cast & ) { + } catch (boost::bad_any_cast &) { return false; } } @@ -65,9 +66,7 @@ public: CustomPropHandler *clone() const { return new DataStructsExplicitBitVecPropHandler; } - }; -} +} // namespace RDKit #endif - diff --git a/Code/DataStructs/DiscreteDistMat.h b/Code/DataStructs/DiscreteDistMat.h index 4caff0d86..103b5fdc4 100644 --- a/Code/DataStructs/DiscreteDistMat.h +++ b/Code/DataStructs/DiscreteDistMat.h @@ -26,5 +26,5 @@ class RDKIT_DATASTRUCTS_EXPORT DiscreteDistMat { unsigned int d_fourBitTab[256 * 256]; }; extern DiscreteDistMat *getDiscreteDistMat(); -} +} // namespace RDKit #endif diff --git a/Code/DataStructs/DiscreteValueVect.h b/Code/DataStructs/DiscreteValueVect.h index 83877f77a..635fb9fb0 100644 --- a/Code/DataStructs/DiscreteValueVect.h +++ b/Code/DataStructs/DiscreteValueVect.h @@ -132,13 +132,13 @@ class RDKIT_DATASTRUCTS_EXPORT DiscreteValueVect { void initFromText(const char *pkl, const unsigned int len); }; -RDKIT_DATASTRUCTS_EXPORT unsigned int computeL1Norm(const DiscreteValueVect &v1, - const DiscreteValueVect &v2); +RDKIT_DATASTRUCTS_EXPORT unsigned int computeL1Norm( + const DiscreteValueVect &v1, const DiscreteValueVect &v2); -RDKIT_DATASTRUCTS_EXPORT DiscreteValueVect operator+(const DiscreteValueVect &p1, - const DiscreteValueVect &p2); -RDKIT_DATASTRUCTS_EXPORT DiscreteValueVect operator-(const DiscreteValueVect &p1, - const DiscreteValueVect &p2); -} +RDKIT_DATASTRUCTS_EXPORT DiscreteValueVect +operator+(const DiscreteValueVect &p1, const DiscreteValueVect &p2); +RDKIT_DATASTRUCTS_EXPORT DiscreteValueVect +operator-(const DiscreteValueVect &p1, const DiscreteValueVect &p2); +} // namespace RDKit #endif diff --git a/Code/DataStructs/ExplicitBitVect.h b/Code/DataStructs/ExplicitBitVect.h index 3b2ba8ffd..2d142ad1e 100644 --- a/Code/DataStructs/ExplicitBitVect.h +++ b/Code/DataStructs/ExplicitBitVect.h @@ -44,7 +44,8 @@ class RDKIT_DATASTRUCTS_EXPORT ExplicitBitVect : public BitVect { //! construct directly from a dynamic_bitset pointer // takes ownership of the pointer ExplicitBitVect(boost::dynamic_bitset<> *bits) - : dp_bits(bits), d_size(static_cast(bits->size())), + : dp_bits(bits), + d_size(static_cast(bits->size())), d_numOnBits(static_cast(bits->count())){}; ~ExplicitBitVect(); diff --git a/Code/DataStructs/FPBReader.h b/Code/DataStructs/FPBReader.h index 35dba8137..2cb05cab5 100644 --- a/Code/DataStructs/FPBReader.h +++ b/Code/DataStructs/FPBReader.h @@ -169,17 +169,17 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { to be done */ - std::vector > getTanimotoNeighbors( + std::vector> getTanimotoNeighbors( const std::uint8_t *bv, double threshold = 0.7, bool usePopcountScreen = true) const; //! \overload - std::vector > getTanimotoNeighbors( + std::vector> getTanimotoNeighbors( boost::shared_array bv, double threshold = 0.7, bool usePopcountScreen = true) const { return getTanimotoNeighbors(bv.get(), threshold, usePopcountScreen); }; //! \overload - std::vector > getTanimotoNeighbors( + std::vector> getTanimotoNeighbors( const ExplicitBitVect &ebv, double threshold = 0.7, bool usePopcountScreen = true) const; @@ -218,17 +218,17 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { to be done */ - std::vector > getTverskyNeighbors( + std::vector> getTverskyNeighbors( const std::uint8_t *bv, double ca, double cb, double threshold = 0.7, bool usePopcountScreen = true) const; //! \overload - std::vector > getTverskyNeighbors( + std::vector> getTverskyNeighbors( boost::shared_array bv, double ca, double cb, double threshold = 0.7, bool usePopcountScreen = true) const { return getTverskyNeighbors(bv.get(), ca, cb, threshold, usePopcountScreen); }; //! \overload - std::vector > getTverskyNeighbors( + std::vector> getTverskyNeighbors( const ExplicitBitVect &ebv, double ca, double cb, double threshold = 0.7, bool usePopcountScreen = true) const; @@ -276,5 +276,5 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { df_lazyRead = lazyRead; } }; -} +} // namespace RDKit #endif diff --git a/Code/DataStructs/MultiFPBReader.h b/Code/DataStructs/MultiFPBReader.h index 630541ea2..fe6660284 100644 --- a/Code/DataStructs/MultiFPBReader.h +++ b/Code/DataStructs/MultiFPBReader.h @@ -185,15 +185,15 @@ class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader { /*! (i.e. where all the bits set in the query are also set in the db molecule) */ - std::vector > getContainingNeighbors( + std::vector> getContainingNeighbors( const std::uint8_t *bv, int numThreads = 1) const; //! \overload - std::vector > getContainingNeighbors( + std::vector> getContainingNeighbors( boost::shared_array bv, int numThreads = 1) const { return getContainingNeighbors(bv.get(), numThreads); }; //! \overload - std::vector > getContainingNeighbors( + std::vector> getContainingNeighbors( const ExplicitBitVect &ebv, int numThreads = 1) const; private: @@ -207,5 +207,5 @@ class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader { MultiFPBReader(const MultiFPBReader &); MultiFPBReader &operator=(const MultiFPBReader &); }; -} +} // namespace RDKit #endif diff --git a/Code/DataStructs/SparseBitVect.h b/Code/DataStructs/SparseBitVect.h index bf23ea083..7e2b460c8 100644 --- a/Code/DataStructs/SparseBitVect.h +++ b/Code/DataStructs/SparseBitVect.h @@ -57,7 +57,7 @@ class RDKIT_DATASTRUCTS_EXPORT SparseBitVect : public BitVect { bool operator[](const unsigned int which) const; SparseBitVect operator|(const SparseBitVect &) const; - SparseBitVect operator&(const SparseBitVect &) const; + SparseBitVect operator&(const SparseBitVect &)const; SparseBitVect operator^(const SparseBitVect &) const; SparseBitVect operator~() const; @@ -72,8 +72,12 @@ class RDKIT_DATASTRUCTS_EXPORT SparseBitVect : public BitVect { bool getBit(const IntVectIter which) const; bool getBit(const IntSetIter which) const; - unsigned int getNumOnBits() const { return static_cast(dp_bits->size()); }; - unsigned int getNumOffBits() const { return d_size - static_cast(dp_bits->size()); }; + unsigned int getNumOnBits() const { + return static_cast(dp_bits->size()); + }; + unsigned int getNumOffBits() const { + return d_size - static_cast(dp_bits->size()); + }; std::string toString() const; diff --git a/Code/DataStructs/SparseIntVect.h b/Code/DataStructs/SparseIntVect.h index c258f8d4d..ef484413c 100644 --- a/Code/DataStructs/SparseIntVect.h +++ b/Code/DataStructs/SparseIntVect.h @@ -464,7 +464,7 @@ void calcVectParams(const SparseIntVect &v1, } } } -} +} // namespace template double DiceSimilarity(const SparseIntVect &v1, @@ -543,6 +543,6 @@ double TanimotoSimilarity(const SparseIntVect &v1, bool returnDistance = false, double bounds = 0.0) { return TverskySimilarity(v1, v2, 1.0, 1.0, returnDistance, bounds); } -} +} // namespace RDKit #endif diff --git a/Code/DataStructs/base64.h b/Code/DataStructs/base64.h index cf813a3a4..05a70b021 100644 --- a/Code/DataStructs/base64.h +++ b/Code/DataStructs/base64.h @@ -21,7 +21,8 @@ Note: The caller is responsible for calling \c delete[] on the char array returned by this function. */ -RDKIT_DATASTRUCTS_EXPORT char *Base64Encode(const unsigned char *, const unsigned int); +RDKIT_DATASTRUCTS_EXPORT char *Base64Encode(const unsigned char *, + const unsigned int); //! return the base64 encoding of an array of chars /*! diff --git a/Code/Demos/RDKit/Basement/TemplEnum/TemplEnum.h b/Code/Demos/RDKit/Basement/TemplEnum/TemplEnum.h index 3bf2fb1ec..1fd82c884 100644 --- a/Code/Demos/RDKit/Basement/TemplEnum/TemplEnum.h +++ b/Code/Demos/RDKit/Basement/TemplEnum/TemplEnum.h @@ -35,5 +35,5 @@ RWMOL_SPTR_VECT enumerateLibrary(RWMol *mol, VECT_RWMOL_SPTR_VECT &sidechains, RWMOL_SPTR_VECT enumFromFiles(const char *templateName, std::vector &sidechainName); -} // end of TemplateEnum namespace +} // namespace TemplateEnum #endif diff --git a/Code/Demos/RDKit/Basement/xpcom/RDMolSupplierImpl.h b/Code/Demos/RDKit/Basement/xpcom/RDMolSupplierImpl.h index 3696ce1d9..3e40e29b3 100644 --- a/Code/Demos/RDKit/Basement/xpcom/RDMolSupplierImpl.h +++ b/Code/Demos/RDKit/Basement/xpcom/RDMolSupplierImpl.h @@ -5,7 +5,7 @@ namespace RDKit { class ROMol; class MolSupplier; -} +} // namespace RDKit class RDMolSupplier : public IRDMolSupplier { public: diff --git a/Code/DistGeom/BoundsMatrix.h b/Code/DistGeom/BoundsMatrix.h index 7e76800c2..b47af52b9 100644 --- a/Code/DistGeom/BoundsMatrix.h +++ b/Code/DistGeom/BoundsMatrix.h @@ -24,7 +24,8 @@ namespace DistGeom { with lower distance bounds on the lower traingle and upper bounds in the upper triangle */ -class RDKIT_DISTGEOMETRY_EXPORT BoundsMatrix : public RDNumeric::SquareMatrix { +class RDKIT_DISTGEOMETRY_EXPORT BoundsMatrix + : public RDNumeric::SquareMatrix { public: typedef boost::shared_array DATA_SPTR; @@ -115,6 +116,6 @@ class RDKIT_DISTGEOMETRY_EXPORT BoundsMatrix : public RDNumeric::SquareMatrix BoundsMatPtr; -} +} // namespace DistGeom #endif diff --git a/Code/DistGeom/ChiralSet.h b/Code/DistGeom/ChiralSet.h index 9acd38ea4..6b9a077df 100644 --- a/Code/DistGeom/ChiralSet.h +++ b/Code/DistGeom/ChiralSet.h @@ -53,6 +53,6 @@ class RDKIT_DISTGEOMETRY_EXPORT ChiralSet { typedef boost::shared_ptr ChiralSetPtr; typedef std::vector VECT_CHIRALSET; -} +} // namespace DistGeom #endif diff --git a/Code/DistGeom/ChiralViolationContrib.h b/Code/DistGeom/ChiralViolationContrib.h index e11706ea2..c5056e062 100644 --- a/Code/DistGeom/ChiralViolationContrib.h +++ b/Code/DistGeom/ChiralViolationContrib.h @@ -13,7 +13,8 @@ class ChiralSet; //! A term to capture the violation of chirality at an atom center //! -class RDKIT_DISTGEOMETRY_EXPORT ChiralViolationContrib : public ForceFields::ForceFieldContrib { +class RDKIT_DISTGEOMETRY_EXPORT ChiralViolationContrib + : public ForceFields::ForceFieldContrib { public: ChiralViolationContrib() : d_idx1(0), @@ -40,7 +41,7 @@ class RDKIT_DISTGEOMETRY_EXPORT ChiralViolationContrib : public ForceFields::For double getEnergy(double *pos) const; //! calculate the contribution of this contrib to the gradient at a given - //state + // state void getGrad(double *pos, double *grad) const; virtual ChiralViolationContrib *copy() const { return new ChiralViolationContrib(*this); @@ -97,6 +98,6 @@ class RDKIT_DISTGEOMETRY_EXPORT ChiralViolationContrib : public ForceFields::For double d_volUpper; double d_weight; }; -} +} // namespace DistGeom #endif diff --git a/Code/DistGeom/DistViolationContrib.h b/Code/DistGeom/DistViolationContrib.h index 82f1305ae..48ed6993e 100644 --- a/Code/DistGeom/DistViolationContrib.h +++ b/Code/DistGeom/DistViolationContrib.h @@ -16,7 +16,8 @@ namespace DistGeom { //! A term to capture the violation of the upper and lower bounds by //! distance between two points -class RDKIT_DISTGEOMETRY_EXPORT DistViolationContrib : public ForceFields::ForceFieldContrib { +class RDKIT_DISTGEOMETRY_EXPORT DistViolationContrib + : public ForceFields::ForceFieldContrib { public: DistViolationContrib() : d_end1Idx(0), d_end2Idx(0), d_ub(1000.0), d_lb(0.0), d_weight(1.0){}; @@ -47,6 +48,6 @@ class RDKIT_DISTGEOMETRY_EXPORT DistViolationContrib : public ForceFields::Force double d_lb; //!< lower bound on the distance between d_end1Idx,d_end2Idx double d_weight; //!< used to adjust relative contribution weights }; -} +} // namespace DistGeom #endif diff --git a/Code/DistGeom/FourthDimContrib.h b/Code/DistGeom/FourthDimContrib.h index 50deb6035..0e1c341ca 100644 --- a/Code/DistGeom/FourthDimContrib.h +++ b/Code/DistGeom/FourthDimContrib.h @@ -12,7 +12,8 @@ namespace DistGeom { //! A term used in penalizing chirality violations //! -class RDKIT_DISTGEOMETRY_EXPORT FourthDimContrib : public ForceFields::ForceFieldContrib { +class RDKIT_DISTGEOMETRY_EXPORT FourthDimContrib + : public ForceFields::ForceFieldContrib { public: FourthDimContrib() : d_idx(0), d_weight(0.0){}; @@ -42,7 +43,7 @@ class RDKIT_DISTGEOMETRY_EXPORT FourthDimContrib : public ForceFields::ForceFiel } //! calculate the contribution of this contrib to the gradient at a given - //state + // state void getGrad(double *pos, double *grad) const { PRECONDITION(dp_forceField, "no owner"); PRECONDITION(dp_forceField->dimension() == 4, @@ -59,6 +60,6 @@ class RDKIT_DISTGEOMETRY_EXPORT FourthDimContrib : public ForceFields::ForceFiel unsigned int d_idx; double d_weight; }; -} +} // namespace DistGeom #endif diff --git a/Code/DistGeom/TriangleSmooth.h b/Code/DistGeom/TriangleSmooth.h index eb26f0f66..b02cca3d6 100644 --- a/Code/DistGeom/TriangleSmooth.h +++ b/Code/DistGeom/TriangleSmooth.h @@ -26,9 +26,11 @@ namespace DistGeom { \param tol a tolerance (percent) for errors in the smoothing process */ -RDKIT_DISTGEOMETRY_EXPORT bool triangleSmoothBounds(BoundsMatrix *boundsMat, double tol = 0.); +RDKIT_DISTGEOMETRY_EXPORT bool triangleSmoothBounds(BoundsMatrix *boundsMat, + double tol = 0.); //! \overload -RDKIT_DISTGEOMETRY_EXPORT bool triangleSmoothBounds(BoundsMatPtr boundsMat, double tol = 0.); -} +RDKIT_DISTGEOMETRY_EXPORT bool triangleSmoothBounds(BoundsMatPtr boundsMat, + double tol = 0.); +} // namespace DistGeom #endif diff --git a/Code/Features/Feature.h b/Code/Features/Feature.h index b40199a17..10b1b166a 100644 --- a/Code/Features/Feature.h +++ b/Code/Features/Feature.h @@ -92,5 +92,5 @@ class ImplicitFeature { // FIX: add something correct for directions std::vector d_dirs; }; -} +} // namespace RDFeatures #endif diff --git a/Code/ForceField/Contrib.h b/Code/ForceField/Contrib.h index 165b735af..fcdfe5dc9 100644 --- a/Code/ForceField/Contrib.h +++ b/Code/ForceField/Contrib.h @@ -35,6 +35,6 @@ class RDKIT_FORCEFIELD_EXPORT ForceFieldContrib { protected: ForceField *dp_forceField; //!< our owning ForceField }; -} +} // namespace ForceFields #endif diff --git a/Code/ForceField/ForceField.h b/Code/ForceField/ForceField.h index f1175e5c9..e27e99b3a 100644 --- a/Code/ForceField/ForceField.h +++ b/Code/ForceField/ForceField.h @@ -229,5 +229,5 @@ class RDKIT_FORCEFIELD_EXPORT ForceField { //! initializes our internal distance matrix void initDistanceMatrix(); }; -} +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/AngleBend.h b/Code/ForceField/MMFF/AngleBend.h index 76628b2b0..ff393b5d4 100644 --- a/Code/ForceField/MMFF/AngleBend.h +++ b/Code/ForceField/MMFF/AngleBend.h @@ -53,18 +53,26 @@ class RDKIT_FORCEFIELD_EXPORT AngleBendContrib : public ForceFieldContrib { }; namespace Utils { //! returns the MMFF rest value for an angle -RDKIT_FORCEFIELD_EXPORT double calcAngleRestValue(const MMFFAngle *mmffAngleParams); +RDKIT_FORCEFIELD_EXPORT double calcAngleRestValue( + const MMFFAngle *mmffAngleParams); //! returns the MMFF force constant for an angle -RDKIT_FORCEFIELD_EXPORT double calcAngleForceConstant(const MMFFAngle *mmffAngleParams); +RDKIT_FORCEFIELD_EXPORT double calcAngleForceConstant( + const MMFFAngle *mmffAngleParams); //! calculates and returns the cosine of the angle between points p1, p2, p3 -RDKIT_FORCEFIELD_EXPORT double calcCosTheta(RDGeom::Point3D p1, RDGeom::Point3D p2, RDGeom::Point3D p3, - double dist1, double dist2); +RDKIT_FORCEFIELD_EXPORT double calcCosTheta(RDGeom::Point3D p1, + RDGeom::Point3D p2, + RDGeom::Point3D p3, double dist1, + double dist2); //! calculates and returns the angle bending MMFF energy -RDKIT_FORCEFIELD_EXPORT double calcAngleBendEnergy(const double theta0, const double ka, bool isLinear, - const double cosTheta); -RDKIT_FORCEFIELD_EXPORT void calcAngleBendGrad(RDGeom::Point3D *r, double *dist, double **g, - double &dE_dTheta, double &cosTheta, double &sinTheta); -} -} -} +RDKIT_FORCEFIELD_EXPORT double calcAngleBendEnergy(const double theta0, + const double ka, + bool isLinear, + const double cosTheta); +RDKIT_FORCEFIELD_EXPORT void calcAngleBendGrad(RDGeom::Point3D *r, double *dist, + double **g, double &dE_dTheta, + double &cosTheta, + double &sinTheta); +} // namespace Utils +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/AngleConstraint.h b/Code/ForceField/MMFF/AngleConstraint.h index 3ed2b105c..0a89c8530 100644 --- a/Code/ForceField/MMFF/AngleConstraint.h +++ b/Code/ForceField/MMFF/AngleConstraint.h @@ -19,7 +19,8 @@ namespace ForceFields { namespace MMFF { //! An angle range constraint modelled after a AngleBendContrib -class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib : public ForceFieldContrib { +class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib + : public ForceFieldContrib { public: AngleConstraintContrib() : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1){}; //! Constructor @@ -56,6 +57,6 @@ class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib : p double d_minAngleDeg, d_maxAngleDeg; //!< rest amplitudes of the angle double d_forceConstant; //!< force constant of the angle constraint }; -} -} +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/BondStretch.h b/Code/ForceField/MMFF/BondStretch.h index 4122a8b0b..e87c89f17 100644 --- a/Code/ForceField/MMFF/BondStretch.h +++ b/Code/ForceField/MMFF/BondStretch.h @@ -52,13 +52,16 @@ class RDKIT_FORCEFIELD_EXPORT BondStretchContrib : public ForceFieldContrib { namespace Utils { //! returns the MMFF rest length for a bond -RDKIT_FORCEFIELD_EXPORT double calcBondRestLength(const MMFFBond *mmffBondParams); +RDKIT_FORCEFIELD_EXPORT double calcBondRestLength( + const MMFFBond *mmffBondParams); //! returns the MMFF force constant for a bond -RDKIT_FORCEFIELD_EXPORT double calcBondForceConstant(const MMFFBond *mmffBondParams); +RDKIT_FORCEFIELD_EXPORT double calcBondForceConstant( + const MMFFBond *mmffBondParams); //! calculates and returns the bond stretching MMFF energy -RDKIT_FORCEFIELD_EXPORT double calcBondStretchEnergy(const double r0, const double kb, - const double distance); -} -} -} +RDKIT_FORCEFIELD_EXPORT double calcBondStretchEnergy(const double r0, + const double kb, + const double distance); +} // namespace Utils +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/DistanceConstraint.h b/Code/ForceField/MMFF/DistanceConstraint.h index 2e1a5c4f9..f11d74f4a 100644 --- a/Code/ForceField/MMFF/DistanceConstraint.h +++ b/Code/ForceField/MMFF/DistanceConstraint.h @@ -19,7 +19,8 @@ namespace ForceFields { namespace MMFF { //! A distance range constraint modelled after a BondStretchContrib -class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib : public ForceFieldContrib { +class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib + : public ForceFieldContrib { public: DistanceConstraintContrib() : d_end1Idx(-1), d_end2Idx(-1){}; //! Constructor @@ -55,6 +56,6 @@ class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib : public ForceFieldContr double d_minLen, d_maxLen; //!< rest length of the bond double d_forceConstant; //!< force constant of the bond }; -} -} +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/Nonbonded.h b/Code/ForceField/MMFF/Nonbonded.h index 6d2e48987..f861ffa4f 100644 --- a/Code/ForceField/MMFF/Nonbonded.h +++ b/Code/ForceField/MMFF/Nonbonded.h @@ -73,27 +73,32 @@ class RDKIT_FORCEFIELD_EXPORT EleContrib : public ForceFieldContrib { namespace Utils { //! calculates and returns the unscaled minimum distance (R*ij) for a MMFF VdW -//contact -RDKIT_FORCEFIELD_EXPORT double calcUnscaledVdWMinimum(MMFFVdWCollection *mmffVdW, - const MMFFVdW *mmffVdWParamsAtom1, - const MMFFVdW *mmffVdWParamsAtom2); +// contact +RDKIT_FORCEFIELD_EXPORT double calcUnscaledVdWMinimum( + MMFFVdWCollection *mmffVdW, const MMFFVdW *mmffVdWParamsAtom1, + const MMFFVdW *mmffVdWParamsAtom2); //! calculates and returns the unscaled well depth (epsilon) for a MMFF VdW -//contact -RDKIT_FORCEFIELD_EXPORT double calcUnscaledVdWWellDepth(double R_star_ij, - const MMFFVdW *mmffVdWParamsIAtom, - const MMFFVdW *mmffVdWParamsJAtom); +// contact +RDKIT_FORCEFIELD_EXPORT double calcUnscaledVdWWellDepth( + double R_star_ij, const MMFFVdW *mmffVdWParamsIAtom, + const MMFFVdW *mmffVdWParamsJAtom); //! scales the VdW parameters -RDKIT_FORCEFIELD_EXPORT void scaleVdWParams(double &R_star_ij, double &wellDepth, - MMFFVdWCollection *mmffVdW, - const MMFFVdW *mmffVdWParamsIAtom, - const MMFFVdW *mmffVdWParamsJAtom); +RDKIT_FORCEFIELD_EXPORT void scaleVdWParams(double &R_star_ij, + double &wellDepth, + MMFFVdWCollection *mmffVdW, + const MMFFVdW *mmffVdWParamsIAtom, + const MMFFVdW *mmffVdWParamsJAtom); //! calculates and returns the Van der Waals MMFF energy -RDKIT_FORCEFIELD_EXPORT double calcVdWEnergy(const double dist, const double R_star_ij, - const double wellDepth); +RDKIT_FORCEFIELD_EXPORT double calcVdWEnergy(const double dist, + const double R_star_ij, + const double wellDepth); //! calculates and returns the electrostatic MMFF energy -RDKIT_FORCEFIELD_EXPORT double calcEleEnergy(unsigned int idx1, unsigned int idx2, double dist, - double chargeTerm, std::uint8_t dielModel, bool is1_4); -} -} -} +RDKIT_FORCEFIELD_EXPORT double calcEleEnergy(unsigned int idx1, + unsigned int idx2, double dist, + double chargeTerm, + std::uint8_t dielModel, + bool is1_4); +} // namespace Utils +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/OopBend.h b/Code/ForceField/MMFF/OopBend.h index 1ef783f4c..7ad0abbb1 100644 --- a/Code/ForceField/MMFF/OopBend.h +++ b/Code/ForceField/MMFF/OopBend.h @@ -49,13 +49,17 @@ and the angle formed by atom1-atom2-atom3 namespace Utils { //! calculates and returns the Wilson angle (in degrees) -RDKIT_FORCEFIELD_EXPORT double calcOopChi(const RDGeom::Point3D &iPoint, const RDGeom::Point3D &jPoint, - const RDGeom::Point3D &kPoint, const RDGeom::Point3D &lPoint); +RDKIT_FORCEFIELD_EXPORT double calcOopChi(const RDGeom::Point3D &iPoint, + const RDGeom::Point3D &jPoint, + const RDGeom::Point3D &kPoint, + const RDGeom::Point3D &lPoint); //! returns the out-of-plane force constant koop -RDKIT_FORCEFIELD_EXPORT double calcOopBendForceConstant(const MMFFOop *mmffOopParams); +RDKIT_FORCEFIELD_EXPORT double calcOopBendForceConstant( + const MMFFOop *mmffOopParams); //! calculates and returns the out-of-plane MMFF energy -RDKIT_FORCEFIELD_EXPORT double calcOopBendEnergy(const double chi, const double koop); -} -} -} +RDKIT_FORCEFIELD_EXPORT double calcOopBendEnergy(const double chi, + const double koop); +} // namespace Utils +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/Params.h b/Code/ForceField/MMFF/Params.h index d5ac6cf07..bf6d3e86c 100644 --- a/Code/ForceField/MMFF/Params.h +++ b/Code/ForceField/MMFF/Params.h @@ -191,8 +191,9 @@ class RDKIT_FORCEFIELD_EXPORT MMFFAromCollection { private: //! to force this to be a singleton, the constructor must be private MMFFAromCollection(const std::uint8_t mmffArom[]); - static class std::unique_ptr ds_instance; //!< the singleton - std::vector d_params; //!< the aromatic type vector + static class std::unique_ptr + ds_instance; //!< the singleton + std::vector d_params; //!< the aromatic type vector }; class RDKIT_FORCEFIELD_EXPORT MMFFDefCollection { @@ -236,7 +237,8 @@ class RDKIT_FORCEFIELD_EXPORT MMFFDefCollection { private: //! to force this to be a singleton, the constructor must be private MMFFDefCollection(std::string mmffDef); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map d_params; //!< the parameter map #else @@ -276,8 +278,9 @@ class RDKIT_FORCEFIELD_EXPORT MMFFPropCollection { return ((res != d_params.end()) ? &((*res).second) : NULL); #else std::pair::const_iterator, - std::vector::const_iterator> bounds = - std::equal_range(d_iAtomType.begin(), d_iAtomType.end(), atomType); + std::vector::const_iterator> + bounds = + std::equal_range(d_iAtomType.begin(), d_iAtomType.end(), atomType); return ((bounds.first != bounds.second) ? &d_params[bounds.first - d_iAtomType.begin()] @@ -288,7 +291,8 @@ class RDKIT_FORCEFIELD_EXPORT MMFFPropCollection { private: //! to force this to be a singleton, the constructor must be private MMFFPropCollection(std::string mmffProp); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map d_params; //!< the parameter map #else @@ -337,7 +341,8 @@ class RDKIT_FORCEFIELD_EXPORT MMFFPBCICollection { private: //! to force this to be a singleton, the constructor must be private MMFFPBCICollection(std::string mmffPBCI); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map d_params; //!< the parameter map #else @@ -383,7 +388,7 @@ class RDKIT_FORCEFIELD_EXPORT MMFFChgCollection { } #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map >::const_iterator res1; + std::map>::const_iterator res1; std::map::const_iterator res2; res1 = d_params[bondType].find(canIAtomType); if (res1 != d_params[bondType].end()) { @@ -394,7 +399,8 @@ class RDKIT_FORCEFIELD_EXPORT MMFFChgCollection { } #else std::pair::const_iterator, - std::vector::const_iterator> bounds; + std::vector::const_iterator> + bounds; bounds = std::equal_range(d_iAtomType.begin(), d_iAtomType.end(), canIAtomType); @@ -421,15 +427,15 @@ class RDKIT_FORCEFIELD_EXPORT MMFFChgCollection { private: //! to force this to be a singleton, the constructor must be private MMFFChgCollection(std::string mmffChg); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton //!< the parameter 3D-map #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP - std::map< - const unsigned int, - std::map > > + std::map>> d_params; //!< the parameter 3D-map #else - std::vector d_params; //! the parameter vector + std::vector d_params; //! the parameter vector std::vector d_iAtomType; //! atom type vector for atom i std::vector d_jAtomType; //! atom type vector for atom j std::vector d_bondType; //! bond type vector for bond i-j @@ -473,10 +479,10 @@ class RDKIT_FORCEFIELD_EXPORT MMFFBondCollection { #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map > >::const_iterator + std::map>>::const_iterator res1; std::map >::const_iterator res2; + std::map>::const_iterator res2; std::map::const_iterator res3; res1 = d_params.find(bondType); if (res1 != d_params.end()) { @@ -490,7 +496,8 @@ class RDKIT_FORCEFIELD_EXPORT MMFFBondCollection { } #else std::pair::const_iterator, - std::vector::const_iterator> bounds; + std::vector::const_iterator> + bounds; bounds = std::equal_range(d_iAtomType.begin(), d_iAtomType.end(), canAtomType); if (bounds.first != bounds.second) { @@ -516,14 +523,14 @@ class RDKIT_FORCEFIELD_EXPORT MMFFBondCollection { private: //! to force this to be a singleton, the constructor must be private MMFFBondCollection(std::string mmffBond); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP - std::map< - const unsigned int, - std::map > > + std::map>> d_params; //!< the parameter 3D-map #else - std::vector d_params; //!< the parameter vector + std::vector d_params; //!< the parameter vector std::vector d_iAtomType; //! atom type vector for atom i std::vector d_jAtomType; //! atom type vector for atom j std::vector d_bondType; //! bond type vector for bond i-j @@ -564,7 +571,7 @@ class RDKIT_FORCEFIELD_EXPORT MMFFBndkCollection { } #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map >::const_iterator res1; + std::map>::const_iterator res1; std::map::const_iterator res2; res1 = d_params.find(canAtomicNum); if (res1 != d_params.end()) { @@ -575,7 +582,8 @@ class RDKIT_FORCEFIELD_EXPORT MMFFBndkCollection { } #else std::pair::const_iterator, - std::vector::const_iterator> bounds; + std::vector::const_iterator> + bounds; bounds = std::equal_range(d_iAtomicNum.begin(), d_iAtomicNum.end(), canAtomicNum); if (bounds.first != bounds.second) { @@ -595,12 +603,13 @@ class RDKIT_FORCEFIELD_EXPORT MMFFBndkCollection { private: //! to force this to be a singleton, the constructor must be private MMFFBndkCollection(std::string mmffBndk); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP - std::map > + std::map> d_params; //!< the parameter 2D-map #else - std::vector d_params; //!< the parameter vector + std::vector d_params; //!< the parameter vector std::vector d_iAtomicNum; //! atomic number vector for atom i std::vector d_jAtomicNum; //! atomic number vector for atom j #endif @@ -644,8 +653,8 @@ class RDKIT_FORCEFIELD_EXPORT MMFFHerschbachLaurieCollection { } #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map >::const_iterator res1; + std::map>::const_iterator + res1; std::map::const_iterator res2; res1 = d_params.find(canIRow); if (res1 != d_params.end()) { @@ -656,7 +665,8 @@ class RDKIT_FORCEFIELD_EXPORT MMFFHerschbachLaurieCollection { } #else std::pair::const_iterator, - std::vector::const_iterator> bounds; + std::vector::const_iterator> + bounds; bounds = std::equal_range(d_iRow.begin(), d_iRow.end(), canIRow); if (bounds.first != bounds.second) { bounds = std::equal_range( @@ -674,10 +684,11 @@ class RDKIT_FORCEFIELD_EXPORT MMFFHerschbachLaurieCollection { private: //! to force this to be a singleton, the constructor must be private MMFFHerschbachLaurieCollection(std::string mmffHerschbachLaurie); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map > + std::map> d_params; //!< the parameter 2D-map #else std::vector d_params; //!< the parameter vector @@ -722,8 +733,9 @@ class RDKIT_FORCEFIELD_EXPORT MMFFCovRadPauEleCollection { return ((res != d_params.end()) ? &((*res).second) : NULL); #else std::pair::const_iterator, - std::vector::const_iterator> bounds = - std::equal_range(d_atomicNum.begin(), d_atomicNum.end(), atomicNum); + std::vector::const_iterator> + bounds = + std::equal_range(d_atomicNum.begin(), d_atomicNum.end(), atomicNum); return ((bounds.first != bounds.second) ? &d_params[bounds.first - d_atomicNum.begin()] @@ -734,13 +746,14 @@ class RDKIT_FORCEFIELD_EXPORT MMFFCovRadPauEleCollection { private: //! to force this to be a singleton, the constructor must be private MMFFCovRadPauEleCollection(std::string mmffCovRadPauEle); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map d_params; //!< the parameter map #else - std::vector d_params; //!< the parameter vector - std::vector d_atomicNum; //!< the atomic number vector + std::vector d_params; //!< the parameter vector + std::vector d_atomicNum; //!< the atomic number vector #endif }; @@ -784,14 +797,14 @@ class RDKIT_FORCEFIELD_EXPORT MMFFAngleCollection { std::map > > >:: + std::map>>>:: const_iterator res1; std::map > >:: - const_iterator res2; + std::map>>::const_iterator + res2; std::map >::const_iterator res3; + std::map>::const_iterator res3; std::map::const_iterator res4; while ((iter < 4) && (!mmffAngleParams)) { unsigned int canIAtomType = (*mmffDef)(iAtomType)->eqLevel[iter]; @@ -818,10 +831,12 @@ class RDKIT_FORCEFIELD_EXPORT MMFFAngleCollection { } #else std::pair::const_iterator, - std::vector::const_iterator> jBounds = - std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType); + std::vector::const_iterator> + jBounds = + std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType); std::pair::const_iterator, - std::vector::const_iterator> bounds; + std::vector::const_iterator> + bounds; if (jBounds.first != jBounds.second) { while ((iter < 4) && (!mmffAngleParams)) { unsigned int canIAtomType = (*mmffDef)(iAtomType)->eqLevel[iter]; @@ -861,20 +876,20 @@ class RDKIT_FORCEFIELD_EXPORT MMFFAngleCollection { private: //! to force this to be a singleton, the constructor must be private MMFFAngleCollection(std::string mmffAngle); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map > > > + std::map>>> d_params; //!< the parameter 4D-map #else - std::vector d_params; //!< the parameter vector + std::vector d_params; //!< the parameter vector std::vector d_iAtomType; //! atom type vector for atom i std::vector d_jAtomType; //! atom type vector for atom j std::vector d_kAtomType; //! atom type vector for atom k - std::vector - d_angleType; //! angle type vector for angle i-j-k + std::vector d_angleType; //! angle type vector for angle i-j-k #endif }; @@ -922,14 +937,14 @@ class RDKIT_FORCEFIELD_EXPORT MMFFStbnCollection { std::map > > >:: + std::map>>>:: const_iterator res1; std::map > >::const_iterator + std::map>>::const_iterator res2; std::map >::const_iterator res3; + std::map>::const_iterator res3; std::map::const_iterator res4; res1 = d_params.find(canStretchBendType); if (res1 != d_params.end()) { @@ -946,10 +961,12 @@ class RDKIT_FORCEFIELD_EXPORT MMFFStbnCollection { } #else std::pair::const_iterator, - std::vector::const_iterator> jBounds = - std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType); + std::vector::const_iterator> + jBounds = + std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType); std::pair::const_iterator, - std::vector::const_iterator> bounds; + std::vector::const_iterator> + bounds; if (jBounds.first != jBounds.second) { bounds = std::equal_range( d_iAtomType.begin() + (jBounds.first - d_jAtomType.begin()), @@ -980,15 +997,16 @@ class RDKIT_FORCEFIELD_EXPORT MMFFStbnCollection { private: //! to force this to be a singleton, the constructor must be private MMFFStbnCollection(std::string mmffStbn); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map > > > + std::map>>> d_params; //!< the parameter 4D-map #else - std::vector d_params; //!< the parameter vector + std::vector d_params; //!< the parameter vector std::vector d_iAtomType; //! atom type vector for atom i std::vector d_jAtomType; //! atom type vector for atom j std::vector d_kAtomType; //! atom type vector for atom k @@ -1027,10 +1045,10 @@ class RDKIT_FORCEFIELD_EXPORT MMFFDfsbCollection { const unsigned int periodicTableRow3) { std::map > >::const_iterator + std::map>>::const_iterator res1; std::map >::const_iterator res2; + std::map>::const_iterator res2; std::map::const_iterator res3; const MMFFStbn *mmffDfsbParams = NULL; bool swap = false; @@ -1058,10 +1076,10 @@ class RDKIT_FORCEFIELD_EXPORT MMFFDfsbCollection { private: //! to force this to be a singleton, the constructor must be private MMFFDfsbCollection(std::string mmffDfsb); - static class std::unique_ptr ds_instance; //!< the singleton - std::map< - const unsigned int, - std::map > > + static class std::unique_ptr + ds_instance; //!< the singleton + std::map>> d_params; //!< the parameter 3D-map }; @@ -1106,14 +1124,14 @@ class RDKIT_FORCEFIELD_EXPORT MMFFOopCollection { std::map > > >:: + std::map>>>:: const_iterator res1; std::map > >::const_iterator + std::map>>::const_iterator res2; std::map >::const_iterator res3; + std::map>::const_iterator res3; std::map::const_iterator res4; while ((iter < 4) && (!mmffOopParams)) { canIKLAtomType[0] = (*mmffDef)(iAtomType)->eqLevel[iter]; @@ -1138,10 +1156,12 @@ class RDKIT_FORCEFIELD_EXPORT MMFFOopCollection { } #else std::pair::const_iterator, - std::vector::const_iterator> jBounds = - std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType); + std::vector::const_iterator> + jBounds = + std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType); std::pair::const_iterator, - std::vector::const_iterator> bounds; + std::vector::const_iterator> + bounds; if (jBounds.first != jBounds.second) { while ((iter < 4) && (!mmffOopParams)) { canIKLAtomType[0] = (*mmffDef)(iAtomType)->eqLevel[iter]; @@ -1178,15 +1198,16 @@ class RDKIT_FORCEFIELD_EXPORT MMFFOopCollection { private: //! to force this to be a singleton, the constructor must be private MMFFOopCollection(const bool isMMFFs, std::string mmffOop); - static class std::unique_ptr ds_instance[2]; //!< the singleton + static class std::unique_ptr + ds_instance[2]; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map > > > + std::map>>> d_params; //!< the parameter 4D-map #else - std::vector d_params; //!< the parameter vector + std::vector d_params; //!< the parameter vector std::vector d_iAtomType; //! atom type vector for atom i std::vector d_jAtomType; //! atom type vector for atom j std::vector d_kAtomType; //! atom type vector for atom k @@ -1237,29 +1258,30 @@ class RDKIT_FORCEFIELD_EXPORT MMFFTorCollection { #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map< const unsigned int, - std::map< - const unsigned int, - std::map > > > >:: + std::map>>>>:: const_iterator res1; std::map > > >:: + std::map>>>:: const_iterator res2; std::map > >::const_iterator + std::map>>::const_iterator res3; std::map >::const_iterator res4; + std::map>::const_iterator res4; std::map::const_iterator res5; #else std::pair::const_iterator, - std::vector::const_iterator> jBounds; + std::vector::const_iterator> + jBounds; std::pair::const_iterator, - std::vector::const_iterator> bounds; + std::vector::const_iterator> + bounds; #endif while (((iter < maxIter) && ((!mmffTorParams) || (maxIter == 4))) || @@ -1363,17 +1385,19 @@ class RDKIT_FORCEFIELD_EXPORT MMFFTorCollection { private: //! to force this to be a singleton, the constructor must be private MMFFTorCollection(const bool isMMFFs, std::string mmffTor); - static class std::unique_ptr ds_instance[2]; //!< the singleton + static class std::unique_ptr + ds_instance[2]; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP - std::map > > > > + std::map< + const unsigned int, + std::map< + const unsigned int, + std::map>>>> d_params; //!< the parameter 5D-map #else - std::vector d_params; //!< the parameter vector + std::vector d_params; //!< the parameter vector std::vector d_iAtomType; //! atom type vector for atom i std::vector d_jAtomType; //! atom type vector for atom j std::vector d_kAtomType; //! atom type vector for atom k @@ -1420,8 +1444,9 @@ class RDKIT_FORCEFIELD_EXPORT MMFFVdWCollection { return (res != d_params.end() ? &((*res).second) : NULL); #else std::pair::const_iterator, - std::vector::const_iterator> bounds = - std::equal_range(d_atomType.begin(), d_atomType.end(), atomType); + std::vector::const_iterator> + bounds = + std::equal_range(d_atomType.begin(), d_atomType.end(), atomType); return ((bounds.first != bounds.second) ? &d_params[bounds.first - d_atomType.begin()] @@ -1432,15 +1457,16 @@ class RDKIT_FORCEFIELD_EXPORT MMFFVdWCollection { private: //! to force this to be a singleton, the constructor must be private MMFFVdWCollection(std::string mmffVdW); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr + ds_instance; //!< the singleton #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP std::map d_params; //!< the parameter map #else - std::vector d_params; //!< the parameter vector + std::vector d_params; //!< the parameter vector std::vector d_atomType; //! atom type vector #endif }; -} -} +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/PositionConstraint.h b/Code/ForceField/MMFF/PositionConstraint.h index 034aa6275..e71c03016 100644 --- a/Code/ForceField/MMFF/PositionConstraint.h +++ b/Code/ForceField/MMFF/PositionConstraint.h @@ -20,7 +20,8 @@ namespace ForceFields { namespace MMFF { //! A position constraint of the type 0.5k * deltaX^2 -class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib : public ForceFieldContrib { +class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib + : public ForceFieldContrib { public: PositionConstraintContrib() : d_atIdx(-1){}; //! Constructor @@ -49,6 +50,6 @@ class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib : public ForceFieldContr RDGeom::Point3D d_pos0; //!< reference position double d_forceConstant; //!< force constant of the bond }; -} -} +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/StretchBend.h b/Code/ForceField/MMFF/StretchBend.h index f28bb6bf3..d2158d7f0 100644 --- a/Code/ForceField/MMFF/StretchBend.h +++ b/Code/ForceField/MMFF/StretchBend.h @@ -64,7 +64,7 @@ RDKIT_FORCEFIELD_EXPORT std::pair calcStbnForceConstants( RDKIT_FORCEFIELD_EXPORT std::pair calcStretchBendEnergy( const double deltaDist1, const double deltaDist2, const double deltaTheta, const std::pair forceConstants); -} -} -} +} // namespace Utils +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/TorsionAngle.h b/Code/ForceField/MMFF/TorsionAngle.h index 23258246d..b1c04c96d 100644 --- a/Code/ForceField/MMFF/TorsionAngle.h +++ b/Code/ForceField/MMFF/TorsionAngle.h @@ -25,7 +25,8 @@ namespace MMFF { class MMFFTor; //! the torsion term for MMFF -class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT TorsionAngleContrib : public ForceFieldContrib { +class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT TorsionAngleContrib + : public ForceFieldContrib { public: TorsionAngleContrib() : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){}; @@ -59,18 +60,22 @@ class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT TorsionAngleContrib : publ namespace Utils { //! calculates and returns the cosine of a torsion angle RDKIT_FORCEFIELD_EXPORT double calcTorsionCosPhi(const RDGeom::Point3D &iPoint, - const RDGeom::Point3D &jPoint, - const RDGeom::Point3D &kPoint, - const RDGeom::Point3D &lPoint); + const RDGeom::Point3D &jPoint, + const RDGeom::Point3D &kPoint, + const RDGeom::Point3D &lPoint); //! returns the 3-tuple of a torsion angle force constants -RDKIT_FORCEFIELD_EXPORT boost::tuple calcTorsionForceConstant( - const MMFFTor *mmffTorParams); +RDKIT_FORCEFIELD_EXPORT boost::tuple +calcTorsionForceConstant(const MMFFTor *mmffTorParams); //! calculates and returns the torsional MMFF energy -RDKIT_FORCEFIELD_EXPORT double calcTorsionEnergy(const double V1, const double V2, const double V3, - const double cosPhi); -RDKIT_FORCEFIELD_EXPORT void calcTorsionGrad(RDGeom::Point3D *r, RDGeom::Point3D *t, double *d, - double **g, double &sinTerm, double &cosPhi); -} -} -} +RDKIT_FORCEFIELD_EXPORT double calcTorsionEnergy(const double V1, + const double V2, + const double V3, + const double cosPhi); +RDKIT_FORCEFIELD_EXPORT void calcTorsionGrad(RDGeom::Point3D *r, + RDGeom::Point3D *t, double *d, + double **g, double &sinTerm, + double &cosPhi); +} // namespace Utils +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/MMFF/TorsionConstraint.h b/Code/ForceField/MMFF/TorsionConstraint.h index ca28da066..e2f384d9a 100644 --- a/Code/ForceField/MMFF/TorsionConstraint.h +++ b/Code/ForceField/MMFF/TorsionConstraint.h @@ -19,7 +19,8 @@ namespace ForceFields { namespace MMFF { //! A dihedral angle range constraint modelled after a TorsionContrib -class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib : public ForceFieldContrib { +class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib + : public ForceFieldContrib { public: TorsionConstraintContrib() : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){}; @@ -60,6 +61,6 @@ class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib : d_maxDihedralDeg; //!< rest amplitudes of the dihedral angle double d_forceConstant; //!< force constant of the angle constraint }; -} -} +} // namespace MMFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/UFF/AngleBend.h b/Code/ForceField/UFF/AngleBend.h index c1eab6c1d..a572440ad 100644 --- a/Code/ForceField/UFF/AngleBend.h +++ b/Code/ForceField/UFF/AngleBend.h @@ -76,13 +76,15 @@ namespace Utils { \param at3Params pointer to the parameters for atom 3 */ -RDKIT_FORCEFIELD_EXPORT double calcAngleForceConstant(double theta0, double bondOrder12, - double bondOrder23, const AtomicParams *at1Params, - const AtomicParams *at2Params, - const AtomicParams *at3Params); -RDKIT_FORCEFIELD_EXPORT void calcAngleBendGrad(RDGeom::Point3D *r, double *dist, double **g, - double &dE_dTheta, double &cosTheta, double &sinTheta); -} -} -} +RDKIT_FORCEFIELD_EXPORT double calcAngleForceConstant( + double theta0, double bondOrder12, double bondOrder23, + const AtomicParams *at1Params, const AtomicParams *at2Params, + const AtomicParams *at3Params); +RDKIT_FORCEFIELD_EXPORT void calcAngleBendGrad(RDGeom::Point3D *r, double *dist, + double **g, double &dE_dTheta, + double &cosTheta, + double &sinTheta); +} // namespace Utils +} // namespace UFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/UFF/AngleConstraint.h b/Code/ForceField/UFF/AngleConstraint.h index 02a44716a..27e568bba 100644 --- a/Code/ForceField/UFF/AngleConstraint.h +++ b/Code/ForceField/UFF/AngleConstraint.h @@ -19,7 +19,8 @@ namespace ForceFields { namespace UFF { //! An angle range constraint modelled after a AngleBendContrib -class RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib : public ForceFieldContrib { +class RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib + : public ForceFieldContrib { public: AngleConstraintContrib() : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1){}; //! Constructor @@ -55,6 +56,6 @@ class RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib : public ForceFieldContrib double d_minAngleDeg, d_maxAngleDeg; //!< rest amplitudes of the angle double d_forceConstant; //!< force constant of the angle constraint }; -} -} +} // namespace UFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/UFF/BondStretch.h b/Code/ForceField/UFF/BondStretch.h index 3f9b0a1a5..fbf4d5fb6 100644 --- a/Code/ForceField/UFF/BondStretch.h +++ b/Code/ForceField/UFF/BondStretch.h @@ -59,8 +59,9 @@ namespace Utils { \return the rest length */ -RDKIT_FORCEFIELD_EXPORT double calcBondRestLength(double bondOrder, const AtomicParams *end1Params, - const AtomicParams *end2Params); +RDKIT_FORCEFIELD_EXPORT double calcBondRestLength( + double bondOrder, const AtomicParams *end1Params, + const AtomicParams *end2Params); //! calculates and returns the UFF force constant for a bond /*! @@ -72,9 +73,10 @@ RDKIT_FORCEFIELD_EXPORT double calcBondRestLength(double bondOrder, const Atomic \return the force constant */ -RDKIT_FORCEFIELD_EXPORT double calcBondForceConstant(double restLength, const AtomicParams *end1Params, - const AtomicParams *end2Params); -} -} -} +RDKIT_FORCEFIELD_EXPORT double calcBondForceConstant( + double restLength, const AtomicParams *end1Params, + const AtomicParams *end2Params); +} // namespace Utils +} // namespace UFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/UFF/DistanceConstraint.h b/Code/ForceField/UFF/DistanceConstraint.h index e184c53dc..224aa0078 100644 --- a/Code/ForceField/UFF/DistanceConstraint.h +++ b/Code/ForceField/UFF/DistanceConstraint.h @@ -19,7 +19,8 @@ namespace ForceFields { namespace UFF { //! A distance range constraint modelled after a BondStretchContrib -class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib : public ForceFieldContrib { +class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib + : public ForceFieldContrib { public: DistanceConstraintContrib() : d_end1Idx(-1), d_end2Idx(-1){}; //! Constructor @@ -55,6 +56,6 @@ class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib : public ForceFieldContr double d_minLen, d_maxLen; //!< rest length of the bond double d_forceConstant; //!< force constant of the bond }; -} -} +} // namespace UFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/UFF/Inversion.h b/Code/ForceField/UFF/Inversion.h index 3142995bb..fa999916e 100644 --- a/Code/ForceField/UFF/Inversion.h +++ b/Code/ForceField/UFF/Inversion.h @@ -56,9 +56,9 @@ namespace Utils { //! calculates and returns the cosine of the Y angle in an improper torsion //! (see UFF paper, equation 19) RDKIT_FORCEFIELD_EXPORT double calculateCosY(const RDGeom::Point3D &iPoint, - const RDGeom::Point3D &jPoint, - const RDGeom::Point3D &kPoint, - const RDGeom::Point3D &lPoint); + const RDGeom::Point3D &jPoint, + const RDGeom::Point3D &kPoint, + const RDGeom::Point3D &lPoint); //! calculates and returns the UFF force constant for an improper torsion /*! @@ -72,7 +72,7 @@ RDKIT_FORCEFIELD_EXPORT double calculateCosY(const RDGeom::Point3D &iPoint, */ RDKIT_FORCEFIELD_EXPORT boost::tuple calcInversionCoefficientsAndForceConstant(int at2AtomicNum, bool isCBoundToO); -} -} -} +} // namespace Utils +} // namespace UFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/UFF/Nonbonded.h b/Code/ForceField/UFF/Nonbonded.h index d87ad62b8..a40c72e09 100644 --- a/Code/ForceField/UFF/Nonbonded.h +++ b/Code/ForceField/UFF/Nonbonded.h @@ -66,8 +66,8 @@ namespace Utils { \return the position of the minimum */ -RDKIT_FORCEFIELD_EXPORT double calcNonbondedMinimum(const AtomicParams *at1Params, - const AtomicParams *at2Params); +RDKIT_FORCEFIELD_EXPORT double calcNonbondedMinimum( + const AtomicParams *at1Params, const AtomicParams *at2Params); //! calculates and returns the UFF well depth for a vdW contact /*! @@ -78,9 +78,9 @@ RDKIT_FORCEFIELD_EXPORT double calcNonbondedMinimum(const AtomicParams *at1Param \return the depth of the well */ -RDKIT_FORCEFIELD_EXPORT double calcNonbondedDepth(const AtomicParams *at1Params, - const AtomicParams *at2Params); -} -} -} +RDKIT_FORCEFIELD_EXPORT double calcNonbondedDepth( + const AtomicParams *at1Params, const AtomicParams *at2Params); +} // namespace Utils +} // namespace UFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/UFF/Params.h b/Code/ForceField/UFF/Params.h index c076e9f90..dcdb27987 100644 --- a/Code/ForceField/UFF/Params.h +++ b/Code/ForceField/UFF/Params.h @@ -90,7 +90,7 @@ const double lambda = 0.1332; //!< scaling factor for rBO correction const double G = 332.06; //!< bond force constant prefactor const double amideBondOrder = 1.41; //!< special case bond order for amide C-N bonds. -}; +}; // namespace Params //! singleton class for retrieving UFF AtomParams /*! @@ -146,9 +146,9 @@ class RDKIT_FORCEFIELD_EXPORT ParamCollection { private: //! to force this to be a singleton, the constructor must be private ParamCollection(std::string paramData); - static class std::unique_ptr ds_instance; //!< the singleton + static class std::unique_ptr ds_instance; //!< the singleton std::map d_params; //!< the parameter map }; -} -} +} // namespace UFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/UFF/PositionConstraint.h b/Code/ForceField/UFF/PositionConstraint.h index 9e0617eee..6128cd1bc 100644 --- a/Code/ForceField/UFF/PositionConstraint.h +++ b/Code/ForceField/UFF/PositionConstraint.h @@ -20,7 +20,8 @@ namespace ForceFields { namespace UFF { //! A position constraint of the type 0.5k * deltaX^2 -class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib : public ForceFieldContrib { +class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib + : public ForceFieldContrib { public: PositionConstraintContrib() : d_atIdx(-1){}; //! Constructor @@ -49,6 +50,6 @@ class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib : public ForceFieldContr RDGeom::Point3D d_pos0; //!< reference position double d_forceConstant; //!< force constant of the bond }; -} -} +} // namespace UFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/UFF/TorsionAngle.h b/Code/ForceField/UFF/TorsionAngle.h index 240a6c95e..a6e558e90 100644 --- a/Code/ForceField/UFF/TorsionAngle.h +++ b/Code/ForceField/UFF/TorsionAngle.h @@ -95,15 +95,19 @@ class RDKIT_FORCEFIELD_EXPORT TorsionAngleContrib : public ForceFieldContrib { namespace Utils { //! calculates and returns the cosine of a torsion angle -RDKIT_FORCEFIELD_EXPORT double calculateCosTorsion(const RDGeom::Point3D &p1, const RDGeom::Point3D &p2, - const RDGeom::Point3D &p3, - const RDGeom::Point3D &p4); -RDKIT_FORCEFIELD_EXPORT void calcTorsionGrad(RDGeom::Point3D *r, RDGeom::Point3D *t, double *d, - double **g, double &sinTerm, double &cosPhi); -RDKIT_FORCEFIELD_EXPORT double equation17(double bondOrder23, const AtomicParams *at2Params, - const AtomicParams *at3Params); +RDKIT_FORCEFIELD_EXPORT double calculateCosTorsion(const RDGeom::Point3D &p1, + const RDGeom::Point3D &p2, + const RDGeom::Point3D &p3, + const RDGeom::Point3D &p4); +RDKIT_FORCEFIELD_EXPORT void calcTorsionGrad(RDGeom::Point3D *r, + RDGeom::Point3D *t, double *d, + double **g, double &sinTerm, + double &cosPhi); +RDKIT_FORCEFIELD_EXPORT double equation17(double bondOrder23, + const AtomicParams *at2Params, + const AtomicParams *at3Params); RDKIT_FORCEFIELD_EXPORT bool isInGroup6(int num); -} -} -} +} // namespace Utils +} // namespace UFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/UFF/TorsionConstraint.h b/Code/ForceField/UFF/TorsionConstraint.h index 0e68f27f8..26dc6abe2 100644 --- a/Code/ForceField/UFF/TorsionConstraint.h +++ b/Code/ForceField/UFF/TorsionConstraint.h @@ -19,7 +19,8 @@ namespace ForceFields { namespace UFF { //! A dihedral angle range constraint modelled after a TorsionContrib -class RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib : public ForceFieldContrib { +class RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib + : public ForceFieldContrib { public: TorsionConstraintContrib() : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){}; @@ -60,6 +61,6 @@ class RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib : public ForceFieldContri d_maxDihedralDeg; //!< rest amplitudes of the dihedral angle double d_forceConstant; //!< force constant of the angle constraint }; -} -} +} // namespace UFF +} // namespace ForceFields #endif diff --git a/Code/ForceField/Wrap/PyForceField.h b/Code/ForceField/Wrap/PyForceField.h index dd18c759d..852c43fe8 100644 --- a/Code/ForceField/Wrap/PyForceField.h +++ b/Code/ForceField/Wrap/PyForceField.h @@ -49,9 +49,7 @@ class PyForceField { double calcEnergyWithPos(const python::object &pos = python::object()); - double calcEnergy() { - return calcEnergyWithPos(); - } + double calcEnergy() { return calcEnergyWithPos(); } PyObject *calcGradWithPos(const python::object &pos = python::object()); @@ -62,7 +60,8 @@ class PyForceField { return this->field->minimize(maxIts, forceTol, energyTol); } - boost::python::tuple minimizeTrajectory(unsigned int snapshotFreq, int maxIts, double forceTol, double energyTol); + boost::python::tuple minimizeTrajectory(unsigned int snapshotFreq, int maxIts, + double forceTol, double energyTol); void initialize() { PRECONDITION(this->field, "no force field"); @@ -72,15 +71,15 @@ class PyForceField { unsigned int dimension() { PRECONDITION(this->field, "no force field"); return this->field->dimension(); - } + } unsigned int numPoints() { PRECONDITION(this->field, "no force field"); return this->field->numPoints(); - } + } // private: - std::vector > extraPoints; + std::vector> extraPoints; boost::shared_ptr field; }; @@ -173,4 +172,4 @@ PyObject *getUFFInversionParams(const RDKit::ROMol &mol, const unsigned int idx4); PyObject *getUFFVdWParams(const RDKit::ROMol &mol, const unsigned int idx1, const unsigned int idx2); -} +} // namespace ForceFields diff --git a/Code/Geometry/Grid3D.h b/Code/Geometry/Grid3D.h index ee2bdcd03..565256d19 100644 --- a/Code/Geometry/Grid3D.h +++ b/Code/Geometry/Grid3D.h @@ -49,6 +49,6 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Grid3D { virtual const RDKit::DiscreteValueVect *getOccupancyVect() const = 0; }; -} +} // namespace RDGeom #endif diff --git a/Code/Geometry/GridUtils.h b/Code/Geometry/GridUtils.h index a7ec4b04c..8e76cdcf4 100644 --- a/Code/Geometry/GridUtils.h +++ b/Code/Geometry/GridUtils.h @@ -20,12 +20,15 @@ class Point3D; //! calculate the tversky index between the shapes encoded on two grids /*! - tversky(S1,S2) = | S1&S2 | / ( alpha * ( | S1 | - | S1&S2 | ) + beta * ( | S2 | - | S1&S2 | ) + | S1&S2 | ) + tversky(S1,S2) = | S1&S2 | / ( alpha * ( | S1 | - | S1&S2 | ) + beta * ( | + S2 | - | S1&S2 | ) + | S1&S2 | ) */ template -RDKIT_RDGEOMETRYLIB_EXPORT double tverskyIndex(const GRIDTYPE &grid1, const GRIDTYPE &grid2, double alpha, double beta); +RDKIT_RDGEOMETRYLIB_EXPORT double tverskyIndex(const GRIDTYPE &grid1, + const GRIDTYPE &grid2, + double alpha, double beta); //! calculate the tanimoto distance between the shapes encoded on two grids /*! @@ -35,7 +38,8 @@ RDKIT_RDGEOMETRYLIB_EXPORT double tverskyIndex(const GRIDTYPE &grid1, const GRID */ template -RDKIT_RDGEOMETRYLIB_EXPORT double tanimotoDistance(const GRIDTYPE &grid1, const GRIDTYPE &grid2); +RDKIT_RDGEOMETRYLIB_EXPORT double tanimotoDistance(const GRIDTYPE &grid1, + const GRIDTYPE &grid2); //! calculate the protrude distance between the shapes encoded on two grids /*! @@ -43,17 +47,18 @@ RDKIT_RDGEOMETRYLIB_EXPORT double tanimotoDistance(const GRIDTYPE &grid1, const */ template -RDKIT_RDGEOMETRYLIB_EXPORT double protrudeDistance(const GRIDTYPE &grid1, const GRIDTYPE &grid2); +RDKIT_RDGEOMETRYLIB_EXPORT double protrudeDistance(const GRIDTYPE &grid1, + const GRIDTYPE &grid2); //! calculate the grid centroid within a window of a point -RDKIT_RDGEOMETRYLIB_EXPORT Point3D computeGridCentroid(const UniformGrid3D &grid, const Point3D &pt, - double windowRadius, double &weightSum); +RDKIT_RDGEOMETRYLIB_EXPORT Point3D +computeGridCentroid(const UniformGrid3D &grid, const Point3D &pt, + double windowRadius, double &weightSum); //! find terminal points of a shape encoded on a grid //! this is part of the subshape implementation -RDKIT_RDGEOMETRYLIB_EXPORT std::vector findGridTerminalPoints(const UniformGrid3D &grid, - double windowRadius, - double inclusionFraction); -} +RDKIT_RDGEOMETRYLIB_EXPORT std::vector findGridTerminalPoints( + const UniformGrid3D &grid, double windowRadius, double inclusionFraction); +} // namespace RDGeom #endif diff --git a/Code/Geometry/Transform2D.h b/Code/Geometry/Transform2D.h index 099c42c76..a10db32e9 100644 --- a/Code/Geometry/Transform2D.h +++ b/Code/Geometry/Transform2D.h @@ -18,7 +18,8 @@ namespace RDGeom { class Point2D; const unsigned int DIM_2D = 3; -class RDKIT_RDGEOMETRYLIB_EXPORT Transform2D : public RDNumeric::SquareMatrix { +class RDKIT_RDGEOMETRYLIB_EXPORT Transform2D + : public RDNumeric::SquareMatrix { public: //! \brief Constructor /*! @@ -69,7 +70,7 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Transform2D : public RDNumeric::SquareMatrix { +class RDKIT_RDGEOMETRYLIB_EXPORT Transform3D + : public RDNumeric::SquareMatrix { public: //! Constructor /*! @@ -76,7 +77,7 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Transform3D : public RDNumeric::SquareMatrix > VECT_SH_PTR; + typedef boost::shared_ptr> VECT_SH_PTR; PointND(unsigned int dim) { RDNumeric::Vector *nvec = new RDNumeric::Vector(dim, 0.0); @@ -513,22 +516,35 @@ typedef std::map INT_POINT2D_MAP; typedef INT_POINT2D_MAP::iterator INT_POINT2D_MAP_I; typedef INT_POINT2D_MAP::const_iterator INT_POINT2D_MAP_CI; -RDKIT_RDGEOMETRYLIB_EXPORT std::ostream &operator<<(std::ostream &target, const RDGeom::Point &pt); +RDKIT_RDGEOMETRYLIB_EXPORT std::ostream &operator<<(std::ostream &target, + const RDGeom::Point &pt); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point3D operator+(const RDGeom::Point3D &p1, const RDGeom::Point3D &p2); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point3D operator-(const RDGeom::Point3D &p1, const RDGeom::Point3D &p2); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point3D operator*(const RDGeom::Point3D &p1, double v); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point3D operator/(const RDGeom::Point3D &p1, double v); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point3D operator+(const RDGeom::Point3D &p1, + const RDGeom::Point3D &p2); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point3D operator-(const RDGeom::Point3D &p1, + const RDGeom::Point3D &p2); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point3D operator*(const RDGeom::Point3D &p1, + double v); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point3D operator/(const RDGeom::Point3D &p1, + double v); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point2D operator+(const RDGeom::Point2D &p1, const RDGeom::Point2D &p2); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point2D operator-(const RDGeom::Point2D &p1, const RDGeom::Point2D &p2); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point2D operator*(const RDGeom::Point2D &p1, double v); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point2D operator/(const RDGeom::Point2D &p1, double v); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point2D operator+(const RDGeom::Point2D &p1, + const RDGeom::Point2D &p2); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point2D operator-(const RDGeom::Point2D &p1, + const RDGeom::Point2D &p2); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point2D operator*(const RDGeom::Point2D &p1, + double v); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point2D operator/(const RDGeom::Point2D &p1, + double v); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::PointND operator+(const RDGeom::PointND &p1, const RDGeom::PointND &p2); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::PointND operator-(const RDGeom::PointND &p1, const RDGeom::PointND &p2); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::PointND operator*(const RDGeom::PointND &p1, double v); -RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::PointND operator/(const RDGeom::PointND &p1, double v); -} +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::PointND operator+(const RDGeom::PointND &p1, + const RDGeom::PointND &p2); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::PointND operator-(const RDGeom::PointND &p1, + const RDGeom::PointND &p2); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::PointND operator*(const RDGeom::PointND &p1, + double v); +RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::PointND operator/(const RDGeom::PointND &p1, + double v); +} // namespace RDGeom #endif diff --git a/Code/GraphMol/Atom.h b/Code/GraphMol/Atom.h index 17a11728e..b4c48032e 100644 --- a/Code/GraphMol/Atom.h +++ b/Code/GraphMol/Atom.h @@ -422,10 +422,12 @@ RDKIT_GRAPHMOL_EXPORT std::string getAtomValue(const Atom *atom); //! Sets the supplemental label that will follow the atom when writing // smiles strings. -RDKIT_GRAPHMOL_EXPORT void setSupplementalSmilesLabel(Atom *atom, const std::string &label); +RDKIT_GRAPHMOL_EXPORT void setSupplementalSmilesLabel(Atom *atom, + const std::string &label); RDKIT_GRAPHMOL_EXPORT std::string getSupplementalSmilesLabel(const Atom *atom); -}; +}; // namespace RDKit //! allows Atom objects to be dumped to streams -RDKIT_GRAPHMOL_EXPORT std::ostream &operator<<(std::ostream &target, const RDKit::Atom &at); +RDKIT_GRAPHMOL_EXPORT std::ostream &operator<<(std::ostream &target, + const RDKit::Atom &at); #endif diff --git a/Code/GraphMol/AtomIterators.h b/Code/GraphMol/AtomIterators.h index c10759441..f0304067f 100644 --- a/Code/GraphMol/AtomIterators.h +++ b/Code/GraphMol/AtomIterators.h @@ -202,6 +202,6 @@ class RDKIT_GRAPHMOL_EXPORT MatchingAtomIterator_ { int _findPrev(int from); }; -} /* end o namespace */ +} // namespace RDKit #endif diff --git a/Code/GraphMol/Basement/FeatTrees/FeatTree.h b/Code/GraphMol/Basement/FeatTrees/FeatTree.h index ac1b45e92..bcfa6958e 100644 --- a/Code/GraphMol/Basement/FeatTrees/FeatTree.h +++ b/Code/GraphMol/Basement/FeatTrees/FeatTree.h @@ -42,7 +42,8 @@ struct FeatTreeEdge_t { typedef boost::property FeatTreeEdge; typedef boost::adjacency_list FeatTreeGraph; + FeatTreeNode, FeatTreeEdge> + FeatTreeGraph; typedef boost::shared_ptr FeatTreeGraphSPtr; typedef boost::property_map::type @@ -56,6 +57,6 @@ typedef boost::property_map::type FeatTreeGraphSPtr molToBaseTree(const ROMol &mol); void baseTreeToFeatTree(FeatTreeGraph &baseTree); -} -} +} // namespace FeatTrees +} // namespace RDKit #endif diff --git a/Code/GraphMol/Basement/FeatTrees/FeatTreeUtils.h b/Code/GraphMol/Basement/FeatTrees/FeatTreeUtils.h index c96b83520..412232ed6 100644 --- a/Code/GraphMol/Basement/FeatTrees/FeatTreeUtils.h +++ b/Code/GraphMol/Basement/FeatTrees/FeatTreeUtils.h @@ -34,6 +34,6 @@ void addBondsFromNonringAtoms(const ROMol &mol, FeatTreeGraph &featGraph, std::vector &atomIndices); void addZeroNodes(FeatTreeGraph &featGraph); void replaceCycles(FeatTreeGraph &featGraph); -} -} +} // namespace FeatTrees +} // namespace RDKit #endif diff --git a/Code/GraphMol/Bond.h b/Code/GraphMol/Bond.h index 5a4723fb4..e744d8a09 100644 --- a/Code/GraphMol/Bond.h +++ b/Code/GraphMol/Bond.h @@ -339,9 +339,10 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps { void initBond(); }; -}; +}; // namespace RDKit //! allows Bond objects to be dumped to streams -RDKIT_GRAPHMOL_EXPORT extern std::ostream &operator<<(std::ostream &target, const RDKit::Bond &b); +RDKIT_GRAPHMOL_EXPORT extern std::ostream &operator<<(std::ostream &target, + const RDKit::Bond &b); #endif diff --git a/Code/GraphMol/BondIterators.h b/Code/GraphMol/BondIterators.h index eb9b920ac..cf85dd4c8 100644 --- a/Code/GraphMol/BondIterators.h +++ b/Code/GraphMol/BondIterators.h @@ -70,6 +70,6 @@ class RDKIT_GRAPHMOL_EXPORT ConstBondIterator_ { ROMol::EDGE_ITER _beg, _end, _pos; ROMol const *_mol; }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/Canon.h b/Code/GraphMol/Canon.h index a284a8792..2dd49020a 100644 --- a/Code/GraphMol/Canon.h +++ b/Code/GraphMol/Canon.h @@ -110,14 +110,12 @@ typedef boost::tuple PossibleType; and the like are changed to fit the canonical traversal order */ -RDKIT_GRAPHMOL_EXPORT void canonicalizeFragment(ROMol &mol, int atomIdx, - std::vector &colors, - const std::vector &ranks, - MolStack &molStack, - const boost::dynamic_bitset<> *bondsInPlay = 0, - const std::vector *bondSymbols = 0, - bool doIsomericSmiles = false, - bool doRandom = false); +RDKIT_GRAPHMOL_EXPORT void canonicalizeFragment( + ROMol &mol, int atomIdx, std::vector &colors, + const std::vector &ranks, MolStack &molStack, + const boost::dynamic_bitset<> *bondsInPlay = 0, + const std::vector *bondSymbols = 0, + bool doIsomericSmiles = false, bool doRandom = false); } // end of namespace Canon } // end of namespace RDKit diff --git a/Code/GraphMol/ChemReactions/Enumerate/CartesianProduct.h b/Code/GraphMol/ChemReactions/Enumerate/CartesianProduct.h index edfa65d8b..11db74991 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/CartesianProduct.h +++ b/Code/GraphMol/ChemReactions/Enumerate/CartesianProduct.h @@ -67,7 +67,8 @@ namespace RDKit { See EnumerationStrategyBase for more details and usage. */ -class RDKIT_CHEMREACTIONS_EXPORT CartesianProductStrategy : public EnumerationStrategyBase { +class RDKIT_CHEMREACTIONS_EXPORT CartesianProductStrategy + : public EnumerationStrategyBase { size_t m_numPermutationsProcessed; public: @@ -76,7 +77,8 @@ class RDKIT_CHEMREACTIONS_EXPORT CartesianProductStrategy : public EnumerationSt using EnumerationStrategyBase::initialize; - virtual void initializeStrategy(const ChemicalReaction &, const EnumerationTypes::BBS &) { + virtual void initializeStrategy(const ChemicalReaction &, + const EnumerationTypes::BBS &) { m_numPermutationsProcessed = 0; } @@ -93,7 +95,8 @@ class RDKIT_CHEMREACTIONS_EXPORT CartesianProductStrategy : public EnumerationSt } virtual boost::uint64_t getPermutationIdx() const { - return m_numPermutationsProcessed; } + return m_numPermutationsProcessed; + } virtual operator bool() const { return hasNext(); } @@ -128,18 +131,18 @@ class RDKIT_CHEMREACTIONS_EXPORT CartesianProductStrategy : public EnumerationSt } private: -#ifdef RDK_USE_BOOST_SERIALIZATION +#ifdef RDK_USE_BOOST_SERIALIZATION friend class boost::serialization::access; template void serialize(Archive &ar, const unsigned int /*version*/) { ar &boost::serialization::base_object(*this); ar &m_numPermutationsProcessed; } -#endif +#endif }; -} +} // namespace RDKit -#ifdef RDK_USE_BOOST_SERIALIZATION +#ifdef RDK_USE_BOOST_SERIALIZATION BOOST_CLASS_VERSION(RDKit::CartesianProductStrategy, 1) #endif diff --git a/Code/GraphMol/ChemReactions/Enumerate/Enumerate.h b/Code/GraphMol/ChemReactions/Enumerate/Enumerate.h index 48e508a9a..86aed58e3 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/Enumerate.h +++ b/Code/GraphMol/ChemReactions/Enumerate/Enumerate.h @@ -43,7 +43,6 @@ future releases. */ - namespace RDKit { //! This is a class for providing enumeration options that control @@ -58,29 +57,24 @@ namespace RDKit { pass chemical sanitization. Note that if the product template itself\n\ does not pass sanitization, then none of the products will. */ -struct RDKIT_CHEMREACTIONS_EXPORT EnumerationParams -{ +struct RDKIT_CHEMREACTIONS_EXPORT EnumerationParams { int reagentMaxMatchCount; bool sanePartialProducts; - EnumerationParams() : - reagentMaxMatchCount(INT_MAX), sanePartialProducts(false) { - } + EnumerationParams() + : reagentMaxMatchCount(INT_MAX), sanePartialProducts(false) {} - EnumerationParams(const EnumerationParams &rhs) : - reagentMaxMatchCount(rhs.reagentMaxMatchCount), - sanePartialProducts(rhs.sanePartialProducts) { - } + EnumerationParams(const EnumerationParams &rhs) + : reagentMaxMatchCount(rhs.reagentMaxMatchCount), + sanePartialProducts(rhs.sanePartialProducts) {} }; - //! Helper function, remove reagents that are incompatible // with the reaction. // rxn must be sanitized, initialized and preprocessed. // this happens automatically in EnumerateLibrary RDKIT_CHEMREACTIONS_EXPORT EnumerationTypes::BBS removeNonmatchingReagents( - const ChemicalReaction &rxn, - EnumerationTypes::BBS bbs, - const EnumerationParams ¶ms=EnumerationParams()); + const ChemicalReaction &rxn, EnumerationTypes::BBS bbs, + const EnumerationParams ¶ms = EnumerationParams()); //! This is a class for running reactions on sets of reagents. /*! @@ -115,8 +109,8 @@ RDKIT_CHEMREACTIONS_EXPORT EnumerationTypes::BBS removeNonmatchingReagents( \endverbatim */ - -class RDKIT_CHEMREACTIONS_EXPORT EnumerateLibrary : public EnumerateLibraryBase { +class RDKIT_CHEMREACTIONS_EXPORT EnumerateLibrary + : public EnumerateLibraryBase { EnumerationTypes::BBS m_bbs; public: @@ -127,11 +121,11 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerateLibrary : public EnumerateLibraryBase EnumerateLibrary(const ChemicalReaction &rxn, const EnumerationTypes::BBS &reagents, - const EnumerationParams & params = EnumerationParams()); + const EnumerationParams ¶ms = EnumerationParams()); EnumerateLibrary(const ChemicalReaction &rxn, const EnumerationTypes::BBS &reagents, const EnumerationStrategyBase &enumerator, - const EnumerationParams & params = EnumerationParams()); + const EnumerationParams ¶ms = EnumerationParams()); EnumerateLibrary(const EnumerateLibrary &rhs); //! Return the reagents used in the library @@ -190,5 +184,5 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerateLibrary : public EnumerateLibraryBase RDKIT_CHEMREACTIONS_EXPORT bool EnumerateLibraryCanSerialize(); -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/ChemReactions/Enumerate/EnumerateBase.h b/Code/GraphMol/ChemReactions/Enumerate/EnumerateBase.h index 1cfdc8cd7..e0a4c0c8e 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/EnumerateBase.h +++ b/Code/GraphMol/ChemReactions/Enumerate/EnumerateBase.h @@ -120,7 +120,7 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerateLibraryBase { //! get the next set of products as smiles // This returns a vector of a vector strings. // Each result vector corresponds for a product template. - virtual std::vector > nextSmiles(); + virtual std::vector> nextSmiles(); //! Get the current position into the reagent vectors // Use getState/setState to save/restart the enumeration @@ -196,5 +196,5 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerateLibraryBase { #ifdef RDK_USE_BOOST_SERIALIZATION BOOST_SERIALIZATION_ASSUME_ABSTRACT(EnumerateLibraryBase) #endif -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/ChemReactions/Enumerate/EnumerateTypes.h b/Code/GraphMol/ChemReactions/Enumerate/EnumerateTypes.h index 6a2a901eb..6d3ec5158 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/EnumerateTypes.h +++ b/Code/GraphMol/ChemReactions/Enumerate/EnumerateTypes.h @@ -54,6 +54,6 @@ typedef std::vector BBS; //! building_blocks.push_back( BBS[1][groups[1] ); //! rxn.runReactants( building_blocks ); typedef std::vector RGROUPS; -} -} +} // namespace EnumerationTypes +} // namespace RDKit #endif diff --git a/Code/GraphMol/ChemReactions/Enumerate/EnumerationPickler.h b/Code/GraphMol/ChemReactions/Enumerate/EnumerationPickler.h index 4b46df294..9abc628cf 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/EnumerationPickler.h +++ b/Code/GraphMol/ChemReactions/Enumerate/EnumerationPickler.h @@ -38,20 +38,23 @@ namespace RDKit { namespace EnumerationStrategyPickler { //! pickles a EnumerationStrategy and adds the results to a stream \c ss -RDKIT_CHEMREACTIONS_EXPORT void pickle(const boost::shared_ptr &enumerator, - std::ostream &ss); -RDKIT_CHEMREACTIONS_EXPORT void pickle(const boost::shared_ptr &enumerator, - std::string &s); +RDKIT_CHEMREACTIONS_EXPORT void pickle( + const boost::shared_ptr &enumerator, + std::ostream &ss); +RDKIT_CHEMREACTIONS_EXPORT void pickle( + const boost::shared_ptr &enumerator, + std::string &s); //! constructs a EnumerationStrategy from a pickle stored in a string //! Since an EnumerationStrategyBase is polymorphic, this must return //! a shared pointer to the EnumerationStrategyBase -RDKIT_CHEMREACTIONS_EXPORT boost::shared_ptr fromPickle(std::istream &pickle); +RDKIT_CHEMREACTIONS_EXPORT boost::shared_ptr +fromPickle(std::istream &pickle); //! a pointer to the EnumerationStrategyBase -RDKIT_CHEMREACTIONS_EXPORT boost::shared_ptr fromPickle( - const std::string &pickle); -} -} +RDKIT_CHEMREACTIONS_EXPORT boost::shared_ptr +fromPickle(const std::string &pickle); +} // namespace EnumerationStrategyPickler +} // namespace RDKit #endif diff --git a/Code/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h b/Code/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h index 84d11a173..e6aab72e6 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h +++ b/Code/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h @@ -53,7 +53,8 @@ namespace RDKit { //! class for flagging enumeration strategy errors -class RDKIT_CHEMREACTIONS_EXPORT EnumerationStrategyException : public std::exception { +class RDKIT_CHEMREACTIONS_EXPORT EnumerationStrategyException + : public std::exception { public: EnumerationStrategyException(const char *msg) : _msg(msg){}; EnumerationStrategyException(const std::string &msg) : _msg(msg){}; @@ -71,7 +72,7 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerationStrategyException : public std::exce */ template EnumerationTypes::RGROUPS getSizesFromBBs( - const std::vector > &bbs) { + const std::vector> &bbs) { EnumerationTypes::RGROUPS sizes; for (size_t i = 0; i < bbs.size(); ++i) sizes.push_back(bbs[i].size()); return sizes; @@ -88,8 +89,9 @@ RDKIT_CHEMREACTIONS_EXPORT EnumerationTypes::RGROUPS getSizesFromReactants( //! Helper function for enumeration, bbs are stored in a //! std::vector< std::vector > // -RDKIT_CHEMREACTIONS_EXPORT MOL_SPTR_VECT getReactantsFromRGroups(const std::vector &bbs, - const EnumerationTypes::RGROUPS &rgroups); +RDKIT_CHEMREACTIONS_EXPORT MOL_SPTR_VECT +getReactantsFromRGroups(const std::vector &bbs, + const EnumerationTypes::RGROUPS &rgroups); //! computeNumProducts //! Returns the number of possible product combination from @@ -98,7 +100,8 @@ RDKIT_CHEMREACTIONS_EXPORT MOL_SPTR_VECT getReactantsFromRGroups(const std::vect //! number will not fit into the machines integer type. //! n.b. An overflow simply means there are a lot of products //! not that they cannot be enumerated -RDKIT_CHEMREACTIONS_EXPORT boost::uint64_t computeNumProducts(const EnumerationTypes::RGROUPS &sizes); +RDKIT_CHEMREACTIONS_EXPORT boost::uint64_t computeNumProducts( + const EnumerationTypes::RGROUPS &sizes); //! Base Class for enumeration strageties //! Usage: @@ -204,7 +207,7 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerationStrategyBase { #ifdef RDK_USE_BOOST_SERIALIZATION BOOST_SERIALIZATION_ASSUME_ABSTRACT(EnumerationStrategyBase) #endif -} +} // namespace RDKit #ifdef RDK_USE_BOOST_SERIALIZATION BOOST_CLASS_VERSION(RDKit::EnumerationStrategyBase, 1) diff --git a/Code/GraphMol/ChemReactions/Enumerate/EvenSamplePairs.h b/Code/GraphMol/ChemReactions/Enumerate/EvenSamplePairs.h index c659bc479..b50320921 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/EvenSamplePairs.h +++ b/Code/GraphMol/ChemReactions/Enumerate/EvenSamplePairs.h @@ -52,13 +52,14 @@ namespace RDKit { See EnumeartionStrategyBase for more details. */ -class RDKIT_CHEMREACTIONS_EXPORT EvenSamplePairsStrategy : public EnumerationStrategyBase { +class RDKIT_CHEMREACTIONS_EXPORT EvenSamplePairsStrategy + : public EnumerationStrategyBase { boost::uint64_t m_numPermutationsProcessed; std::vector used_count; - std::vector > var_used; - std::vector > pair_used; - std::vector > pair_counts; + std::vector> var_used; + std::vector> pair_used; + std::vector> pair_counts; std::set selected; boost::uint64_t seed; // last seed for permutation (starts at 0) @@ -189,7 +190,7 @@ class RDKIT_CHEMREACTIONS_EXPORT EvenSamplePairsStrategy : public EnumerationStr } #endif }; -} +} // namespace RDKit BOOST_CLASS_VERSION(RDKit::EvenSamplePairsStrategy, 1) diff --git a/Code/GraphMol/ChemReactions/Enumerate/RandomSample.h b/Code/GraphMol/ChemReactions/Enumerate/RandomSample.h index 4b7da3f6f..858347bf3 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/RandomSample.h +++ b/Code/GraphMol/ChemReactions/Enumerate/RandomSample.h @@ -62,10 +62,11 @@ namespace RDKit { See EnumerationStrategyBase for more details and usage. */ -class RDKIT_CHEMREACTIONS_EXPORT RandomSampleStrategy : public EnumerationStrategyBase { +class RDKIT_CHEMREACTIONS_EXPORT RandomSampleStrategy + : public EnumerationStrategyBase { boost::uint64_t m_numPermutationsProcessed; boost::minstd_rand m_rng; - std::vector > m_distributions; + std::vector> m_distributions; public: RandomSampleStrategy() @@ -81,7 +82,8 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleStrategy : public EnumerationStrate using EnumerationStrategyBase::initialize; - virtual void initializeStrategy(const ChemicalReaction &, const EnumerationTypes::BBS &) { + virtual void initializeStrategy(const ChemicalReaction &, + const EnumerationTypes::BBS &) { m_distributions.clear(); for (size_t i = 0; i < m_permutationSizes.size(); ++i) { m_distributions.push_back(boost::random::uniform_int_distribution<>( @@ -105,7 +107,8 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleStrategy : public EnumerationStrate } virtual boost::uint64_t getPermutationIdx() const { - return m_numPermutationsProcessed; } + return m_numPermutationsProcessed; + } virtual operator bool() const { return true; } @@ -114,7 +117,7 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleStrategy : public EnumerationStrate } private: -#ifdef RDK_USE_BOOST_SERIALIZATION +#ifdef RDK_USE_BOOST_SERIALIZATION friend class boost::serialization::access; template @@ -152,11 +155,11 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleStrategy : public EnumerationStrate void serialize(Archive &ar, const unsigned int file_version) { boost::serialization::split_member(ar, *this, file_version); } -#endif +#endif }; -} +} // namespace RDKit -#ifdef RDK_USE_BOOST_SERIALIZATION +#ifdef RDK_USE_BOOST_SERIALIZATION BOOST_CLASS_VERSION(RDKit::RandomSampleStrategy, 1) #endif diff --git a/Code/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h b/Code/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h index dbd6e3712..6a7c25156 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h +++ b/Code/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h @@ -65,13 +65,14 @@ namespace RDKit { See EnumerationStrategyBase for more details and usage. */ -class RDKIT_CHEMREACTIONS_EXPORT RandomSampleAllBBsStrategy : public EnumerationStrategyBase { +class RDKIT_CHEMREACTIONS_EXPORT RandomSampleAllBBsStrategy + : public EnumerationStrategyBase { boost::uint64_t m_numPermutationsProcessed; size_t m_offset; size_t m_maxoffset; boost::minstd_rand m_rng; - std::vector > m_distributions; + std::vector> m_distributions; public: RandomSampleAllBBsStrategy() @@ -88,7 +89,8 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleAllBBsStrategy : public Enumeration } using EnumerationStrategyBase::initialize; - void initializeStrategy(const ChemicalReaction &, const EnumerationTypes::BBS &) { + void initializeStrategy(const ChemicalReaction &, + const EnumerationTypes::BBS &) { m_distributions.clear(); m_permutation.resize(m_permutationSizes.size()); m_permutationSizes = m_permutationSizes; @@ -124,7 +126,8 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleAllBBsStrategy : public Enumeration } virtual boost::uint64_t getPermutationIdx() const { - return m_numPermutationsProcessed; } + return m_numPermutationsProcessed; + } virtual operator bool() const { return true; } @@ -133,7 +136,7 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleAllBBsStrategy : public Enumeration } private: -#ifdef RDK_USE_BOOST_SERIALIZATION +#ifdef RDK_USE_BOOST_SERIALIZATION friend class boost::serialization::access; template @@ -178,9 +181,9 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleAllBBsStrategy : public Enumeration } #endif }; -} +} // namespace RDKit -#ifdef RDK_USE_BOOST_SERIALIZATION +#ifdef RDK_USE_BOOST_SERIALIZATION BOOST_CLASS_VERSION(RDKit::RandomSampleAllBBsStrategy, 1) #endif diff --git a/Code/GraphMol/ChemReactions/PreprocessRxn.h b/Code/GraphMol/ChemReactions/PreprocessRxn.h index 4ca8479e6..9e3f81670 100644 --- a/Code/GraphMol/ChemReactions/PreprocessRxn.h +++ b/Code/GraphMol/ChemReactions/PreprocessRxn.h @@ -39,27 +39,26 @@ namespace RDKit { -RDKIT_CHEMREACTIONS_EXPORT bool preprocessReaction(ChemicalReaction &rxn, - const std::string &propName=common_properties::molFileValue); +RDKIT_CHEMREACTIONS_EXPORT bool preprocessReaction( + ChemicalReaction &rxn, + const std::string &propName = common_properties::molFileValue); -RDKIT_CHEMREACTIONS_EXPORT bool preprocessReaction(ChemicalReaction &rxn, - unsigned int &numWarnings, - unsigned int &numErrors, - std::vector< - std::vector > >&reactantLabels, - const std::string &propName=common_properties::molFileValue); +RDKIT_CHEMREACTIONS_EXPORT bool preprocessReaction( + ChemicalReaction &rxn, unsigned int &numWarnings, unsigned int &numErrors, + std::vector>> + &reactantLabels, + const std::string &propName = common_properties::molFileValue); -RDKIT_CHEMREACTIONS_EXPORT bool preprocessReaction(ChemicalReaction &rxn, - const std::map &queries, - const std::string &propName=common_properties::molFileValue); - -RDKIT_CHEMREACTIONS_EXPORT bool preprocessReaction(ChemicalReaction &rxn, - unsigned int &numWarnings, - unsigned int &numErrors, - std::vector< - std::vector > >&reactantLabels, - const std::map &queries, - const std::string &propName=common_properties::molFileValue); -} +RDKIT_CHEMREACTIONS_EXPORT bool preprocessReaction( + ChemicalReaction &rxn, const std::map &queries, + const std::string &propName = common_properties::molFileValue); + +RDKIT_CHEMREACTIONS_EXPORT bool preprocessReaction( + ChemicalReaction &rxn, unsigned int &numWarnings, unsigned int &numErrors, + std::vector>> + &reactantLabels, + const std::map &queries, + const std::string &propName = common_properties::molFileValue); +} // namespace RDKit #endif diff --git a/Code/GraphMol/ChemReactions/Reaction.h b/Code/GraphMol/ChemReactions/Reaction.h index cdc5164b6..9c9fe49bd 100644 --- a/Code/GraphMol/ChemReactions/Reaction.h +++ b/Code/GraphMol/ChemReactions/Reaction.h @@ -43,7 +43,8 @@ namespace RDKit { class ReactionPickler; //! used to indicate an error in the chemical reaction engine -class RDKIT_CHEMREACTIONS_EXPORT ChemicalReactionException : public std::exception { +class RDKIT_CHEMREACTIONS_EXPORT ChemicalReactionException + : public std::exception { public: //! construct with an error message explicit ChemicalReactionException(const char *msg) : _msg(msg){}; @@ -218,8 +219,8 @@ class RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction : public RDProps { map multiple times onto its reactant. This leads to multiple possible result sets. */ - std::vector runReactants(const MOL_SPTR_VECT reactants, - unsigned int numProducts=1000) const; + std::vector runReactants( + const MOL_SPTR_VECT reactants, unsigned int numProducts = 1000) const; //! Runs a single reactant against a single reactant template /*! @@ -353,31 +354,33 @@ class RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction : public RDProps { //! the \c which argument is used to return which of the reactants //! the molecule matches. If there's no match, it is equal to the number //! of reactants on return -RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeReactantOfReaction(const ChemicalReaction &rxn, const ROMol &mol, - unsigned int &which); +RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeReactantOfReaction( + const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which); //! \overload -RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeReactantOfReaction(const ChemicalReaction &rxn, - const ROMol &mol); +RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeReactantOfReaction( + const ChemicalReaction &rxn, const ROMol &mol); //! tests whether or not the molecule has a substructure match //! to any of the reaction's products //! the \c which argument is used to return which of the products //! the molecule matches. If there's no match, it is equal to the number //! of products on return -RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeProductOfReaction(const ChemicalReaction &rxn, const ROMol &mol, - unsigned int &which); +RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeProductOfReaction( + const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which); //! \overload -RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeProductOfReaction(const ChemicalReaction &rxn, const ROMol &mol); +RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeProductOfReaction( + const ChemicalReaction &rxn, const ROMol &mol); //! tests whether or not the molecule has a substructure match //! to any of the reaction's agents //! the \c which argument is used to return which of the agents //! the molecule matches. If there's no match, it is equal to the number //! of agents on return -RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeAgentOfReaction(const ChemicalReaction &rxn, const ROMol &mol, - unsigned int &which); +RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeAgentOfReaction( + const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which); //! \overload -RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeAgentOfReaction(const ChemicalReaction &rxn, const ROMol &mol); +RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeAgentOfReaction( + const ChemicalReaction &rxn, const ROMol &mol); //! returns indices of the atoms in each reactant that are changed //! in the reaction @@ -406,8 +409,8 @@ RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeAgentOfReaction(const ChemicalReaction When coming from RXN: the atomic number of the atom in the rxn file sets the value. */ -RDKIT_CHEMREACTIONS_EXPORT VECT_INT_VECT getReactingAtoms(const ChemicalReaction &rxn, - bool mappedAtomsOnly = false); +RDKIT_CHEMREACTIONS_EXPORT VECT_INT_VECT +getReactingAtoms(const ChemicalReaction &rxn, bool mappedAtomsOnly = false); //! add the recursive queries to the reactants of a reaction /*! @@ -436,7 +439,7 @@ RDKIT_CHEMREACTIONS_EXPORT void addRecursiveQueriesToReaction( std::vector>> *reactantLabels = NULL); -} // end of RDKit namespace +} // namespace RDKit namespace RDDepict { //! \brief Generate 2D coordinates (a depiction) for a reaction @@ -467,13 +470,12 @@ namespace RDDepict { for the other parameters see the documentation for compute2DCoords() */ -RDKIT_CHEMREACTIONS_EXPORT void compute2DCoordsForReaction(RDKit::ChemicalReaction &rxn, - double spacing = 2.0, bool updateProps = true, - bool canonOrient = false, - unsigned int nFlipsPerSample = 0, - unsigned int nSamples = 0, int sampleSeed = 0, - bool permuteDeg4Nodes = false); +RDKIT_CHEMREACTIONS_EXPORT void compute2DCoordsForReaction( + RDKit::ChemicalReaction &rxn, double spacing = 2.0, bool updateProps = true, + bool canonOrient = false, unsigned int nFlipsPerSample = 0, + unsigned int nSamples = 0, int sampleSeed = 0, + bool permuteDeg4Nodes = false); -} // end of RDDepict namespace +} // namespace RDDepict #endif diff --git a/Code/GraphMol/ChemReactions/ReactionFingerprints.h b/Code/GraphMol/ChemReactions/ReactionFingerprints.h index 83623a834..f6612c2a5 100644 --- a/Code/GraphMol/ChemReactions/ReactionFingerprints.h +++ b/Code/GraphMol/ChemReactions/ReactionFingerprints.h @@ -99,8 +99,10 @@ struct RDKIT_CHEMREACTIONS_EXPORT ReactionFingerprintParams { FingerprintType fpType; }; -RDKIT_CHEMREACTIONS_EXPORT extern const ReactionFingerprintParams DefaultStructuralFPParams; -RDKIT_CHEMREACTIONS_EXPORT extern const ReactionFingerprintParams DefaultDifferenceFPParams; +RDKIT_CHEMREACTIONS_EXPORT extern const ReactionFingerprintParams + DefaultStructuralFPParams; +RDKIT_CHEMREACTIONS_EXPORT extern const ReactionFingerprintParams + DefaultDifferenceFPParams; //! Generates a structural fingerprint for a reaction //! to use in screening @@ -142,9 +144,10 @@ RDKIT_CHEMREACTIONS_EXPORT ExplicitBitVect *StructuralFingerprintChemReaction( Notes: - the caller is responsible for deleteing the result */ -RDKIT_CHEMREACTIONS_EXPORT SparseIntVect *DifferenceFingerprintChemReaction( - const ChemicalReaction &rxn, - const ReactionFingerprintParams ¶ms = DefaultDifferenceFPParams); -} +RDKIT_CHEMREACTIONS_EXPORT SparseIntVect + *DifferenceFingerprintChemReaction( + const ChemicalReaction &rxn, + const ReactionFingerprintParams ¶ms = DefaultDifferenceFPParams); +} // namespace RDKit #endif diff --git a/Code/GraphMol/ChemReactions/ReactionParser.h b/Code/GraphMol/ChemReactions/ReactionParser.h index 859994b40..1ee64b9d0 100644 --- a/Code/GraphMol/ChemReactions/ReactionParser.h +++ b/Code/GraphMol/ChemReactions/ReactionParser.h @@ -41,7 +41,8 @@ namespace RDKit { class ChemicalReaction; //! used to indicate an error in parsing reaction data -class RDKIT_CHEMREACTIONS_EXPORT ChemicalReactionParserException : public std::exception { +class RDKIT_CHEMREACTIONS_EXPORT ChemicalReactionParserException + : public std::exception { public: //! construct with an error message explicit ChemicalReactionParserException(const char *msg) : _msg(msg){}; @@ -57,12 +58,14 @@ class RDKIT_CHEMREACTIONS_EXPORT ChemicalReactionParserException : public std::e }; //! Parse a text block in MDL rxn format into a ChemicalReaction -RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction *RxnBlockToChemicalReaction(const std::string &rxnBlock); +RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction *RxnBlockToChemicalReaction( + const std::string &rxnBlock); //! Parse a file in MDL rxn format into a ChemicalReaction -RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction *RxnFileToChemicalReaction(const std::string &fileName); +RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction *RxnFileToChemicalReaction( + const std::string &fileName); //! Parse a text stream in MDL rxn format into a ChemicalReaction -RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction *RxnDataStreamToChemicalReaction(std::istream &rxnStream, - unsigned int &line); +RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction *RxnDataStreamToChemicalReaction( + std::istream &rxnStream, unsigned int &line); //! Parse a string containing "Reaction SMARTS" into a ChemicalReaction /*! @@ -91,14 +94,16 @@ RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction *RxnSmartsToChemicalReaction( \param mol ROMol with RXN roles set */ -RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction *RxnMolToChemicalReaction(const ROMol &mol); +RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction *RxnMolToChemicalReaction( + const ROMol &mol); //! returns the reaction SMARTS for a reaction -RDKIT_CHEMREACTIONS_EXPORT std::string ChemicalReactionToRxnSmarts(const ChemicalReaction &rxn); +RDKIT_CHEMREACTIONS_EXPORT std::string ChemicalReactionToRxnSmarts( + const ChemicalReaction &rxn); //! returns the reaction SMILES for a reaction -RDKIT_CHEMREACTIONS_EXPORT std::string ChemicalReactionToRxnSmiles(const ChemicalReaction &rxn, - bool canonical = true); +RDKIT_CHEMREACTIONS_EXPORT std::string ChemicalReactionToRxnSmiles( + const ChemicalReaction &rxn, bool canonical = true); //! returns an RXN block for a reaction /*! @@ -107,12 +112,13 @@ RDKIT_CHEMREACTIONS_EXPORT std::string ChemicalReactionToRxnSmiles(const Chemica otherwise they were included in the reactants block (default) */ -RDKIT_CHEMREACTIONS_EXPORT std::string ChemicalReactionToRxnBlock(const ChemicalReaction &rxn, - bool separateAgents = false); +RDKIT_CHEMREACTIONS_EXPORT std::string ChemicalReactionToRxnBlock( + const ChemicalReaction &rxn, bool separateAgents = false); //! returns a ROMol with RXN roles used to describe the reaction -RDKIT_CHEMREACTIONS_EXPORT ROMol *ChemicalReactionToRxnMol(const ChemicalReaction &rxn); +RDKIT_CHEMREACTIONS_EXPORT ROMol *ChemicalReactionToRxnMol( + const ChemicalReaction &rxn); -}; // end of RDKit namespace +}; // namespace RDKit #endif diff --git a/Code/GraphMol/ChemReactions/ReactionPickler.h b/Code/GraphMol/ChemReactions/ReactionPickler.h index 8d7cb5f1b..5b29e2ddf 100644 --- a/Code/GraphMol/ChemReactions/ReactionPickler.h +++ b/Code/GraphMol/ChemReactions/ReactionPickler.h @@ -25,7 +25,8 @@ namespace RDKit { class ChemicalReaction; //! used to indicate exceptions whilst pickling (serializing) reactions -class RDKIT_CHEMREACTIONS_EXPORT ReactionPicklerException : public std::exception { +class RDKIT_CHEMREACTIONS_EXPORT ReactionPicklerException + : public std::exception { public: ReactionPicklerException(const char *msg) : _msg(msg){}; ReactionPicklerException(const std::string msg) : _msg(msg){}; @@ -39,9 +40,9 @@ class RDKIT_CHEMREACTIONS_EXPORT ReactionPicklerException : public std::exceptio //! handles pickling (serializing) reactions class RDKIT_CHEMREACTIONS_EXPORT ReactionPickler { public: - static const std::int32_t versionMajor; //!< mark the pickle version - static const std::int32_t versionMinor; //!< mark the pickle version - static const std::int32_t versionPatch; //!< mark the pickle version + static const std::int32_t versionMajor; //!< mark the pickle version + static const std::int32_t versionMinor; //!< mark the pickle version + static const std::int32_t versionPatch; //!< mark the pickle version static const std::int32_t endianId; //! mark the endian-ness of the pickle //! the pickle format is tagged using these tags: @@ -113,6 +114,6 @@ class RDKIT_CHEMREACTIONS_EXPORT ReactionPickler { //! unpickle standard properties static void _unpickleProperties(std::istream &ss, RDProps &props); }; -}; +}; // namespace RDKit #endif diff --git a/Code/GraphMol/ChemReactions/ReactionRunner.h b/Code/GraphMol/ChemReactions/ReactionRunner.h index 1dfa450de..7608ee833 100644 --- a/Code/GraphMol/ChemReactions/ReactionRunner.h +++ b/Code/GraphMol/ChemReactions/ReactionRunner.h @@ -57,7 +57,7 @@ namespace RDKit { */ RDKIT_CHEMREACTIONS_EXPORT std::vector run_Reactants( const ChemicalReaction& rxn, const MOL_SPTR_VECT& reactants, - unsigned int maxProducts=1000); + unsigned int maxProducts = 1000); //! Runs a single reactant against a single reactant template /*! @@ -74,11 +74,11 @@ RDKIT_CHEMREACTIONS_EXPORT std::vector run_Reactants( */ -RDKIT_CHEMREACTIONS_EXPORT std::vector run_Reactant(const ChemicalReaction& rxn, - const ROMOL_SPTR& reactant, - unsigned int reactantIdx); +RDKIT_CHEMREACTIONS_EXPORT std::vector run_Reactant( + const ChemicalReaction& rxn, const ROMOL_SPTR& reactant, + unsigned int reactantIdx); -//! Reduce the product generated by run_Reactants or run_Reactant to +//! Reduce the product generated by run_Reactants or run_Reactant to // the sidechains that come from the reagents // // n.b. molecules that might be a product of the given reaction @@ -88,22 +88,24 @@ RDKIT_CHEMREACTIONS_EXPORT std::vector run_Reactant(const Chemica \param addDummyAtoms If true, add dummy atoms to the sidechains for the non-reagent parts of the sidechain. Dummy atoms are annotated with the atom maps from the reaction. - If False, then any sidechain atom where a bond was cleaved is annotated with: - _rgroupAtomMaps property which indicates the scaffold atommaps that where bonded - _rgroupBonds property which indicates the bondtype for each atommap bonded + If False, then any sidechain atom where a bond was cleaved is annotated + with: _rgroupAtomMaps property which indicates the scaffold atommaps that + where bonded _rgroupBonds property which indicates the bondtype for each + atommap bonded */ -RDKIT_CHEMREACTIONS_EXPORT ROMol* reduceProductToSideChains(const ROMOL_SPTR& product, - bool addDummyAtoms = true); +RDKIT_CHEMREACTIONS_EXPORT ROMol* reduceProductToSideChains( + const ROMOL_SPTR& product, bool addDummyAtoms = true); namespace ReactionRunnerUtils { RDKIT_CHEMREACTIONS_EXPORT MOL_SPTR_VECT generateOneProductSet( - const ChemicalReaction &rxn, const MOL_SPTR_VECT &reactants, - const std::vector &reactantsMatch); + const ChemicalReaction& rxn, const MOL_SPTR_VECT& reactants, + const std::vector& reactantsMatch); -RDKIT_CHEMREACTIONS_EXPORT RWMOL_SPTR convertTemplateToMol(const ROMOL_SPTR prodTemplateSptr); -} +RDKIT_CHEMREACTIONS_EXPORT RWMOL_SPTR +convertTemplateToMol(const ROMOL_SPTR prodTemplateSptr); +} // namespace ReactionRunnerUtils -} // end of RDKit namespace +} // namespace RDKit #endif diff --git a/Code/GraphMol/ChemReactions/ReactionUtils.h b/Code/GraphMol/ChemReactions/ReactionUtils.h index 203f5e4c6..702820bf9 100644 --- a/Code/GraphMol/ChemReactions/ReactionUtils.h +++ b/Code/GraphMol/ChemReactions/ReactionUtils.h @@ -40,32 +40,35 @@ namespace RDKit { enum ReactionMoleculeType { Reactant, Product, Agent }; -RDKIT_CHEMREACTIONS_EXPORT MOL_SPTR_VECT::const_iterator getStartIterator(const ChemicalReaction &rxn, - ReactionMoleculeType t); -RDKIT_CHEMREACTIONS_EXPORT MOL_SPTR_VECT::const_iterator getEndIterator(const ChemicalReaction &rxn, - ReactionMoleculeType t); +RDKIT_CHEMREACTIONS_EXPORT MOL_SPTR_VECT::const_iterator getStartIterator( + const ChemicalReaction &rxn, ReactionMoleculeType t); +RDKIT_CHEMREACTIONS_EXPORT MOL_SPTR_VECT::const_iterator getEndIterator( + const ChemicalReaction &rxn, ReactionMoleculeType t); -RDKIT_CHEMREACTIONS_EXPORT bool hasReactantTemplateSubstructMatch(const ChemicalReaction &rxn, - const ChemicalReaction &query_rxn); +RDKIT_CHEMREACTIONS_EXPORT bool hasReactantTemplateSubstructMatch( + const ChemicalReaction &rxn, const ChemicalReaction &query_rxn); -RDKIT_CHEMREACTIONS_EXPORT bool hasProductTemplateSubstructMatch(const ChemicalReaction &rxn, - const ChemicalReaction &query_rxn); +RDKIT_CHEMREACTIONS_EXPORT bool hasProductTemplateSubstructMatch( + const ChemicalReaction &rxn, const ChemicalReaction &query_rxn); -RDKIT_CHEMREACTIONS_EXPORT bool hasAgentTemplateSubstructMatch(const ChemicalReaction &rxn, - const ChemicalReaction &query_rxn); +RDKIT_CHEMREACTIONS_EXPORT bool hasAgentTemplateSubstructMatch( + const ChemicalReaction &rxn, const ChemicalReaction &query_rxn); -RDKIT_CHEMREACTIONS_EXPORT bool hasReactionSubstructMatch(const ChemicalReaction &rxn, - const ChemicalReaction &query_rxn, - bool includeAgents = false); +RDKIT_CHEMREACTIONS_EXPORT bool hasReactionSubstructMatch( + const ChemicalReaction &rxn, const ChemicalReaction &query_rxn, + bool includeAgents = false); -RDKIT_CHEMREACTIONS_EXPORT bool hasReactionAtomMapping(const ChemicalReaction &rxn); +RDKIT_CHEMREACTIONS_EXPORT bool hasReactionAtomMapping( + const ChemicalReaction &rxn); -RDKIT_CHEMREACTIONS_EXPORT bool isReactionTemplateMoleculeAgent(const ROMol &mol, double agentThreshold); +RDKIT_CHEMREACTIONS_EXPORT bool isReactionTemplateMoleculeAgent( + const ROMol &mol, double agentThreshold); RDKIT_CHEMREACTIONS_EXPORT void updateProductsStereochem(ChemicalReaction *rxn); -RDKIT_CHEMREACTIONS_EXPORT void removeMappingNumbersFromReactions(const ChemicalReaction &rxn); +RDKIT_CHEMREACTIONS_EXPORT void removeMappingNumbersFromReactions( + const ChemicalReaction &rxn); -} // end of RDKit namespace +} // namespace RDKit #endif diff --git a/Code/GraphMol/ChemReactions/SanitizeRxn.h b/Code/GraphMol/ChemReactions/SanitizeRxn.h index 848c021c0..22d6350f4 100644 --- a/Code/GraphMol/ChemReactions/SanitizeRxn.h +++ b/Code/GraphMol/ChemReactions/SanitizeRxn.h @@ -52,20 +52,20 @@ class RDKIT_CHEMREACTIONS_EXPORT RxnSanitizeException : public std::exception { std::string _msg; }; - namespace RxnOps { //! Any dummy atom with a map but no RGroup label, should be an RGroup //! in RDKit's view of a reaction. //! See if these atoms can be salvaged into RGroups. RDKIT_CHEMREACTIONS_EXPORT void fixRGroups(ChemicalReaction &rxn); -//! If atom maps are not defined on rgroups, attempt to deduce them from the RGroup +//! If atom maps are not defined on rgroups, attempt to deduce them from the +//! RGroup //! labels, or add new ones if possible. RDKIT_CHEMREACTIONS_EXPORT void fixAtomMaps(ChemicalReaction &rxn); - //! Adjusts the reactant templates to properly match reagents -RDKIT_CHEMREACTIONS_EXPORT void adjustTemplates(ChemicalReaction &rxn, const MolOps::AdjustQueryParameters ¶ms); +RDKIT_CHEMREACTIONS_EXPORT void adjustTemplates( + ChemicalReaction &rxn, const MolOps::AdjustQueryParameters ¶ms); //! merge query Hs if appropriate RDKIT_CHEMREACTIONS_EXPORT void fixHs(ChemicalReaction &rxn); @@ -86,8 +86,9 @@ inline const MolOps::AdjustQueryParameters DefaultRxnAdjustParams() { // -- deprecated - renamed MatchOnlyAtRgroupsAdjustParams // -- this doesn't match sciquest style searching inline const MolOps::AdjustQueryParameters ChemDrawRxnAdjustParams() { - BOOST_LOG(rdWarningLog) << - " deprecated -- please use MatchOnlyAtRgroupsAdjustParams instead" << std::endl; + BOOST_LOG(rdWarningLog) + << " deprecated -- please use MatchOnlyAtRgroupsAdjustParams instead" + << std::endl; MolOps::AdjustQueryParameters params; params.adjustDegree = true; params.adjustDegreeFlags = MolOps::ADJUST_IGNOREDUMMIES; @@ -144,7 +145,7 @@ typedef enum { Notes: - This attempts to fix known issues with certain reaction drawers. - HOWEVER, if any flag is returned in operationsPerformed, + HOWEVER, if any flag is returned in operationsPerformed, the reaction may still be suspect to its validity. - Aromaticity can be tricky when starting with Kekule structures that have query features, aromaticity works well for non-query rings, however @@ -152,15 +153,16 @@ typedef enum { aromatic) may not have enough information. */ -RDKIT_CHEMREACTIONS_EXPORT void sanitizeRxn(ChemicalReaction &rxn, - unsigned int &operationsThatFailed, - unsigned int sanitizeOps = SANITIZE_ALL, - const MolOps::AdjustQueryParameters ¶ms = DefaultRxnAdjustParams()); +RDKIT_CHEMREACTIONS_EXPORT void sanitizeRxn( + ChemicalReaction &rxn, unsigned int &operationsThatFailed, + unsigned int sanitizeOps = SANITIZE_ALL, + const MolOps::AdjustQueryParameters ¶ms = DefaultRxnAdjustParams()); //! \overload -RDKIT_CHEMREACTIONS_EXPORT void sanitizeRxn(ChemicalReaction &rxn, - const MolOps::AdjustQueryParameters ¶ms = DefaultRxnAdjustParams()); +RDKIT_CHEMREACTIONS_EXPORT void sanitizeRxn( + ChemicalReaction &rxn, + const MolOps::AdjustQueryParameters ¶ms = DefaultRxnAdjustParams()); -} -} +} // namespace RxnOps +} // namespace RDKit #endif diff --git a/Code/GraphMol/ChemTransforms/ChemTransforms.h b/Code/GraphMol/ChemTransforms/ChemTransforms.h index 3056c7079..ec50f1246 100644 --- a/Code/GraphMol/ChemTransforms/ChemTransforms.h +++ b/Code/GraphMol/ChemTransforms/ChemTransforms.h @@ -35,8 +35,10 @@ typedef boost::shared_ptr ROMOL_SPTR; \return a copy of \c mol with the matching atoms and bonds (if any) removed. */ -RDKIT_CHEMTRANSFORMS_EXPORT ROMol *deleteSubstructs(const ROMol &mol, const ROMol &query, - bool onlyFrags = false, bool useChirality = false); +RDKIT_CHEMTRANSFORMS_EXPORT ROMol *deleteSubstructs(const ROMol &mol, + const ROMol &query, + bool onlyFrags = false, + bool useChirality = false); //! \brief Returns a list of copies of an ROMol with the atoms and bonds that //! match a pattern replaced with the atoms contained in another molecule. @@ -95,9 +97,9 @@ RDKIT_CHEMTRANSFORMS_EXPORT std::vector replaceSubstructs( removed and dummies at the connection points. */ - -RDKIT_CHEMTRANSFORMS_EXPORT ROMol *replaceSidechains(const ROMol &mol, const ROMol &coreQuery, - bool useChirality = false); +RDKIT_CHEMTRANSFORMS_EXPORT ROMol *replaceSidechains(const ROMol &mol, + const ROMol &coreQuery, + bool useChirality = false); //! \brief Returns a copy of an ROMol with the atoms and bonds that //! are referenced by the MatchVector removed. @@ -115,16 +117,12 @@ RDKIT_CHEMTRANSFORMS_EXPORT ROMol *replaceSidechains(const ROMol &mol, const ROM \param mol - the ROMol of interest \param core - the core being matched against - \param matchVect - a matchVect of the type returned by Substructure Matching - \param replaceDummies - if set, atoms matching dummies in the core will also - be replaced - \param labelByIndex - if set, the dummy atoms at attachment points are - labelled with the - index+1 of the corresponding atom in the core - \param requireDummyMatch - if set, only side chains that are connected to - atoms in - the core that have attached dummies will be - considered. + \param matchVect - a matchVect of the type returned by Substructure + Matching \param replaceDummies - if set, atoms matching dummies in the core + will also be replaced \param labelByIndex - if set, the dummy atoms at + attachment points are labelled with the index+1 of the corresponding atom in + the core \param requireDummyMatch - if set, only side chains that are + connected to atoms in the core that have attached dummies will be considered. Molecules that have sidechains that are attached at other points will be rejected (NULL returned). \param useChirality - if set, match the coreQuery using chirality @@ -135,11 +133,12 @@ RDKIT_CHEMTRANSFORMS_EXPORT ROMol *replaceSidechains(const ROMol &mol, const ROM for deleting this molecule. If the core query is not matched, NULL is returned. */ -RDKIT_CHEMTRANSFORMS_EXPORT ROMol *replaceCore(const ROMol &mol, const ROMol &core, - const MatchVectType &matchVect, - bool replaceDummies = true, - bool labelByIndex = false, - bool requireDummyMatch = false); +RDKIT_CHEMTRANSFORMS_EXPORT ROMol *replaceCore(const ROMol &mol, + const ROMol &core, + const MatchVectType &matchVect, + bool replaceDummies = true, + bool labelByIndex = false, + bool requireDummyMatch = false); //! \brief Returns a copy of an ROMol with the atoms and bonds that //! do fall within a substructure match removed. @@ -172,9 +171,12 @@ RDKIT_CHEMTRANSFORMS_EXPORT ROMol *replaceCore(const ROMol &mol, const ROMol &co for deleting this molecule. If the core query is not matched, NULL is returned. */ -RDKIT_CHEMTRANSFORMS_EXPORT ROMol *replaceCore(const ROMol &mol, const ROMol &coreQuery, - bool replaceDummies = true, bool labelByIndex = false, - bool requireDummyMatch = false, bool useChirality = false); +RDKIT_CHEMTRANSFORMS_EXPORT ROMol *replaceCore(const ROMol &mol, + const ROMol &coreQuery, + bool replaceDummies = true, + bool labelByIndex = false, + bool requireDummyMatch = false, + bool useChirality = false); //! \brief Carries out a Murcko decomposition on the molecule provided //! @@ -200,8 +202,9 @@ RDKIT_CHEMTRANSFORMS_EXPORT ROMol *MurckoDecompose(const ROMol &mol); The new molecule has not been sanitized. The client is responsible for deleting this molecule. */ -RDKIT_CHEMTRANSFORMS_EXPORT ROMol *combineMols(const ROMol &mol1, const ROMol &mol2, - RDGeom::Point3D offset = RDGeom::Point3D(0, 0, 0)); +RDKIT_CHEMTRANSFORMS_EXPORT ROMol *combineMols( + const ROMol &mol1, const ROMol &mol2, + RDGeom::Point3D offset = RDGeom::Point3D(0, 0, 0)); //! \brief Adds named recursive queries to a molecule's atoms based on atom // labels @@ -227,7 +230,7 @@ RDKIT_CHEMTRANSFORMS_EXPORT ROMol *combineMols(const ROMol &mol1, const ROMol &m RDKIT_CHEMTRANSFORMS_EXPORT void addRecursiveQueries( ROMol &mol, const std::map &queries, const std::string &propName, - std::vector > *reactantLabels = NULL); + std::vector> *reactantLabels = NULL); //! \brief parses a query definition file and sets up a set of definitions //! suitable for use by addRecursiveQueries() @@ -243,30 +246,24 @@ RDKIT_CHEMTRANSFORMS_EXPORT void addRecursiveQueries( \param smartsColumn - column with the SMARTS definitions of the queries */ -RDKIT_CHEMTRANSFORMS_EXPORT void parseQueryDefFile(const std::string &filename, - std::map &queryDefs, - bool standardize = true, - const std::string &delimiter = "\t", - const std::string &comment = "//", - unsigned int nameColumn = 0, - unsigned int smartsColumn = 1); +RDKIT_CHEMTRANSFORMS_EXPORT void parseQueryDefFile( + const std::string &filename, std::map &queryDefs, + bool standardize = true, const std::string &delimiter = "\t", + const std::string &comment = "//", unsigned int nameColumn = 0, + unsigned int smartsColumn = 1); //! \overload -RDKIT_CHEMTRANSFORMS_EXPORT void parseQueryDefFile(std::istream *inStream, - std::map &queryDefs, - bool standardize = true, - const std::string &delimiter = "\t", - const std::string &comment = "//", - unsigned int nameColumn = 0, - unsigned int smartsColumn = 1); +RDKIT_CHEMTRANSFORMS_EXPORT void parseQueryDefFile( + std::istream *inStream, std::map &queryDefs, + bool standardize = true, const std::string &delimiter = "\t", + const std::string &comment = "//", unsigned int nameColumn = 0, + unsigned int smartsColumn = 1); //! \brief equivalent to parseQueryDefFile() but the query definitions are // explicitly passed in -RDKIT_CHEMTRANSFORMS_EXPORT void parseQueryDefText(const std::string &queryDefText, - std::map &queryDefs, - bool standardize = true, - const std::string &delimiter = "\t", - const std::string &comment = "//", - unsigned int nameColumn = 0, - unsigned int smartsColumn = 1); -} +RDKIT_CHEMTRANSFORMS_EXPORT void parseQueryDefText( + const std::string &queryDefText, + std::map &queryDefs, bool standardize = true, + const std::string &delimiter = "\t", const std::string &comment = "//", + unsigned int nameColumn = 0, unsigned int smartsColumn = 1); +} // namespace RDKit #endif diff --git a/Code/GraphMol/ChemTransforms/MolFragmenter.h b/Code/GraphMol/ChemTransforms/MolFragmenter.h index 4c0e8b4c0..fbd5aa322 100644 --- a/Code/GraphMol/ChemTransforms/MolFragmenter.h +++ b/Code/GraphMol/ChemTransforms/MolFragmenter.h @@ -50,7 +50,7 @@ struct RDKIT_CHEMTRANSFORMS_EXPORT FragmenterBondType { RDKIT_CHEMTRANSFORMS_EXPORT ROMol *fragmentOnBonds( const ROMol &mol, const std::vector &bondIndices, bool addDummies = true, - const std::vector > *dummyLabels = 0, + const std::vector> *dummyLabels = 0, const std::vector *bondTypes = 0, std::vector *nCutsPerAtom = 0); //! \overload @@ -62,9 +62,9 @@ RDKIT_CHEMTRANSFORMS_EXPORT void fragmentOnSomeBonds( const ROMol &mol, const std::vector &bondIndices, std::vector &resMols, unsigned int maxToCut = 1, bool addDummies = true, - const std::vector > *dummyLabels = 0, + const std::vector> *dummyLabels = 0, const std::vector *bondTypes = 0, - std::vector > *nCutsPerAtom = 0); + std::vector> *nCutsPerAtom = 0); //! \brief Fragments a molecule by breaking all BRICS bonds /*! @@ -82,8 +82,9 @@ RDKIT_CHEMTRANSFORMS_EXPORT void constructFragmenterAtomTypes( const std::string &str, std::map &defs, const std::string &comment = "//", bool validate = true, std::map *environs = 0); -RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSAtomTypes(std::map &defs, - std::map *environs = 0); +RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSAtomTypes( + std::map &defs, + std::map *environs = 0); RDKIT_CHEMTRANSFORMS_EXPORT void constructFragmenterBondTypes( std::istream *inStream, const std::map &atomTypes, @@ -94,7 +95,8 @@ RDKIT_CHEMTRANSFORMS_EXPORT void constructFragmenterBondTypes( const std::map &atomTypes, std::vector &defs, const std::string &comment = "//", bool validate = true, bool labelByConnector = true); -RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSBondTypes(std::vector &defs); -} -} +RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSBondTypes( + std::vector &defs); +} // namespace MolFragmenter +} // namespace RDKit #endif diff --git a/Code/GraphMol/Chirality.h b/Code/GraphMol/Chirality.h index e4fc98abb..1fe502474 100644 --- a/Code/GraphMol/Chirality.h +++ b/Code/GraphMol/Chirality.h @@ -31,8 +31,9 @@ namespace Chirality { CIP ranking. */ -RDKIT_GRAPHMOL_EXPORT void assignAtomCIPRanks(const ROMol &mol, UINT_VECT &ranks); -} -} +RDKIT_GRAPHMOL_EXPORT void assignAtomCIPRanks(const ROMol &mol, + UINT_VECT &ranks); +} // namespace Chirality +} // namespace RDKit /// @endcond #endif diff --git a/Code/GraphMol/Conformer.h b/Code/GraphMol/Conformer.h index 58c2e570f..779f56224 100644 --- a/Code/GraphMol/Conformer.h +++ b/Code/GraphMol/Conformer.h @@ -81,17 +81,17 @@ class RDKIT_GRAPHMOL_EXPORT Conformer { //! Get the position of the specified atom const RDGeom::Point3D &getAtomPos(unsigned int atomId) const; //! overload - template + template const RDGeom::Point3D &getAtomPos(U atomId) const { - return getAtomPos(rdcast(atomId)); + return getAtomPos(rdcast(atomId)); } //! Get the position of the specified atom RDGeom::Point3D &getAtomPos(unsigned int atomId); //! overload - template + template RDGeom::Point3D &getAtomPos(U atomId) { - return getAtomPos(rdcast(atomId)); + return getAtomPos(rdcast(atomId)); } //! Set the position of the specified atom @@ -103,9 +103,9 @@ class RDKIT_GRAPHMOL_EXPORT Conformer { d_positions[atomId] = position; } //! overload - template + template void setAtomPos(U atomId, const RDGeom::Point3D &position) { - return setAtomPos(rdcast(atomId), position); + return setAtomPos(rdcast(atomId), position); } //! get the ID of this conformer inline unsigned int getId() const { return d_id; } @@ -114,11 +114,12 @@ class RDKIT_GRAPHMOL_EXPORT Conformer { inline void setId(unsigned int id) { d_id = id; } //! Get the number of atoms - inline unsigned int getNumAtoms() const { return rdcast(d_positions.size()); } + inline unsigned int getNumAtoms() const { + return rdcast(d_positions.size()); + } inline bool is3D() const { return df_is3D; } inline void set3D(bool v) { df_is3D = v; } - protected: //! Set owning moelcule void setOwningMol(ROMol *mol); @@ -140,14 +141,12 @@ typedef boost::shared_ptr CONFORMER_SPTR; \param conf Conformer object to analyze */ inline bool hasNonZeroZCoords(const Conformer &conf) { - for(auto p: conf.getPositions()) { - if (p.z != 0.0) - return true; + for (auto p : conf.getPositions()) { + if (p.z != 0.0) return true; } return false; - } -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/Depictor/Basement/Depictor.h b/Code/GraphMol/Depictor/Basement/Depictor.h index 9ee4bbd37..74d498f91 100644 --- a/Code/GraphMol/Depictor/Basement/Depictor.h +++ b/Code/GraphMol/Depictor/Basement/Depictor.h @@ -30,6 +30,6 @@ int Add2DCoordsToMol(ROMol& mol, bool useDLL = true); #else int Add2DCoordsToMol(ROMol &mol, bool useDLL = false); #endif -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/Depictor/DepictUtils.h b/Code/GraphMol/Depictor/DepictUtils.h index 7acab9c89..6744c444e 100644 --- a/Code/GraphMol/Depictor/DepictUtils.h +++ b/Code/GraphMol/Depictor/DepictUtils.h @@ -67,10 +67,11 @@ typedef std::list LIST_PAIR_DII; where A is the angle between a and b */ -RDKIT_DEPICTOR_EXPORT RDGeom::INT_POINT2D_MAP embedRing(const RDKit::INT_VECT &ring); +RDKIT_DEPICTOR_EXPORT RDGeom::INT_POINT2D_MAP embedRing( + const RDKit::INT_VECT &ring); RDKIT_DEPICTOR_EXPORT void transformPoints(RDGeom::INT_POINT2D_MAP &nringCor, - const RDGeom::Transform2D &trans); + const RDGeom::Transform2D &trans); //! Find a point that bisects the angle at rcr /*! @@ -78,9 +79,9 @@ RDKIT_DEPICTOR_EXPORT void transformPoints(RDGeom::INT_POINT2D_MAP &nringCor, angle 'ang' at rcr */ -RDKIT_DEPICTOR_EXPORT RDGeom::Point2D computeBisectPoint(const RDGeom::Point2D &rcr, double ang, - const RDGeom::Point2D &nb1, - const RDGeom::Point2D &nb2); +RDKIT_DEPICTOR_EXPORT RDGeom::Point2D computeBisectPoint( + const RDGeom::Point2D &rcr, double ang, const RDGeom::Point2D &nb1, + const RDGeom::Point2D &nb2); //! Reflect a set of point through a the line joining two point /*! @@ -93,11 +94,12 @@ RDKIT_DEPICTOR_EXPORT RDGeom::Point2D computeBisectPoint(const RDGeom::Point2D & \param loc2 the second point of the line to be used as a mirror */ RDKIT_DEPICTOR_EXPORT void reflectPoints(RDGeom::INT_POINT2D_MAP &coordMap, - const RDGeom::Point2D &loc1, const RDGeom::Point2D &loc2); + const RDGeom::Point2D &loc1, + const RDGeom::Point2D &loc2); RDKIT_DEPICTOR_EXPORT RDGeom::Point2D reflectPoint(const RDGeom::Point2D &point, - const RDGeom::Point2D &loc1, - const RDGeom::Point2D &loc2); + const RDGeom::Point2D &loc1, + const RDGeom::Point2D &loc2); //! Set the neighbors yet to added to aid such that the atoms with the most subs // fall on opposite sides @@ -132,8 +134,9 @@ RDKIT_DEPICTOR_EXPORT RDGeom::Point2D reflectPoint(const RDGeom::Point2D &point, And the correct ordering of the neighbors is B,D,C */ -RDKIT_DEPICTOR_EXPORT RDKit::INT_VECT setNbrOrder(unsigned int aid, const RDKit::INT_VECT &nbrs, - const RDKit::ROMol &mol); +RDKIT_DEPICTOR_EXPORT RDKit::INT_VECT setNbrOrder(unsigned int aid, + const RDKit::INT_VECT &nbrs, + const RDKit::ROMol &mol); //! \brief From a given set of rings find the ring the largest common elements // with other rings @@ -152,9 +155,9 @@ RDKIT_DEPICTOR_EXPORT RDKit::INT_VECT setNbrOrder(unsigned int aid, const RDKit: \return list of atom ids that are common */ -RDKIT_DEPICTOR_EXPORT RDKit::INT_VECT findNextRingToEmbed(const RDKit::INT_VECT &doneRings, - const RDKit::VECT_INT_VECT &fusedRings, - int &nextId); +RDKIT_DEPICTOR_EXPORT RDKit::INT_VECT findNextRingToEmbed( + const RDKit::INT_VECT &doneRings, const RDKit::VECT_INT_VECT &fusedRings, + int &nextId); typedef std::pair INT_PAIR; typedef std::vector INT_PAIR_VECT; @@ -169,8 +172,9 @@ typedef std::pair DOUBLE_INT_PAIR; \param ascending sort to an ascending order or a descending order */ template -RDKIT_DEPICTOR_EXPORT T rankAtomsByRank(const RDKit::ROMol &mol, const T &commAtms, - bool ascending = true); +RDKIT_DEPICTOR_EXPORT T rankAtomsByRank(const RDKit::ROMol &mol, + const T &commAtms, + bool ascending = true); //! computes a subangle for an atom of given hybridization and degree /*! @@ -283,8 +287,8 @@ inline double computeAngle(const RDGeom::Point2D ¢er, \return the index of the ring with the least number of substitutions */ -RDKIT_DEPICTOR_EXPORT int pickFirstRingToEmbed(const RDKit::ROMol &mol, - const RDKit::VECT_INT_VECT &fusedRings); +RDKIT_DEPICTOR_EXPORT int pickFirstRingToEmbed( + const RDKit::ROMol &mol, const RDKit::VECT_INT_VECT &fusedRings); //! \brief find the rotatable bonds on the shortest path between two atoms //! we will ignore ring atoms, and double bonds which are marked cis/trans @@ -299,8 +303,9 @@ RDKIT_DEPICTOR_EXPORT int pickFirstRingToEmbed(const RDKit::ROMol &mol, \return a set of the indices of the rotatable bonds */ -RDKIT_DEPICTOR_EXPORT RDKit::INT_VECT getRotatableBonds(const RDKit::ROMol &mol, unsigned int aid1, - unsigned int aid2); +RDKIT_DEPICTOR_EXPORT RDKit::INT_VECT getRotatableBonds(const RDKit::ROMol &mol, + unsigned int aid1, + unsigned int aid2); //! \brief find all the rotatable bonds in a molecule //! we will ignore ring atoms, and double bonds which are marked cis/trans @@ -313,11 +318,14 @@ RDKIT_DEPICTOR_EXPORT RDKit::INT_VECT getRotatableBonds(const RDKit::ROMol &mol, \return a set of the indices of the rotatable bonds */ -RDKIT_DEPICTOR_EXPORT RDKit::INT_VECT getAllRotatableBonds(const RDKit::ROMol &mol); +RDKIT_DEPICTOR_EXPORT RDKit::INT_VECT getAllRotatableBonds( + const RDKit::ROMol &mol); //! Get the ids of the atoms and bonds that are connected to aid -RDKIT_DEPICTOR_EXPORT void getNbrAtomAndBondIds(unsigned int aid, const RDKit::ROMol *mol, - RDKit::INT_VECT &aids, RDKit::INT_VECT &bids); +RDKIT_DEPICTOR_EXPORT void getNbrAtomAndBondIds(unsigned int aid, + const RDKit::ROMol *mol, + RDKit::INT_VECT &aids, + RDKit::INT_VECT &bids); //! Find pairs of bonds that can be permuted at a non-ring degree 4 atom /*! @@ -343,9 +351,9 @@ RDKIT_DEPICTOR_EXPORT void getNbrAtomAndBondIds(unsigned int aid, const RDKit::R the neighbors \param nbrLocs - locations of the neighbors */ -RDKIT_DEPICTOR_EXPORT INT_PAIR_VECT findBondsPairsToPermuteDeg4(const RDGeom::Point2D ¢er, - const RDKit::INT_VECT &nbrBids, - const VECT_C_POINT &nbrLocs); +RDKIT_DEPICTOR_EXPORT INT_PAIR_VECT findBondsPairsToPermuteDeg4( + const RDGeom::Point2D ¢er, const RDKit::INT_VECT &nbrBids, + const VECT_C_POINT &nbrLocs); //! returns the rank of the atom for determining draw order inline int getAtomDepictRank(const RDKit::Atom *at) { @@ -356,6 +364,6 @@ inline int getAtomDepictRank(const RDKit::Atom *at) { int deg = at->getDegree(); return maxDeg * anum + deg; } -} +} // namespace RDDepict #endif diff --git a/Code/GraphMol/Depictor/EmbeddedFrag.h b/Code/GraphMol/Depictor/EmbeddedFrag.h index 6c7243a61..93c282d49 100644 --- a/Code/GraphMol/Depictor/EmbeddedFrag.h +++ b/Code/GraphMol/Depictor/EmbeddedFrag.h @@ -20,7 +20,7 @@ namespace RDKit { class ROMol; class Bond; -} +} // namespace RDKit namespace RDDepict { typedef boost::shared_array DOUBLE_SMART_PTR; @@ -553,6 +553,6 @@ class RDKIT_DEPICTOR_EXPORT EmbeddedFrag { // pointer to the owning molecule const RDKit::ROMol *dp_mol; }; -} +} // namespace RDDepict #endif diff --git a/Code/GraphMol/Depictor/RDDepictor.h b/Code/GraphMol/Depictor/RDDepictor.h index e37becdf6..4f84831ef 100644 --- a/Code/GraphMol/Depictor/RDDepictor.h +++ b/Code/GraphMol/Depictor/RDDepictor.h @@ -70,13 +70,11 @@ class RDKIT_DEPICTOR_EXPORT DepictException : public std::exception { 2D coordinates */ -RDKIT_DEPICTOR_EXPORT unsigned int compute2DCoords(RDKit::ROMol &mol, - const RDGeom::INT_POINT2D_MAP *coordMap = 0, - bool canonOrient = false, bool clearConfs = true, - unsigned int nFlipsPerSample = 0, - unsigned int nSamples = 0, int sampleSeed = 0, - bool permuteDeg4Nodes = false, - bool forceRDKit = false); +RDKIT_DEPICTOR_EXPORT unsigned int compute2DCoords( + RDKit::ROMol &mol, const RDGeom::INT_POINT2D_MAP *coordMap = 0, + bool canonOrient = false, bool clearConfs = true, + unsigned int nFlipsPerSample = 0, unsigned int nSamples = 0, + int sampleSeed = 0, bool permuteDeg4Nodes = false, bool forceRDKit = false); //! \brief Compute the 2D coordinates such the interatom distances // mimic those in a distance matrix @@ -186,12 +184,10 @@ RDKIT_DEPICTOR_EXPORT void generateDepictionMatching2DStructure( for molecules that don't match the reference or the referencePattern; if false, throws a DepictException. */ -RDKIT_DEPICTOR_EXPORT void generateDepictionMatching3DStructure(RDKit::ROMol &mol, - const RDKit::ROMol &reference, - int confId = -1, - RDKit::ROMol *referencePattern = 0, - bool acceptFailure = false, - bool forceRDKit = false); -}; +RDKIT_DEPICTOR_EXPORT void generateDepictionMatching3DStructure( + RDKit::ROMol &mol, const RDKit::ROMol &reference, int confId = -1, + RDKit::ROMol *referencePattern = 0, bool acceptFailure = false, + bool forceRDKit = false); +}; // namespace RDDepict #endif diff --git a/Code/GraphMol/Descriptors/AUTOCORR2D.h b/Code/GraphMol/Descriptors/AUTOCORR2D.h index 86372e06e..771e61f58 100644 --- a/Code/GraphMol/Descriptors/AUTOCORR2D.h +++ b/Code/GraphMol/Descriptors/AUTOCORR2D.h @@ -41,8 +41,9 @@ namespace RDKit { class ROMol; namespace Descriptors { const std::string AUTOCORR2DVersion = "1.0.0"; -RDKIT_DESCRIPTORS_EXPORT void AUTOCORR2D(const ROMol &, std::vector &res, - const std::string &customAtomPropName=""); -} -} +RDKIT_DESCRIPTORS_EXPORT void AUTOCORR2D( + const ROMol &, std::vector &res, + const std::string &customAtomPropName = ""); +} // namespace Descriptors +} // namespace RDKit #endif diff --git a/Code/GraphMol/Descriptors/AUTOCORR3D.h b/Code/GraphMol/Descriptors/AUTOCORR3D.h index 08007e620..cdbce6753 100644 --- a/Code/GraphMol/Descriptors/AUTOCORR3D.h +++ b/Code/GraphMol/Descriptors/AUTOCORR3D.h @@ -42,9 +42,10 @@ namespace RDKit { class ROMol; namespace Descriptors { const std::string AUTOCORR3DVersion = "1.0.0"; -RDKIT_DESCRIPTORS_EXPORT void AUTOCORR3D(const ROMol &, std::vector &res, int confId = -1, - const std::string &customAtomPropName=""); -} -} +RDKIT_DESCRIPTORS_EXPORT void AUTOCORR3D( + const ROMol &, std::vector &res, int confId = -1, + const std::string &customAtomPropName = ""); +} // namespace Descriptors +} // namespace RDKit #endif #endif diff --git a/Code/GraphMol/Descriptors/ConnectivityDescriptors.h b/Code/GraphMol/Descriptors/ConnectivityDescriptors.h index c2113dba5..91261c16a 100644 --- a/Code/GraphMol/Descriptors/ConnectivityDescriptors.h +++ b/Code/GraphMol/Descriptors/ConnectivityDescriptors.h @@ -72,7 +72,8 @@ const std::string chi4vVersion = "1.2.0"; \param force forces the value to be recalculated instead of pulled from the cache */ -RDKIT_DESCRIPTORS_EXPORT double calcChiNv(const ROMol &mol, unsigned int n, bool force = false); +RDKIT_DESCRIPTORS_EXPORT double calcChiNv(const ROMol &mol, unsigned int n, + bool force = false); const std::string chiNvVersion = "1.2.0"; //! Similar to Hall Kier ChiXv, but uses nVal instead of valence @@ -128,7 +129,8 @@ const std::string chi4nVersion = "1.2.0"; \param force forces the value to be recalculated instead of pulled from the cache */ -RDKIT_DESCRIPTORS_EXPORT double calcChiNn(const ROMol &mol, unsigned int n, bool force = false); +RDKIT_DESCRIPTORS_EXPORT double calcChiNn(const ROMol &mol, unsigned int n, + bool force = false); const std::string chiNnVersion = "1.2.0"; //! calculate the Hall-Kier alpha value for a molecule @@ -141,8 +143,8 @@ const std::string chiNnVersion = "1.2.0"; neccessarily sum to the full value. Note: this can be a time-consuming calculation. */ -RDKIT_DESCRIPTORS_EXPORT double calcHallKierAlpha(const ROMol &mol, - std::vector *atomContribs = 0); +RDKIT_DESCRIPTORS_EXPORT double calcHallKierAlpha( + const ROMol &mol, std::vector *atomContribs = 0); const std::string hallKierAlphaVersion = "1.2.0"; //! calculate the Hall-Kier kappa1 value for a molecule @@ -171,10 +173,11 @@ RDKIT_DESCRIPTORS_EXPORT double calcKappa3(const ROMol &mol); const std::string kappa3Version = "1.1.0"; namespace detail { -RDKIT_DESCRIPTORS_EXPORT void hkDeltas(const ROMol &mol, std::vector &deltas, bool force); +RDKIT_DESCRIPTORS_EXPORT void hkDeltas(const ROMol &mol, + std::vector &deltas, bool force); } } // end of namespace Descriptors -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/Descriptors/Crippen.h b/Code/GraphMol/Descriptors/Crippen.h index a2cee9e23..1455c9631 100644 --- a/Code/GraphMol/Descriptors/Crippen.h +++ b/Code/GraphMol/Descriptors/Crippen.h @@ -47,10 +47,11 @@ const std::string crippenVersion = "1.2.0"; number of atoms */ -RDKIT_DESCRIPTORS_EXPORT void getCrippenAtomContribs(const ROMol &mol, std::vector &logpContribs, - std::vector &mrContribs, bool force = false, - std::vector *atomTypes = 0, - std::vector *atomTypeLabels = 0); +RDKIT_DESCRIPTORS_EXPORT void getCrippenAtomContribs( + const ROMol &mol, std::vector &logpContribs, + std::vector &mrContribs, bool force = false, + std::vector *atomTypes = 0, + std::vector *atomTypeLabels = 0); //! generate Wildman-Crippen LogP and MR estimates for a molecule /*! @@ -68,8 +69,10 @@ RDKIT_DESCRIPTORS_EXPORT void getCrippenAtomContribs(const ROMol &mol, std::vect pulled from the cache */ -RDKIT_DESCRIPTORS_EXPORT void calcCrippenDescriptors(const ROMol &mol, double &logp, double &mr, - bool includeHs = true, bool force = false); +RDKIT_DESCRIPTORS_EXPORT void calcCrippenDescriptors(const ROMol &mol, + double &logp, double &mr, + bool includeHs = true, + bool force = false); //! a class used to store Crippen parameters class RDKIT_DESCRIPTORS_EXPORT CrippenParams { @@ -99,7 +102,6 @@ const std::string CrippenMRVersion = crippenVersion; */ RDKIT_DESCRIPTORS_EXPORT double calcMR(const ROMol &mol); - //! singleton class for retrieving Crippen parameters /*! Use the singleton like this: @@ -130,6 +132,6 @@ class RDKIT_DESCRIPTORS_EXPORT CrippenParamCollection { ParamsVect d_params; //!< the parameters }; } // end of namespace Descriptors -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/Descriptors/EEM.h b/Code/GraphMol/Descriptors/EEM.h index c22bb9140..1e2d42136 100644 --- a/Code/GraphMol/Descriptors/EEM.h +++ b/Code/GraphMol/Descriptors/EEM.h @@ -26,7 +26,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifndef EEMRDKIT_H_SEPT2017 #define EEMRDKIT_H_SEPT2017 @@ -35,25 +34,26 @@ namespace RDKit { class ROMol; namespace Descriptors { - namespace { - class EEM_arrays { - public: - unsigned int n; - unsigned int *Atomindex; - unsigned int *EEMatomtype; +namespace { +class EEM_arrays { + public: + unsigned int n; + unsigned int *Atomindex; + unsigned int *EEMatomtype; - EEM_arrays() = delete; - EEM_arrays(const EEM_arrays&) = delete; - void operator=(const EEM_arrays&) = delete; + EEM_arrays() = delete; + EEM_arrays(const EEM_arrays &) = delete; + void operator=(const EEM_arrays &) = delete; - EEM_arrays(const ROMol &mol, unsigned int n); - ~EEM_arrays(); - }; - } + EEM_arrays(const ROMol &mol, unsigned int n); + ~EEM_arrays(); +}; +} // namespace const std::string EEMVersion = "1.0.0"; - void RDKIT_DESCRIPTORS_EXPORT EEM(ROMol &mol, std::vector &res, int confId); -} -} +void RDKIT_DESCRIPTORS_EXPORT EEM(ROMol &mol, std::vector &res, + int confId); +} // namespace Descriptors +} // namespace RDKit #endif #endif diff --git a/Code/GraphMol/Descriptors/GETAWAY.h b/Code/GraphMol/Descriptors/GETAWAY.h index 49bc9acfa..f8a8cbf6f 100644 --- a/Code/GraphMol/Descriptors/GETAWAY.h +++ b/Code/GraphMol/Descriptors/GETAWAY.h @@ -42,9 +42,10 @@ namespace RDKit { class ROMol; namespace Descriptors { const std::string GETAWAYVersion = "1.0.0"; -RDKIT_DESCRIPTORS_EXPORT void GETAWAY(const ROMol&, std::vector &res, int confId=-1, unsigned int precision=2, - const std::string &customAtomPropName=""); -} -} +RDKIT_DESCRIPTORS_EXPORT void GETAWAY( + const ROMol &, std::vector &res, int confId = -1, + unsigned int precision = 2, const std::string &customAtomPropName = ""); +} // namespace Descriptors +} // namespace RDKit #endif #endif diff --git a/Code/GraphMol/Descriptors/Lipinski.h b/Code/GraphMol/Descriptors/Lipinski.h index e6c25d850..e53b7b7fb 100644 --- a/Code/GraphMol/Descriptors/Lipinski.h +++ b/Code/GraphMol/Descriptors/Lipinski.h @@ -33,9 +33,9 @@ const std::string lipinskiHBDVersion = "2.0.0"; RDKIT_DESCRIPTORS_EXPORT unsigned int calcLipinskiHBD(const ROMol &mol); enum NumRotatableBondsOptions { - Default = -1, - NonStrict = 0, - Strict = 1, + Default = -1, + NonStrict = 0, + Strict = 1, StrictLinkages = 2, }; @@ -49,8 +49,8 @@ RDKIT_DESCRIPTORS_EXPORT extern const std::string NumRotatableBondsVersion; handles rotatable bonds between rings as well. if Default - uses the default choice (normally Strict) */ -RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumRotatableBonds(const ROMol &mol, - NumRotatableBondsOptions useStrictDefinition=Default); +RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumRotatableBonds( + const ROMol &mol, NumRotatableBondsOptions useStrictDefinition = Default); //! calculates the number of rotatable bonds ( backwards compatibility function, //! deprecated, please use calcNumRotatableBonds(const ROMol&, int) @@ -58,7 +58,8 @@ RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumRotatableBonds(const ROMol &mol, \param mol the molecule of interest \param strict if Strict == true, uses NumRotatableBondsOptions::Strict */ -RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumRotatableBonds(const ROMol &mol, bool strict); +RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumRotatableBonds(const ROMol &mol, + bool strict); RDKIT_DESCRIPTORS_EXPORT extern const std::string NumHBDVersion; //! calculates the number of H-bond donors @@ -101,51 +102,64 @@ RDKIT_DESCRIPTORS_EXPORT extern const std::string NumHeterocyclesVersion; //! calculates the number of SSSR heterocycles RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumHeterocycles(const ROMol &mol); -RDKIT_DESCRIPTORS_EXPORT extern const std::string NumAromaticHeterocyclesVersion; +RDKIT_DESCRIPTORS_EXPORT extern const std::string + NumAromaticHeterocyclesVersion; //! calculates the number of aromatic SSSR heterocycles -RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumAromaticHeterocycles(const ROMol &mol); +RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumAromaticHeterocycles( + const ROMol &mol); RDKIT_DESCRIPTORS_EXPORT extern const std::string NumAromaticCarbocyclesVersion; //! calculates the number of aromatic SSSR carbocycles -RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumAromaticCarbocycles(const ROMol &mol); +RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumAromaticCarbocycles( + const ROMol &mol); -RDKIT_DESCRIPTORS_EXPORT extern const std::string NumSaturatedHeterocyclesVersion; +RDKIT_DESCRIPTORS_EXPORT extern const std::string + NumSaturatedHeterocyclesVersion; //! calculates the number of saturated SSSR heterocycles -RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumSaturatedHeterocycles(const ROMol &mol); +RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumSaturatedHeterocycles( + const ROMol &mol); -RDKIT_DESCRIPTORS_EXPORT extern const std::string NumSaturatedCarbocyclesVersion; +RDKIT_DESCRIPTORS_EXPORT extern const std::string + NumSaturatedCarbocyclesVersion; //! calculates the number of saturated SSSR carbocycles -RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumSaturatedCarbocycles(const ROMol &mol); +RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumSaturatedCarbocycles( + const ROMol &mol); -RDKIT_DESCRIPTORS_EXPORT extern const std::string NumAliphaticHeterocyclesVersion; +RDKIT_DESCRIPTORS_EXPORT extern const std::string + NumAliphaticHeterocyclesVersion; //! calculates the number of aliphatic (at least one non-aromatic bond) SSSR // heterocycles -RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumAliphaticHeterocycles(const ROMol &mol); +RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumAliphaticHeterocycles( + const ROMol &mol); -RDKIT_DESCRIPTORS_EXPORT extern const std::string NumAliphaticCarbocyclesVersion; +RDKIT_DESCRIPTORS_EXPORT extern const std::string + NumAliphaticCarbocyclesVersion; //! calculates the number of aliphatic (at least one non-aromatic bond) SSSR // carbocycles -RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumAliphaticCarbocycles(const ROMol &mol); +RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumAliphaticCarbocycles( + const ROMol &mol); RDKIT_DESCRIPTORS_EXPORT extern const std::string NumSpiroAtomsVersion; //! calculates the number of spiro atoms (atoms shared between rings that share // exactly one atom) -RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumSpiroAtoms(const ROMol &mol, - std::vector *atoms = NULL); +RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumSpiroAtoms( + const ROMol &mol, std::vector *atoms = NULL); RDKIT_DESCRIPTORS_EXPORT extern const std::string NumBridgeheadAtomsVersion; //! calculates the number of bridgehead atoms (atoms shared between rings that // share at least two bonds) -RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumBridgeheadAtoms(const ROMol &mol, - std::vector *atoms = NULL); +RDKIT_DESCRIPTORS_EXPORT unsigned int calcNumBridgeheadAtoms( + const ROMol &mol, std::vector *atoms = NULL); RDKIT_DESCRIPTORS_EXPORT extern const std::string NumAtomStereoCentersVersion; //! calculates the total number of atom stereo centers RDKIT_DESCRIPTORS_EXPORT unsigned numAtomStereoCenters(const ROMol &mol); //! calculates the number of unspecified stereo atom stereo centers -RDKIT_DESCRIPTORS_EXPORT extern const std::string NumUnspecifiedAtomStereoCentersVersion; -RDKIT_DESCRIPTORS_EXPORT unsigned numUnspecifiedAtomStereoCenters(const ROMol &mol); +RDKIT_DESCRIPTORS_EXPORT extern const std::string + NumUnspecifiedAtomStereoCentersVersion; +RDKIT_DESCRIPTORS_EXPORT unsigned numUnspecifiedAtomStereoCenters( + const ROMol &mol); //! Helper function to register the descriptors with the descriptor service RDKIT_DESCRIPTORS_EXPORT void registerDescriptors(); diff --git a/Code/GraphMol/Descriptors/MORSE.h b/Code/GraphMol/Descriptors/MORSE.h index 29104d108..330271888 100644 --- a/Code/GraphMol/Descriptors/MORSE.h +++ b/Code/GraphMol/Descriptors/MORSE.h @@ -40,8 +40,9 @@ namespace RDKit { class ROMol; namespace Descriptors { const std::string MORSEVersion = "1.0.0"; -RDKIT_DESCRIPTORS_EXPORT void MORSE(const ROMol &, std::vector &res, int confId = -1, - const std::string &customAtomPropName = ""); +RDKIT_DESCRIPTORS_EXPORT void MORSE(const ROMol &, std::vector &res, + int confId = -1, + const std::string &customAtomPropName = ""); } // namespace Descriptors } // namespace RDKit diff --git a/Code/GraphMol/Descriptors/MQN.h b/Code/GraphMol/Descriptors/MQN.h index d7d91306f..542b67214 100644 --- a/Code/GraphMol/Descriptors/MQN.h +++ b/Code/GraphMol/Descriptors/MQN.h @@ -38,7 +38,8 @@ const std::string MQNVersion = "1.0.0"; \return a vector with the MQNs */ -RDKIT_DESCRIPTORS_EXPORT std::vector calcMQNs(const ROMol &mol, bool force = false); +RDKIT_DESCRIPTORS_EXPORT std::vector calcMQNs(const ROMol &mol, + bool force = false); } // end of namespace Descriptors } // end of namespace RDKit diff --git a/Code/GraphMol/Descriptors/MolData3Ddescriptors.h b/Code/GraphMol/Descriptors/MolData3Ddescriptors.h index f30c753a2..0c4f629fa 100644 --- a/Code/GraphMol/Descriptors/MolData3Ddescriptors.h +++ b/Code/GraphMol/Descriptors/MolData3Ddescriptors.h @@ -45,7 +45,8 @@ class RDKIT_DESCRIPTORS_EXPORT MolData3Ddescriptors { MolData3Ddescriptors(); std::vector GetCharges(const RDKit::ROMol& mol); std::vector GetRelativeMW(const RDKit::ROMol& mol); - std::vector GetCustomAtomProp(const RDKit::ROMol& mol, const std::string &customAtomPropName); + std::vector GetCustomAtomProp(const RDKit::ROMol& mol, + const std::string& customAtomPropName); std::vector GetRelativePol(const RDKit::ROMol& mol); std::vector GetRelativeRcov(const RDKit::ROMol& mol); std::vector GetRelativeENeg(const RDKit::ROMol& mol); diff --git a/Code/GraphMol/Descriptors/MolDescriptors.h b/Code/GraphMol/Descriptors/MolDescriptors.h index 2bb3585ea..2980eeb7a 100644 --- a/Code/GraphMol/Descriptors/MolDescriptors.h +++ b/Code/GraphMol/Descriptors/MolDescriptors.h @@ -32,7 +32,8 @@ namespace Descriptors { \return the AMW */ RDKIT_DESCRIPTORS_EXPORT extern const std::string amwVersion; -RDKIT_DESCRIPTORS_EXPORT double calcAMW(const ROMol &mol, bool onlyHeavy = false); +RDKIT_DESCRIPTORS_EXPORT double calcAMW(const ROMol &mol, + bool onlyHeavy = false); /*! Calculates a molecule's exact molecular weight @@ -43,7 +44,8 @@ RDKIT_DESCRIPTORS_EXPORT double calcAMW(const ROMol &mol, bool onlyHeavy = false \return the exact MW */ RDKIT_DESCRIPTORS_EXPORT extern const std::string exactmwVersion; -RDKIT_DESCRIPTORS_EXPORT double calcExactMW(const ROMol &mol, bool onlyHeavy = false); +RDKIT_DESCRIPTORS_EXPORT double calcExactMW(const ROMol &mol, + bool onlyHeavy = false); /*! Calculates a molecule's formula @@ -56,8 +58,9 @@ RDKIT_DESCRIPTORS_EXPORT double calcExactMW(const ROMol &mol, bool onlyHeavy = f \return the formula as a string */ -RDKIT_DESCRIPTORS_EXPORT std::string calcMolFormula(const ROMol &mol, bool separateIsotopes = false, - bool abbreviateHIsotopes = true); +RDKIT_DESCRIPTORS_EXPORT std::string calcMolFormula( + const ROMol &mol, bool separateIsotopes = false, + bool abbreviateHIsotopes = true); } // end of namespace Descriptors } // end of namespace RDKit diff --git a/Code/GraphMol/Descriptors/PBF.h b/Code/GraphMol/Descriptors/PBF.h index 556c7dfa2..abbb99b80 100644 --- a/Code/GraphMol/Descriptors/PBF.h +++ b/Code/GraphMol/Descriptors/PBF.h @@ -3,7 +3,7 @@ // All rights reserved. // // Redistribution and use in source and binary forms, with or without -//modification, are permitted provided that the following conditions are +// modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright @@ -14,7 +14,8 @@ // with the distribution. // * Neither the name of Institue of Cancer Research. // nor the names of its contributors may be used to endorse or promote -// products derived from this software without specific prior written permission. +// products derived from this software without specific prior written +// permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -28,12 +29,15 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// For more information on the Plane of Best Fit please see http://pubs.acs.org/doi/abs/10.1021/ci300293f +// For more information on the Plane of Best Fit please see +// http://pubs.acs.org/doi/abs/10.1021/ci300293f // // If this code has been useful to you, please include the reference // in any work which has made use of it: -// Plane of Best Fit: A Novel Method to Characterize the Three-Dimensionality of Molecules, Nicholas C. Firth, Nathan Brown, and Julian Blagg, Journal of Chemical Information and Modeling 2012 52 (10), 2516-2525 +// Plane of Best Fit: A Novel Method to Characterize the Three-Dimensionality +// of Molecules, Nicholas C. Firth, Nathan Brown, and Julian Blagg, Journal of +// Chemical Information and Modeling 2012 52 (10), 2516-2525 // // @@ -49,8 +53,8 @@ namespace RDKit { class ROMol; namespace Descriptors { const std::string PBFVersion = "1.0.0"; -RDKIT_DESCRIPTORS_EXPORT double PBF(const ROMol&,int confId=-1); -} -} +RDKIT_DESCRIPTORS_EXPORT double PBF(const ROMol&, int confId = -1); +} // namespace Descriptors +} // namespace RDKit #endif #endif diff --git a/Code/GraphMol/Descriptors/Property.h b/Code/GraphMol/Descriptors/Property.h index 9e63267a2..d37d76b32 100644 --- a/Code/GraphMol/Descriptors/Property.h +++ b/Code/GraphMol/Descriptors/Property.h @@ -43,53 +43,49 @@ namespace RDKit { namespace Descriptors { - struct RDKIT_DESCRIPTORS_EXPORT PropertyFunctor { - // Registry of property functions - // See REGISTER_DESCRIPTOR - std::string propName; - std::string propVersion; - double (*d_dataFunc)(const ROMol&); - - PropertyFunctor(const std::string &name, const std::string &version, - double (*func)(const ROMol&)=NULL) : - propName(name), propVersion(version), d_dataFunc(func) { - } - virtual ~PropertyFunctor() {}; - - //! Compute the value of the property - virtual double operator()(const RDKit::ROMol &) const = 0; - - //! Return the name of the property - const std::string getName() const { return propName; } - //! Return the properties version - const std::string getVersion() const { return propVersion; } - +struct RDKIT_DESCRIPTORS_EXPORT PropertyFunctor { + // Registry of property functions + // See REGISTER_DESCRIPTOR + std::string propName; + std::string propVersion; + double (*d_dataFunc)(const ROMol &); + + PropertyFunctor(const std::string &name, const std::string &version, + double (*func)(const ROMol &) = NULL) + : propName(name), propVersion(version), d_dataFunc(func) {} + virtual ~PropertyFunctor(){}; + + //! Compute the value of the property + virtual double operator()(const RDKit::ROMol &) const = 0; + + //! Return the name of the property + const std::string getName() const { return propName; } + //! Return the properties version + const std::string getVersion() const { return propVersion; } }; - //! Holds a collection of properties for computation purposes class RDKIT_DESCRIPTORS_EXPORT Properties { -protected: - std::vector > m_properties; - -public: + protected: + std::vector> m_properties; + + public: Properties(); Properties(const std::vector &propNames); - + std::vector getPropertyNames() const; - std::vector computeProperties(const RDKit::ROMol &mol, bool annotate=false) const; - void annotateProperties(RDKit::ROMol& mol) const; - + std::vector computeProperties(const RDKit::ROMol &mol, + bool annotate = false) const; + void annotateProperties(RDKit::ROMol &mol) const; + //! Register a property function - takes ownership static int registerProperty(PropertyFunctor *ptr); - static boost::shared_ptr getProperty(const std::string &name); + static boost::shared_ptr getProperty( + const std::string &name); static std::vector getAvailableProperties(); - static std::vector > registry; - - + static std::vector> registry; }; - typedef Queries::Query PROP_BOOL_QUERY; typedef Queries::AndQuery PROP_AND_QUERY; typedef Queries::OrQuery PROP_OR_QUERY; @@ -102,26 +98,23 @@ typedef Queries::GreaterQuery PROP_GREATER_QUERY; typedef Queries::GreaterEqualQuery PROP_GREATEREQUAL_QUERY; - typedef Queries::LessQuery PROP_LESS_QUERY; -typedef Queries::LessEqualQuery PROP_LESSEQUAL_QUERY; +typedef Queries::LessEqualQuery + PROP_LESSEQUAL_QUERY; typedef Queries::RangeQuery PROP_RANGE_QUERY; - -template -T* makePropertyQuery(const std::string &name, double what) { +template +T *makePropertyQuery(const std::string &name, double what) { T *t = new T(what); - t->setDataFunc( Properties::getProperty(name)->d_dataFunc ); + t->setDataFunc(Properties::getProperty(name)->d_dataFunc); return t; } +RDKIT_DESCRIPTORS_EXPORT PROP_RANGE_QUERY *makePropertyRangeQuery( + const std::string &name, double min, double max); -RDKIT_DESCRIPTORS_EXPORT PROP_RANGE_QUERY *makePropertyRangeQuery(const std::string &name, - double min, - double max); - -} -} +} // namespace Descriptors +} // namespace RDKit #endif diff --git a/Code/GraphMol/Descriptors/RDF.h b/Code/GraphMol/Descriptors/RDF.h index 8c0f82aa8..c4c88f186 100644 --- a/Code/GraphMol/Descriptors/RDF.h +++ b/Code/GraphMol/Descriptors/RDF.h @@ -42,8 +42,9 @@ namespace RDKit { class ROMol; namespace Descriptors { const std::string RDFVersion = "1.0.0"; -RDKIT_DESCRIPTORS_EXPORT void RDF(const ROMol &, std::vector &res, int confId = -1, - const std::string &customAtomPropName = ""); +RDKIT_DESCRIPTORS_EXPORT void RDF(const ROMol &, std::vector &res, + int confId = -1, + const std::string &customAtomPropName = ""); } // namespace Descriptors } // namespace RDKit diff --git a/Code/GraphMol/Descriptors/RegisterDescriptor.h b/Code/GraphMol/Descriptors/RegisterDescriptor.h index 3cddd6b17..25ce5749b 100644 --- a/Code/GraphMol/Descriptors/RegisterDescriptor.h +++ b/Code/GraphMol/Descriptors/RegisterDescriptor.h @@ -46,36 +46,39 @@ namespace Descriptors { // these macros create a static class that can call the specified function. // using double class::operator(const ROMol&) // this class also contains a function pointer with the signature -// double(*)(const ROMol&) +// double(*)(const ROMol&) // these classes are automatically registered with the property registry - /* +/* #define REGISTER_FULL_DESCRIPTOR( NAME, VERSION, FUNC ) \ - double NAME##PropertyFunction(const ROMol&m){return static_cast(FUNC(mol));}\ - struct NAME##PropertyFunctor : public PropertyFunctor{ \ - NAME##PropertyFunctor(bool registerProp=true) : PropertyFunctor(#NAME, VERSION) { \ - if (registerProp) Properties::registerProperty(new NAME##PropertyFunctor(false)); \ - d_dataFunc = &NAME##PropertyFunction; \ - } \ - double operator()(const RDKit::ROMol &mol) const { \ - return NAME##PropertyFunction(mol); } \ - }; \ - static NAME##PropertyFunctor NAME##PropertyFunctor__; - */ +double NAME##PropertyFunction(const ROMol&m){return +static_cast(FUNC(mol));}\ +struct NAME##PropertyFunctor : public PropertyFunctor{ \ + NAME##PropertyFunctor(bool registerProp=true) : PropertyFunctor(#NAME, +VERSION) { \ + if (registerProp) Properties::registerProperty(new +NAME##PropertyFunctor(false)); \ + d_dataFunc = &NAME##PropertyFunction; \ + } \ + double operator()(const RDKit::ROMol &mol) const { \ + return NAME##PropertyFunction(mol); } \ +}; \ +static NAME##PropertyFunctor NAME##PropertyFunctor__; +*/ - - -#define REGISTER_DESCRIPTOR( NAME, FUNC ) \ - struct NAME##PropertyFunctor : public PropertyFunctor{ \ - static double _func(const ROMol&m){return static_cast(FUNC(m));} \ - NAME##PropertyFunctor(bool registerProp=true) : \ - PropertyFunctor(#NAME, NAME##Version, _func) { \ - if (registerProp) Properties::registerProperty(new NAME##PropertyFunctor(false)); \ - } \ - double operator()(const RDKit::ROMol &mol) const { \ - return _func(mol); } \ - }; \ +#define REGISTER_DESCRIPTOR(NAME, FUNC) \ + struct NAME##PropertyFunctor : public PropertyFunctor { \ + static double _func(const ROMol &m) { \ + return static_cast(FUNC(m)); \ + } \ + NAME##PropertyFunctor(bool registerProp = true) \ + : PropertyFunctor(#NAME, NAME##Version, _func) { \ + if (registerProp) \ + Properties::registerProperty(new NAME##PropertyFunctor(false)); \ + } \ + double operator()(const RDKit::ROMol &mol) const { return _func(mol); } \ + }; \ static NAME##PropertyFunctor NAME##PropertyFunctor__; -} -} +} // namespace Descriptors +} // namespace RDKit #endif diff --git a/Code/GraphMol/Descriptors/USRDescriptor.h b/Code/GraphMol/Descriptors/USRDescriptor.h index 2d484790b..ebd34156a 100644 --- a/Code/GraphMol/Descriptors/USRDescriptor.h +++ b/Code/GraphMol/Descriptors/USRDescriptor.h @@ -60,7 +60,9 @@ namespace Descriptors { \param confId the conformer Id */ -RDKIT_DESCRIPTORS_EXPORT void USR(const ROMol &mol, std::vector &descriptor, int confId = -1); +RDKIT_DESCRIPTORS_EXPORT void USR(const ROMol &mol, + std::vector &descriptor, + int confId = -1); /*! Calculates the ultra-fast shape recognition with CREDO atom types (USRCAT) @@ -76,8 +78,9 @@ RDKIT_DESCRIPTORS_EXPORT void USR(const ROMol &mol, std::vector &descrip \param confId the conformer Id */ -RDKIT_DESCRIPTORS_EXPORT void USRCAT(const ROMol &mol, std::vector &descriptor, - std::vector> &atomIds, int confId = -1); +RDKIT_DESCRIPTORS_EXPORT void USRCAT( + const ROMol &mol, std::vector &descriptor, + std::vector> &atomIds, int confId = -1); /*! Calculates the four distance distributions for the USR descriptor @@ -86,9 +89,10 @@ RDKIT_DESCRIPTORS_EXPORT void USRCAT(const ROMol &mol, std::vector &desc \param points storage for the four points */ -RDKIT_DESCRIPTORS_EXPORT void calcUSRDistributions(const RDGeom::Point3DConstPtrVect &coords, - std::vector> &dist, - std::vector &points); +RDKIT_DESCRIPTORS_EXPORT void calcUSRDistributions( + const RDGeom::Point3DConstPtrVect &coords, + std::vector> &dist, + std::vector &points); /*! Calculates the four distance distributions for the USR descriptor @@ -98,9 +102,10 @@ RDKIT_DESCRIPTORS_EXPORT void calcUSRDistributions(const RDGeom::Point3DConstPtr \param dist storage for the distance distributions */ -RDKIT_DESCRIPTORS_EXPORT void calcUSRDistributionsFromPoints(const RDGeom::Point3DConstPtrVect &coords, - const std::vector &points, - std::vector> &dist); +RDKIT_DESCRIPTORS_EXPORT void calcUSRDistributionsFromPoints( + const RDGeom::Point3DConstPtrVect &coords, + const std::vector &points, + std::vector> &dist); /*! Calculates the USR descriptor from the four distance distributions @@ -109,8 +114,9 @@ RDKIT_DESCRIPTORS_EXPORT void calcUSRDistributionsFromPoints(const RDGeom::Point \param descriptor storage for the computed USR descriptor */ -RDKIT_DESCRIPTORS_EXPORT void calcUSRFromDistributions(const std::vector> &dist, - std::vector &descriptor); +RDKIT_DESCRIPTORS_EXPORT void calcUSRFromDistributions( + const std::vector> &dist, + std::vector &descriptor); /*! Calculates the score between two USRCAT descriptors with weights @@ -121,9 +127,9 @@ RDKIT_DESCRIPTORS_EXPORT void calcUSRFromDistributions(const std::vector &d1, - const std::vector &d2, - const std::vector &weights); +RDKIT_DESCRIPTORS_EXPORT double calcUSRScore( + const std::vector &d1, const std::vector &d2, + const std::vector &weights); } // end of namespace Descriptors } // end of namespace RDKit diff --git a/Code/GraphMol/Descriptors/WHIM.h b/Code/GraphMol/Descriptors/WHIM.h index 468cbfc32..f83523ac8 100644 --- a/Code/GraphMol/Descriptors/WHIM.h +++ b/Code/GraphMol/Descriptors/WHIM.h @@ -42,8 +42,9 @@ namespace RDKit { class ROMol; namespace Descriptors { const std::string WHIMVersion = "1.0.0"; -RDKIT_DESCRIPTORS_EXPORT void WHIM(const ROMol &, std::vector &res, int confId = -1, - double th = 0.001, const std::string &customAtomPropName = ""); +RDKIT_DESCRIPTORS_EXPORT void WHIM(const ROMol &, std::vector &res, + int confId = -1, double th = 0.001, + const std::string &customAtomPropName = ""); } // namespace Descriptors } // namespace RDKit #endif diff --git a/Code/GraphMol/DistGeomHelpers/Embedder.h b/Code/GraphMol/DistGeomHelpers/Embedder.h index 67bc32fb3..08c0b2674 100644 --- a/Code/GraphMol/DistGeomHelpers/Embedder.h +++ b/Code/GraphMol/DistGeomHelpers/Embedder.h @@ -167,8 +167,9 @@ struct RDKIT_DISTGEOMHELPERS_EXPORT EmbedParameters { }; //*! Embed multiple conformations for a molecule -RDKIT_DISTGEOMHELPERS_EXPORT void EmbedMultipleConfs(ROMol &mol, INT_VECT &res, unsigned int numConfs, - const EmbedParameters ¶ms); +RDKIT_DISTGEOMHELPERS_EXPORT void EmbedMultipleConfs( + ROMol &mol, INT_VECT &res, unsigned int numConfs, + const EmbedParameters ¶ms); inline INT_VECT EmbedMultipleConfs(ROMol &mol, unsigned int numConfs, const EmbedParameters ¶ms) { INT_VECT res; @@ -400,7 +401,7 @@ RDKIT_DISTGEOMHELPERS_EXPORT extern const EmbedParameters ETDG; RDKIT_DISTGEOMHELPERS_EXPORT extern const EmbedParameters ETKDG; //! Parameters corresponding to Sereina Riniker's ETKDG approach - version 2 RDKIT_DISTGEOMHELPERS_EXPORT extern const EmbedParameters ETKDGv2; -} -} +} // namespace DGeomHelpers +} // namespace RDKit #endif diff --git a/Code/GraphMol/FMCS/Composition2N.h b/Code/GraphMol/FMCS/Composition2N.h index d35d5c84b..ecb754fdc 100644 --- a/Code/GraphMol/FMCS/Composition2N.h +++ b/Code/GraphMol/FMCS/Composition2N.h @@ -47,5 +47,5 @@ class Composition2N { // generator of 2^N-1 possible bit combinations // unused: bool nonZero() {return 0!=getBitSet();} bool isSet(unsigned bit) const { return 0 != (getBitSet() & (1uLL << bit)); } }; -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FMCS/DebugTrace.h b/Code/GraphMol/FMCS/DebugTrace.h index 17bb93cc4..b90658ab0 100644 --- a/Code/GraphMol/FMCS/DebugTrace.h +++ b/Code/GraphMol/FMCS/DebugTrace.h @@ -154,5 +154,5 @@ struct ExecStatistics { DupCacheFoundMatch(0) {} }; #endif -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FMCS/DuplicatedSeedCache.h b/Code/GraphMol/FMCS/DuplicatedSeedCache.h index 63e6e56cf..714d5681d 100644 --- a/Code/GraphMol/FMCS/DuplicatedSeedCache.h +++ b/Code/GraphMol/FMCS/DuplicatedSeedCache.h @@ -94,5 +94,5 @@ class DuplicatedSeedCache { return Index.size(); // for statistics only } }; -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FMCS/Graph.h b/Code/GraphMol/FMCS/Graph.h index ffbf224af..eef867293 100644 --- a/Code/GraphMol/FMCS/Graph.h +++ b/Code/GraphMol/FMCS/Graph.h @@ -18,7 +18,8 @@ namespace FMCS { typedef unsigned AtomIdx_t; typedef unsigned BondIdx_t; typedef boost::adjacency_list Graph_t; + AtomIdx_t, BondIdx_t> + Graph_t; class RDKIT_FMCS_EXPORT Graph : public Graph_t { public: @@ -36,5 +37,5 @@ class RDKIT_FMCS_EXPORT Graph : public Graph_t { (*this)[which] = bond; } }; -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FMCS/MatchTable.h b/Code/GraphMol/FMCS/MatchTable.h index 280fa4929..74ae30091 100644 --- a/Code/GraphMol/FMCS/MatchTable.h +++ b/Code/GraphMol/FMCS/MatchTable.h @@ -15,8 +15,9 @@ namespace RDKit { namespace FMCS { template -class RDKIT_FMCS_EXPORT TArray2D { // for scalar value types ! including bool with special STL - // implementation (no reference to item - bitset used) +class RDKIT_FMCS_EXPORT + TArray2D { // for scalar value types ! including bool with special STL + // implementation (no reference to item - bitset used) size_t XSize; size_t YSize; std::vector Data; @@ -45,5 +46,5 @@ class RDKIT_FMCS_EXPORT TArray2D { // for scalar value types ! including bool w }; typedef TArray2D MatchTable; // row is index in QueryMolecule -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FMCS/MaximumCommonSubgraph.h b/Code/GraphMol/FMCS/MaximumCommonSubgraph.h index 67b1c0bab..fe590ae44 100644 --- a/Code/GraphMol/FMCS/MaximumCommonSubgraph.h +++ b/Code/GraphMol/FMCS/MaximumCommonSubgraph.h @@ -97,5 +97,5 @@ class RDKIT_FMCS_EXPORT MaximumCommonSubgraph { bool match(Seed& seed); bool matchIncrementalFast(Seed& seed, unsigned itarget); }; -} +} // namespace FMCS } // namespace RDKit diff --git a/Code/GraphMol/FMCS/RingMatchTableSet.h b/Code/GraphMol/FMCS/RingMatchTableSet.h index 80d4f41e8..1502ed02d 100644 --- a/Code/GraphMol/FMCS/RingMatchTableSet.h +++ b/Code/GraphMol/FMCS/RingMatchTableSet.h @@ -55,8 +55,8 @@ class RDKIT_FMCS_EXPORT RingMatchTableSet { }; private: - std::vector >* QueryBondRingsIndeces; - std::map > > + std::vector>* QueryBondRingsIndeces; + std::map>> TargetBondRingsIndecesSet; // by target molecules std::map MatchMatrixSet; // by target molecules @@ -80,15 +80,15 @@ class RDKIT_FMCS_EXPORT RingMatchTableSet { } inline bool isTargetBondInRing(const ROMol* target, unsigned bi) const { - std::map > >::const_iterator - i = TargetBondRingsIndecesSet.find(target); + std::map>>::const_iterator i = + TargetBondRingsIndecesSet.find(target); if (TargetBondRingsIndecesSet.end() == i) throw - 1; // never return i->second[bi].empty(); } inline const std::vector& getTargetBondRings(const ROMol* target, unsigned bi) const { - std::map > >::const_iterator - i = TargetBondRingsIndecesSet.find(target); + std::map>>::const_iterator i = + TargetBondRingsIndecesSet.find(target); if (TargetBondRingsIndecesSet.end() == i) throw - 1; // never return i->second[bi]; } @@ -119,7 +119,7 @@ class RDKIT_FMCS_EXPORT RingMatchTableSet { (*QueryBondRingsIndeces)[*bi].push_back(ri); } inline void addTargetBondRingsIndeces(const ROMol* mol2) { - std::vector >& m = TargetBondRingsIndecesSet[mol2]; + std::vector>& m = TargetBondRingsIndecesSet[mol2]; m.resize(mol2->getNumBonds()); size_t ri = 0; @@ -229,5 +229,5 @@ class RDKIT_FMCS_EXPORT RingMatchTableSet { return m; } }; -} +} // namespace FMCS } // namespace RDKit diff --git a/Code/GraphMol/FMCS/Seed.h b/Code/GraphMol/FMCS/Seed.h index ea1b54154..35594f6cd 100644 --- a/Code/GraphMol/FMCS/Seed.h +++ b/Code/GraphMol/FMCS/Seed.h @@ -21,7 +21,8 @@ namespace FMCS { class MaximumCommonSubgraph; struct TargetMatch; -struct RDKIT_FMCS_EXPORT MolFragment { // Reference to a fragment of source molecule +struct RDKIT_FMCS_EXPORT + MolFragment { // Reference to a fragment of source molecule std::vector Atoms; std::vector Bonds; std::vector AtomsIdx; @@ -139,5 +140,5 @@ class RDKIT_FMCS_EXPORT Seed { unsigned addBond(const Bond* bond); void fillNewBonds(const ROMol& qmol); }; -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FMCS/SeedSet.h b/Code/GraphMol/FMCS/SeedSet.h index 75f00909d..6bf04b541 100644 --- a/Code/GraphMol/FMCS/SeedSet.h +++ b/Code/GraphMol/FMCS/SeedSet.h @@ -56,5 +56,5 @@ class RDKIT_FMCS_EXPORT SeedSet { // sorted by amount of bonds return val; } }; -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FMCS/SubstructMatchCustom.h b/Code/GraphMol/FMCS/SubstructMatchCustom.h index d0842f09a..b8ee665cc 100644 --- a/Code/GraphMol/FMCS/SubstructMatchCustom.h +++ b/Code/GraphMol/FMCS/SubstructMatchCustom.h @@ -16,8 +16,9 @@ namespace RDKit { namespace FMCS { -typedef std::vector > match_V_t; +typedef std::vector< + std::pair> + match_V_t; const unsigned int NotSet = (unsigned int)-1; RDKIT_FMCS_EXPORT bool SubstructMatchCustomTable( @@ -38,5 +39,5 @@ RDKIT_FMCS_EXPORT bool SubstructMatchCustom( MCSFinalMatchCheckFunction finalCompare, const MCSAtomCompareParameters& acp, const MCSBondCompareParameters& bcp, void* user_data, match_V_t* match = 0); -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FMCS/SubstructureCache.h b/Code/GraphMol/FMCS/SubstructureCache.h index 83e478754..b216fb08b 100644 --- a/Code/GraphMol/FMCS/SubstructureCache.h +++ b/Code/GraphMol/FMCS/SubstructureCache.h @@ -66,9 +66,9 @@ class RDKIT_FMCS_EXPORT SubstructureCache { const Bond* bond = seed.MoleculeFragment.Bonds[seedBondIdx]; unsigned order = queryBondLabels[seed.MoleculeFragment.BondsIdx[seedBondIdx]]; - unsigned atom1 = - seed.MoleculeFragment.SeedAtomIdxMap.find(bond->getBeginAtomIdx()) - ->second; + unsigned atom1 = seed.MoleculeFragment.SeedAtomIdxMap + .find(bond->getBeginAtomIdx()) + ->second; unsigned atom2 = seed.MoleculeFragment.SeedAtomIdxMap.find(bond->getEndAtomIdx()) ->second; @@ -144,9 +144,10 @@ class RDKIT_FMCS_EXPORT SubstructureCache { } entry->push_back(seed.Topology); - if (!NumericIndex.insert(std::pair( - key.NumericMetrics.Value, - ValueStorage.size() - 1)).second) + if (!NumericIndex + .insert(std::pair( + key.NumericMetrics.Value, ValueStorage.size() - 1)) + .second) return; // not enought memory room to add the item, but it is just cache } @@ -162,5 +163,5 @@ class RDKIT_FMCS_EXPORT SubstructureCache { return n; } }; -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FMCS/Target.h b/Code/GraphMol/FMCS/Target.h index 220806e6a..20f428259 100644 --- a/Code/GraphMol/FMCS/Target.h +++ b/Code/GraphMol/FMCS/Target.h @@ -24,5 +24,5 @@ struct Target { MatchTable AtomMatchTable; MatchTable BondMatchTable; }; -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FMCS/TargetMatch.h b/Code/GraphMol/FMCS/TargetMatch.h index fb2cd5f31..301a256b2 100644 --- a/Code/GraphMol/FMCS/TargetMatch.h +++ b/Code/GraphMol/FMCS/TargetMatch.h @@ -96,5 +96,5 @@ struct TargetMatch { Empty = false; } }; -} -} +} // namespace FMCS +} // namespace RDKit diff --git a/Code/GraphMol/FileParsers/MolFileStereochem.h b/Code/GraphMol/FileParsers/MolFileStereochem.h index 38e8b20b5..5a7b17d20 100644 --- a/Code/GraphMol/FileParsers/MolFileStereochem.h +++ b/Code/GraphMol/FileParsers/MolFileStereochem.h @@ -15,18 +15,19 @@ namespace RDKit { //! deprecated, please use MolOps::assignChiralTypesFromBondDirs instead -RDKIT_FILEPARSERS_EXPORT void DetectAtomStereoChemistry(RWMol &mol, const Conformer *conf); +RDKIT_FILEPARSERS_EXPORT void DetectAtomStereoChemistry(RWMol &mol, + const Conformer *conf); //! deprecated, please use MolOps::detectBondStereoChemistry instead -RDKIT_FILEPARSERS_EXPORT void DetectBondStereoChemistry(ROMol &mol, const Conformer *conf); +RDKIT_FILEPARSERS_EXPORT void DetectBondStereoChemistry(ROMol &mol, + const Conformer *conf); RDKIT_FILEPARSERS_EXPORT void WedgeMolBonds(ROMol &mol, const Conformer *conf); -RDKIT_FILEPARSERS_EXPORT void WedgeBond(Bond *bond, unsigned int fromAtomIdx, const Conformer *conf); +RDKIT_FILEPARSERS_EXPORT void WedgeBond(Bond *bond, unsigned int fromAtomIdx, + const Conformer *conf); RDKIT_FILEPARSERS_EXPORT INT_MAP_INT pickBondsToWedge(const ROMol &mol); RDKIT_FILEPARSERS_EXPORT void ClearSingleBondDirFlags(ROMol &mol); -RDKIT_FILEPARSERS_EXPORT Bond::BondDir DetermineBondWedgeState(const Bond *bond, - unsigned int fromAtomIdx, - const Conformer *conf); -RDKIT_FILEPARSERS_EXPORT Bond::BondDir DetermineBondWedgeState(const Bond *bond, - const INT_MAP_INT &wedgeBonds, - const Conformer *conf); -} +RDKIT_FILEPARSERS_EXPORT Bond::BondDir DetermineBondWedgeState( + const Bond *bond, unsigned int fromAtomIdx, const Conformer *conf); +RDKIT_FILEPARSERS_EXPORT Bond::BondDir DetermineBondWedgeState( + const Bond *bond, const INT_MAP_INT &wedgeBonds, const Conformer *conf); +} // namespace RDKit #endif diff --git a/Code/GraphMol/FileParsers/MolSupplier.h b/Code/GraphMol/FileParsers/MolSupplier.h index 52af80740..3a84bea70 100644 --- a/Code/GraphMol/FileParsers/MolSupplier.h +++ b/Code/GraphMol/FileParsers/MolSupplier.h @@ -106,12 +106,8 @@ class RDKIT_FILEPARSERS_EXPORT ForwardSDMolSupplier : public MolSupplier { virtual ROMol *next(); virtual bool atEnd(); - void setProcessPropertyLists(bool val) { - df_processPropertyLists = val; - } - bool getProcessPropertyLists() const { - return df_processPropertyLists; - } + void setProcessPropertyLists(bool val) { df_processPropertyLists = val; } + bool getProcessPropertyLists() const { return df_processPropertyLists; } protected: virtual void checkForEnd(); diff --git a/Code/GraphMol/FileParsers/ProximityBonds.h b/Code/GraphMol/FileParsers/ProximityBonds.h index d348b0bab..569116b5d 100644 --- a/Code/GraphMol/FileParsers/ProximityBonds.h +++ b/Code/GraphMol/FileParsers/ProximityBonds.h @@ -17,9 +17,11 @@ static const unsigned int ctdIGNORE_H_H_CONTACTS = 0x1; // static const unsigned int ctdALL_FLAGS = 0xFFFFFFFF; class AtomPDBResidueInfo; RDKIT_FILEPARSERS_EXPORT bool IsBlacklistedPair(Atom *beg_atom, Atom *end_atom); -RDKIT_FILEPARSERS_EXPORT void ConnectTheDots(RWMol *mol, unsigned int flags = 0); +RDKIT_FILEPARSERS_EXPORT void ConnectTheDots(RWMol *mol, + unsigned int flags = 0); RDKIT_FILEPARSERS_EXPORT void StandardPDBResidueBondOrders(RWMol *mol); -RDKIT_FILEPARSERS_EXPORT bool SamePDBResidue(AtomPDBResidueInfo *p, AtomPDBResidueInfo *q); -} +RDKIT_FILEPARSERS_EXPORT bool SamePDBResidue(AtomPDBResidueInfo *p, + AtomPDBResidueInfo *q); +} // namespace RDKit #endif // _RD_PROXIMITYBONDS_H_ diff --git a/Code/GraphMol/FileParsers/SequenceParsers.h b/Code/GraphMol/FileParsers/SequenceParsers.h index 65693446b..abb369e26 100644 --- a/Code/GraphMol/FileParsers/SequenceParsers.h +++ b/Code/GraphMol/FileParsers/SequenceParsers.h @@ -25,9 +25,11 @@ class RWMol; *of the corresponding amino acid * */ -RDKIT_FILEPARSERS_EXPORT RWMol *SequenceToMol(const char *seq, bool sanitize, bool lowerD); +RDKIT_FILEPARSERS_EXPORT RWMol *SequenceToMol(const char *seq, bool sanitize, + bool lowerD); //! \overload -RDKIT_FILEPARSERS_EXPORT RWMol *SequenceToMol(const std::string &seq, bool sanitize, bool lowerD); +RDKIT_FILEPARSERS_EXPORT RWMol *SequenceToMol(const std::string &seq, + bool sanitize, bool lowerD); // \brief construct a protein, RNA or DNA molecule from a sequence string /*! @@ -47,10 +49,13 @@ RDKIT_FILEPARSERS_EXPORT RWMol *SequenceToMol(const std::string &seq, bool sanit * 9 DNA, both caps * */ -RDKIT_FILEPARSERS_EXPORT RWMol *SequenceToMol(const char *seq, bool sanitize = true, int flavor = 0); +RDKIT_FILEPARSERS_EXPORT RWMol *SequenceToMol(const char *seq, + bool sanitize = true, + int flavor = 0); //! \overload -RDKIT_FILEPARSERS_EXPORT RWMol *SequenceToMol(const std::string &seq, bool sanitize = true, - int flavor = 0); +RDKIT_FILEPARSERS_EXPORT RWMol *SequenceToMol(const std::string &seq, + bool sanitize = true, + int flavor = 0); // \brief construct a molecule from a FASTA string (currently only supports // peptides) @@ -62,9 +67,11 @@ RDKIT_FILEPARSERS_EXPORT RWMol *SequenceToMol(const std::string &seq, bool sanit *of the corresponding amino acid * */ -RDKIT_FILEPARSERS_EXPORT RWMol *FASTAToMol(const char *seq, bool sanitize, bool lowerD); +RDKIT_FILEPARSERS_EXPORT RWMol *FASTAToMol(const char *seq, bool sanitize, + bool lowerD); //! \overload -RDKIT_FILEPARSERS_EXPORT RWMol *FASTAToMol(const std::string &seq, bool sanitize, bool lowerD); +RDKIT_FILEPARSERS_EXPORT RWMol *FASTAToMol(const std::string &seq, + bool sanitize, bool lowerD); // \brief construct a protein, DNA or RNA molecule from a FASTA string /*! @@ -84,9 +91,13 @@ RDKIT_FILEPARSERS_EXPORT RWMol *FASTAToMol(const std::string &seq, bool sanitize * 9 DNA, both caps * */ -RDKIT_FILEPARSERS_EXPORT RWMol *FASTAToMol(const char *seq, bool sanitize = true, int flavor = 0); +RDKIT_FILEPARSERS_EXPORT RWMol *FASTAToMol(const char *seq, + bool sanitize = true, + int flavor = 0); //! \overload -RDKIT_FILEPARSERS_EXPORT RWMol *FASTAToMol(const std::string &seq, bool sanitize = true, int flavor = 0); +RDKIT_FILEPARSERS_EXPORT RWMol *FASTAToMol(const std::string &seq, + bool sanitize = true, + int flavor = 0); // \brief construct a molecule from a HELM string (currently only supports // peptides) @@ -96,9 +107,11 @@ RDKIT_FILEPARSERS_EXPORT RWMol *FASTAToMol(const std::string &seq, bool sanitize *the molecule * */ -RDKIT_FILEPARSERS_EXPORT RWMol *HELMToMol(const char *helm, bool sanitize = true); +RDKIT_FILEPARSERS_EXPORT RWMol *HELMToMol(const char *helm, + bool sanitize = true); //! \overload -RDKIT_FILEPARSERS_EXPORT RWMol *HELMToMol(const std::string &helm, bool sanitize = true); -} +RDKIT_FILEPARSERS_EXPORT RWMol *HELMToMol(const std::string &helm, + bool sanitize = true); +} // namespace RDKit #endif diff --git a/Code/GraphMol/FileParsers/SequenceWriters.h b/Code/GraphMol/FileParsers/SequenceWriters.h index 90a3541f9..9e844aa89 100644 --- a/Code/GraphMol/FileParsers/SequenceWriters.h +++ b/Code/GraphMol/FileParsers/SequenceWriters.h @@ -42,6 +42,6 @@ RDKIT_FILEPARSERS_EXPORT std::string MolToFASTA(const ROMol &mol); *structures */ RDKIT_FILEPARSERS_EXPORT std::string MolToHELM(const ROMol &mol); -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/FilterCatalog/FilterCatalog.h b/Code/GraphMol/FilterCatalog/FilterCatalog.h index 18e369da3..ac25eff3b 100644 --- a/Code/GraphMol/FilterCatalog/FilterCatalog.h +++ b/Code/GraphMol/FilterCatalog/FilterCatalog.h @@ -39,7 +39,8 @@ namespace RDKit { class FilterCatalog; -class RDKIT_FILTERCATALOG_EXPORT FilterCatalogParams : public RDCatalog::CatalogParams { +class RDKIT_FILTERCATALOG_EXPORT FilterCatalogParams + : public RDCatalog::CatalogParams { public: enum FilterCatalogs { PAINS_A = (1u << 1), @@ -199,7 +200,9 @@ class RDKIT_FILTERCATALOG_EXPORT FilterCatalog : public FCatalog { //------------------------------------ //! returns the number of entries in the catalog - virtual unsigned int getNumEntries() const { return static_cast(d_entries.size()); } + virtual unsigned int getNumEntries() const { + return static_cast(d_entries.size()); + } //------------------------------------ //! Reset the current catalog to match the specified FilterCatalogParameters @@ -243,6 +246,6 @@ class RDKIT_FILTERCATALOG_EXPORT FilterCatalog : public FCatalog { }; RDKIT_FILTERCATALOG_EXPORT bool FilterCatalogCanSerialize(); -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/FilterCatalog/FilterCatalogEntry.h b/Code/GraphMol/FilterCatalog/FilterCatalogEntry.h index 8cfa7af00..d6c2ddac1 100644 --- a/Code/GraphMol/FilterCatalog/FilterCatalogEntry.h +++ b/Code/GraphMol/FilterCatalog/FilterCatalogEntry.h @@ -52,7 +52,8 @@ namespace RDKit { typedef std::map STRING_PROPS; -class RDKIT_FILTERCATALOG_EXPORT FilterCatalogEntry : public RDCatalog::CatalogEntry { +class RDKIT_FILTERCATALOG_EXPORT FilterCatalogEntry + : public RDCatalog::CatalogEntry { private: boost::shared_ptr d_matcher; Dict d_props; @@ -265,7 +266,7 @@ class RDKIT_FILTERCATALOG_EXPORT FilterCatalogEntry : public RDCatalog::CatalogE BOOST_SERIALIZATION_SPLIT_MEMBER(); #endif }; -} +} // namespace RDKit #ifdef RDK_USE_BOOST_SERIALIZATION BOOST_CLASS_VERSION(RDKit::FilterCatalogEntry, 1); diff --git a/Code/GraphMol/FilterCatalog/FilterMatcherBase.h b/Code/GraphMol/FilterCatalog/FilterMatcherBase.h index 44e6bf70e..851777adf 100644 --- a/Code/GraphMol/FilterCatalog/FilterMatcherBase.h +++ b/Code/GraphMol/FilterCatalog/FilterMatcherBase.h @@ -65,12 +65,11 @@ struct RDKIT_FILTERCATALOG_EXPORT FilterMatch { return (filterMatch.get() == rhs.filterMatch.get() && atomPairs == rhs.atomPairs); } - + bool operator!=(const FilterMatch &rhs) const { return !(filterMatch.get() == rhs.filterMatch.get() && atomPairs == rhs.atomPairs); } - }; RDKIT_FILTERCATALOG_EXPORT extern const char *DEFAULT_FILTERMATCHERBASE_NAME; @@ -121,10 +120,12 @@ class RDKIT_FILTERCATALOG_EXPORT FilterMatcherBase // Clones the current FilterMatcherBase into one that // can be passed around safely. virtual boost::shared_ptr Clone() const { - BOOST_LOG(rdWarningLog) << "FilterMatcherBase::Clone is deprecated, use copy instead" << std::endl; + BOOST_LOG(rdWarningLog) + << "FilterMatcherBase::Clone is deprecated, use copy instead" + << std::endl; return copy(); } - + //------------------------------------ //! copy // copies the current FilterMatcherBase into one that @@ -145,5 +146,5 @@ class RDKIT_FILTERCATALOG_EXPORT FilterMatcherBase #ifdef RDK_USE_BOOST_SERIALIZATION BOOST_SERIALIZATION_ASSUME_ABSTRACT(FilterMatcherBase) #endif -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/FilterCatalog/FilterMatchers.h b/Code/GraphMol/FilterCatalog/FilterMatchers.h index b4194da71..69ca336ad 100644 --- a/Code/GraphMol/FilterCatalog/FilterMatchers.h +++ b/Code/GraphMol/FilterCatalog/FilterMatchers.h @@ -44,7 +44,7 @@ std::string getArgName(const boost::shared_ptr &arg) { if (arg.get()) return arg->getName(); return ""; } -} +} // namespace namespace FilterMatchOps { class RDKIT_FILTERCATALOG_EXPORT And : public FilterMatcherBase { @@ -224,7 +224,7 @@ class RDKIT_FILTERCATALOG_EXPORT Not : public FilterMatcherBase { } #endif }; -} +} // namespace FilterMatchOps RDKIT_FILTERCATALOG_EXPORT extern const char *SMARTS_MATCH_NAME_DEFAULT; class RDKIT_FILTERCATALOG_EXPORT SmartsMatcher : public FilterMatcherBase { @@ -369,7 +369,7 @@ class RDKIT_FILTERCATALOG_EXPORT SmartsMatcher : public FilterMatcherBase { // which will return the SmartsMatcher FilterMatch only if no patterns // in the exclusion list are found. class RDKIT_FILTERCATALOG_EXPORT ExclusionList : public FilterMatcherBase { - std::vector > d_offPatterns; + std::vector> d_offPatterns; public: ExclusionList() : FilterMatcherBase("Not any of"), d_offPatterns() {} @@ -383,7 +383,7 @@ class RDKIT_FILTERCATALOG_EXPORT ExclusionList : public FilterMatcherBase { //! And(Not(Single... ExclusionList( - const std::vector > &offPatterns) + const std::vector> &offPatterns) : FilterMatcherBase("Not any of"), d_offPatterns(offPatterns) {} virtual std::string getName() const { @@ -408,7 +408,7 @@ class RDKIT_FILTERCATALOG_EXPORT ExclusionList : public FilterMatcherBase { } void setExclusionPatterns( - const std::vector > &offPatterns) { + const std::vector> &offPatterns) { d_offPatterns = offPatterns; } @@ -450,16 +450,14 @@ class RDKIT_FILTERCATALOG_EXPORT ExclusionList : public FilterMatcherBase { #endif }; -class RDKIT_FILTERCATALOG_EXPORT FilterHierarchyMatcher : public FilterMatcherBase { - std::vector > d_children; +class RDKIT_FILTERCATALOG_EXPORT FilterHierarchyMatcher + : public FilterMatcherBase { + std::vector> d_children; boost::shared_ptr d_matcher; - -public: + + public: // !Default Constructor for serialization - FilterHierarchyMatcher() : - FilterMatcherBase(), - d_matcher() { - } + FilterHierarchyMatcher() : FilterMatcherBase(), d_matcher() {} //! Constructs a FilterHierarchyMatcher from a FilterMatchBase //! A FilterHierarchyMatcher is a tree hierarchy where to //! match a child node, one needs to match the parent first. @@ -468,11 +466,9 @@ public: /* \param matcher FilterMatcherBase to match this node against */ - FilterHierarchyMatcher(const FilterMatcherBase &matcher) : - FilterMatcherBase(), - d_matcher(matcher.copy()) { - } - + FilterHierarchyMatcher(const FilterMatcherBase &matcher) + : FilterMatcherBase(), d_matcher(matcher.copy()) {} + //! Return the name for this node (from the underlying FilterMatcherBase) virtual std::string getName() const { if (d_matcher.get()) { @@ -482,15 +478,13 @@ public: } //! returns true if this node has a valid matcher - bool isValid() const { - return d_matcher->isValid(); - } + bool isValid() const { return d_matcher->isValid(); } //! Set a new FilterMatcherBase for this node /* \param matcher The new FilterMatcherBase */ - void setPattern(const FilterMatcherBase & matcher) { + void setPattern(const FilterMatcherBase &matcher) { PRECONDITION(matcher.isValid(), "Adding invalid patterns is not allowed."); d_matcher = matcher.copy(); PRECONDITION(getName() == d_matcher->getName(), "Opps"); @@ -506,9 +500,9 @@ public: const FilterHierarchyMatcher &hierarchy) { PRECONDITION(hierarchy.d_matcher.get() && hierarchy.d_matcher->isValid(), "Only one root node is allowed in a FilterHierarchyMatcher"); - - d_children.push_back( boost::shared_ptr( - new FilterHierarchyMatcher(hierarchy) )); + + d_children.push_back(boost::shared_ptr( + new FilterHierarchyMatcher(hierarchy))); return d_children.back(); } @@ -517,7 +511,8 @@ public: \param mol The molecule to match against \param matches The vector of FilterMatch objects that match */ - virtual bool getMatches(const ROMol &mol, std::vector &matches) const; + virtual bool getMatches(const ROMol &mol, + std::vector &matches) const; //! Does this node match the molecule /* @@ -530,8 +525,10 @@ public: //! copys the FilterHierarchyMatcher into a FilterMatcherBase virtual boost::shared_ptr copy() const { - return boost::shared_ptr(new FilterHierarchyMatcher(*this)); + return boost::shared_ptr( + new FilterHierarchyMatcher(*this)); } + private: #ifdef RDK_USE_BOOST_SERIALIZATION friend class boost::serialization::access; @@ -543,7 +540,6 @@ public: ar &d_matcher; } #endif - }; #ifdef RDK_USE_BOOST_SERIALIZATION @@ -558,7 +554,7 @@ void registerFilterMatcherTypes(Archive &ar) { ar.register_type(static_cast(NULL)); } #endif -} +} // namespace RDKit #ifdef RDK_USE_BOOST_SERIALIZATION BOOST_CLASS_VERSION(RDKit::SmartsMatcher, 1) diff --git a/Code/GraphMol/FilterCatalog/Filters.h b/Code/GraphMol/FilterCatalog/Filters.h index 8411519be..cd3eee65e 100644 --- a/Code/GraphMol/FilterCatalog/Filters.h +++ b/Code/GraphMol/FilterCatalog/Filters.h @@ -58,6 +58,6 @@ const FilterProperty_t *GetFilterProperties( FilterCatalogEntry *MakeFilterCatalogEntry(const FilterData_t &, unsigned int num_props = 0, const FilterProperty_t *props = 0); -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/FilterCatalog/FunctionalGroupHierarchy.h b/Code/GraphMol/FilterCatalog/FunctionalGroupHierarchy.h index 3edd8c4ac..337baddf1 100644 --- a/Code/GraphMol/FilterCatalog/FunctionalGroupHierarchy.h +++ b/Code/GraphMol/FilterCatalog/FunctionalGroupHierarchy.h @@ -35,7 +35,6 @@ #define RDKIT_FUNCTIONAL_GROUP_HIERARCHY_H #include "FilterCatalog.h" - namespace RDKit { //! Return the functional group hierarchy as a FilterCatalog RDKIT_FILTERCATALOG_EXPORT const FilterCatalog &GetFunctionalGroupHierarchy(); @@ -45,9 +44,9 @@ RDKIT_FILTERCATALOG_EXPORT const FilterCatalog &GetFunctionalGroupHierarchy(); /* /param normalized If set to true, return the flattened hierarchy with lower case labels. [default false] -*/ -RDKIT_FILTERCATALOG_EXPORT const std::map &GetFlattenedFunctionalGroupHierarchy( - bool normalized=false); -} +*/ +RDKIT_FILTERCATALOG_EXPORT const std::map + &GetFlattenedFunctionalGroupHierarchy(bool normalized = false); +} // namespace RDKit #endif diff --git a/Code/GraphMol/Fingerprints/FingerprintUtil.h b/Code/GraphMol/Fingerprints/FingerprintUtil.h index dbab1b3f3..706f93de8 100644 --- a/Code/GraphMol/Fingerprints/FingerprintUtil.h +++ b/Code/GraphMol/Fingerprints/FingerprintUtil.h @@ -140,8 +140,8 @@ RDKIT_FINGERPRINTS_EXPORT void buildDefaultRDKitFingerprintAtomInvariants( RDKIT_FINGERPRINTS_EXPORT void enumerateAllPaths( const ROMol &mol, std::map>> &allPaths, - const std::vector *fromAtoms, bool branchedPaths, - bool useHs, unsigned int minPath, unsigned int maxPath); + const std::vector *fromAtoms, bool branchedPaths, bool useHs, + unsigned int minPath, unsigned int maxPath); RDKIT_FINGERPRINTS_EXPORT void identifyQueryBonds( const ROMol &mol, std::vector &bondCache, diff --git a/Code/GraphMol/Fingerprints/Fingerprints.h b/Code/GraphMol/Fingerprints/Fingerprints.h index 345580e54..a21a470b5 100644 --- a/Code/GraphMol/Fingerprints/Fingerprints.h +++ b/Code/GraphMol/Fingerprints/Fingerprints.h @@ -57,8 +57,8 @@ RDKIT_FINGERPRINTS_EXPORT ExplicitBitVect *RDKFingerprintMol( bool branchedPaths = true, bool useBondOrder = true, std::vector *atomInvariants = 0, const std::vector *fromAtoms = 0, - std::vector > *atomBits = 0, - std::map > > *bitInfo=0); + std::vector> *atomBits = 0, + std::map>> *bitInfo = 0); const std::string RDKFingerprintMolVersion = "2.0.0"; //! \brief Generates a topological (Daylight like) fingerprint for a molecule @@ -146,17 +146,15 @@ RDKIT_FINGERPRINTS_EXPORT ExplicitBitVect *PatternFingerprintMol( std::vector *atomCounts = 0, ExplicitBitVect *setOnlyBits = 0); -RDKIT_FINGERPRINTS_EXPORT SparseIntVect *getUnfoldedRDKFingerprintMol(const ROMol &mol,unsigned int minPath=1, - unsigned int maxPath=7, - bool useHs=true, - bool branchedPaths=true, - bool useBondOrder=true, - std::vector *atomInvariants=0, - const std::vector *fromAtoms=0, - std::vector > *atomBits=0, - std::map > > *bitInfo=0); - -} +RDKIT_FINGERPRINTS_EXPORT SparseIntVect + *getUnfoldedRDKFingerprintMol( + const ROMol &mol, unsigned int minPath = 1, unsigned int maxPath = 7, + bool useHs = true, bool branchedPaths = true, bool useBondOrder = true, + std::vector *atomInvariants = 0, + const std::vector *fromAtoms = 0, + std::vector> *atomBits = 0, + std::map>> *bitInfo = 0); +} // namespace RDKit #endif diff --git a/Code/GraphMol/Fingerprints/MACCS.h b/Code/GraphMol/Fingerprints/MACCS.h index 4931d913b..f004a6c93 100644 --- a/Code/GraphMol/Fingerprints/MACCS.h +++ b/Code/GraphMol/Fingerprints/MACCS.h @@ -24,8 +24,9 @@ const std::string maccsFingerprintVersion = "2.0.0"; responsible for calling delete on this. */ -RDKIT_FINGERPRINTS_EXPORT ExplicitBitVect *getFingerprintAsBitVect(const ROMol &mol); -} -} +RDKIT_FINGERPRINTS_EXPORT ExplicitBitVect *getFingerprintAsBitVect( + const ROMol &mol); +} // namespace MACCSFingerprints +} // namespace RDKit #endif diff --git a/Code/GraphMol/Fingerprints/MorganFingerprints.h b/Code/GraphMol/Fingerprints/MorganFingerprints.h index 20748c2cf..9ff21ca15 100644 --- a/Code/GraphMol/Fingerprints/MorganFingerprints.h +++ b/Code/GraphMol/Fingerprints/MorganFingerprints.h @@ -103,8 +103,8 @@ const std::string morganFingerprintVersion = "1.0.0"; RDKIT_FINGERPRINTS_EXPORT SparseIntVect *getFingerprint( const ROMol &mol, unsigned int radius, std::vector *invariants = 0, - const std::vector *fromAtoms = 0, - bool useChirality = false, bool useBondTypes = true, bool useCounts = true, + const std::vector *fromAtoms = 0, bool useChirality = false, + bool useBondTypes = true, bool useCounts = true, bool onlyNonzeroInvariants = false, BitInfoMap *atomsSettingBits = 0); //! returns the Morgan fingerprint for a molecule @@ -152,9 +152,9 @@ RDKIT_FINGERPRINTS_EXPORT SparseIntVect *getFingerprint( RDKIT_FINGERPRINTS_EXPORT SparseIntVect *getHashedFingerprint( const ROMol &mol, unsigned int radius, unsigned int nBits = 2048, std::vector *invariants = 0, - const std::vector *fromAtoms = 0, - bool useChirality = false, bool useBondTypes = true, - bool onlyNonzeroInvariants = false, BitInfoMap *atomsSettingBits = 0); + const std::vector *fromAtoms = 0, bool useChirality = false, + bool useBondTypes = true, bool onlyNonzeroInvariants = false, + BitInfoMap *atomsSettingBits = 0); //! returns the Morgan fingerprint for a molecule as a bit vector /*! @@ -191,9 +191,9 @@ RDKIT_FINGERPRINTS_EXPORT SparseIntVect *getHashedFingerprint( RDKIT_FINGERPRINTS_EXPORT ExplicitBitVect *getFingerprintAsBitVect( const ROMol &mol, unsigned int radius, unsigned int nBits, std::vector *invariants = 0, - const std::vector *fromAtoms = 0, - bool useChirality = false, bool useBondTypes = true, - bool onlyNonzeroInvariants = false, BitInfoMap *atomsSettingBits = 0); + const std::vector *fromAtoms = 0, bool useChirality = false, + bool useBondTypes = true, bool onlyNonzeroInvariants = false, + BitInfoMap *atomsSettingBits = 0); } // end of namespace MorganFingerprints } // namespace RDKit diff --git a/Code/GraphMol/Fingerprints/TopologicalTorsionGenerator.h b/Code/GraphMol/Fingerprints/TopologicalTorsionGenerator.h index d297d9d17..54567bca8 100644 --- a/Code/GraphMol/Fingerprints/TopologicalTorsionGenerator.h +++ b/Code/GraphMol/Fingerprints/TopologicalTorsionGenerator.h @@ -105,7 +105,8 @@ class RDKIT_FINGERPRINTS_EXPORT TopologicalTorsionEnvGenerator fingerprints */ template -RDKIT_FINGERPRINTS_EXPORT FingerprintGenerator *getTopologicalTorsionGenerator( +RDKIT_FINGERPRINTS_EXPORT FingerprintGenerator * +getTopologicalTorsionGenerator( const bool includeChirality = false, const uint32_t torsionAtomCount = 4, AtomInvariantsGenerator *atomInvariantsGenerator = nullptr, const bool countSimulation = true, diff --git a/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h b/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h index 029565156..0648a7ccd 100644 --- a/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h +++ b/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h @@ -24,13 +24,14 @@ class Point3D; namespace ForceFields { class ForceField; class ForceFieldContrib; -} +} // namespace ForceFields namespace ForceFields { namespace CrystalFF { //! the torsion term for multiplicity m = 1 - 6 -class RDKIT_FORCEFIELDHELPERS_EXPORT TorsionAngleContribM6 : public ForceFields::ForceFieldContrib { +class RDKIT_FORCEFIELDHELPERS_EXPORT TorsionAngleContribM6 + : public ForceFields::ForceFieldContrib { public: TorsionAngleContribM6() : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){}; @@ -64,8 +65,9 @@ class RDKIT_FORCEFIELDHELPERS_EXPORT TorsionAngleContribM6 : public ForceFields: }; //! calculates and returns the torsional energy -RDKIT_FORCEFIELDHELPERS_EXPORT double calcTorsionEnergyM6(const std::vector &V, - const std::vector &signs, const double cosPhi); -} -} +RDKIT_FORCEFIELDHELPERS_EXPORT double calcTorsionEnergyM6( + const std::vector &V, const std::vector &signs, + const double cosPhi); +} // namespace CrystalFF +} // namespace ForceFields #endif diff --git a/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h b/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h index 0a137df25..1813991e4 100644 --- a/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h +++ b/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h @@ -167,41 +167,44 @@ class RDKIT_FORCEFIELDHELPERS_EXPORT MMFFMolProperties { bool d_torsionTerm; bool d_vdWTerm; bool d_eleTerm; - double d_dielConst; //!< the dielectric constant + double d_dielConst; //!< the dielectric constant std::uint8_t d_dielModel; //!< the dielectric model (1 = constant, 2 = // distance-dependent) std::uint8_t d_verbosity; std::ostream *d_oStream; std::vector d_MMFFAtomPropertiesPtrVect; }; -RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int isAngleInRingOfSize3or4(const ROMol &mol, const unsigned int idx1, - const unsigned int idx2, - const unsigned int idx3); -RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int isTorsionInRingOfSize4or5(const ROMol &mol, - const unsigned int idx1, - const unsigned int idx2, - const unsigned int idx3, - const unsigned int idx4); -RDKIT_FORCEFIELDHELPERS_EXPORT bool isRingAromatic(const ROMol &mol, const INT_VECT &ringIndxVect); -RDKIT_FORCEFIELDHELPERS_EXPORT bool isAtomInAromaticRingOfSize(const Atom *atom, const unsigned int ringSize); +RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int isAngleInRingOfSize3or4( + const ROMol &mol, const unsigned int idx1, const unsigned int idx2, + const unsigned int idx3); +RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int isTorsionInRingOfSize4or5( + const ROMol &mol, const unsigned int idx1, const unsigned int idx2, + const unsigned int idx3, const unsigned int idx4); +RDKIT_FORCEFIELDHELPERS_EXPORT bool isRingAromatic( + const ROMol &mol, const INT_VECT &ringIndxVect); +RDKIT_FORCEFIELDHELPERS_EXPORT bool isAtomInAromaticRingOfSize( + const Atom *atom, const unsigned int ringSize); RDKIT_FORCEFIELDHELPERS_EXPORT bool isAtomNOxide(const Atom *atom); -RDKIT_FORCEFIELDHELPERS_EXPORT bool areAtomsInSameAromaticRing(const ROMol &mol, const unsigned int idx1, - const unsigned int idx2); -RDKIT_FORCEFIELDHELPERS_EXPORT bool areAtomsInSameRingOfSize(const ROMol &mol, const unsigned int ringSize, - const unsigned int numAtoms, ...); +RDKIT_FORCEFIELDHELPERS_EXPORT bool areAtomsInSameAromaticRing( + const ROMol &mol, const unsigned int idx1, const unsigned int idx2); +RDKIT_FORCEFIELDHELPERS_EXPORT bool areAtomsInSameRingOfSize( + const ROMol &mol, const unsigned int ringSize, const unsigned int numAtoms, + ...); RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int sanitizeMMFFMol(RWMol &mol); RDKIT_FORCEFIELDHELPERS_EXPORT void setMMFFAromaticity(RWMol &mol); -RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int getMMFFStretchBendType(const unsigned int angleType, - const unsigned int bondType1, - const unsigned int bondType2); -RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int getPeriodicTableRow(const int atomicNum); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFAngle *getMMFFAngleBendEmpiricalRuleParams( +RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int getMMFFStretchBendType( + const unsigned int angleType, const unsigned int bondType1, + const unsigned int bondType2); +RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int getPeriodicTableRow( + const int atomicNum); +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFAngle * +getMMFFAngleBendEmpiricalRuleParams( const ROMol &mol, const ForceFields::MMFF::MMFFAngle *oldMMFFAngleParams, const ForceFields::MMFF::MMFFProp *mmffPropParamsCentralAtom, const ForceFields::MMFF::MMFFBond *mmffBondParams1, const ForceFields::MMFF::MMFFBond *mmffBondParams2, unsigned int idx1, unsigned int idx2, unsigned int idx3); -} -} +} // namespace MMFF +} // namespace RDKit #endif diff --git a/Code/GraphMol/ForceFieldHelpers/MMFF/Builder.h b/Code/GraphMol/ForceFieldHelpers/MMFF/Builder.h index 6b2f7c778..a46c1cd44 100644 --- a/Code/GraphMol/ForceFieldHelpers/MMFF/Builder.h +++ b/Code/GraphMol/ForceFieldHelpers/MMFF/Builder.h @@ -81,7 +81,8 @@ RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField *constructForceField( bool ignoreInterfragInteractions = true); namespace Tools { -class RDKIT_FORCEFIELDHELPERS_EXPORT DefaultTorsionBondSmarts : private boost::noncopyable { +class RDKIT_FORCEFIELDHELPERS_EXPORT DefaultTorsionBondSmarts + : private boost::noncopyable { public: static const std::string &string() { return ds_string; } static const ROMol *query(); @@ -98,36 +99,43 @@ class RDKIT_FORCEFIELDHELPERS_EXPORT DefaultTorsionBondSmarts : private boost::n enum { RELATION_1_2 = 0, RELATION_1_3 = 1, RELATION_1_4 = 2, RELATION_1_X = 3 }; // these functions are primarily exposed so they can be tested. -RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms, int i, int j); -RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell(boost::shared_array &res, unsigned int pos, - std::uint8_t value); -RDKIT_FORCEFIELDHELPERS_EXPORT std::uint8_t getTwoBitCell(boost::shared_array &res, - unsigned int pos); -RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array buildNeighborMatrix(const ROMol &mol); -RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(const ROMol &mol, MMFFMolProperties *mmffMolProperties, - ForceFields::ForceField *field); -RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(const ROMol &mol, MMFFMolProperties *mmffMolProperties, - ForceFields::ForceField *field); -RDKIT_FORCEFIELDHELPERS_EXPORT void addStretchBend(const ROMol &mol, MMFFMolProperties *mmffMolProperties, - ForceFields::ForceField *field); -RDKIT_FORCEFIELDHELPERS_EXPORT void addOop(const ROMol &mol, MMFFMolProperties *mmffMolProperties, - ForceFields::ForceField *field); +RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms, + int i, int j); +RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell( + boost::shared_array &res, unsigned int pos, + std::uint8_t value); +RDKIT_FORCEFIELDHELPERS_EXPORT std::uint8_t getTwoBitCell( + boost::shared_array &res, unsigned int pos); +RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array +buildNeighborMatrix(const ROMol &mol); +RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds( + const ROMol &mol, MMFFMolProperties *mmffMolProperties, + ForceFields::ForceField *field); +RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles( + const ROMol &mol, MMFFMolProperties *mmffMolProperties, + ForceFields::ForceField *field); +RDKIT_FORCEFIELDHELPERS_EXPORT void addStretchBend( + const ROMol &mol, MMFFMolProperties *mmffMolProperties, + ForceFields::ForceField *field); +RDKIT_FORCEFIELDHELPERS_EXPORT void addOop(const ROMol &mol, + MMFFMolProperties *mmffMolProperties, + ForceFields::ForceField *field); RDKIT_FORCEFIELDHELPERS_EXPORT void addTorsions( const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field, const std::string &torsionBondSmarts = DefaultTorsionBondSmarts::string()); -RDKIT_FORCEFIELDHELPERS_EXPORT void addVdW(const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties, - ForceFields::ForceField *field, - boost::shared_array neighborMatrix, - double nonBondedThresh = 100.0, - bool ignoreInterfragInteractions = true); -RDKIT_FORCEFIELDHELPERS_EXPORT void addEle(const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties, - ForceFields::ForceField *field, - boost::shared_array neighborMatrix, - double nonBondedThresh = 100.0, - bool ignoreInterfragInteractions = true); -} -} -} +RDKIT_FORCEFIELDHELPERS_EXPORT void addVdW( + const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties, + ForceFields::ForceField *field, + boost::shared_array neighborMatrix, + double nonBondedThresh = 100.0, bool ignoreInterfragInteractions = true); +RDKIT_FORCEFIELDHELPERS_EXPORT void addEle( + const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties, + ForceFields::ForceField *field, + boost::shared_array neighborMatrix, + double nonBondedThresh = 100.0, bool ignoreInterfragInteractions = true); +} // namespace Tools +} // namespace MMFF +} // namespace RDKit #endif diff --git a/Code/GraphMol/ForceFieldHelpers/MMFF/MMFF.h b/Code/GraphMol/ForceFieldHelpers/MMFF/MMFF.h index 71e6934e5..2c8debf6c 100644 --- a/Code/GraphMol/ForceFieldHelpers/MMFF/MMFF.h +++ b/Code/GraphMol/ForceFieldHelpers/MMFF/MMFF.h @@ -78,7 +78,7 @@ void MMFFOptimizeMoleculeConfsHelper_(ForceFields::ForceField ff, ROMol *mol, (*res)[i] = std::make_pair(needsMore, e); } } -} // end of detail namespace +} // namespace detail #endif //! Convenience function for optimizing all of a molecule's conformations using // MMFF @@ -146,6 +146,6 @@ void MMFFOptimizeMoleculeConfs(ROMol &mol, } } } -} // end of namespace UFF +} // namespace MMFF } // end of namespace RDKit #endif diff --git a/Code/GraphMol/ForceFieldHelpers/UFF/AtomTyper.h b/Code/GraphMol/ForceFieldHelpers/UFF/AtomTyper.h index 944350160..5b20a5ece 100644 --- a/Code/GraphMol/ForceFieldHelpers/UFF/AtomTyper.h +++ b/Code/GraphMol/ForceFieldHelpers/UFF/AtomTyper.h @@ -19,7 +19,7 @@ namespace ForceFields { namespace UFF { class AtomicParams; } -} +} // namespace ForceFields namespace RDKit { class ROMol; class Atom; @@ -29,29 +29,29 @@ typedef std::vector AtomicParamVect; RDKIT_FORCEFIELDHELPERS_EXPORT std::pair getAtomTypes( const ROMol &mol, const std::string ¶mData = ""); -RDKIT_FORCEFIELDHELPERS_EXPORT bool getUFFBondStretchParams(const ROMol &mol, unsigned int idx1, - unsigned int idx2, - ForceFields::UFF::UFFBond &uffBondStretchParams); -RDKIT_FORCEFIELDHELPERS_EXPORT bool getUFFAngleBendParams(const ROMol &mol, unsigned int idx1, - unsigned int idx2, unsigned int idx3, - ForceFields::UFF::UFFAngle &uffAngleBendParams); -RDKIT_FORCEFIELDHELPERS_EXPORT bool getUFFTorsionParams(const ROMol &mol, unsigned int idx1, unsigned int idx2, - unsigned int idx3, unsigned int idx4, - ForceFields::UFF::UFFTor &uffTorsionParams); -RDKIT_FORCEFIELDHELPERS_EXPORT bool getUFFInversionParams(const ROMol &mol, unsigned int idx1, - unsigned int idx2, unsigned int idx3, - unsigned int idx4, - ForceFields::UFF::UFFInv &uffInversionParams); -RDKIT_FORCEFIELDHELPERS_EXPORT bool getUFFVdWParams(const ROMol &mol, unsigned int idx1, unsigned int idx2, - ForceFields::UFF::UFFVdW &uffVdWParams); +RDKIT_FORCEFIELDHELPERS_EXPORT bool getUFFBondStretchParams( + const ROMol &mol, unsigned int idx1, unsigned int idx2, + ForceFields::UFF::UFFBond &uffBondStretchParams); +RDKIT_FORCEFIELDHELPERS_EXPORT bool getUFFAngleBendParams( + const ROMol &mol, unsigned int idx1, unsigned int idx2, unsigned int idx3, + ForceFields::UFF::UFFAngle &uffAngleBendParams); +RDKIT_FORCEFIELDHELPERS_EXPORT bool getUFFTorsionParams( + const ROMol &mol, unsigned int idx1, unsigned int idx2, unsigned int idx3, + unsigned int idx4, ForceFields::UFF::UFFTor &uffTorsionParams); +RDKIT_FORCEFIELDHELPERS_EXPORT bool getUFFInversionParams( + const ROMol &mol, unsigned int idx1, unsigned int idx2, unsigned int idx3, + unsigned int idx4, ForceFields::UFF::UFFInv &uffInversionParams); +RDKIT_FORCEFIELDHELPERS_EXPORT bool getUFFVdWParams( + const ROMol &mol, unsigned int idx1, unsigned int idx2, + ForceFields::UFF::UFFVdW &uffVdWParams); namespace Tools { // these functions are primarily exposed so they can be tested. -RDKIT_FORCEFIELDHELPERS_EXPORT void addAtomChargeFlags(const Atom *atom, std::string &atomKey, - bool tolerateChargeMismatch = true); +RDKIT_FORCEFIELDHELPERS_EXPORT void addAtomChargeFlags( + const Atom *atom, std::string &atomKey, bool tolerateChargeMismatch = true); RDKIT_FORCEFIELDHELPERS_EXPORT std::string getAtomLabel(const Atom *atom); -} -} -} +} // namespace Tools +} // namespace UFF +} // namespace RDKit #endif diff --git a/Code/GraphMol/ForceFieldHelpers/UFF/Builder.h b/Code/GraphMol/ForceFieldHelpers/UFF/Builder.h index df4b5c821..37e81b6d9 100644 --- a/Code/GraphMol/ForceFieldHelpers/UFF/Builder.h +++ b/Code/GraphMol/ForceFieldHelpers/UFF/Builder.h @@ -25,7 +25,7 @@ class ForceField; namespace UFF { class AtomicParams; } -} +} // namespace ForceFields namespace RDKit { class ROMol; @@ -77,7 +77,8 @@ RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField *constructForceField( int confId = -1, bool ignoreInterfragInteractions = true); namespace Tools { -class RDKIT_FORCEFIELDHELPERS_EXPORT DefaultTorsionBondSmarts : private boost::noncopyable { +class RDKIT_FORCEFIELDHELPERS_EXPORT DefaultTorsionBondSmarts + : private boost::noncopyable { public: static const std::string &string() { return ds_string; } static const ROMol *query(); @@ -94,29 +95,35 @@ class RDKIT_FORCEFIELDHELPERS_EXPORT DefaultTorsionBondSmarts : private boost::n enum { RELATION_1_2 = 0, RELATION_1_3 = 1, RELATION_1_4 = 2, RELATION_1_X = 3 }; // these functions are primarily exposed so they can be tested. -RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms, int i, int j); -RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell(boost::shared_array &res, unsigned int pos, - std::uint8_t value); -RDKIT_FORCEFIELDHELPERS_EXPORT std::uint8_t getTwoBitCell(boost::shared_array &res, - unsigned int pos); -RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array buildNeighborMatrix(const ROMol &mol); -RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(const ROMol &mol, const AtomicParamVect ¶ms, - ForceFields::ForceField *field); -RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(const ROMol &mol, const AtomicParamVect ¶ms, - ForceFields::ForceField *field); -RDKIT_FORCEFIELDHELPERS_EXPORT void addNonbonded(const ROMol &mol, int confId, const AtomicParamVect ¶ms, - ForceFields::ForceField *field, - boost::shared_array neighborMatrix, - double vdwThresh = 100.0, - bool ignoreInterfragInteractions = true); +RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms, + int i, int j); +RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell( + boost::shared_array &res, unsigned int pos, + std::uint8_t value); +RDKIT_FORCEFIELDHELPERS_EXPORT std::uint8_t getTwoBitCell( + boost::shared_array &res, unsigned int pos); +RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array +buildNeighborMatrix(const ROMol &mol); +RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(const ROMol &mol, + const AtomicParamVect ¶ms, + ForceFields::ForceField *field); +RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(const ROMol &mol, + const AtomicParamVect ¶ms, + ForceFields::ForceField *field); +RDKIT_FORCEFIELDHELPERS_EXPORT void addNonbonded( + const ROMol &mol, int confId, const AtomicParamVect ¶ms, + ForceFields::ForceField *field, + boost::shared_array neighborMatrix, double vdwThresh = 100.0, + bool ignoreInterfragInteractions = true); RDKIT_FORCEFIELDHELPERS_EXPORT void addTorsions( const ROMol &mol, const AtomicParamVect ¶ms, ForceFields::ForceField *field, const std::string &torsionBondSmarts = DefaultTorsionBondSmarts::string()); -RDKIT_FORCEFIELDHELPERS_EXPORT void addInversions(const ROMol &mol, const AtomicParamVect ¶ms, - ForceFields::ForceField *field); -} -} -} +RDKIT_FORCEFIELDHELPERS_EXPORT void addInversions( + const ROMol &mol, const AtomicParamVect ¶ms, + ForceFields::ForceField *field); +} // namespace Tools +} // namespace UFF +} // namespace RDKit #endif diff --git a/Code/GraphMol/ForceFieldHelpers/UFF/UFF.h b/Code/GraphMol/ForceFieldHelpers/UFF/UFF.h index 0870bd50f..2c63a195b 100644 --- a/Code/GraphMol/ForceFieldHelpers/UFF/UFF.h +++ b/Code/GraphMol/ForceFieldHelpers/UFF/UFF.h @@ -67,7 +67,7 @@ void UFFOptimizeMoleculeConfsHelper_(ForceFields::ForceField ff, ROMol *mol, (*res)[i] = std::make_pair(needsMore, e); } } -} // end of detail namespace +} // namespace detail #endif //! Convenience function for optimizing all of a molecule's conformations using // UFF diff --git a/Code/GraphMol/FragCatalog/FragCatGenerator.h b/Code/GraphMol/FragCatalog/FragCatGenerator.h index 321844250..578f990bf 100644 --- a/Code/GraphMol/FragCatalog/FragCatGenerator.h +++ b/Code/GraphMol/FragCatalog/FragCatGenerator.h @@ -28,6 +28,6 @@ class RDKIT_FRAGCATALOG_EXPORT FragCatGenerator { unsigned int addFragsFromMol(const ROMol &mol, FragCatalog *fcat); }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/FragCatalog/FragCatParams.h b/Code/GraphMol/FragCatalog/FragCatParams.h index 52bd9e9d3..5dbafa7cf 100644 --- a/Code/GraphMol/FragCatalog/FragCatParams.h +++ b/Code/GraphMol/FragCatalog/FragCatParams.h @@ -18,7 +18,7 @@ namespace RDKit { class ROMol; -typedef std::vector > MOL_SPTR_VECT; +typedef std::vector> MOL_SPTR_VECT; //! container for user parameters used to create a fragment catalog class RDKIT_FRAGCATALOG_EXPORT FragCatParams : public RDCatalog::CatalogParams { @@ -65,7 +65,9 @@ class RDKIT_FRAGCATALOG_EXPORT FragCatParams : public RDCatalog::CatalogParams { void setTolerance(double val) { d_tolerance = val; } //! returns our number of functional groups - unsigned int getNumFuncGroups() const { return static_cast(d_funcGroups.size()); } + unsigned int getNumFuncGroups() const { + return static_cast(d_funcGroups.size()); + } //! returns our std::vector of functional groups const MOL_SPTR_VECT &getFuncGroups() const; @@ -87,6 +89,6 @@ class RDKIT_FRAGCATALOG_EXPORT FragCatParams : public RDCatalog::CatalogParams { MOL_SPTR_VECT d_funcGroups; }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/FragCatalog/FragCatalogEntry.h b/Code/GraphMol/FragCatalog/FragCatalogEntry.h index c0d94a808..911afda3e 100644 --- a/Code/GraphMol/FragCatalog/FragCatalogEntry.h +++ b/Code/GraphMol/FragCatalog/FragCatalogEntry.h @@ -24,7 +24,8 @@ namespace RDKit { -class RDKIT_FRAGCATALOG_EXPORT FragCatalogEntry : public RDCatalog::CatalogEntry { +class RDKIT_FRAGCATALOG_EXPORT FragCatalogEntry + : public RDCatalog::CatalogEntry { public: FragCatalogEntry() : dp_mol(0), d_descrip(""), d_order(0) { dp_props = new Dict(); @@ -128,6 +129,6 @@ class RDKIT_FRAGCATALOG_EXPORT FragCatalogEntry : public RDCatalog::CatalogEntry // group ID INT_INT_VECT_MAP d_aToFmap; }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/FragCatalog/FragCatalogUtils.h b/Code/GraphMol/FragCatalog/FragCatalogUtils.h index 608d94529..6a0ed82a1 100644 --- a/Code/GraphMol/FragCatalog/FragCatalogUtils.h +++ b/Code/GraphMol/FragCatalog/FragCatalogUtils.h @@ -23,7 +23,8 @@ namespace RDKit { // each functional groups is read in as a molecule with queryatoms and // querybonds RDKIT_FRAGCATALOG_EXPORT MOL_SPTR_VECT readFuncGroups(std::string fileName); -RDKIT_FRAGCATALOG_EXPORT MOL_SPTR_VECT readFuncGroups(std::istream &inStream, int nToRead = -1); +RDKIT_FRAGCATALOG_EXPORT MOL_SPTR_VECT readFuncGroups(std::istream &inStream, + int nToRead = -1); // REVIEW: should this return a vector of pairs or a map? // mark the functional groups of interest on the molecule @@ -39,8 +40,8 @@ RDKIT_FRAGCATALOG_EXPORT MOL_SPTR_VECT readFuncGroups(std::istream &inStream, in // the connection bond is included. these need to be chopped from // the molecule later -RDKIT_FRAGCATALOG_EXPORT MatchVectType findFuncGroupsOnMol(const ROMol &mol, const FragCatParams *params, - INT_VECT &fgBonds); +RDKIT_FRAGCATALOG_EXPORT MatchVectType findFuncGroupsOnMol( + const ROMol &mol, const FragCatParams *params, INT_VECT &fgBonds); // This functions is called before either adding the fragments from a molecule // to a fragment catalog or generating the fincgerprint for this molecule @@ -53,8 +54,9 @@ RDKIT_FRAGCATALOG_EXPORT MatchVectType findFuncGroupsOnMol(const ROMol &mol, con // - return coreMol to the caller of this function and the enter the atom ids to // func // group ids mapping into aToFmap argument -RDKIT_FRAGCATALOG_EXPORT ROMol *prepareMol(const ROMol &mol, const FragCatParams *fparams, - MatchVectType &aToFmap); -} +RDKIT_FRAGCATALOG_EXPORT ROMol *prepareMol(const ROMol &mol, + const FragCatParams *fparams, + MatchVectType &aToFmap); +} // namespace RDKit #endif diff --git a/Code/GraphMol/FragCatalog/FragFPGenerator.h b/Code/GraphMol/FragCatalog/FragFPGenerator.h index f9a2f794f..88126ab11 100644 --- a/Code/GraphMol/FragCatalog/FragFPGenerator.h +++ b/Code/GraphMol/FragCatalog/FragFPGenerator.h @@ -21,7 +21,7 @@ namespace RDKit { class ROMol; typedef RDCatalog::HierarchCatalog FragCatalog; -typedef std::vector > MatchVectType; +typedef std::vector> MatchVectType; class RDKIT_FRAGCATALOG_EXPORT FragFPGenerator { public: @@ -33,6 +33,6 @@ class RDKIT_FRAGCATALOG_EXPORT FragFPGenerator { void computeFP(const ROMol &mol, const FragCatalog &fcat, const MatchVectType &aidToFid, ExplicitBitVect *fp); }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/MMPA/MMPA.h b/Code/GraphMol/MMPA/MMPA.h index 909a43447..4dce4e1e7 100644 --- a/Code/GraphMol/MMPA/MMPA.h +++ b/Code/GraphMol/MMPA/MMPA.h @@ -33,10 +33,10 @@ namespace MMPA { \return true if the molecule was fragmented, false otherwise. */ -RDKIT_MMPA_EXPORT bool fragmentMol(const ROMol& mol, - std::vector >& result, - unsigned int maxCuts = 3, unsigned int maxCutBonds = 20, - const std::string& pattern = "[#6+0;!$(*=,#[!#6])]!@!=!#[*]"); +RDKIT_MMPA_EXPORT bool fragmentMol( + const ROMol& mol, std::vector>& result, + unsigned int maxCuts = 3, unsigned int maxCutBonds = 20, + const std::string& pattern = "[#6+0;!$(*=,#[!#6])]!@!=!#[*]"); //! fragments a Molecule for processing with the Matched Molecular Pairs //! MMPA algorithm (Hussain et al) @@ -45,7 +45,7 @@ RDKIT_MMPA_EXPORT bool fragmentMol(const ROMol& mol, \param result Vector of Core and Sidechain results from the various cuts \param minCuts Minimum number of times to cut the molecule to generate - fragments. + fragments. \param maxCuts Maximum number of times to cut the molecule to generate fragments. \param maxCutBonds Set the bond limit for determining which molecules @@ -54,12 +54,10 @@ RDKIT_MMPA_EXPORT bool fragmentMol(const ROMol& mol, \return true if the molecule was fragmented, false otherwise. */ -RDKIT_MMPA_EXPORT bool fragmentMol(const ROMol& mol, - std::vector >& result, - unsigned int minCuts, - unsigned int maxCuts, - unsigned int maxCutBonds, - const std::string& pattern = "[#6+0;!$(*=,#[!#6])]!@!=!#[*]"); +RDKIT_MMPA_EXPORT bool fragmentMol( + const ROMol& mol, std::vector>& result, + unsigned int minCuts, unsigned int maxCuts, unsigned int maxCutBonds, + const std::string& pattern = "[#6+0;!$(*=,#[!#6])]!@!=!#[*]"); //! fragments a Molecule for processing with the Matched Molecular Pairs //! MMPA algorithm (Hussain et al) @@ -69,16 +67,15 @@ RDKIT_MMPA_EXPORT bool fragmentMol(const ROMol& mol, cuts \param bondsToCut Vector of bond indices to use as cut points \param minCuts Minimum number of times to cut the molecule to generate - fragments. + fragments. \param maxCuts Maximum number of times to cut the molecule to generate fragments. \return true if the molecule was fragmented, false otherwise. */ -RDKIT_MMPA_EXPORT bool fragmentMol(const ROMol& mol, - std::vector >& result, - const std::vector& bondsToCut, - unsigned int minCuts = 1, - unsigned int maxCuts = 3); +RDKIT_MMPA_EXPORT bool fragmentMol( + const ROMol& mol, std::vector>& result, + const std::vector& bondsToCut, unsigned int minCuts = 1, + unsigned int maxCuts = 3); -} +} // namespace MMPA } // namespace RDKit diff --git a/Code/GraphMol/MolAlign/AlignMolecules.h b/Code/GraphMol/MolAlign/AlignMolecules.h index 74f93a2c5..9902dfa61 100644 --- a/Code/GraphMol/MolAlign/AlignMolecules.h +++ b/Code/GraphMol/MolAlign/AlignMolecules.h @@ -16,7 +16,7 @@ #include namespace RDKit { -typedef std::vector > MatchVectType; +typedef std::vector> MatchVectType; class Conformer; class ROMol; @@ -63,11 +63,11 @@ class RDKIT_MOLALIGN_EXPORT MolAlignException : public std::exception { Returns RMSD value */ -RDKIT_MOLALIGN_EXPORT double getAlignmentTransform(const ROMol &prbMol, const ROMol &refMol, - RDGeom::Transform3D &trans, int prbCid = -1, - int refCid = -1, const MatchVectType *atomMap = 0, - const RDNumeric::DoubleVector *weights = 0, - bool reflect = false, unsigned int maxIters = 50); +RDKIT_MOLALIGN_EXPORT double getAlignmentTransform( + const ROMol &prbMol, const ROMol &refMol, RDGeom::Transform3D &trans, + int prbCid = -1, int refCid = -1, const MatchVectType *atomMap = 0, + const RDNumeric::DoubleVector *weights = 0, bool reflect = false, + unsigned int maxIters = 50); //! Optimally (minimum RMSD) align a molecule to another molecule /*! @@ -96,10 +96,11 @@ RDKIT_MOLALIGN_EXPORT double getAlignmentTransform(const ROMol &prbMol, const RO Returns RMSD value */ -RDKIT_MOLALIGN_EXPORT double alignMol(ROMol &prbMol, const ROMol &refMol, int prbCid = -1, - int refCid = -1, const MatchVectType *atomMap = 0, - const RDNumeric::DoubleVector *weights = 0, - bool reflect = false, unsigned int maxIters = 50); +RDKIT_MOLALIGN_EXPORT double alignMol( + ROMol &prbMol, const ROMol &refMol, int prbCid = -1, int refCid = -1, + const MatchVectType *atomMap = 0, + const RDNumeric::DoubleVector *weights = 0, bool reflect = false, + unsigned int maxIters = 50); //! Returns the optimal RMS for aligning two molecules, taking // symmetry into account. As a side-effect, the probe molecule is @@ -146,12 +147,11 @@ RDKIT_MOLALIGN_EXPORT double getBestRMS( between the reference conformation and the other aligned conformations */ -RDKIT_MOLALIGN_EXPORT void alignMolConformers(ROMol &mol, - const std::vector *atomIds = 0, - const std::vector *confIds = 0, - const RDNumeric::DoubleVector *weights = 0, - bool reflect = false, unsigned int maxIters = 50, - std::vector *RMSlist = 0); -} -} +RDKIT_MOLALIGN_EXPORT void alignMolConformers( + ROMol &mol, const std::vector *atomIds = 0, + const std::vector *confIds = 0, + const RDNumeric::DoubleVector *weights = 0, bool reflect = false, + unsigned int maxIters = 50, std::vector *RMSlist = 0); +} // namespace MolAlign +} // namespace RDKit #endif diff --git a/Code/GraphMol/MolAlign/O3AAlignMolecules.h b/Code/GraphMol/MolAlign/O3AAlignMolecules.h index 42edc86a1..1faf90ea2 100644 --- a/Code/GraphMol/MolAlign/O3AAlignMolecules.h +++ b/Code/GraphMol/MolAlign/O3AAlignMolecules.h @@ -83,7 +83,7 @@ class RDKIT_MOLALIGN_EXPORT O3AConstraintVect { d_compareO3AConstraint); ++d_count; } - std::vector >::size_type size() { + std::vector>::size_type size() { return d_o3aConstraintVect.size(); } O3AConstraint *operator[](unsigned int i) { @@ -92,7 +92,7 @@ class RDKIT_MOLALIGN_EXPORT O3AConstraintVect { private: unsigned int d_count; - std::vector > d_o3aConstraintVect; + std::vector> d_o3aConstraintVect; static bool d_compareO3AConstraint(boost::shared_ptr a, boost::shared_ptr b) { return ( @@ -247,7 +247,7 @@ class RDKIT_MOLALIGN_EXPORT SDM { const Conformer *d_prbConf; const Conformer *d_refConf; O3AConstraintVect *d_o3aConstraintVect; - std::vector > d_SDMPtrVect; + std::vector> d_SDMPtrVect; static bool compareSDMScore(boost::shared_ptr a, boost::shared_ptr b) { return ((a->score != b->score) @@ -318,28 +318,36 @@ class RDKIT_MOLALIGN_EXPORT O3A { double d_o3aScore; }; -RDKIT_MOLALIGN_EXPORT void randomTransform(ROMol &mol, const int cid = -1, const int seed = -1); -RDKIT_MOLALIGN_EXPORT const RDGeom::POINT3D_VECT *reflect(const Conformer &conf); -RDKIT_MOLALIGN_EXPORT int o3aMMFFCostFunc(const unsigned int prbIdx, const unsigned int refIdx, - double hSum, void *data); -RDKIT_MOLALIGN_EXPORT double o3aMMFFWeightFunc(const unsigned int prbIdx, const unsigned int refIdx, - void *data); -RDKIT_MOLALIGN_EXPORT double o3aMMFFScoringFunc(const unsigned int prbIdx, const unsigned int refIdx, - void *data); -RDKIT_MOLALIGN_EXPORT int o3aCrippenCostFunc(const unsigned int prbIdx, const unsigned int refIdx, - double hSum, void *data); +RDKIT_MOLALIGN_EXPORT void randomTransform(ROMol &mol, const int cid = -1, + const int seed = -1); +RDKIT_MOLALIGN_EXPORT const RDGeom::POINT3D_VECT *reflect( + const Conformer &conf); +RDKIT_MOLALIGN_EXPORT int o3aMMFFCostFunc(const unsigned int prbIdx, + const unsigned int refIdx, + double hSum, void *data); +RDKIT_MOLALIGN_EXPORT double o3aMMFFWeightFunc(const unsigned int prbIdx, + const unsigned int refIdx, + void *data); +RDKIT_MOLALIGN_EXPORT double o3aMMFFScoringFunc(const unsigned int prbIdx, + const unsigned int refIdx, + void *data); +RDKIT_MOLALIGN_EXPORT int o3aCrippenCostFunc(const unsigned int prbIdx, + const unsigned int refIdx, + double hSum, void *data); RDKIT_MOLALIGN_EXPORT double o3aCrippenWeightFunc(const unsigned int prbIdx, - const unsigned int refIdx, void *data); + const unsigned int refIdx, + void *data); RDKIT_MOLALIGN_EXPORT double o3aCrippenScoringFunc(const unsigned int prbIdx, - const unsigned int refIdx, void *data); + const unsigned int refIdx, + void *data); RDKIT_MOLALIGN_EXPORT void getO3AForProbeConfs( ROMol &prbMol, const ROMol &refMol, void *prbProp, void *refProp, - std::vector > &res, int numThreads = 1, + std::vector> &res, int numThreads = 1, O3A::AtomTypeScheme atomTypes = O3A::MMFF94, const int refCid = -1, const bool reflect = false, const unsigned int maxIters = 50, unsigned int options = 0, const MatchVectType *constraintMap = NULL, const RDNumeric::DoubleVector *constraintWeights = NULL); -} -} +} // namespace MolAlign +} // namespace RDKit #endif diff --git a/Code/GraphMol/MolBundle.h b/Code/GraphMol/MolBundle.h index 7653b8b83..704220db6 100644 --- a/Code/GraphMol/MolBundle.h +++ b/Code/GraphMol/MolBundle.h @@ -85,5 +85,5 @@ class MolBundle : public RDProps { std::vector> d_mols; }; -}; // end of RDKit namespace +}; // namespace RDKit #endif diff --git a/Code/GraphMol/MolCatalog/MolCatalog.h b/Code/GraphMol/MolCatalog/MolCatalog.h index a6da21575..3c06e3d99 100644 --- a/Code/GraphMol/MolCatalog/MolCatalog.h +++ b/Code/GraphMol/MolCatalog/MolCatalog.h @@ -15,6 +15,6 @@ namespace RDKit { //! a hierarchical catalog for holding molecules typedef RDCatalog::HierarchCatalog MolCatalog; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/MolCatalog/MolCatalogEntry.h b/Code/GraphMol/MolCatalog/MolCatalogEntry.h index 1555d27cd..1c7cfe62d 100644 --- a/Code/GraphMol/MolCatalog/MolCatalogEntry.h +++ b/Code/GraphMol/MolCatalog/MolCatalogEntry.h @@ -102,6 +102,6 @@ class RDKIT_MOLCATALOG_EXPORT MolCatalogEntry : public RDCatalog::CatalogEntry { unsigned int d_order; std::string d_descrip; }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/MolCatalog/MolCatalogParams.h b/Code/GraphMol/MolCatalog/MolCatalogParams.h index ea5c7065f..f4db677f9 100644 --- a/Code/GraphMol/MolCatalog/MolCatalogParams.h +++ b/Code/GraphMol/MolCatalog/MolCatalogParams.h @@ -12,7 +12,8 @@ namespace RDKit { //! container for user parameters used to create a mol catalog -class RDKIT_MOLCATALOG_EXPORT MolCatalogParams : public RDCatalog::CatalogParams { +class RDKIT_MOLCATALOG_EXPORT MolCatalogParams + : public RDCatalog::CatalogParams { public: MolCatalogParams() { d_typeStr = "MolCatalog Parameters"; } @@ -34,6 +35,6 @@ class RDKIT_MOLCATALOG_EXPORT MolCatalogParams : public RDCatalog::CatalogParams //! initialize from a string containing a pickle void initFromString(const std::string &text); }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/MolChemicalFeatures/FeatureParser.h b/Code/GraphMol/MolChemicalFeatures/FeatureParser.h index e992cbd30..9f2031a40 100644 --- a/Code/GraphMol/MolChemicalFeatures/FeatureParser.h +++ b/Code/GraphMol/MolChemicalFeatures/FeatureParser.h @@ -19,7 +19,8 @@ namespace RDKit { //! \brief class used to indicate errors in parsing feature definition //! files. -class RDKIT_MOLCHEMICALFEATURES_EXPORT FeatureFileParseException : public std::exception { +class RDKIT_MOLCHEMICALFEATURES_EXPORT FeatureFileParseException + : public std::exception { public: FeatureFileParseException(unsigned int lineNo, std::string line, std::string msg) @@ -34,21 +35,23 @@ class RDKIT_MOLCHEMICALFEATURES_EXPORT FeatureFileParseException : public std::e std::string d_line, d_msg; }; -RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureData(const std::string &defnText, - MolChemicalFeatureDef::CollectionType &featDefs); -RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureData(std::istream &istream, - MolChemicalFeatureDef::CollectionType &featDefs); -RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureFile(const std::string &fileName, - MolChemicalFeatureDef::CollectionType &featDefs); +RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureData( + const std::string &defnText, + MolChemicalFeatureDef::CollectionType &featDefs); +RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureData( + std::istream &istream, MolChemicalFeatureDef::CollectionType &featDefs); +RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureFile( + const std::string &fileName, + MolChemicalFeatureDef::CollectionType &featDefs); namespace Local { // these functions are exposed only so they can be tested -RDKIT_MOLCHEMICALFEATURES_EXPORT void parseAtomType(const std::string &inLine, - std::map &atomTypeDefs, - const unsigned int &lineNo); +RDKIT_MOLCHEMICALFEATURES_EXPORT void parseAtomType( + const std::string &inLine, std::map &atomTypeDefs, + const unsigned int &lineNo); RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeatureDef *parseFeatureDef( std::istream &inStream, const std::string &inLine, unsigned int &lineNo, const std::map &atomTypeDefs); -} +} // namespace Local } // end of namespace RDKit #endif diff --git a/Code/GraphMol/MolChemicalFeatures/MolChemicalFeature.h b/Code/GraphMol/MolChemicalFeatures/MolChemicalFeature.h index 4d543780f..79be245a4 100644 --- a/Code/GraphMol/MolChemicalFeatures/MolChemicalFeature.h +++ b/Code/GraphMol/MolChemicalFeatures/MolChemicalFeature.h @@ -23,7 +23,8 @@ class Atom; class MolChemicalFeatureFactory; class MolChemicalFeatureDef; -class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeature : public ChemicalFeatures::ChemicalFeature { +class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeature + : public ChemicalFeatures::ChemicalFeature { friend class MolChemicalFeatureFactory; public: @@ -92,6 +93,6 @@ class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeature : public ChemicalFeatu AtomPtrContainer d_atoms; mutable PointCacheType d_locs; }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h b/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h index 15d38a7ec..2a3c378ed 100644 --- a/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h +++ b/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h @@ -24,7 +24,7 @@ class MolChemicalFeatureDef; class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeatureDef { public: - typedef std::list > CollectionType; + typedef std::list> CollectionType; MolChemicalFeatureDef() : d_family(""), d_type(""), d_smarts(""){}; MolChemicalFeatureDef(const std::string &smarts, std::string family, @@ -64,5 +64,5 @@ class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeatureDef { boost::shared_ptr dp_pattern; std::vector d_weights; }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/MolDraw2D/MolDraw2DCairo.h b/Code/GraphMol/MolDraw2D/MolDraw2DCairo.h index d6af83561..3b14dbba0 100644 --- a/Code/GraphMol/MolDraw2D/MolDraw2DCairo.h +++ b/Code/GraphMol/MolDraw2D/MolDraw2DCairo.h @@ -86,5 +86,5 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2DCairo : public MolDraw2D { void initDrawing(); }; -} +} // namespace RDKit #endif // MOLDRAW2DCAIRO_H diff --git a/Code/GraphMol/MolDraw2D/MolDraw2DDetails.h b/Code/GraphMol/MolDraw2D/MolDraw2DDetails.h index e7eac9a00..e3891400e 100644 --- a/Code/GraphMol/MolDraw2D/MolDraw2DDetails.h +++ b/Code/GraphMol/MolDraw2D/MolDraw2DDetails.h @@ -48,9 +48,9 @@ const int char_widths[] = { 0, 0, 834}; RDKIT_MOLDRAW2D_EXPORT void arcPoints(const Point2D &cds1, const Point2D &cds2, - std::vector &res, float startAng = 0, - float extent = 360); -} -} + std::vector &res, + float startAng = 0, float extent = 360); +} // namespace MolDraw2D_detail +} // namespace RDKit #endif diff --git a/Code/GraphMol/MolDraw2D/MolDraw2DQt.h b/Code/GraphMol/MolDraw2D/MolDraw2DQt.h index 12fb1bfed..416ec5fa3 100644 --- a/Code/GraphMol/MolDraw2D/MolDraw2DQt.h +++ b/Code/GraphMol/MolDraw2D/MolDraw2DQt.h @@ -47,5 +47,5 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2DQt : public MolDraw2D { private: QPainter &qp_; }; -} +} // namespace RDKit #endif // MOLDRAW2DQT_H diff --git a/Code/GraphMol/MolDraw2D/MolDraw2Dwx.h b/Code/GraphMol/MolDraw2D/MolDraw2Dwx.h index c6cc8cce0..8fb864124 100644 --- a/Code/GraphMol/MolDraw2D/MolDraw2Dwx.h +++ b/Code/GraphMol/MolDraw2D/MolDraw2Dwx.h @@ -103,5 +103,5 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2Dwx : public MolDraw2D { private: wxDC &m_dc; }; -} +} // namespace RDKit #endif // MOLDRAW2DWX_H diff --git a/Code/GraphMol/MolDraw2D/MultiMolDraw2D.h b/Code/GraphMol/MolDraw2D/MultiMolDraw2D.h index b7d918e89..64f0d8f95 100644 --- a/Code/GraphMol/MolDraw2D/MultiMolDraw2D.h +++ b/Code/GraphMol/MolDraw2D/MultiMolDraw2D.h @@ -27,11 +27,11 @@ class RDKIT_MOLDRAW2D_EXPORT MultiMolDraw2D { virtual void drawMolecules( const std::vector &mols, const std::vector *legends = NULL, - const std::vector > *highlight_atoms = NULL, - const std::vector > *highlight_bonds = NULL, - const std::vector > *highlight_atom_maps = NULL, - const std::vector > *highlight_bond_maps = NULL, - const std::vector > *highlight_radii = NULL, + const std::vector> *highlight_atoms = NULL, + const std::vector> *highlight_bonds = NULL, + const std::vector> *highlight_atom_maps = NULL, + const std::vector> *highlight_bond_maps = NULL, + const std::vector> *highlight_radii = NULL, const std::vector *confIds = NULL); virtual int width() const { return width_; } @@ -48,8 +48,8 @@ class RDKIT_MOLDRAW2D_EXPORT MultiMolDraw2D { bool globalScaling_; MolDrawOptions options_; - std::vector > drawers_; + std::vector> drawers_; }; -} +} // namespace RDKit #endif // RDKITMOLDRAW2D_H diff --git a/Code/GraphMol/MolHash/MolHash.h b/Code/GraphMol/MolHash/MolHash.h index a046d52ae..6de22ed00 100644 --- a/Code/GraphMol/MolHash/MolHash.h +++ b/Code/GraphMol/MolHash/MolHash.h @@ -74,15 +74,16 @@ struct RDKIT_MOLHASH_EXPORT HashSet { }; #pragma pack(pop) -RDKIT_MOLHASH_EXPORT void generateMoleculeHashSet(const ROMol &mol, HashSet &res, - const std::vector *atomsToUse = 0, - const std::vector *bondsToUse = 0); +RDKIT_MOLHASH_EXPORT void generateMoleculeHashSet( + const ROMol &mol, HashSet &res, const std::vector *atomsToUse = 0, + const std::vector *bondsToUse = 0); RDKIT_MOLHASH_EXPORT std::string generateMoleculeHashSet( const ROMol &mol, const std::vector *atomsToUse = 0, const std::vector *bondsToUse = 0); -RDKIT_MOLHASH_EXPORT std::string encode(const void *bin, - size_t size); // binary data to Base64 encoded string -} -} +RDKIT_MOLHASH_EXPORT std::string encode( + const void *bin, + size_t size); // binary data to Base64 encoded string +} // namespace MolHash +} // namespace RDKit diff --git a/Code/GraphMol/MolInterchange/MolInterchange.h b/Code/GraphMol/MolInterchange/MolInterchange.h index 3d09f9598..8ff8b551d 100644 --- a/Code/GraphMol/MolInterchange/MolInterchange.h +++ b/Code/GraphMol/MolInterchange/MolInterchange.h @@ -53,25 +53,26 @@ static JSONParseParameters defaultJSONParseParameters; * \param inStream - stream containing the data * \param params - parsing options */ -RDKIT_MOLINTERCHANGE_EXPORT std::vector> JSONDataStreamToMols( - std::istream *inStream, - const JSONParseParameters ¶ms = defaultJSONParseParameters); +RDKIT_MOLINTERCHANGE_EXPORT std::vector> +JSONDataStreamToMols(std::istream *inStream, const JSONParseParameters ¶ms = + defaultJSONParseParameters); // \brief construct molecules from MolJSON data /*! * \param jsonBlock - string containing the mol block * \param params - parsing options */ -RDKIT_MOLINTERCHANGE_EXPORT std::vector> JSONDataToMols( - const std::string &jsonBlock, - const JSONParseParameters ¶ms = defaultJSONParseParameters); +RDKIT_MOLINTERCHANGE_EXPORT std::vector> +JSONDataToMols(const std::string &jsonBlock, + const JSONParseParameters ¶ms = defaultJSONParseParameters); // \brief returns MolJSON for a set of molecules /*! * \param mols - the molecules to work with */ template -RDKIT_MOLINTERCHANGE_EXPORT std::string MolsToJSONData(const std::vector &mols); +RDKIT_MOLINTERCHANGE_EXPORT std::string MolsToJSONData( + const std::vector &mols); // \brief returns MolJSON for a molecule /*! diff --git a/Code/GraphMol/MolInterchange/details.h b/Code/GraphMol/MolInterchange/details.h index 7bb9ea5ba..6e8865d75 100644 --- a/Code/GraphMol/MolInterchange/details.h +++ b/Code/GraphMol/MolInterchange/details.h @@ -43,6 +43,6 @@ static const std::map inv_stereolookup = { {Bond::STEREONONE, "unspecified"}, {Bond::STEREOCIS, "cis"}, {Bond::STEREOTRANS, "trans"}, {Bond::STEREOZ, "cis"}, {Bond::STEREOE, "trans"}, {Bond::STEREOANY, "either"}}; -} -} +} // namespace MolInterchange +} // namespace RDKit #endif diff --git a/Code/GraphMol/MolPickler.h b/Code/GraphMol/MolPickler.h index a0fdcc9b3..5ca85fea8 100644 --- a/Code/GraphMol/MolPickler.h +++ b/Code/GraphMol/MolPickler.h @@ -206,9 +206,10 @@ class RDKIT_GRAPHMOL_EXPORT MolPickler { //! do the actual work of pickling a SubstanceGroup template - static void _pickleSubstanceGroup(std::ostream &ss, const SubstanceGroup &sgroup, - std::map &atomIdxMap, - std::map &bondIdxMap); + static void _pickleSubstanceGroup(std::ostream &ss, + const SubstanceGroup &sgroup, + std::map &atomIdxMap, + std::map &bondIdxMap); //! do the actual work of pickling Stereo Group data template @@ -245,7 +246,8 @@ class RDKIT_GRAPHMOL_EXPORT MolPickler { //! extract a SubstanceGroup from a pickle template - static SubstanceGroup _getSubstanceGroupFromPickle(std::istream &ss, ROMol *mol, int version); + static SubstanceGroup _getSubstanceGroupFromPickle(std::istream &ss, + ROMol *mol, int version); template static void _depickleStereo(std::istream &ss, ROMol *mol, int version); diff --git a/Code/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h b/Code/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h index 0043b04c4..c2f737ee6 100644 --- a/Code/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h +++ b/Code/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h @@ -54,7 +54,6 @@ class RDKIT_MOLSTANDARDIZE_EXPORT TautomerTransform { Charges = other.Charges; } return *this; - }; ~TautomerTransform() { delete Mol; } diff --git a/Code/GraphMol/MolTransforms/MolTransforms.h b/Code/GraphMol/MolTransforms/MolTransforms.h index 0e2b249e2..0dd8d2c6b 100644 --- a/Code/GraphMol/MolTransforms/MolTransforms.h +++ b/Code/GraphMol/MolTransforms/MolTransforms.h @@ -22,15 +22,17 @@ namespace RDKit { class ROMol; class Atom; class Conformer; -} +} // namespace RDKit namespace RDGeom { class Transform3D; } namespace MolTransforms { -RDKIT_MOLTRANSFORMS_EXPORT void transformMolsAtoms(RDKit::ROMol *mol, RDGeom::Transform3D &tform); -RDKIT_MOLTRANSFORMS_EXPORT void transformAtom(RDKit::Atom *atom, RDGeom::Transform3D &tform); +RDKIT_MOLTRANSFORMS_EXPORT void transformMolsAtoms(RDKit::ROMol *mol, + RDGeom::Transform3D &tform); +RDKIT_MOLTRANSFORMS_EXPORT void transformAtom(RDKit::Atom *atom, + RDGeom::Transform3D &tform); //! Compute the centroid of a conformer /*! @@ -40,8 +42,8 @@ RDKIT_MOLTRANSFORMS_EXPORT void transformAtom(RDKit::Atom *atom, RDGeom::Transfo \param conf Conformer of interest \param ignoreHs If true, ignore hydrogen atoms */ -RDKIT_MOLTRANSFORMS_EXPORT RDGeom::Point3D computeCentroid(const RDKit::Conformer &conf, - bool ignoreHs = true); +RDKIT_MOLTRANSFORMS_EXPORT RDGeom::Point3D computeCentroid( + const RDKit::Conformer &conf, bool ignoreHs = true); #ifdef RDK_HAS_EIGEN3 //! Compute principal axes and moments of inertia for a conformer @@ -62,11 +64,10 @@ RDKIT_MOLTRANSFORMS_EXPORT RDGeom::Point3D computeCentroid(const RDKit::Conforme \returns whether or not the calculation was successful */ -RDKIT_MOLTRANSFORMS_EXPORT bool computePrincipalAxesAndMoments(const RDKit::Conformer &conf, - Eigen::Matrix3d &axes, - Eigen::Vector3d &moments, - bool ignoreHs = false, bool force = false, - const std::vector *weights = NULL); +RDKIT_MOLTRANSFORMS_EXPORT bool computePrincipalAxesAndMoments( + const RDKit::Conformer &conf, Eigen::Matrix3d &axes, + Eigen::Vector3d &moments, bool ignoreHs = false, bool force = false, + const std::vector *weights = NULL); //! Compute principal axes and moments from the gyration matrix of a conformer /*! @@ -85,7 +86,8 @@ RDKIT_MOLTRANSFORMS_EXPORT bool computePrincipalAxesAndMoments(const RDKit::Conf \returns whether or not the calculation was successful */ -RDKIT_MOLTRANSFORMS_EXPORT bool computePrincipalAxesAndMomentsFromGyrationMatrix( +RDKIT_MOLTRANSFORMS_EXPORT bool +computePrincipalAxesAndMomentsFromGyrationMatrix( const RDKit::Conformer &conf, Eigen::Matrix3d &axes, Eigen::Vector3d &moments, bool ignoreHs = false, bool force = false, const std::vector *weights = NULL); @@ -112,8 +114,8 @@ RDKIT_MOLTRANSFORMS_EXPORT RDGeom::Transform3D *computeCanonicalTransform( bool normalizeCovar = false, bool ignoreHs = true); //! Transform the conformation using the specified transformation -RDKIT_MOLTRANSFORMS_EXPORT void transformConformer(RDKit::Conformer &conf, - const RDGeom::Transform3D &trans); +RDKIT_MOLTRANSFORMS_EXPORT void transformConformer( + RDKit::Conformer &conf, const RDGeom::Transform3D &trans); //! Canonicalize the orientation of a conformer so that its principal axes //! around the specified center point coincide with the x, y, z axes @@ -128,9 +130,9 @@ RDKIT_MOLTRANSFORMS_EXPORT void transformConformer(RDKit::Conformer &conf, \param ignoreHs If true, ignore hydrogen atoms */ -RDKIT_MOLTRANSFORMS_EXPORT void canonicalizeConformer(RDKit::Conformer &conf, - const RDGeom::Point3D *center = 0, - bool normalizeCovar = false, bool ignoreHs = true); +RDKIT_MOLTRANSFORMS_EXPORT void canonicalizeConformer( + RDKit::Conformer &conf, const RDGeom::Point3D *center = 0, + bool normalizeCovar = false, bool ignoreHs = true); //! Canonicalize all the conformations in a molecule /*! @@ -139,21 +141,27 @@ RDKIT_MOLTRANSFORMS_EXPORT void canonicalizeConformer(RDKit::Conformer &conf, of atoms \param ignoreHs If true, ignore hydrogens */ -RDKIT_MOLTRANSFORMS_EXPORT void canonicalizeMol(RDKit::ROMol &mol, bool normalizeCovar = false, - bool ignoreHs = true); +RDKIT_MOLTRANSFORMS_EXPORT void canonicalizeMol(RDKit::ROMol &mol, + bool normalizeCovar = false, + bool ignoreHs = true); //! Get the bond length between the specified atoms i, j -RDKIT_MOLTRANSFORMS_EXPORT double getBondLength(const RDKit::Conformer &conf, unsigned int iAtomId, - unsigned int jAtomId); +RDKIT_MOLTRANSFORMS_EXPORT double getBondLength(const RDKit::Conformer &conf, + unsigned int iAtomId, + unsigned int jAtomId); //! Set the bond length between the specified atoms i, j //! (all atoms bonded to atom j are moved) -RDKIT_MOLTRANSFORMS_EXPORT void setBondLength(RDKit::Conformer &conf, unsigned int iAtomId, - unsigned int jAtomId, double value); +RDKIT_MOLTRANSFORMS_EXPORT void setBondLength(RDKit::Conformer &conf, + unsigned int iAtomId, + unsigned int jAtomId, + double value); //! Get the angle in radians among the specified atoms i, j, k -RDKIT_MOLTRANSFORMS_EXPORT double getAngleRad(const RDKit::Conformer &conf, unsigned int iAtomId, - unsigned int jAtomId, unsigned int kAtomId); +RDKIT_MOLTRANSFORMS_EXPORT double getAngleRad(const RDKit::Conformer &conf, + unsigned int iAtomId, + unsigned int jAtomId, + unsigned int kAtomId); //! Get the angle in degrees among the specified atoms i, j, k inline double getAngleDeg(const RDKit::Conformer &conf, unsigned int iAtomId, @@ -163,8 +171,10 @@ inline double getAngleDeg(const RDKit::Conformer &conf, unsigned int iAtomId, //! Set the angle in radians among the specified atoms i, j, k //! (all atoms bonded to atom k are moved) -RDKIT_MOLTRANSFORMS_EXPORT void setAngleRad(RDKit::Conformer &conf, unsigned int iAtomId, - unsigned int jAtomId, unsigned int kAtomId, double value); +RDKIT_MOLTRANSFORMS_EXPORT void setAngleRad(RDKit::Conformer &conf, + unsigned int iAtomId, + unsigned int jAtomId, + unsigned int kAtomId, double value); //! Set the angle in degrees among the specified atoms i, j, k //! (all atoms bonded to atom k are moved) @@ -175,9 +185,11 @@ inline void setAngleDeg(RDKit::Conformer &conf, unsigned int iAtomId, } //! Get the dihedral angle in radians among the specified atoms i, j, k, l -RDKIT_MOLTRANSFORMS_EXPORT double getDihedralRad(const RDKit::Conformer &conf, unsigned int iAtomId, - unsigned int jAtomId, unsigned int kAtomId, - unsigned int lAtomId); +RDKIT_MOLTRANSFORMS_EXPORT double getDihedralRad(const RDKit::Conformer &conf, + unsigned int iAtomId, + unsigned int jAtomId, + unsigned int kAtomId, + unsigned int lAtomId); //! Get the dihedral angle in degrees among the specified atoms i, j, k, l inline double getDihedralDeg(const RDKit::Conformer &conf, unsigned int iAtomId, @@ -189,9 +201,9 @@ inline double getDihedralDeg(const RDKit::Conformer &conf, unsigned int iAtomId, //! Set the dihedral angle in radians among the specified atoms i, j, k, l //! (all atoms bonded to atom l are moved) -RDKIT_MOLTRANSFORMS_EXPORT void setDihedralRad(RDKit::Conformer &conf, unsigned int iAtomId, - unsigned int jAtomId, unsigned int kAtomId, - unsigned int lAtomId, double value); +RDKIT_MOLTRANSFORMS_EXPORT void setDihedralRad( + RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId, + unsigned int kAtomId, unsigned int lAtomId, double value); //! Set the dihedral angle in degrees among the specified atoms i, j, k, l //! (all atoms bonded to atom l are moved) @@ -200,5 +212,5 @@ inline void setDihedralDeg(RDKit::Conformer &conf, unsigned int iAtomId, unsigned int lAtomId, double value) { setDihedralRad(conf, iAtomId, jAtomId, kAtomId, lAtomId, value / 180. * M_PI); } -} +} // namespace MolTransforms #endif diff --git a/Code/GraphMol/MonomerInfo.h b/Code/GraphMol/MonomerInfo.h index 0acec5b4e..e6852b55a 100644 --- a/Code/GraphMol/MonomerInfo.h +++ b/Code/GraphMol/MonomerInfo.h @@ -131,9 +131,9 @@ class RDKIT_GRAPHMOL_EXPORT AtomPDBResidueInfo : public AtomMonomerInfo { unsigned int d_secondaryStructure; unsigned int d_segmentNumber; }; -}; +}; // namespace RDKit //! allows AtomPDBResidueInfo objects to be dumped to streams -RDKIT_GRAPHMOL_EXPORT std::ostream &operator<<(std::ostream &target, - const RDKit::AtomPDBResidueInfo &apri); +RDKIT_GRAPHMOL_EXPORT std::ostream &operator<<( + std::ostream &target, const RDKit::AtomPDBResidueInfo &apri); #endif diff --git a/Code/GraphMol/PartialCharges/GasteigerCharges.h b/Code/GraphMol/PartialCharges/GasteigerCharges.h index 575c18b8c..3f49a4472 100644 --- a/Code/GraphMol/PartialCharges/GasteigerCharges.h +++ b/Code/GraphMol/PartialCharges/GasteigerCharges.h @@ -15,12 +15,13 @@ namespace RDKit { class ROMol; -RDKIT_PARTIALCHARGES_EXPORT void computeGasteigerCharges(const ROMol *mol, int nIter = 12, - bool throwOnParamFailure = false); -RDKIT_PARTIALCHARGES_EXPORT void computeGasteigerCharges(const ROMol &mol, int nIter = 12, - bool throwOnParamFailure = false); -RDKIT_PARTIALCHARGES_EXPORT void computeGasteigerCharges(const ROMol &mol, std::vector &charges, - int nIter = 12, bool throwOnParamFailure = false); -} +RDKIT_PARTIALCHARGES_EXPORT void computeGasteigerCharges( + const ROMol *mol, int nIter = 12, bool throwOnParamFailure = false); +RDKIT_PARTIALCHARGES_EXPORT void computeGasteigerCharges( + const ROMol &mol, int nIter = 12, bool throwOnParamFailure = false); +RDKIT_PARTIALCHARGES_EXPORT void computeGasteigerCharges( + const ROMol &mol, std::vector &charges, int nIter = 12, + bool throwOnParamFailure = false); +} // namespace RDKit #endif diff --git a/Code/GraphMol/PartialCharges/GasteigerParams.h b/Code/GraphMol/PartialCharges/GasteigerParams.h index 2b084f86d..19cf1aed9 100644 --- a/Code/GraphMol/PartialCharges/GasteigerParams.h +++ b/Code/GraphMol/PartialCharges/GasteigerParams.h @@ -81,6 +81,6 @@ class RDKIT_PARTIALCHARGES_EXPORT GasteigerParams { static class GasteigerParams *ds_instance; }; -}; +}; // namespace RDKit #endif diff --git a/Code/GraphMol/PeriodicTable.h b/Code/GraphMol/PeriodicTable.h index 210c7de55..92b47720c 100644 --- a/Code/GraphMol/PeriodicTable.h +++ b/Code/GraphMol/PeriodicTable.h @@ -232,9 +232,9 @@ class RDKIT_GRAPHMOL_EXPORT PeriodicTable { //! isotope is unknown. double getMassForIsotope(UINT atomicNumber, UINT isotope) const { PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found"); - const std::map > &m = + const std::map> &m = byanum[atomicNumber].d_isotopeInfoMap; - std::map >::const_iterator item = + std::map>::const_iterator item = m.find(isotope); if (item == m.end()) { return 0.0; @@ -257,9 +257,9 @@ class RDKIT_GRAPHMOL_EXPORT PeriodicTable { //! isotope is unknown. double getAbundanceForIsotope(UINT atomicNumber, UINT isotope) const { PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found"); - const std::map > &m = + const std::map> &m = byanum[atomicNumber].d_isotopeInfoMap; - std::map >::const_iterator item = + std::map>::const_iterator item = m.find(isotope); if (item == m.end()) { return 0.0; @@ -318,6 +318,6 @@ class RDKIT_GRAPHMOL_EXPORT PeriodicTable { std::vector byanum; STR_UINT_MAP byname; }; -}; +}; // namespace RDKit #endif diff --git a/Code/GraphMol/QueryAtom.h b/Code/GraphMol/QueryAtom.h index b49b4fa8e..6357304a3 100644 --- a/Code/GraphMol/QueryAtom.h +++ b/Code/GraphMol/QueryAtom.h @@ -93,7 +93,7 @@ inline std::string qhelper(Atom::QUERYATOM_QUERY *q, unsigned int depth) { } return res; } -} // end of detail namespace +} // namespace detail inline std::string describeQuery(const Atom *atom) { PRECONDITION(atom, "bad atom"); std::string res = ""; @@ -103,6 +103,6 @@ inline std::string describeQuery(const Atom *atom) { return res; } -}; // end o' namespace +}; // namespace RDKit #endif diff --git a/Code/GraphMol/QueryBond.h b/Code/GraphMol/QueryBond.h index 4fe2162da..65aaef8b5 100644 --- a/Code/GraphMol/QueryBond.h +++ b/Code/GraphMol/QueryBond.h @@ -104,7 +104,7 @@ inline std::string qhelper(Bond::QUERYBOND_QUERY *q, unsigned int depth) { } return res; } -} // end of detail namespace +} // namespace detail inline std::string describeQuery(const Bond *bond) { PRECONDITION(bond, "bad bond"); std::string res = ""; @@ -113,6 +113,6 @@ inline std::string describeQuery(const Bond *bond) { } return res; } -}; +}; // namespace RDKit #endif diff --git a/Code/GraphMol/QueryOps.h b/Code/GraphMol/QueryOps.h index 3b670366c..135e1257b 100644 --- a/Code/GraphMol/QueryOps.h +++ b/Code/GraphMol/QueryOps.h @@ -933,15 +933,20 @@ class HasPropWithValueQuery public: HasPropWithValueQuery() - : Queries::EqualityQuery(), propname(), val(), tol(0.0) { + : Queries::EqualityQuery(), + propname(), + val(), + tol(0.0) { this->setDescription("HasPropWithValue"); this->setDataFunc(0); }; - + explicit HasPropWithValueQuery(const std::string &prop, - const ExplicitBitVect &v, - float tol = 0.0) - : Queries::EqualityQuery(), propname(prop), val(v), tol(tol) { + const ExplicitBitVect &v, float tol = 0.0) + : Queries::EqualityQuery(), + propname(prop), + val(v), + tol(tol) { this->setDescription("HasPropWithValue"); this->setDataFunc(0); }; @@ -950,7 +955,8 @@ class HasPropWithValueQuery bool res = what->hasProp(propname); if (res) { try { - const ExplicitBitVect &bv = what->template getProp(propname); + const ExplicitBitVect &bv = + what->template getProp(propname); const double tani = TanimotoSimilarity(val, bv); res = (1.0 - tani) <= tol; } catch (KeyErrorException) { @@ -982,9 +988,8 @@ class HasPropWithValueQuery //! returns a copy of this query Queries::Query *copy() const { HasPropWithValueQuery *res = - new HasPropWithValueQuery(this->propname, - this->val, - this->tol); + new HasPropWithValueQuery( + this->propname, this->val, this->tol); res->setNegation(this->getNegation()); res->d_description = this->d_description; return res; @@ -999,9 +1004,10 @@ Queries::EqualityQuery *makePropQuery( template Queries::EqualityQuery *makePropQuery( - const std::string &propname, const ExplicitBitVect &val, float tolerance=0.0) { - return new HasPropWithValueQuery(propname, val, - tolerance); + const std::string &propname, const ExplicitBitVect &val, + float tolerance = 0.0) { + return new HasPropWithValueQuery( + propname, val, tolerance); } RDKIT_GRAPHMOL_EXPORT bool isComplexQuery(const Bond *b); diff --git a/Code/GraphMol/RGroupDecomposition/RGroupDecomp.h b/Code/GraphMol/RGroupDecomposition/RGroupDecomp.h index b17aac24c..680211238 100644 --- a/Code/GraphMol/RGroupDecomposition/RGroupDecomp.h +++ b/Code/GraphMol/RGroupDecomposition/RGroupDecomp.h @@ -116,19 +116,17 @@ class RDKIT_RGROUPDECOMPOSITION_EXPORT RGroupDecomposition { RGroupColumns getRGroupsAsColumns() const; }; -RDKIT_RGROUPDECOMPOSITION_EXPORT unsigned int RGroupDecompose(const std::vector &cores, - const std::vector &mols, - RGroupRows &rows, - std::vector *unmatched = 0, - const RGroupDecompositionParameters &options = - RGroupDecompositionParameters()); +RDKIT_RGROUPDECOMPOSITION_EXPORT unsigned int RGroupDecompose( + const std::vector &cores, const std::vector &mols, + RGroupRows &rows, std::vector *unmatched = 0, + const RGroupDecompositionParameters &options = + RGroupDecompositionParameters()); -RDKIT_RGROUPDECOMPOSITION_EXPORT unsigned int RGroupDecompose(const std::vector &cores, - const std::vector &mols, - RGroupColumns &columns, - std::vector *unmatched = 0, - const RGroupDecompositionParameters &options = - RGroupDecompositionParameters()); -} +RDKIT_RGROUPDECOMPOSITION_EXPORT unsigned int RGroupDecompose( + const std::vector &cores, const std::vector &mols, + RGroupColumns &columns, std::vector *unmatched = 0, + const RGroupDecompositionParameters &options = + RGroupDecompositionParameters()); +} // namespace RDKit #endif diff --git a/Code/GraphMol/ReducedGraphs/ReducedGraphs.h b/Code/GraphMol/ReducedGraphs/ReducedGraphs.h index 125425658..73aaa77a1 100644 --- a/Code/GraphMol/ReducedGraphs/ReducedGraphs.h +++ b/Code/GraphMol/ReducedGraphs/ReducedGraphs.h @@ -32,7 +32,7 @@ namespace ReducedGraphs { */ RDKIT_REDUCEDGRAPHS_EXPORT ROMol *generateMolExtendedReducedGraph( - const ROMol &mol, std::vector > *atomTypes = 0); + const ROMol &mol, std::vector> *atomTypes = 0); //! \brief Generates a ErG fingerprint vector for a molecule that's already a // reduced graph /*! @@ -51,8 +51,9 @@ RDKIT_REDUCEDGRAPHS_EXPORT ROMol *generateMolExtendedReducedGraph( - the caller is responsible for deleteing the result */ -RDKIT_REDUCEDGRAPHS_EXPORT RDNumeric::DoubleVector *generateErGFingerprintForReducedGraph( - const ROMol &mol, std::vector > *atomTypes = 0, +RDKIT_REDUCEDGRAPHS_EXPORT RDNumeric::DoubleVector * +generateErGFingerprintForReducedGraph( + const ROMol &mol, std::vector> *atomTypes = 0, double fuzzIncrement = 0.3, unsigned int minPath = 1, unsigned int maxPath = 15); @@ -74,10 +75,10 @@ RDKIT_REDUCEDGRAPHS_EXPORT RDNumeric::DoubleVector *generateErGFingerprintForRed */ RDKIT_REDUCEDGRAPHS_EXPORT RDNumeric::DoubleVector *getErGFingerprint( - const ROMol &mol, std::vector > *atomTypes = 0, + const ROMol &mol, std::vector> *atomTypes = 0, double fuzzIncrement = 0.3, unsigned int minPath = 1, unsigned int maxPath = 15); -} // end of ReducedGraphs namespace -} // end of RDKit namespace +} // namespace ReducedGraphs +} // namespace RDKit #endif diff --git a/Code/GraphMol/Resonance.h b/Code/GraphMol/Resonance.h index ebb28fae2..6f3eed327 100644 --- a/Code/GraphMol/Resonance.h +++ b/Code/GraphMol/Resonance.h @@ -37,7 +37,7 @@ class RDKIT_GRAPHMOL_EXPORT ResonanceMolSupplier { * than the the most octet-complete structure */ ALLOW_INCOMPLETE_OCTETS = (1 << 0), /*! include resonance structures featuring charge separation also - * when uncharged resonance structures exist */ + * when uncharged resonance structures exist */ ALLOW_CHARGE_SEPARATION = (1 << 1), /*! enumerate all possible degenerate Kekule resonance structures * (the default is to include just one) */ @@ -156,5 +156,5 @@ class RDKIT_GRAPHMOL_EXPORT ResonanceMolSupplier { ROMol *assignBondsFormalCharges(std::vector &c) const; static bool cePermCompare(const CEPerm *a, const CEPerm *b); }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/RingInfo.h b/Code/GraphMol/RingInfo.h index 4e322c0fb..5b061aa49 100644 --- a/Code/GraphMol/RingInfo.h +++ b/Code/GraphMol/RingInfo.h @@ -136,6 +136,6 @@ class RDKIT_GRAPHMOL_EXPORT RingInfo { DataType d_atomMembers, d_bondMembers; VECT_INT_VECT d_atomRings, d_bondRings; }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/SLNParse/SLNAttribs.h b/Code/GraphMol/SLNParse/SLNAttribs.h index bb7a31127..3fb8c20e1 100644 --- a/Code/GraphMol/SLNParse/SLNAttribs.h +++ b/Code/GraphMol/SLNParse/SLNAttribs.h @@ -62,7 +62,7 @@ class RDKIT_SLNPARSE_EXPORT AttribType { void *structQuery; }; -typedef std::vector > > +typedef std::vector>> AttribListType; //! parses the attributes provided for an atom and sets @@ -89,6 +89,6 @@ void parseFinalBondAttribs(Bond *bond, bool doingQuery); void parseMolAttribs(ROMol *mol, AttribListType attribs); void adjustAtomChiralities(RWMol *mol); -} -} +} // namespace SLNParse +} // namespace RDKit #endif diff --git a/Code/GraphMol/SanitException.h b/Code/GraphMol/SanitException.h index 37cdd7bbd..d53c719d4 100644 --- a/Code/GraphMol/SanitException.h +++ b/Code/GraphMol/SanitException.h @@ -34,6 +34,6 @@ class RDKIT_GRAPHMOL_EXPORT MolSanitizeException : public std::exception { private: std::string _msg; }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/ShapeHelpers/ShapeEncoder.h b/Code/GraphMol/ShapeHelpers/ShapeEncoder.h index 3d611ee7a..b97c4a258 100644 --- a/Code/GraphMol/ShapeHelpers/ShapeEncoder.h +++ b/Code/GraphMol/ShapeHelpers/ShapeEncoder.h @@ -14,7 +14,7 @@ namespace RDGeom { class UniformGrid3D; class Transform3D; -} +} // namespace RDGeom namespace RDKit { class ROMol; @@ -40,10 +40,10 @@ namespace MolShapes { \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding process */ -RDKIT_SHAPEHELPERS_EXPORT void EncodeShape(const ROMol &mol, RDGeom::UniformGrid3D &grid, int confId = -1, - const RDGeom::Transform3D *trans = 0, double vdwScale = 0.8, - double stepSize = 0.25, int maxLayers = -1, - bool ignoreHs = true); +RDKIT_SHAPEHELPERS_EXPORT void EncodeShape( + const ROMol &mol, RDGeom::UniformGrid3D &grid, int confId = -1, + const RDGeom::Transform3D *trans = 0, double vdwScale = 0.8, + double stepSize = 0.25, int maxLayers = -1, bool ignoreHs = true); //! Emcode the shape of a conformer on to a grid /*! @@ -64,10 +64,10 @@ RDKIT_SHAPEHELPERS_EXPORT void EncodeShape(const ROMol &mol, RDGeom::UniformGrid \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding process */ -RDKIT_SHAPEHELPERS_EXPORT void EncodeShape(const Conformer &conf, RDGeom::UniformGrid3D &grid, - const RDGeom::Transform3D *trans = 0, double vdwScale = 0.8, - double stepSize = 0.25, int maxLayers = -1, - bool ignoreHs = true); -} -} +RDKIT_SHAPEHELPERS_EXPORT void EncodeShape( + const Conformer &conf, RDGeom::UniformGrid3D &grid, + const RDGeom::Transform3D *trans = 0, double vdwScale = 0.8, + double stepSize = 0.25, int maxLayers = -1, bool ignoreHs = true); +} // namespace MolShapes +} // namespace RDKit #endif diff --git a/Code/GraphMol/ShapeHelpers/ShapeUtils.h b/Code/GraphMol/ShapeHelpers/ShapeUtils.h index da42200f5..8fd98c8c1 100644 --- a/Code/GraphMol/ShapeHelpers/ShapeUtils.h +++ b/Code/GraphMol/ShapeHelpers/ShapeUtils.h @@ -16,7 +16,7 @@ namespace RDGeom { class Point3D; class Transform3D; -} +} // namespace RDGeom namespace RDKit { class ROMol; @@ -27,10 +27,9 @@ namespace MolShapes { //! Compute the size of the box that can fit the conformation, and offset of the // box //! from the origin -RDKIT_SHAPEHELPERS_EXPORT void computeConfDimsAndOffset(const Conformer &conf, RDGeom::Point3D &dims, - RDGeom::Point3D &offSet, - const RDGeom::Transform3D *trans = 0, - double padding = 2.5); +RDKIT_SHAPEHELPERS_EXPORT void computeConfDimsAndOffset( + const Conformer &conf, RDGeom::Point3D &dims, RDGeom::Point3D &offSet, + const RDGeom::Transform3D *trans = 0, double padding = 2.5); //! Compute the a box that will fit the confomer /*! @@ -41,16 +40,16 @@ RDKIT_SHAPEHELPERS_EXPORT void computeConfDimsAndOffset(const Conformer &conf, R coordinates \param padding Padding added on the sides around the conformer */ -RDKIT_SHAPEHELPERS_EXPORT void computeConfBox(const Conformer &conf, RDGeom::Point3D &leftBottom, - RDGeom::Point3D &rightTop, - const RDGeom::Transform3D *trans = 0, double padding = 2.5); +RDKIT_SHAPEHELPERS_EXPORT void computeConfBox( + const Conformer &conf, RDGeom::Point3D &leftBottom, + RDGeom::Point3D &rightTop, const RDGeom::Transform3D *trans = 0, + double padding = 2.5); //! Compute the union of two boxes -RDKIT_SHAPEHELPERS_EXPORT void computeUnionBox(const RDGeom::Point3D &leftBottom1, - const RDGeom::Point3D &rightTop1, - const RDGeom::Point3D &leftBottom2, - const RDGeom::Point3D &rightTop2, - RDGeom::Point3D &uLeftBottom, RDGeom::Point3D &uRightTop); +RDKIT_SHAPEHELPERS_EXPORT void computeUnionBox( + const RDGeom::Point3D &leftBottom1, const RDGeom::Point3D &rightTop1, + const RDGeom::Point3D &leftBottom2, const RDGeom::Point3D &rightTop2, + RDGeom::Point3D &uLeftBottom, RDGeom::Point3D &uRightTop); //! Compute dimensions of a conformer /*! @@ -59,10 +58,9 @@ RDKIT_SHAPEHELPERS_EXPORT void computeUnionBox(const RDGeom::Point3D &leftBottom \param center Optionally specify the center \param ignoreHs if true, ignore the hydrogen atoms in computing the centroid */ -RDKIT_SHAPEHELPERS_EXPORT std::vector getConfDimensions(const Conformer &conf, - double padding = 2.5, - const RDGeom::Point3D *center = 0, - bool ignoreHs = true); +RDKIT_SHAPEHELPERS_EXPORT std::vector getConfDimensions( + const Conformer &conf, double padding = 2.5, + const RDGeom::Point3D *center = 0, bool ignoreHs = true); //! Compute the shape tversky index between two molecule based on a // predefined alignment @@ -94,12 +92,13 @@ RDKIT_SHAPEHELPERS_EXPORT std::vector getConfDimensions(const Conformer process */ -RDKIT_SHAPEHELPERS_EXPORT double tverskyIndex(const ROMol &mol1, const ROMol &mol2, double alpha, double beta, int confId1 = -1, - int confId2 = -1, double gridSpacing = 0.5, - DiscreteValueVect::DiscreteValueType bitsPerPoint = - DiscreteValueVect::TWOBITVALUE, - double vdwScale = 0.8, double stepSize = 0.25, - int maxLayers = -1, bool ignoreHs = true); +RDKIT_SHAPEHELPERS_EXPORT double tverskyIndex( + const ROMol &mol1, const ROMol &mol2, double alpha, double beta, + int confId1 = -1, int confId2 = -1, double gridSpacing = 0.5, + DiscreteValueVect::DiscreteValueType bitsPerPoint = + DiscreteValueVect::TWOBITVALUE, + double vdwScale = 0.8, double stepSize = 0.25, int maxLayers = -1, + bool ignoreHs = true); //! Compute the shape tversky index between two conformers based on a // predefined alignment @@ -127,13 +126,13 @@ RDKIT_SHAPEHELPERS_EXPORT double tverskyIndex(const ROMol &mol1, const ROMol &mo process */ -RDKIT_SHAPEHELPERS_EXPORT double tverskyIndex(const Conformer &conf1, const Conformer &conf2, double alpha, double beta, - double gridSpacing = 0.5, - DiscreteValueVect::DiscreteValueType bitsPerPoint = - DiscreteValueVect::TWOBITVALUE, - double vdwScale = 0.8, double stepSize = 0.25, - int maxLayers = -1, bool ignoreHs = true); - +RDKIT_SHAPEHELPERS_EXPORT double tverskyIndex( + const Conformer &conf1, const Conformer &conf2, double alpha, double beta, + double gridSpacing = 0.5, + DiscreteValueVect::DiscreteValueType bitsPerPoint = + DiscreteValueVect::TWOBITVALUE, + double vdwScale = 0.8, double stepSize = 0.25, int maxLayers = -1, + bool ignoreHs = true); //! Compute the shape tanimoto distance between two molecule based on a // predefined alignment @@ -163,12 +162,13 @@ RDKIT_SHAPEHELPERS_EXPORT double tverskyIndex(const Conformer &conf1, const Conf process */ -RDKIT_SHAPEHELPERS_EXPORT double tanimotoDistance(const ROMol &mol1, const ROMol &mol2, int confId1 = -1, - int confId2 = -1, double gridSpacing = 0.5, - DiscreteValueVect::DiscreteValueType bitsPerPoint = - DiscreteValueVect::TWOBITVALUE, - double vdwScale = 0.8, double stepSize = 0.25, - int maxLayers = -1, bool ignoreHs = true); +RDKIT_SHAPEHELPERS_EXPORT double tanimotoDistance( + const ROMol &mol1, const ROMol &mol2, int confId1 = -1, int confId2 = -1, + double gridSpacing = 0.5, + DiscreteValueVect::DiscreteValueType bitsPerPoint = + DiscreteValueVect::TWOBITVALUE, + double vdwScale = 0.8, double stepSize = 0.25, int maxLayers = -1, + bool ignoreHs = true); //! Compute the shape tanimoto distance between two conformers based on a // predefined alignment @@ -193,12 +193,12 @@ RDKIT_SHAPEHELPERS_EXPORT double tanimotoDistance(const ROMol &mol1, const ROMol process */ -RDKIT_SHAPEHELPERS_EXPORT double tanimotoDistance(const Conformer &conf1, const Conformer &conf2, - double gridSpacing = 0.5, - DiscreteValueVect::DiscreteValueType bitsPerPoint = - DiscreteValueVect::TWOBITVALUE, - double vdwScale = 0.8, double stepSize = 0.25, - int maxLayers = -1, bool ignoreHs = true); +RDKIT_SHAPEHELPERS_EXPORT double tanimotoDistance( + const Conformer &conf1, const Conformer &conf2, double gridSpacing = 0.5, + DiscreteValueVect::DiscreteValueType bitsPerPoint = + DiscreteValueVect::TWOBITVALUE, + double vdwScale = 0.8, double stepSize = 0.25, int maxLayers = -1, + bool ignoreHs = true); //! Compute the shape protrusion distance between two molecule based on a // predefined alignment @@ -232,13 +232,13 @@ RDKIT_SHAPEHELPERS_EXPORT double tanimotoDistance(const Conformer &conf1, const one. */ -RDKIT_SHAPEHELPERS_EXPORT double protrudeDistance(const ROMol &mol1, const ROMol &mol2, int confId1 = -1, - int confId2 = -1, double gridSpacing = 0.5, - DiscreteValueVect::DiscreteValueType bitsPerPoint = - DiscreteValueVect::TWOBITVALUE, - double vdwScale = 0.8, double stepSize = 0.25, - int maxLayers = -1, bool ignoreHs = true, - bool allowReordering = true); +RDKIT_SHAPEHELPERS_EXPORT double protrudeDistance( + const ROMol &mol1, const ROMol &mol2, int confId1 = -1, int confId2 = -1, + double gridSpacing = 0.5, + DiscreteValueVect::DiscreteValueType bitsPerPoint = + DiscreteValueVect::TWOBITVALUE, + double vdwScale = 0.8, double stepSize = 0.25, int maxLayers = -1, + bool ignoreHs = true, bool allowReordering = true); //! Compute the shape protrusion distance between two conformers based on a // predefined alignment @@ -267,14 +267,13 @@ RDKIT_SHAPEHELPERS_EXPORT double protrudeDistance(const ROMol &mol1, const ROMol one. */ -RDKIT_SHAPEHELPERS_EXPORT double protrudeDistance(const Conformer &conf1, const Conformer &conf2, - double gridSpacing = 0.5, - DiscreteValueVect::DiscreteValueType bitsPerPoint = - DiscreteValueVect::TWOBITVALUE, - double vdwScale = 0.8, double stepSize = 0.25, - int maxLayers = -1, bool ignoreHs = true, - bool allowReordering = true); -} -} +RDKIT_SHAPEHELPERS_EXPORT double protrudeDistance( + const Conformer &conf1, const Conformer &conf2, double gridSpacing = 0.5, + DiscreteValueVect::DiscreteValueType bitsPerPoint = + DiscreteValueVect::TWOBITVALUE, + double vdwScale = 0.8, double stepSize = 0.25, int maxLayers = -1, + bool ignoreHs = true, bool allowReordering = true); +} // namespace MolShapes +} // namespace RDKit #endif diff --git a/Code/GraphMol/SmilesParse/SmartsWrite.h b/Code/GraphMol/SmilesParse/SmartsWrite.h index aa1d3c116..6450cbaf2 100644 --- a/Code/GraphMol/SmilesParse/SmartsWrite.h +++ b/Code/GraphMol/SmilesParse/SmartsWrite.h @@ -20,12 +20,14 @@ namespace SmartsWrite { //! returns the SMARTS for a QueryAtom RDKIT_SMILESPARSE_EXPORT std::string GetAtomSmarts(const QueryAtom *qatom); //! returns the SMARTS for a QueryBond -RDKIT_SMILESPARSE_EXPORT std::string GetBondSmarts(const QueryBond *qbond, int atomToLeftIdx = -1); -} +RDKIT_SMILESPARSE_EXPORT std::string GetBondSmarts(const QueryBond *qbond, + int atomToLeftIdx = -1); +} // namespace SmartsWrite class ROMol; //! returns the SMARTS for a molecule -RDKIT_SMILESPARSE_EXPORT std::string MolToSmarts(ROMol &mol, bool doIsomericSmarts = true); -}; +RDKIT_SMILESPARSE_EXPORT std::string MolToSmarts(ROMol &mol, + bool doIsomericSmarts = true); +}; // namespace RDKit #endif diff --git a/Code/GraphMol/SmilesParse/SmilesWrite.h b/Code/GraphMol/SmilesParse/SmilesWrite.h index 856a8eb40..32d85028f 100644 --- a/Code/GraphMol/SmilesParse/SmilesWrite.h +++ b/Code/GraphMol/SmilesParse/SmilesWrite.h @@ -24,7 +24,6 @@ namespace SmilesWrite { //! \brief returns the cxsmiles data for a molecule RDKIT_SMILESPARSE_EXPORT std::string getCXExtensions(const ROMol &mol); - //! \brief returns true if the atom number is in the SMILES organic subset RDKIT_SMILESPARSE_EXPORT bool inOrganicSubset(int atomicNumber); @@ -110,7 +109,6 @@ RDKIT_SMILESPARSE_EXPORT std::string MolFragmentToSmiles( bool canonical = true, bool allBondsExplicit = false, bool allHsExplicit = false); - //! \brief returns canonical CXSMILES for a molecule /*! \param mol : the molecule in question. diff --git a/Code/GraphMol/SmilesParse/primes.h b/Code/GraphMol/SmilesParse/primes.h index b5ab1ec58..67032cd0c 100644 --- a/Code/GraphMol/SmilesParse/primes.h +++ b/Code/GraphMol/SmilesParse/primes.h @@ -14,5 +14,5 @@ namespace RDKit { const int NUM_PRIMES_AVAIL = 1000; extern int firstThousandPrimes[NUM_PRIMES_AVAIL]; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/StructChecker/Pattern.h b/Code/GraphMol/StructChecker/Pattern.h index b0bc58cf5..2210474c9 100644 --- a/Code/GraphMol/StructChecker/Pattern.h +++ b/Code/GraphMol/StructChecker/Pattern.h @@ -16,23 +16,32 @@ namespace RDKit { namespace StructureCheck { RDKIT_STRUCTCHECKER_EXPORT RDKit::Bond::BondType convertBondType(AABondType bt); -RDKIT_STRUCTCHECKER_EXPORT AABondType convertBondType(RDKit::Bond::BondType rdbt); +RDKIT_STRUCTCHECKER_EXPORT AABondType +convertBondType(RDKit::Bond::BondType rdbt); RDKIT_STRUCTCHECKER_EXPORT unsigned getAtomicNumber(const std::string symbol); -RDKIT_STRUCTCHECKER_EXPORT bool AtomSymbolMatch(const std::string symbol, const std::string pattern); -RDKIT_STRUCTCHECKER_EXPORT bool LigandMatches(const Atom &a, const Bond &b, const Ligand &l, - bool use_charge = false); -RDKIT_STRUCTCHECKER_EXPORT bool isBondTypeMatch(const RDKit::Bond &b, AABondType lbt); -RDKIT_STRUCTCHECKER_EXPORT bool RecMatch(const ROMol &mol, unsigned atomIdx, const AugmentedAtom &aa, - const std::vector &nbp, bool verbose); -RDKIT_STRUCTCHECKER_EXPORT bool AAMatch(const ROMol &mol, unsigned i, const AugmentedAtom &aa, - const std::vector &atom_ring_status, - const std::vector &nbp, bool verbose); +RDKIT_STRUCTCHECKER_EXPORT bool AtomSymbolMatch(const std::string symbol, + const std::string pattern); +RDKIT_STRUCTCHECKER_EXPORT bool LigandMatches(const Atom &a, const Bond &b, + const Ligand &l, + bool use_charge = false); +RDKIT_STRUCTCHECKER_EXPORT bool isBondTypeMatch(const RDKit::Bond &b, + AABondType lbt); +RDKIT_STRUCTCHECKER_EXPORT bool RecMatch(const ROMol &mol, unsigned atomIdx, + const AugmentedAtom &aa, + const std::vector &nbp, + bool verbose); +RDKIT_STRUCTCHECKER_EXPORT bool AAMatch( + const ROMol &mol, unsigned i, const AugmentedAtom &aa, + const std::vector &atom_ring_status, + const std::vector &nbp, bool verbose); RDKIT_STRUCTCHECKER_EXPORT bool TransformAugmentedAtoms( RWMol &mol, - const std::vector > &aapair, bool verbose); -RDKIT_STRUCTCHECKER_EXPORT bool CheckAtoms(const ROMol &mol, const std::vector &good_atoms, - bool verbose); -} -} + const std::vector> &aapair, + bool verbose); +RDKIT_STRUCTCHECKER_EXPORT bool CheckAtoms( + const ROMol &mol, const std::vector &good_atoms, + bool verbose); +} // namespace StructureCheck +} // namespace RDKit diff --git a/Code/GraphMol/StructChecker/ReCharge.h b/Code/GraphMol/StructChecker/ReCharge.h index a988e4547..d6b028138 100644 --- a/Code/GraphMol/StructChecker/ReCharge.h +++ b/Code/GraphMol/StructChecker/ReCharge.h @@ -16,8 +16,8 @@ namespace RDKit { namespace StructureCheck { /* -* Returns the total charge of all atoms in molecule. -*/ + * Returns the total charge of all atoms in molecule. + */ int TotalCharge(const ROMol &mol); class RDKIT_STRUCTCHECKER_EXPORT ChargeFix { @@ -35,13 +35,13 @@ class RDKIT_STRUCTCHECKER_EXPORT ChargeFix { resetValues(); } /* - * Removes hydrogens from *mp until desired_charge is reached. The - * positions for hydrogen removal are selected by "acidity" combined - * with a refinement algorithm. It returns TRUE if molecule could be - * neutralized and FALSE if any problem were encountered. - * *ndeprot and *nrefine are set to the number of deprotonations - * and refinement cycles performed. - */ + * Removes hydrogens from *mp until desired_charge is reached. The + * positions for hydrogen removal are selected by "acidity" combined + * with a refinement algorithm. It returns TRUE if molecule could be + * neutralized and FALSE if any problem were encountered. + * *ndeprot and *nrefine are set to the number of deprotonations + * and refinement cycles performed. + */ bool rechargeMolecule(unsigned &ndeprot, unsigned &nrefine); private: // internal helpers: @@ -52,5 +52,5 @@ class RDKIT_STRUCTCHECKER_EXPORT ChargeFix { void resetColors(); void resetValues(); }; -} -} +} // namespace StructureCheck +} // namespace RDKit diff --git a/Code/GraphMol/StructChecker/Stereo.h b/Code/GraphMol/StructChecker/Stereo.h index 54574c789..11e46b3b2 100644 --- a/Code/GraphMol/StructChecker/Stereo.h +++ b/Code/GraphMol/StructChecker/Stereo.h @@ -37,52 +37,52 @@ static const int STEREO_BOND_AT_NON_STEREO_ATOM = 2; static const int ZEROED_Z_COORDINATES = 4; static const int CONVERTED_TO_2D = 8; /* DubiousStereochemistry: -* Checks if there is some ill-defined stereochemistry in the -* molecule *mp. The function returns a bit set integer which defines -* the problems encountered. -*/ + * Checks if there is some ill-defined stereochemistry in the + * molecule *mp. The function returns a bit set integer which defines + * the problems encountered. + */ RDKIT_STRUCTCHECKER_EXPORT int DubiousStereochemistry(RWMol &mol); /* FixDubious3DMolecule: -* Checks if the structure has 3D coordinates and/or flat sp3-carbons with -* stereo-bonds and -* converts the designation to 2D, clearing away any Z-component of the -* coordinates. -* Real 3D structures without stereo designations go through untouched. -*/ + * Checks if the structure has 3D coordinates and/or flat sp3-carbons with + * stereo-bonds and + * converts the designation to 2D, clearing away any Z-component of the + * coordinates. + * Real 3D structures without stereo designations go through untouched. + */ RDKIT_STRUCTCHECKER_EXPORT int FixDubious3DMolecule(RWMol &mol); // Removes ill-defined stereodescriptors. RDKIT_STRUCTCHECKER_EXPORT void RemoveDubiousStereochemistry(RWMol &mol); /* -* Checks if all potential stereocenters are either completely undefined -* or attributed with hashes and wedges according to MDL rules. -*/ + * Checks if all potential stereocenters are either completely undefined + * or attributed with hashes and wedges according to MDL rules. + */ RDKIT_STRUCTCHECKER_EXPORT bool CheckStereo(const ROMol &mol); /* -* Checks if any two atoms in *mp come closer than 10% of the -* average bond length or if an atom is too close the line -* between two bonded atoms. -*/ + * Checks if any two atoms in *mp come closer than 10% of the + * average bond length or if an atom is too close the line + * between two bonded atoms. + */ RDKIT_STRUCTCHECKER_EXPORT bool AtomClash(RWMol &mol, double clash_limit); /* -* Computes the stereo parity of atom number iatom in *mp relative -* to its numbering. The immediate neighbours are defined by *nbp -* to speed up processing. -*/ -RDKIT_STRUCTCHECKER_EXPORT int AtomParity(const ROMol &mol, unsigned iatom, const Neighbourhood &nbp); + * Computes the stereo parity of atom number iatom in *mp relative + * to its numbering. The immediate neighbours are defined by *nbp + * to speed up processing. + */ +RDKIT_STRUCTCHECKER_EXPORT int AtomParity(const ROMol &mol, unsigned iatom, + const Neighbourhood &nbp); /* -* Sets the color field of the defined double bonds in *mp to CIS, -* TRANS, or NONE depending on the ligands with the lowest numbering[]. -* It returns the number of defined double bonds found. -*/ -RDKIT_STRUCTCHECKER_EXPORT int CisTransPerception(const ROMol &mol, - const std::vector &points, - const std::vector &numbering, - std::vector &bondColor); -} -} + * Sets the color field of the defined double bonds in *mp to CIS, + * TRANS, or NONE depending on the ligands with the lowest numbering[]. + * It returns the number of defined double bonds found. + */ +RDKIT_STRUCTCHECKER_EXPORT int CisTransPerception( + const ROMol &mol, const std::vector &points, + const std::vector &numbering, std::vector &bondColor); +} // namespace StructureCheck +} // namespace RDKit diff --git a/Code/GraphMol/StructChecker/StripSmallFragments.h b/Code/GraphMol/StructChecker/StripSmallFragments.h index 96fa74437..1af884945 100644 --- a/Code/GraphMol/StructChecker/StripSmallFragments.h +++ b/Code/GraphMol/StructChecker/StripSmallFragments.h @@ -13,9 +13,10 @@ namespace RDKit { namespace StructureCheck { -RDKIT_STRUCTCHECKER_EXPORT bool StripSmallFragments(RWMol &mol, bool verbose=false); +RDKIT_STRUCTCHECKER_EXPORT bool StripSmallFragments(RWMol &mol, + bool verbose = false); RDKIT_STRUCTCHECKER_EXPORT void AddMWMF( RWMol &mol, bool pre); // set mol formula & mass properties "MW_PRE" or "MW_POST" -} -} +} // namespace StructureCheck +} // namespace RDKit diff --git a/Code/GraphMol/StructChecker/StructChecker.h b/Code/GraphMol/StructChecker/StructChecker.h index 1d0591c48..d4fd9572e 100644 --- a/Code/GraphMol/StructChecker/StructChecker.h +++ b/Code/GraphMol/StructChecker/StructChecker.h @@ -134,7 +134,7 @@ struct RDKIT_STRUCTCHECKER_EXPORT StructCheckerOptions { bool Verbose; // Internal data for struchk - std::vector > AugmentedAtomPairs; + std::vector> AugmentedAtomPairs; std::vector AcidicAtoms; std::vector GoodAtoms; std::vector Patterns; @@ -149,10 +149,10 @@ struct RDKIT_STRUCTCHECKER_EXPORT StructCheckerOptions { std::vector ChargeIncTable; // std::map AtomSymbol(or AtomicNumber) -> IncEntry /* [ReadTransformation() ] - * The alpha, beta coefficients of the transfomation function used - * to stretch the preliminary pKa values to the actual predictions. - * The function is pKa = 7 + (pKa'-7)*beta + ((pKa'-7)*alpha)^3. - */ + * The alpha, beta coefficients of the transfomation function used + * to stretch the preliminary pKa values to the actual predictions. + * The function is pKa = 7 + (pKa'-7)*beta + ((pKa'-7)*alpha)^3. + */ double Alpha, Beta; std::vector AlphaPathTable, BetaPathTable; @@ -164,7 +164,7 @@ struct RDKIT_STRUCTCHECKER_EXPORT StructCheckerOptions { bool loadAugmentedAtomTranslations(const std::string &path); void setAugmentedAtomTranslations( - const std::vector > &aaPairs); + const std::vector> &aaPairs); bool loadAcidicAugmentedAtoms(const std::string &path); void setAcidicAugmentedAtoms(const std::vector &acidicAtoms); @@ -197,7 +197,8 @@ struct RDKIT_STRUCTCHECKER_EXPORT StructCheckerOptions { bool loadChargeDataTables(const std::string &path); // file path }; -RDKIT_STRUCTCHECKER_EXPORT bool parseOptionsJSON(const std::string &json, StructCheckerOptions &op); +RDKIT_STRUCTCHECKER_EXPORT bool parseOptionsJSON(const std::string &json, + StructCheckerOptions &op); RDKIT_STRUCTCHECKER_EXPORT bool loadOptionsFromFiles( StructCheckerOptions &op, @@ -295,6 +296,6 @@ class RDKIT_STRUCTCHECKER_EXPORT StructChecker { // internal implementation: private: }; -} -} +} // namespace StructureCheck +} // namespace RDKit #endif diff --git a/Code/GraphMol/StructChecker/StructCheckerOptions.h b/Code/GraphMol/StructChecker/StructCheckerOptions.h index 3b58a6f97..e1c40ec26 100644 --- a/Code/GraphMol/StructChecker/StructCheckerOptions.h +++ b/Code/GraphMol/StructChecker/StructCheckerOptions.h @@ -14,6 +14,7 @@ namespace RDKit { namespace StructureCheck { // used in unit test -RDKIT_STRUCTCHECKER_EXPORT bool StringToAugmentedAtom(const char *str, AugmentedAtom &aa); -} -} +RDKIT_STRUCTCHECKER_EXPORT bool StringToAugmentedAtom(const char *str, + AugmentedAtom &aa); +} // namespace StructureCheck +} // namespace RDKit diff --git a/Code/GraphMol/StructChecker/Tautomer.h b/Code/GraphMol/StructChecker/Tautomer.h index dbc522a69..ff510ddd0 100644 --- a/Code/GraphMol/StructChecker/Tautomer.h +++ b/Code/GraphMol/StructChecker/Tautomer.h @@ -23,5 +23,5 @@ class RDKIT_STRUCTCHECKER_EXPORT StructCheckTautomer { : Mol(mol), Options(options) {} bool applyTautomer(unsigned it); }; -}; -} +}; // namespace StructureCheck +} // namespace RDKit diff --git a/Code/GraphMol/StructChecker/Utilites.h b/Code/GraphMol/StructChecker/Utilites.h index 726ff599f..7d63718eb 100644 --- a/Code/GraphMol/StructChecker/Utilites.h +++ b/Code/GraphMol/StructChecker/Utilites.h @@ -15,18 +15,20 @@ namespace RDKit { namespace StructureCheck { -struct RDKIT_STRUCTCHECKER_EXPORT Neighbourhood { // a set of an atom neighbours +struct RDKIT_STRUCTCHECKER_EXPORT + Neighbourhood { // a set of an atom neighbours std::vector Atoms; // indices of atoms std::vector Bonds; // indices of bonds }; -RDKIT_STRUCTCHECKER_EXPORT void SetupNeighbourhood(const ROMol &mol, - std::vector &neighbour_array); -RDKIT_STRUCTCHECKER_EXPORT bool getMolAtomPoints(const ROMol &mol, - std::vector &atomPoint, bool twod=false); +RDKIT_STRUCTCHECKER_EXPORT void SetupNeighbourhood( + const ROMol &mol, std::vector &neighbour_array); +RDKIT_STRUCTCHECKER_EXPORT bool getMolAtomPoints( + const ROMol &mol, std::vector &atomPoint, + bool twod = false); RDKIT_STRUCTCHECKER_EXPORT std::string LogNeighbourhood( const ROMol &mol, unsigned int idx, const std::vector &bneighbour_array); -} -} +} // namespace StructureCheck +} // namespace RDKit diff --git a/Code/GraphMol/Subgraphs/SubgraphUtils.h b/Code/GraphMol/Subgraphs/SubgraphUtils.h index 76c9af4da..29dabd948 100644 --- a/Code/GraphMol/Subgraphs/SubgraphUtils.h +++ b/Code/GraphMol/Subgraphs/SubgraphUtils.h @@ -26,12 +26,14 @@ typedef boost::tuples::tuple RDKIT_SUBGRAPHS_EXPORT DiscrimTuple calcPathDiscriminators( const ROMol &mol, const PATH_TYPE &path, bool useBO = true, std::vector *extraInvars = 0); -RDKIT_SUBGRAPHS_EXPORT PATH_LIST uniquifyPaths(const ROMol &mol, const PATH_LIST &allPathsb, - bool useBO = true); +RDKIT_SUBGRAPHS_EXPORT PATH_LIST uniquifyPaths(const ROMol &mol, + const PATH_LIST &allPathsb, + bool useBO = true); // Return the list of bond that connect a list of atoms // ASSUMPTION: the atoms specified in the list are connected -RDKIT_SUBGRAPHS_EXPORT PATH_TYPE bondListFromAtomList(const ROMol &mol, const PATH_TYPE &atomIds); +RDKIT_SUBGRAPHS_EXPORT PATH_TYPE bondListFromAtomList(const ROMol &mol, + const PATH_TYPE &atomIds); // create a new molecule object from a part of molecule "mol". The part of // of the molecule is specified as a list of bonds in "path". @@ -40,11 +42,13 @@ RDKIT_SUBGRAPHS_EXPORT PATH_TYPE bondListFromAtomList(const ROMol &mol, const PA // and Bonds // atomIdxMap provides a mapping between the atomsIds in mol to the atomIds in // the newly created sub-molecule (the molecule that is returned) -RDKIT_SUBGRAPHS_EXPORT ROMol *pathToSubmol(const ROMol &mol, const PATH_TYPE &path, bool useQuery, - std::map &atomIdxMap); -RDKIT_SUBGRAPHS_EXPORT ROMol *pathToSubmol(const ROMol &mol, const PATH_TYPE &path, - bool useQuery = false); +RDKIT_SUBGRAPHS_EXPORT ROMol *pathToSubmol(const ROMol &mol, + const PATH_TYPE &path, bool useQuery, + std::map &atomIdxMap); +RDKIT_SUBGRAPHS_EXPORT ROMol *pathToSubmol(const ROMol &mol, + const PATH_TYPE &path, + bool useQuery = false); } // end of namespace Subgraphs -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/Subgraphs/Subgraphs.h b/Code/GraphMol/Subgraphs/Subgraphs.h index b4b4765af..1cf17f7f4 100644 --- a/Code/GraphMol/Subgraphs/Subgraphs.h +++ b/Code/GraphMol/Subgraphs/Subgraphs.h @@ -64,12 +64,10 @@ typedef INT_PATH_LIST_MAP::iterator INT_PATH_LIST_MAP_I; * * The result is a map from subgraph size -> list of paths * (i.e. list of list of bond indices) -*/ -RDKIT_SUBGRAPHS_EXPORT INT_PATH_LIST_MAP findAllSubgraphsOfLengthsMtoN(const ROMol &mol, - unsigned int lowerLen, - unsigned int upperLen, - bool useHs = false, - int rootedAtAtom = -1); + */ +RDKIT_SUBGRAPHS_EXPORT INT_PATH_LIST_MAP findAllSubgraphsOfLengthsMtoN( + const ROMol &mol, unsigned int lowerLen, unsigned int upperLen, + bool useHs = false, int rootedAtAtom = -1); //! \brief find all bond subgraphs of a particular size /*! @@ -83,9 +81,10 @@ RDKIT_SUBGRAPHS_EXPORT INT_PATH_LIST_MAP findAllSubgraphsOfLengthsMtoN(const ROM * * * The result is a list of paths (i.e. list of list of bond indices) -*/ -RDKIT_SUBGRAPHS_EXPORT PATH_LIST findAllSubgraphsOfLengthN(const ROMol &mol, unsigned int targetLen, - bool useHs = false, int rootedAtAtom = -1); + */ +RDKIT_SUBGRAPHS_EXPORT PATH_LIST +findAllSubgraphsOfLengthN(const ROMol &mol, unsigned int targetLen, + bool useHs = false, int rootedAtAtom = -1); //! \brief find unique bond subgraphs of a particular size /*! @@ -100,10 +99,10 @@ RDKIT_SUBGRAPHS_EXPORT PATH_LIST findAllSubgraphsOfLengthN(const ROMol &mol, uns * this atom will be returned. * * The result is a list of paths (i.e. list of list of bond indices) -*/ -RDKIT_SUBGRAPHS_EXPORT PATH_LIST findUniqueSubgraphsOfLengthN(const ROMol &mol, unsigned int targetLen, - bool useHs = false, bool useBO = true, - int rootedAtAtom = -1); + */ +RDKIT_SUBGRAPHS_EXPORT PATH_LIST findUniqueSubgraphsOfLengthN( + const ROMol &mol, unsigned int targetLen, bool useHs = false, + bool useBO = true, int rootedAtAtom = -1); //! \brief find all paths of a particular size /*! * \param mol - the molecule to be considered @@ -117,10 +116,12 @@ RDKIT_SUBGRAPHS_EXPORT PATH_LIST findUniqueSubgraphsOfLengthN(const ROMol &mol, * this atom will be returned. * * The result is a list of paths (i.e. list of list of bond indices) -*/ -RDKIT_SUBGRAPHS_EXPORT PATH_LIST findAllPathsOfLengthN(const ROMol &mol, unsigned int targetLen, - bool useBonds = true, bool useHs = false, - int rootedAtAtom = -1); + */ +RDKIT_SUBGRAPHS_EXPORT PATH_LIST findAllPathsOfLengthN(const ROMol &mol, + unsigned int targetLen, + bool useBonds = true, + bool useHs = false, + int rootedAtAtom = -1); RDKIT_SUBGRAPHS_EXPORT INT_PATH_LIST_MAP findAllPathsOfLengthsMtoN( const ROMol &mol, unsigned int lowerLen, unsigned int upperLen, bool useBonds = true, bool useHs = false, int rootedAtAtom = -1); @@ -135,10 +136,10 @@ RDKIT_SUBGRAPHS_EXPORT INT_PATH_LIST_MAP findAllPathsOfLengthsMtoN( * Hs to the graph. * * The result is a path (a vector of bond indices) -*/ -RDKIT_SUBGRAPHS_EXPORT PATH_TYPE findAtomEnvironmentOfRadiusN(const ROMol &mol, unsigned int radius, - unsigned int rootedAtAtom, - bool useHs = false); -} + */ +RDKIT_SUBGRAPHS_EXPORT PATH_TYPE +findAtomEnvironmentOfRadiusN(const ROMol &mol, unsigned int radius, + unsigned int rootedAtAtom, bool useHs = false); +} // namespace RDKit #endif diff --git a/Code/GraphMol/Substruct/SubstructMatch.h b/Code/GraphMol/Substruct/SubstructMatch.h index 3cca1844c..95b68d3cf 100644 --- a/Code/GraphMol/Substruct/SubstructMatch.h +++ b/Code/GraphMol/Substruct/SubstructMatch.h @@ -62,7 +62,7 @@ struct RDKIT_SUBSTRUCTMATCH_EXPORT SubstructMatchParameters { */ RDKIT_SUBSTRUCTMATCH_EXPORT std::vector SubstructMatch( const ROMol &mol, const ROMol &query, - const SubstructMatchParameters ¶ms=SubstructMatchParameters()); + const SubstructMatchParameters ¶ms = SubstructMatchParameters()); //! Find all substructure matches for a query in a ResonanceMolSupplier object /*! @@ -75,17 +75,17 @@ RDKIT_SUBSTRUCTMATCH_EXPORT std::vector SubstructMatch( */ RDKIT_SUBSTRUCTMATCH_EXPORT std::vector SubstructMatch( ResonanceMolSupplier &resMolSuppl, const ROMol &query, - const SubstructMatchParameters ¶ms=SubstructMatchParameters()); + const SubstructMatchParameters ¶ms = SubstructMatchParameters()); RDKIT_SUBSTRUCTMATCH_EXPORT std::vector SubstructMatch( const MolBundle &bundle, const ROMol &query, - const SubstructMatchParameters ¶ms=SubstructMatchParameters()); + const SubstructMatchParameters ¶ms = SubstructMatchParameters()); RDKIT_SUBSTRUCTMATCH_EXPORT std::vector SubstructMatch( const ROMol &mol, const MolBundle &query, - const SubstructMatchParameters ¶ms=SubstructMatchParameters()); + const SubstructMatchParameters ¶ms = SubstructMatchParameters()); RDKIT_SUBSTRUCTMATCH_EXPORT std::vector SubstructMatch( const MolBundle &bundle, const MolBundle &query, - const SubstructMatchParameters ¶ms=SubstructMatchParameters()); + const SubstructMatchParameters ¶ms = SubstructMatchParameters()); //! Find a substructure match for a query /*! @@ -164,10 +164,11 @@ unsigned int SubstructMatch(T1 &mol, const T2 &query, // // find one match in ResonanceMolSupplier object // -template <> inline -bool SubstructMatch(ResonanceMolSupplier &resMolSupplier, const ROMol &query, - MatchVectType &matchVect, bool recursionPossible, - bool useChirality, bool useQueryQueryMatches) { +template <> +inline bool SubstructMatch(ResonanceMolSupplier &resMolSupplier, + const ROMol &query, MatchVectType &matchVect, + bool recursionPossible, bool useChirality, + bool useQueryQueryMatches) { SubstructMatchParameters params; params.recursionPossible = recursionPossible; params.useChirality = useChirality; @@ -183,13 +184,13 @@ bool SubstructMatch(ResonanceMolSupplier &resMolSupplier, const ROMol &query, return matchVect.size() != 0; } -template <> inline -unsigned int SubstructMatch(ResonanceMolSupplier &resMolSupplier, - const ROMol &query, - std::vector &matchVect, - bool uniquify, bool recursionPossible, - bool useChirality, bool useQueryQueryMatches, - unsigned int maxMatches, int numThreads) { +template <> +inline unsigned int SubstructMatch(ResonanceMolSupplier &resMolSupplier, + const ROMol &query, + std::vector &matchVect, + bool uniquify, bool recursionPossible, + bool useChirality, bool useQueryQueryMatches, + unsigned int maxMatches, int numThreads) { SubstructMatchParameters params; params.uniquify = uniquify; params.recursionPossible = recursionPossible; diff --git a/Code/GraphMol/SubstructLibrary/SubstructLibrary.h b/Code/GraphMol/SubstructLibrary/SubstructLibrary.h index c6828f51e..87cad17ca 100644 --- a/Code/GraphMol/SubstructLibrary/SubstructLibrary.h +++ b/Code/GraphMol/SubstructLibrary/SubstructLibrary.h @@ -42,7 +42,7 @@ namespace RDKit { RDKIT_SUBSTRUCTLIBRARY_EXPORT bool SubstructLibraryCanSerialize(); - + //! Base class API for holding molecules to substructure search. /*! This is an API that hides the implementation details used for @@ -89,8 +89,8 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT MolHolder : public MolHolderBase { return rdcast(mols.size()); } - std::vector> & getMols() { return mols; } - const std::vector> & getMols() const { return mols; } + std::vector> &getMols() { return mols; } + const std::vector> &getMols() const { return mols; } }; //! Concrete class that holds binary cached molecules in memory @@ -144,7 +144,8 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT CachedMolHolder : public MolHolderBase { See RDKit::FPHolder */ -class RDKIT_SUBSTRUCTLIBRARY_EXPORT CachedSmilesMolHolder : public MolHolderBase { +class RDKIT_SUBSTRUCTLIBRARY_EXPORT CachedSmilesMolHolder + : public MolHolderBase { std::vector mols; public: @@ -173,7 +174,7 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT CachedSmilesMolHolder : public MolHolderBase virtual unsigned int size() const { return rdcast(mols.size()); } - + std::vector &getMols() { return mols; } const std::vector &getMols() const { return mols; } }; @@ -192,7 +193,8 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT CachedSmilesMolHolder : public MolHolderBase See RDKit::FPHolder */ -class RDKIT_SUBSTRUCTLIBRARY_EXPORT CachedTrustedSmilesMolHolder : public MolHolderBase { +class RDKIT_SUBSTRUCTLIBRARY_EXPORT CachedTrustedSmilesMolHolder + : public MolHolderBase { std::vector mols; public: @@ -298,7 +300,7 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT PatternHolder : public FPHolderBase { boost::shared_ptr match = lib.getMol(*matchIndex); } \endcode - + Using different mol holders and pattern fingerprints. \code @@ -331,20 +333,20 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT PatternHolder : public FPHolderBase { Each pattern holder has an API point for making its fingerprint. This is useful to ensure that the pattern stored in the database will be compatible with the patterns made when analyzing queries. - + \code boost::shared_ptr molHolder = \ boost::make_shared(); boost::shared_ptr patternHolder = \ boost::make_shared(); - + // the PatternHolder instance is able to make fingerprints. // These, of course, can be read from a file. For demonstration // purposes we construct them here. const std::string trustedSmiles = "c1ccccc1"; ROMol *m = SmilesToMol(trustedSmiles); const ExplicitBitVect *bitVector = patternHolder->makeFingerprint(*m); - + // The trusted smiles and bitVector can be read from any source. // This is the fastest way to load a substruct library. molHolder->addSmiles( trustedSmiles ); @@ -353,7 +355,7 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT PatternHolder : public FPHolderBase { delete m; delete bitVector; \endcode - + */ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { boost::shared_ptr molholder; @@ -379,30 +381,28 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { fps(fpholder.get()) {} SubstructLibrary(const std::string &pickle) - : molholder(new MolHolder), fpholder(), mols(molholder.get()), + : molholder(new MolHolder), + fpholder(), + mols(molholder.get()), fps(nullptr) { - initFromString(pickle); + initFromString(pickle); } //! Get the underlying molecule holder implementation - boost::shared_ptr &getMolHolder() { - return molholder; - } + boost::shared_ptr &getMolHolder() { return molholder; } const boost::shared_ptr &getMolHolder() const { return molholder; } //! Get the underlying molecule holder implementation - boost::shared_ptr &getFpHolder() { - return fpholder; - } + boost::shared_ptr &getFpHolder() { return fpholder; } //! Get the underlying molecule holder implementation const boost::shared_ptr &getFpHolder() const { return fpholder; } - + const MolHolderBase &getMolecules() const { PRECONDITION(mols, "Molecule holder NULL in SubstructLibrary"); return *mols; @@ -568,13 +568,12 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { return rdcast(molholder->size()); } - //! access required for serialization void resetHolders() { mols = molholder.get(); fps = fpholder.get(); } - + //! serializes (pickles) to a stream void toStream(std::ostream &ss) const; //! returns a string with a serialized (pickled) representation @@ -584,7 +583,7 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { //! initializes from a string pickle void initFromString(const std::string &text); }; -} +} // namespace RDKit #include "SubstructLibrarySerialization.h" #endif diff --git a/Code/GraphMol/SubstructLibrary/SubstructLibrarySerialization.h b/Code/GraphMol/SubstructLibrary/SubstructLibrarySerialization.h index 0af204326..16f89962f 100644 --- a/Code/GraphMol/SubstructLibrary/SubstructLibrarySerialization.h +++ b/Code/GraphMol/SubstructLibrary/SubstructLibrarySerialization.h @@ -40,56 +40,55 @@ #include #include - - BOOST_SERIALIZATION_ASSUME_ABSTRACT(RDKit::MolHolderBase) BOOST_SERIALIZATION_ASSUME_ABSTRACT(RDKit::FPHolderBase) namespace boost { namespace serialization { - + template -void serialize(Archive &ar, RDKit::MolHolderBase &, const unsigned int version) { +void serialize(Archive &ar, RDKit::MolHolderBase &, + const unsigned int version) { RDUNUSED_PARAM(version); RDUNUSED_PARAM(ar); } template -void save(Archive &ar, const RDKit::MolHolder& molholder, +void save(Archive &ar, const RDKit::MolHolder &molholder, const unsigned int version) { RDUNUSED_PARAM(version); ar &boost::serialization::base_object(molholder); std::int64_t pkl_count = molholder.getMols().size(); - ar & pkl_count; - - for(auto &mol: molholder.getMols()) { + ar &pkl_count; + + for (auto &mol : molholder.getMols()) { std::string pkl; RDKit::MolPickler::pickleMol(*mol.get(), pkl); ar << pkl; } } - + template -void load(Archive &ar, RDKit::MolHolder& molholder, +void load(Archive &ar, RDKit::MolHolder &molholder, const unsigned int version) { RDUNUSED_PARAM(version); ar &boost::serialization::base_object(molholder); - + std::vector> &mols = molholder.getMols(); mols.clear(); - - std::int64_t pkl_count = -1; - ar & pkl_count; - for(std::int64_t i = 0; i> pkl; mols.push_back(boost::make_shared(pkl)); } } -template +template void serialize_strings(Archive &ar, MolHolder &molholder, const unsigned int version) { RDUNUSED_PARAM(version); @@ -106,7 +105,7 @@ void serialize(Archive &ar, RDKit::CachedMolHolder &molholder, template void serialize(Archive &ar, RDKit::CachedSmilesMolHolder &molholder, const unsigned int version) { - serialize_strings(ar, molholder, version); + serialize_strings(ar, molholder, version); } template @@ -120,25 +119,25 @@ void save(Archive &ar, const RDKit::FPHolderBase &fpholder, const unsigned int version) { RDUNUSED_PARAM(version); std::vector pickles; - for(auto &fp: fpholder.getFingerprints()) { + for (auto &fp : fpholder.getFingerprints()) { pickles.push_back(fp->toString()); } ar &pickles; } - + template void load(Archive &ar, RDKit::FPHolderBase &fpholder, const unsigned int version) { RDUNUSED_PARAM(version); std::vector pickles; std::vector &fps = fpholder.getFingerprints(); - + ar &pickles; for (size_t i = 0; i < fps.size(); ++i) delete fps[i]; fps.clear(); - - for(auto &pkl: pickles) { - fps.push_back( new ExplicitBitVect(pkl) ); + + for (auto &pkl : pickles) { + fps.push_back(new ExplicitBitVect(pkl)); } } @@ -158,14 +157,13 @@ void registerSubstructLibraryTypes(Archive &ar) { ar.register_type(static_cast(NULL)); } - template void save(Archive &ar, const RDKit::SubstructLibrary &slib, const unsigned int version) { RDUNUSED_PARAM(version); registerSubstructLibraryTypes(ar); - ar & slib.getMolHolder(); - ar & slib.getFpHolder(); + ar &slib.getMolHolder(); + ar &slib.getFpHolder(); } template @@ -173,13 +171,13 @@ void load(Archive &ar, RDKit::SubstructLibrary &slib, const unsigned int version) { RDUNUSED_PARAM(version); registerSubstructLibraryTypes(ar); - ar & slib.getMolHolder(); - ar & slib.getFpHolder(); + ar &slib.getMolHolder(); + ar &slib.getFpHolder(); slib.resetHolders(); } -} // end namespace serialization -} // end namespace boost +} // end namespace serialization +} // end namespace boost BOOST_CLASS_VERSION(RDKit::MolHolder, 1); BOOST_CLASS_VERSION(RDKit::CachedMolHolder, 1); diff --git a/Code/GraphMol/Trajectory/Snapshot.h b/Code/GraphMol/Trajectory/Snapshot.h index b93beb8dc..d34a14489 100644 --- a/Code/GraphMol/Trajectory/Snapshot.h +++ b/Code/GraphMol/Trajectory/Snapshot.h @@ -15,60 +15,54 @@ #include namespace RDKit { - class Snapshot; - class Trajectory; - typedef std::vector SnapshotVect; -} +class Snapshot; +class Trajectory; +typedef std::vector SnapshotVect; +} // namespace RDKit namespace RDKit { class RDKIT_TRAJECTORY_EXPORT Snapshot { friend class Trajectory; - public: - /*! \brief Constructor - \param pos is a pointer to an array of (numPoints * dimension) doubles; - numPoints and dimension must match the Trajectory which is going to - contain this Snapshot - \param energy is the energy associated with this set of coordinates - */ - Snapshot(boost::shared_array pos, double energy = 0.0) : - d_trajectory(NULL), - d_energy(energy), - d_pos(pos) {} - /*! \return a const pointer to the parent Trajectory - */ - const Trajectory *trajectory() const { - return d_trajectory; - } - /*! \param pointNum is the atom number whose coordinates will be retrieved - \return the coordinates at pointNum as a Point2D object; - requires the Trajectory dimension to be == 2 - */ - RDGeom::Point2D getPoint2D(unsigned int pointNum) const; - /*! \param pointNum is the atom number whose coordinates will be retrieved - \return the coordinates at pointNum as a Point3D object; - requires the Trajectory dimension to be >= 2 - */ - RDGeom::Point3D getPoint3D(unsigned int pointNum) const; - /*! \return the energy for this Snapshot - */ - double getEnergy() const { - return d_energy; - }; - /*! \brief Sets the energy for this Snapshot - \param energy the energy value assigned to this Snapshot - */ - void setEnergy(double energy) { - d_energy = energy; - } - private: - // Pointer to the parent Trajectory object - const Trajectory *d_trajectory; - // Energy for this set of coordinates - double d_energy; - // shared array to Snapshot coordinates - boost::shared_array d_pos; + + public: + /*! \brief Constructor + \param pos is a pointer to an array of (numPoints * dimension) doubles; + numPoints and dimension must match the Trajectory which is going to + contain this Snapshot + \param energy is the energy associated with this set of coordinates + */ + Snapshot(boost::shared_array pos, double energy = 0.0) + : d_trajectory(NULL), d_energy(energy), d_pos(pos) {} + /*! \return a const pointer to the parent Trajectory + */ + const Trajectory *trajectory() const { return d_trajectory; } + /*! \param pointNum is the atom number whose coordinates will be retrieved + \return the coordinates at pointNum as a Point2D object; + requires the Trajectory dimension to be == 2 + */ + RDGeom::Point2D getPoint2D(unsigned int pointNum) const; + /*! \param pointNum is the atom number whose coordinates will be retrieved + \return the coordinates at pointNum as a Point3D object; + requires the Trajectory dimension to be >= 2 + */ + RDGeom::Point3D getPoint3D(unsigned int pointNum) const; + /*! \return the energy for this Snapshot + */ + double getEnergy() const { return d_energy; }; + /*! \brief Sets the energy for this Snapshot + \param energy the energy value assigned to this Snapshot + */ + void setEnergy(double energy) { d_energy = energy; } + + private: + // Pointer to the parent Trajectory object + const Trajectory *d_trajectory; + // Energy for this set of coordinates + double d_energy; + // shared array to Snapshot coordinates + boost::shared_array d_pos; }; -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/Trajectory/Trajectory.h b/Code/GraphMol/Trajectory/Trajectory.h index 66a8e32f7..1f7221626 100644 --- a/Code/GraphMol/Trajectory/Trajectory.h +++ b/Code/GraphMol/Trajectory/Trajectory.h @@ -19,91 +19,87 @@ namespace RDKit { class ROMol; class RDKIT_TRAJECTORY_EXPORT Trajectory { - public: - /*! \brief Constructor - \param dimension represents the dimensionality of this Trajectory's coordinate tuples; - this is normally 2 (2D coordinates) or 3 (3D coordinates) - \param numPoints is the number of coordinate tuples associated to each Snapshot - \param snapshotVect (optional, defaults to NULL) is a pointer to a SnapshotVect - used to initialize the Trajectory; if not NULL, the Trajectory takes ownership - of the SnapshotVect - */ - Trajectory(unsigned int dimension, unsigned int numPoints, SnapshotVect *snapshotVect = NULL); - /*! \brief Copy constructor - */ - Trajectory(const Trajectory &other); - /*! \return the dimensionality of this Trajectory's coordinate tuples - */ - unsigned int dimension() const { - return d_dimension; - } - /*! \return the number of coordinate tuples associated to each Snapshot - */ - unsigned int numPoints() const { - return d_numPoints; - } - /*! \return the number of Snapshots associated to this Trajectory - */ - size_t size() const { - return d_snapshotVect->size(); - } - /*! \brief Appends a Snapshot to this Trajectory - \param s is the Snapshot to be added; the Trajectory - takes ownership of the snapshot coordinates - \return the zero-based index position of the added Snapshot - */ - unsigned int addSnapshot(const Snapshot &s); - /*! \param snapshotNum is the zero-based index of the retrieved Snapshot - \return a const reference to the relevant Snapshot in the Trajectory - */ - const Snapshot &getSnapshot(unsigned int snapshotNum) const; - /*! \brief Inserts a Snapshot into this Trajectory - \param snapshotNum is the zero-based index of the Trajectory's Snapshot - before which the Snapshot s will be inserted - \param s is the Snapshot to be inserted; the Trajectory - takes ownership of the snapshot coordinates - \return the zero-based index position of the inserted Snapshot - */ - unsigned int insertSnapshot(unsigned int snapshotNum, Snapshot s); - /*! \brief Removes a Snapshot from this Trajectory - \param snapshotNum is the zero-based index of Snapshot to be removed - \return the zero-based index position of the Snapshot after the - removed one; if the last Snapshot was removed, it returns the - size of the trajectory - */ - unsigned int removeSnapshot(unsigned int snapshotNum); - //! Clear all Snapshots from a Trajectory - void clear() { - d_snapshotVect->clear(); - }; - //! Add conformations from the Trajectory to a molecule - /*! - \param mol - ROMol to which Conformers with coordinates from the Trajectory will be added; - the Trajectory must have numPoints() == mol.getNumAtoms() - \param from - the first Snapshot that will be added as a Conformer; defaults to -1 (first available) - \param to - the last Snapshot that will be added as a Conformer; defaults to -1 (all) - \return the number of conformations added - */ - unsigned int addConformersToMol(ROMol &mol, int from = -1, int to = -1); - private: - // dimensionality of this Trajectory's coordinates; - // this is normally 2 (2D coordinates) or 3 (3D coordinates) - const unsigned int d_dimension; - // number of coordinate tuples associated to each Snapshot - const unsigned int d_numPoints; - // smart_ptr to vector holding the Snapshots for this Trajectory - boost::shared_ptr d_snapshotVect; + public: + /*! \brief Constructor + \param dimension represents the dimensionality of this Trajectory's + coordinate tuples; this is normally 2 (2D coordinates) or 3 (3D + coordinates) \param numPoints is the number of coordinate tuples associated + to each Snapshot \param snapshotVect (optional, defaults to NULL) is a + pointer to a SnapshotVect used to initialize the Trajectory; if not NULL, + the Trajectory takes ownership of the SnapshotVect + */ + Trajectory(unsigned int dimension, unsigned int numPoints, + SnapshotVect *snapshotVect = NULL); + /*! \brief Copy constructor + */ + Trajectory(const Trajectory &other); + /*! \return the dimensionality of this Trajectory's coordinate tuples + */ + unsigned int dimension() const { return d_dimension; } + /*! \return the number of coordinate tuples associated to each Snapshot + */ + unsigned int numPoints() const { return d_numPoints; } + /*! \return the number of Snapshots associated to this Trajectory + */ + size_t size() const { return d_snapshotVect->size(); } + /*! \brief Appends a Snapshot to this Trajectory + \param s is the Snapshot to be added; the Trajectory + takes ownership of the snapshot coordinates + \return the zero-based index position of the added Snapshot + */ + unsigned int addSnapshot(const Snapshot &s); + /*! \param snapshotNum is the zero-based index of the retrieved Snapshot + \return a const reference to the relevant Snapshot in the Trajectory + */ + const Snapshot &getSnapshot(unsigned int snapshotNum) const; + /*! \brief Inserts a Snapshot into this Trajectory + \param snapshotNum is the zero-based index of the Trajectory's Snapshot + before which the Snapshot s will be inserted + \param s is the Snapshot to be inserted; the Trajectory + takes ownership of the snapshot coordinates + \return the zero-based index position of the inserted Snapshot + */ + unsigned int insertSnapshot(unsigned int snapshotNum, Snapshot s); + /*! \brief Removes a Snapshot from this Trajectory + \param snapshotNum is the zero-based index of Snapshot to be removed + \return the zero-based index position of the Snapshot after the + removed one; if the last Snapshot was removed, it returns the + size of the trajectory + */ + unsigned int removeSnapshot(unsigned int snapshotNum); + //! Clear all Snapshots from a Trajectory + void clear() { d_snapshotVect->clear(); }; + //! Add conformations from the Trajectory to a molecule + /*! + \param mol - ROMol to which Conformers with coordinates from the Trajectory + will be added; the Trajectory must have numPoints() == mol.getNumAtoms() + \param from - the first Snapshot that will be added as a Conformer; defaults + to -1 (first available) \param to - the last Snapshot that will be added as + a Conformer; defaults to -1 (all) \return the number of conformations added + */ + unsigned int addConformersToMol(ROMol &mol, int from = -1, int to = -1); + + private: + // dimensionality of this Trajectory's coordinates; + // this is normally 2 (2D coordinates) or 3 (3D coordinates) + const unsigned int d_dimension; + // number of coordinate tuples associated to each Snapshot + const unsigned int d_numPoints; + // smart_ptr to vector holding the Snapshots for this Trajectory + boost::shared_ptr d_snapshotVect; }; /*! \brief Reads coordinates from an AMBER trajectory file into the traj Trajectory object \return the number of Snapshot objects read in */ -RDKIT_TRAJECTORY_EXPORT unsigned int readAmberTrajectory(const std::string &fName, Trajectory &traj); +RDKIT_TRAJECTORY_EXPORT unsigned int readAmberTrajectory( + const std::string &fName, Trajectory &traj); /*! \brief Reads coordinates from a GROMOS trajectory file into the traj Trajectory object \return the number of Snapshot objects read in */ -RDKIT_TRAJECTORY_EXPORT unsigned int readGromosTrajectory(const std::string &fName, Trajectory &traj); +RDKIT_TRAJECTORY_EXPORT unsigned int readGromosTrajectory( + const std::string &fName, Trajectory &traj); -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/Wrap/MolSupplier.h b/Code/GraphMol/Wrap/MolSupplier.h index 6bc095195..4d8e42402 100644 --- a/Code/GraphMol/Wrap/MolSupplier.h +++ b/Code/GraphMol/Wrap/MolSupplier.h @@ -85,5 +85,5 @@ ROMol *MolSupplGetItem(T *suppl, int idx) { } return res; } -} +} // namespace RDKit #endif diff --git a/Code/GraphMol/atomic_data.h b/Code/GraphMol/atomic_data.h index e77605c2f..f3fcdb781 100644 --- a/Code/GraphMol/atomic_data.h +++ b/Code/GraphMol/atomic_data.h @@ -58,7 +58,7 @@ class RDKIT_GRAPHMOL_EXPORT atomicData { double MostCommonIsotopeMass() const { return commonIsotopeMass; } // maps isotope number -> mass - std::map > + std::map> d_isotopeInfoMap; // available isotopes private: int anum; // atomic number @@ -72,5 +72,5 @@ class RDKIT_GRAPHMOL_EXPORT atomicData { int commonIsotope; // most comon isotope double commonIsotopeMass; // most comon isotope }; -}; +}; // namespace RDKit #endif diff --git a/Code/GraphMol/new_canon.h b/Code/GraphMol/new_canon.h index 266001ce5..bfb96db8b 100644 --- a/Code/GraphMol/new_canon.h +++ b/Code/GraphMol/new_canon.h @@ -98,9 +98,7 @@ class RDKIT_GRAPHMOL_EXPORT canon_atom { nbrIds(NULL), p_symbol(NULL){}; - ~canon_atom() { - free(nbrIds); - } + ~canon_atom() { free(nbrIds); } }; RDKIT_GRAPHMOL_EXPORT void updateAtomNeighborIndex( diff --git a/Code/JavaWrappers/DiversityPick.h b/Code/JavaWrappers/DiversityPick.h index 35dba28b6..48946b6ed 100644 --- a/Code/JavaWrappers/DiversityPick.h +++ b/Code/JavaWrappers/DiversityPick.h @@ -9,10 +9,11 @@ namespace { class taniFunctor { public: - taniFunctor(const std::vector &ebvs, bool useCache) : df_useCache(useCache), d_ebvs(ebvs) {} + taniFunctor(const std::vector &ebvs, bool useCache) + : df_useCache(useCache), d_ebvs(ebvs) {} double operator()(unsigned int i, unsigned int j) { double res; - if(df_useCache){ + if (df_useCache) { std::pair idxPair(i, j); if (this->d_cache.count(idxPair) > 0) { res = this->d_cache[idxPair]; @@ -31,17 +32,18 @@ class taniFunctor { const std::vector &d_ebvs; std::map, double> d_cache; }; -} +} // namespace std::vector pickUsingFingerprints( const std::vector &ebvs, unsigned int nToPick, - int seed = -1, std::vector firstPicks = std::vector(), bool useCache=true) { + int seed = -1, std::vector firstPicks = std::vector(), + bool useCache = true) { if (nToPick >= ebvs.size()) throw ValueErrorException("nToPick is larger than the vector size"); std::vector res; RDPickers::MaxMinPicker picker; - taniFunctor ftor(ebvs,useCache); + taniFunctor ftor(ebvs, useCache); res = picker.lazyPick(ftor, ebvs.size(), nToPick, firstPicks, seed); return res; } diff --git a/Code/JavaWrappers/GenericRDKitException.h b/Code/JavaWrappers/GenericRDKitException.h index f00dc0faa..35339e636 100644 --- a/Code/JavaWrappers/GenericRDKitException.h +++ b/Code/JavaWrappers/GenericRDKitException.h @@ -24,4 +24,4 @@ class GenericRDKitException : public std::exception { private: std::string _value; }; -} +} // namespace RDKit diff --git a/Code/JavaWrappers/MorganFingerprints.h b/Code/JavaWrappers/MorganFingerprints.h index 7a8e9e11d..5af5401b9 100644 --- a/Code/JavaWrappers/MorganFingerprints.h +++ b/Code/JavaWrappers/MorganFingerprints.h @@ -5,19 +5,17 @@ #include #include #include - + RDKit::SparseIntVect *getFeatureFingerprint( - const RDKit::ROMol &mol, unsigned int radius, - bool useChirality = false, bool useBondTypes=true, bool useCounts=true) { - - std::vector *invars = new std::vector(mol.getNumAtoms()); + const RDKit::ROMol &mol, unsigned int radius, bool useChirality = false, + bool useBondTypes = true, bool useCounts = true) { + std::vector *invars = + new std::vector(mol.getNumAtoms()); RDKit::MorganFingerprints::getFeatureInvariants(mol, *invars); - RDKit::SparseIntVect *res = RDKit::MorganFingerprints::getFingerprint( - mol, static_cast(radius), invars, 0, useChirality, - useBondTypes, useCounts, false, 0); + RDKit::SparseIntVect *res = + RDKit::MorganFingerprints::getFingerprint( + mol, static_cast(radius), invars, 0, useChirality, + useBondTypes, useCounts, false, 0); delete invars; return res; - } - - diff --git a/Code/ML/Cluster/Murtagh/f2c.h b/Code/ML/Cluster/Murtagh/f2c.h index 7ab645e6e..d2bd893ae 100644 --- a/Code/ML/Cluster/Murtagh/f2c.h +++ b/Code/ML/Cluster/Murtagh/f2c.h @@ -14,8 +14,12 @@ typedef char *address; typedef short int shortint; typedef float real; typedef double doublereal; -typedef struct { real r, i; } complex; -typedef struct { doublereal r, i; } doublecomplex; +typedef struct { + real r, i; +} complex; +typedef struct { + doublereal r, i; +} doublecomplex; typedef long int logical; typedef short int shortlogical; typedef char logical1; @@ -125,7 +129,7 @@ typedef struct { #define VOID void -union Multitype {/* for multiple entry points */ +union Multitype { /* for multiple entry points */ integer1 g; shortint h; integer i; @@ -140,7 +144,7 @@ typedef union Multitype Multitype; /*typedef long int Long;*/ /* No longer used; formerly in Namelist */ -struct Vardesc {/* for Namelist */ +struct Vardesc { /* for Namelist */ char *name; char *addr; ftnlen *dims; diff --git a/Code/ML/InfoTheory/CorrMatGenerator.h b/Code/ML/InfoTheory/CorrMatGenerator.h index 417ba1e9c..12e28902c 100644 --- a/Code/ML/InfoTheory/CorrMatGenerator.h +++ b/Code/ML/InfoTheory/CorrMatGenerator.h @@ -68,18 +68,18 @@ class BitCorrMatGenerator { }; //! \brief get the number of examples we used so far to compute the - //correlation matrix + // correlation matrix int getNumExamples() const { return d_nExamples; }; //! \brief Get the list of bits ID that are used to generate the correlation - //matrix + // matrix RDKit::INT_VECT getCorrBitList() const { return d_descs; }; //! \brief Gets a pointer to the correlation matrix double *getCorrMat() { return dp_corrMat; }; //! \brief For each pair of on bits (bi, bj) in fp increase the correlation - //count + // count // for the pair by 1 void collectVotes(const BitVect &fp) { unsigned int nd = d_descs.size(); @@ -110,6 +110,6 @@ class BitCorrMatGenerator { double *dp_corrMat; int d_nExamples; }; -} +} // namespace RDInfoTheory #endif diff --git a/Code/ML/InfoTheory/InfoBitRanker.h b/Code/ML/InfoTheory/InfoBitRanker.h index 05abd1970..22cf88301 100644 --- a/Code/ML/InfoTheory/InfoBitRanker.h +++ b/Code/ML/InfoTheory/InfoBitRanker.h @@ -273,5 +273,5 @@ class RDKIT_INFOTHEORY_EXPORT InfoBitRanker { d_biasList; // if we want a bias towards certain classes in ranking bits ExplicitBitVect *dp_maskBits; // allows only certain bits to be considered }; -} +} // namespace RDInfoTheory #endif diff --git a/Code/ML/InfoTheory/InfoGainFuncs.h b/Code/ML/InfoTheory/InfoGainFuncs.h index 8241499cb..3b6c14c4f 100644 --- a/Code/ML/InfoTheory/InfoGainFuncs.h +++ b/Code/ML/InfoTheory/InfoGainFuncs.h @@ -135,5 +135,5 @@ double InfoEntropyGain(T *dMat, long int dim1, long int dim2) { delete[] variableRes; return gain; } -} +} // namespace RDInfoTheory #endif diff --git a/Code/Numerics/Alignment/AlignPoints.h b/Code/Numerics/Alignment/AlignPoints.h index ce056924d..03a206df0 100644 --- a/Code/Numerics/Alignment/AlignPoints.h +++ b/Code/Numerics/Alignment/AlignPoints.h @@ -20,7 +20,7 @@ namespace RDNumeric { namespace Alignments { //! \brief Compute an optimal alignment (minimum sum of squared distance) -//between +// between //! two sets of points in 3D /*! \param refPoints A vector of pointers to the reference points @@ -38,11 +38,12 @@ namespace Alignments { This function returns the sum of squared distance (SSR) not the RMSD RMSD = sqrt(SSR/numPoints) */ -double RDKIT_ALIGNMENT_EXPORT AlignPoints(const RDGeom::Point3DConstPtrVect &refPoints, - const RDGeom::Point3DConstPtrVect &probePoints, - RDGeom::Transform3D &trans, const DoubleVector *weights = 0, - bool reflect = false, unsigned int maxIterations = 50); -} -} +double RDKIT_ALIGNMENT_EXPORT +AlignPoints(const RDGeom::Point3DConstPtrVect &refPoints, + const RDGeom::Point3DConstPtrVect &probePoints, + RDGeom::Transform3D &trans, const DoubleVector *weights = 0, + bool reflect = false, unsigned int maxIterations = 50); +} // namespace Alignments +} // namespace RDNumeric #endif diff --git a/Code/Numerics/EigenSolvers/PowerEigenSolver.h b/Code/Numerics/EigenSolvers/PowerEigenSolver.h index 1d8f26140..557015872 100644 --- a/Code/Numerics/EigenSolvers/PowerEigenSolver.h +++ b/Code/Numerics/EigenSolvers/PowerEigenSolver.h @@ -19,7 +19,7 @@ namespace RDNumeric { namespace EigenSolvers { //! Compute the \c numEig largest eigenvalues and, optionally, the -//corresponding +// corresponding //! eigenvectors. /*! @@ -53,16 +53,18 @@ We use the iterative power method, which works like this: */ -bool RDKIT_EIGENSOLVERS_EXPORT powerEigenSolver(unsigned int numEig, DoubleSymmMatrix &mat, - DoubleVector &eigenValues, DoubleMatrix *eigenVectors = 0, - int seed = -1); +bool RDKIT_EIGENSOLVERS_EXPORT powerEigenSolver(unsigned int numEig, + DoubleSymmMatrix &mat, + DoubleVector &eigenValues, + DoubleMatrix *eigenVectors = 0, + int seed = -1); //! \overload static inline bool powerEigenSolver(unsigned int numEig, DoubleSymmMatrix &mat, DoubleVector &eigenValues, DoubleMatrix &eigenVectors, int seed = -1) { return powerEigenSolver(numEig, mat, eigenValues, &eigenVectors, seed); } -}; -}; +}; // namespace EigenSolvers +}; // namespace RDNumeric #endif diff --git a/Code/Numerics/Matrix.h b/Code/Numerics/Matrix.h index 3bc5e1b4f..38548905e 100644 --- a/Code/Numerics/Matrix.h +++ b/Code/Numerics/Matrix.h @@ -324,7 +324,7 @@ Vector &multiply(const Matrix &A, const Vector &x, }; typedef Matrix DoubleMatrix; -}; +}; // namespace RDNumeric //! ostream operator for Matrix's template diff --git a/Code/Numerics/Optimizer/BFGSOpt.h b/Code/Numerics/Optimizer/BFGSOpt.h index 9a8247af1..355efd496 100644 --- a/Code/Numerics/Optimizer/BFGSOpt.h +++ b/Code/Numerics/Optimizer/BFGSOpt.h @@ -175,9 +175,9 @@ void linearSearch(unsigned int dim, double *oldPt, double oldVal, double *grad, will be stored after as many steps as indicated through this parameter; defaults to 0 (no snapshots stored) - \param snapshotVect pointer to a std::vector object that will receive - the coordinates and energies every snapshotFreq steps; - defaults to NULL (no snapshots stored) + \param snapshotVect pointer to a std::vector object that will + receive the coordinates and energies every snapshotFreq steps; defaults to + NULL (no snapshots stored) \return a flag indicating success (or type of failure). Possible values are: - 0: success @@ -382,8 +382,8 @@ int minimize(unsigned int dim, double *pos, double gradTol, unsigned int &numIters, double &funcVal, EnergyFunctor func, GradientFunctor gradFunc, double funcTol = TOLX, unsigned int maxIts = MAXITS) { - return minimize(dim, pos, gradTol, numIters, funcVal, func, - gradFunc, 0, NULL, funcTol, maxIts); + return minimize(dim, pos, gradTol, numIters, funcVal, func, gradFunc, 0, NULL, + funcTol, maxIts); } -} +} // namespace BFGSOpt diff --git a/Code/Numerics/SquareMatrix.h b/Code/Numerics/SquareMatrix.h index 36a8089ce..fd5f9d611 100644 --- a/Code/Numerics/SquareMatrix.h +++ b/Code/Numerics/SquareMatrix.h @@ -84,6 +84,6 @@ class SquareMatrix : public Matrix { } }; typedef SquareMatrix DoubleSquareMatrix; -} +} // namespace RDNumeric #endif diff --git a/Code/Numerics/SymmMatrix.h b/Code/Numerics/SymmMatrix.h index 2b19c5620..7287d4289 100644 --- a/Code/Numerics/SymmMatrix.h +++ b/Code/Numerics/SymmMatrix.h @@ -339,7 +339,7 @@ Vector &multiply(const SymmMatrix &A, const Vector &x, typedef SymmMatrix DoubleSymmMatrix; typedef SymmMatrix IntSymmMatrix; typedef SymmMatrix UintSymmMatrix; -} +} // namespace RDNumeric //! ostream operator for Matrix's template diff --git a/Code/PgSQL/rdkit/bitstring.h b/Code/PgSQL/rdkit/bitstring.h index 66ffbe226..42b57c502 100644 --- a/Code/PgSQL/rdkit/bitstring.h +++ b/Code/PgSQL/rdkit/bitstring.h @@ -1,16 +1,16 @@ // // Copyright (c) 2016, Riccardo Vianello // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are -// met: +// met: // -// * Redistributions of source code must retain the above copyright +// * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of the authors nor the names of their contributors // may be used to endorse or promote products derived from this software @@ -37,27 +37,26 @@ extern "C" { #endif - void bitstringUnion(int length, uint8 *bstr1, uint8 *bstr2); - void bitstringIntersection(int length, uint8 *bstr1, uint8 *bstr2); +void bitstringUnion(int length, uint8 *bstr1, uint8 *bstr2); +void bitstringIntersection(int length, uint8 *bstr1, uint8 *bstr2); - int bitstringWeight(int length, uint8 *bstr); - int bitstringIntersectionWeight(int length, uint8 *bstr1, uint8 *bstr2); - int bitstringDifferenceWeight(int length, uint8 *bstr1, uint8 *bstr2); - - int bitstringHemDistance(int length, uint8 *bstr1, uint8 *bstr2); - double bitstringTanimotoSimilarity(int length, uint8 *bstr1, uint8 *bstr2); - double bitstringTanimotoDistance(int length, uint8 *bstr1, uint8 *bstr2); +int bitstringWeight(int length, uint8 *bstr); +int bitstringIntersectionWeight(int length, uint8 *bstr1, uint8 *bstr2); +int bitstringDifferenceWeight(int length, uint8 *bstr1, uint8 *bstr2); - bool bitstringContains(int length, uint8 *bstr1, uint8 *bstr2); - bool bitstringIntersects(int length, uint8 *bstr1, uint8 *bstr2); - bool bitstringAllTrue(int length, uint8 *bstr); +int bitstringHemDistance(int length, uint8 *bstr1, uint8 *bstr2); +double bitstringTanimotoSimilarity(int length, uint8 *bstr1, uint8 *bstr2); +double bitstringTanimotoDistance(int length, uint8 *bstr1, uint8 *bstr2); + +bool bitstringContains(int length, uint8 *bstr1, uint8 *bstr2); +bool bitstringIntersects(int length, uint8 *bstr1, uint8 *bstr2); +bool bitstringAllTrue(int length, uint8 *bstr); + +void bitstringSimpleSubset(int length, uint8 *bstr, int sub_weight, + uint8 *sub_bstr); +void bitstringRandomSubset(int length, int weight, uint8 *bstr, int sub_weight, + uint8 *sub_bstr); - void bitstringSimpleSubset(int length, - uint8 *bstr, int sub_weight, uint8 *sub_bstr); - void bitstringRandomSubset(int length, - int weight, uint8 *bstr, - int sub_weight, uint8 *sub_bstr); - #ifdef __cplusplus } /* extern "C" { */ #endif diff --git a/Code/PgSQL/rdkit/cache.h b/Code/PgSQL/rdkit/cache.h index 98a198e6d..c6c65929d 100644 --- a/Code/PgSQL/rdkit/cache.h +++ b/Code/PgSQL/rdkit/cache.h @@ -38,25 +38,23 @@ extern "C" { #endif - /* * Cache subsystem. Molecules and fingerprints I/O is extremely expensive. */ struct MemoryContextData; /* forward declaration to prevent conflicts with C++ - */ - + */ + void *searchMolCache(void *cache, struct MemoryContextData *ctx, Datum a, Mol **m, CROMol *mol, bytea **sign); - -void *searchBfpCache(void *cache, struct MemoryContextData *ctx, Datum a, - Bfp **f, CBfp *fp, BfpSignature **sign); - -void *searchSfpCache(void *cache, struct MemoryContextData *ctx, Datum a, - Sfp **f, CSfp *fp, bytea **sign); -void *searchReactionCache(void *cache, struct MemoryContextData *ctx, - Datum a, Reaction **r, - CChemicalReaction *rxn, bytea **sign); +void *searchBfpCache(void *cache, struct MemoryContextData *ctx, Datum a, + Bfp **f, CBfp *fp, BfpSignature **sign); + +void *searchSfpCache(void *cache, struct MemoryContextData *ctx, Datum a, + Sfp **f, CSfp *fp, bytea **sign); + +void *searchReactionCache(void *cache, struct MemoryContextData *ctx, Datum a, + Reaction **r, CChemicalReaction *rxn, bytea **sign); #ifdef __cplusplus } diff --git a/Code/Query/AndQuery.h b/Code/Query/AndQuery.h index 4053e286c..dd8c04297 100644 --- a/Code/Query/AndQuery.h +++ b/Code/Query/AndQuery.h @@ -49,5 +49,5 @@ class AndQuery return res; }; }; -} +} // namespace Queries #endif diff --git a/Code/Query/EqualityQuery.h b/Code/Query/EqualityQuery.h index 886d5faed..a91b34692 100644 --- a/Code/Query/EqualityQuery.h +++ b/Code/Query/EqualityQuery.h @@ -23,9 +23,7 @@ template { public: - EqualityQuery() { - this->df_negate = false; - }; + EqualityQuery() { this->df_negate = false; }; //! constructs with our target value explicit EqualityQuery(MatchFuncArgType v) { diff --git a/Code/Query/GreaterEqualQuery.h b/Code/Query/GreaterEqualQuery.h index c8ffe88b7..4088606d6 100644 --- a/Code/Query/GreaterEqualQuery.h +++ b/Code/Query/GreaterEqualQuery.h @@ -73,5 +73,5 @@ class GreaterEqualQuery return res.str(); }; }; -} +} // namespace Queries #endif diff --git a/Code/Query/GreaterQuery.h b/Code/Query/GreaterQuery.h index e48f192b7..d1611b185 100644 --- a/Code/Query/GreaterQuery.h +++ b/Code/Query/GreaterQuery.h @@ -73,5 +73,5 @@ class GreaterQuery return res.str(); }; }; -} +} // namespace Queries #endif diff --git a/Code/Query/LessEqualQuery.h b/Code/Query/LessEqualQuery.h index 3d24dbc26..ef818f322 100644 --- a/Code/Query/LessEqualQuery.h +++ b/Code/Query/LessEqualQuery.h @@ -74,5 +74,5 @@ class LessEqualQuery return res.str(); }; }; -} +} // namespace Queries #endif diff --git a/Code/Query/LessQuery.h b/Code/Query/LessQuery.h index 5ea1d6ebe..0e5a8d953 100644 --- a/Code/Query/LessQuery.h +++ b/Code/Query/LessQuery.h @@ -73,5 +73,5 @@ class LessQuery return res.str(); }; }; -} +} // namespace Queries #endif diff --git a/Code/Query/OrQuery.h b/Code/Query/OrQuery.h index 82e573a4a..109480499 100644 --- a/Code/Query/OrQuery.h +++ b/Code/Query/OrQuery.h @@ -50,5 +50,5 @@ class OrQuery return res; }; }; -} +} // namespace Queries #endif diff --git a/Code/Query/RangeQuery.h b/Code/Query/RangeQuery.h index e8ad6e201..4b0e5234b 100644 --- a/Code/Query/RangeQuery.h +++ b/Code/Query/RangeQuery.h @@ -117,5 +117,5 @@ class RangeQuery MatchFuncArgType d_tol; bool df_upperOpen, df_lowerOpen; }; -} +} // namespace Queries #endif diff --git a/Code/Query/SetQuery.h b/Code/Query/SetQuery.h index dd1bf3e0d..8424a800d 100644 --- a/Code/Query/SetQuery.h +++ b/Code/Query/SetQuery.h @@ -80,5 +80,5 @@ class SetQuery protected: CONTAINER_TYPE d_set; }; -} +} // namespace Queries #endif diff --git a/Code/Query/XOrQuery.h b/Code/Query/XOrQuery.h index 6417ba91e..79c1a9be5 100644 --- a/Code/Query/XOrQuery.h +++ b/Code/Query/XOrQuery.h @@ -55,5 +55,5 @@ class XOrQuery return res; }; }; -} +} // namespace Queries #endif diff --git a/Code/RDGeneral/BadFileException.h b/Code/RDGeneral/BadFileException.h index 7516e72ec..240e0cc32 100644 --- a/Code/RDGeneral/BadFileException.h +++ b/Code/RDGeneral/BadFileException.h @@ -33,6 +33,6 @@ class BadFileException : public std::runtime_error { private: std::string _msg; }; -} +} // namespace RDKit #endif diff --git a/Code/RDGeneral/BoostStartInclude.h b/Code/RDGeneral/BoostStartInclude.h index dea535ca8..30d342416 100644 --- a/Code/RDGeneral/BoostStartInclude.h +++ b/Code/RDGeneral/BoostStartInclude.h @@ -46,9 +46,9 @@ #pragma GCC diagnostic ignored "-Wreorder" #pragma GCC diagnostic ignored "-Wunused" #if defined(__apple_build_version__) -# if __apple_build_version__ >= 7000072 -# pragma GCC diagnostic ignored "-Wunused-local-typedef" -# endif +#if __apple_build_version__ >= 7000072 +#pragma GCC diagnostic ignored "-Wunused-local-typedef" +#endif #endif #elif defined(__ICC) || defined(__INTEL_COMPILER) /* Intel ICC/ICPC. ------------------------------------------ */ @@ -75,7 +75,7 @@ #elif defined(_MSC_VER) /* Microsoft Visual Studio. --------------------------------- */ #pragma warning(push) -#pragma warning(disable:4996 4267) +#pragma warning(disable : 4996 4267) #elif defined(__PGI) /* Portland Group PGCC/PGCPP. ------------------------------- */ diff --git a/Code/RDGeneral/Dict.h b/Code/RDGeneral/Dict.h index 1205755f7..36b506495 100644 --- a/Code/RDGeneral/Dict.h +++ b/Code/RDGeneral/Dict.h @@ -331,7 +331,8 @@ class RDKIT_RDGENERAL_EXPORT Dict { }; template <> -RDKIT_RDGENERAL_EXPORT std::string Dict::getVal(const std::string &what) const; +RDKIT_RDGENERAL_EXPORT std::string Dict::getVal( + const std::string &what) const; } // namespace RDKit #endif diff --git a/Code/RDGeneral/FileParseException.h b/Code/RDGeneral/FileParseException.h index 969e54b64..13c187c85 100644 --- a/Code/RDGeneral/FileParseException.h +++ b/Code/RDGeneral/FileParseException.h @@ -31,6 +31,6 @@ class FileParseException : public std::runtime_error { private: std::string _msg; }; -} +} // namespace RDKit #endif diff --git a/Code/RDGeneral/Invariant.h b/Code/RDGeneral/Invariant.h index b93147528..9c1dfc7d6 100644 --- a/Code/RDGeneral/Invariant.h +++ b/Code/RDGeneral/Invariant.h @@ -77,7 +77,7 @@ class RDKIT_RDGENERAL_EXPORT Invariant : public std::runtime_error { int getLine() const { return line_d; } std::string toString() const; - std::string toUserString() const; // strips build info, adds version + std::string toUserString() const; // strips build info, adds version private: std::string mess_d, expr_d, prefix_d; @@ -86,7 +86,8 @@ class RDKIT_RDGENERAL_EXPORT Invariant : public std::runtime_error { int line_d; }; -RDKIT_RDGENERAL_EXPORT std::ostream& operator<<(std::ostream& s, const Invariant& inv); +RDKIT_RDGENERAL_EXPORT std::ostream& operator<<(std::ostream& s, + const Invariant& inv); } // end of namespace Invar #define ASSERT_INVARIANT(expr, mess) assert(expr) @@ -192,6 +193,6 @@ RDKIT_RDGENERAL_EXPORT std::ostream& operator<<(std::ostream& s, const Invariant // Silence warnings for unused params while // still indicating that they are unused -#define RDUNUSED_PARAM(x) (void) x; +#define RDUNUSED_PARAM(x) (void)x; #endif diff --git a/Code/RDGeneral/LocaleSwitcher.h b/Code/RDGeneral/LocaleSwitcher.h index e4d934abc..3203d5b04 100644 --- a/Code/RDGeneral/LocaleSwitcher.h +++ b/Code/RDGeneral/LocaleSwitcher.h @@ -38,16 +38,17 @@ namespace Utils { // instead of whatever we started in. namespace detail { -class LocaleSwitcherImpl; // concrete OS dependent implementation +class LocaleSwitcherImpl; // concrete OS dependent implementation } class RDKIT_RDGENERAL_EXPORT LocaleSwitcher { detail::LocaleSwitcherImpl *impl; -public: + + public: LocaleSwitcher(); ~LocaleSwitcher(); }; -} -} +} // namespace Utils +} // namespace RDKit #endif diff --git a/Code/RDGeneral/RDAny.h b/Code/RDGeneral/RDAny.h index 5836bf95d..589a081c2 100644 --- a/Code/RDGeneral/RDAny.h +++ b/Code/RDGeneral/RDAny.h @@ -72,7 +72,8 @@ struct RDAny { RDValue m_value; RDAny() : m_value() {} - template RDAny(const T &d) : m_value(d) {} + template + RDAny(const T &d) : m_value(d) {} /* explicit RDAny(bool v) : m_value(v) {} template @@ -80,9 +81,7 @@ struct RDAny { template explicit RDAny(const boost::shared_ptr &v) : m_value(v) {} */ - RDAny(const RDAny &rhs) { - copy_rdvalue(m_value, rhs.m_value); - } + RDAny(const RDAny &rhs) { copy_rdvalue(m_value, rhs.m_value); } ~RDAny() { RDValue::cleanup_rdvalue(m_value); } @@ -158,25 +157,23 @@ struct RDAny { RDAny &operator=(const boost::any &d) { RDValue::cleanup_rdvalue(m_value); - m_value = RDValue(d);//new boost::any(d); + m_value = RDValue(d); // new boost::any(d); return *this; } - template + template RDAny &operator=(const T &d) { RDValue::cleanup_rdvalue(m_value); boost::any *v = new boost::any(d); m_value = RDValue(v); return *this; } - }; //////////////////////////////////////////////////////////////// // rdany_cast //////////////////////////////////////////////////////////////// - // Const Access template const T rdany_cast(const RDAny &d) { @@ -216,5 +213,5 @@ typename boost::disable_if, T>::type from_rdany( return rdany_cast(arg); } -} +} // namespace RDKit #endif diff --git a/Code/RDGeneral/RDLog.h b/Code/RDGeneral/RDLog.h index 0cc4ad124..0bbdaf51c 100644 --- a/Code/RDGeneral/RDLog.h +++ b/Code/RDGeneral/RDLog.h @@ -80,8 +80,8 @@ RDKIT_RDGENERAL_EXPORT void enable_logs(const char *arg); RDKIT_RDGENERAL_EXPORT void enable_logs(const std::string &arg); RDKIT_RDGENERAL_EXPORT void disable_logs(const char *arg); RDKIT_RDGENERAL_EXPORT void disable_logs(const std::string &arg); -} -} +} // namespace logging +} // namespace boost namespace RDLog { RDKIT_RDGENERAL_EXPORT std::ostream &toStream(std::ostream &); } @@ -90,12 +90,18 @@ RDKIT_RDGENERAL_EXPORT std::ostream &toStream(std::ostream &); RDLog::toStream((__arg__->teestream) ? *(__arg__->teestream) \ : *(__arg__->dp_dest)) -RDKIT_RDGENERAL_EXPORT extern std::shared_ptr rdAppLog; -RDKIT_RDGENERAL_EXPORT extern std::shared_ptr rdDebugLog; -RDKIT_RDGENERAL_EXPORT extern std::shared_ptr rdInfoLog; -RDKIT_RDGENERAL_EXPORT extern std::shared_ptr rdErrorLog; -RDKIT_RDGENERAL_EXPORT extern std::shared_ptr rdWarningLog; -RDKIT_RDGENERAL_EXPORT extern std::shared_ptr rdStatusLog; +RDKIT_RDGENERAL_EXPORT extern std::shared_ptr + rdAppLog; +RDKIT_RDGENERAL_EXPORT extern std::shared_ptr + rdDebugLog; +RDKIT_RDGENERAL_EXPORT extern std::shared_ptr + rdInfoLog; +RDKIT_RDGENERAL_EXPORT extern std::shared_ptr + rdErrorLog; +RDKIT_RDGENERAL_EXPORT extern std::shared_ptr + rdWarningLog; +RDKIT_RDGENERAL_EXPORT extern std::shared_ptr + rdStatusLog; #else #define BOOST_LOG_NO_LIB diff --git a/Code/RDGeneral/RDProps.h b/Code/RDGeneral/RDProps.h index 7b35c4e04..ddc2427f4 100644 --- a/Code/RDGeneral/RDProps.h +++ b/Code/RDGeneral/RDProps.h @@ -157,5 +157,5 @@ class RDProps { dp_props.update(source.getDict(), preserveExisting); } }; -} +} // namespace RDKit #endif diff --git a/Code/RDGeneral/RDThreads.h b/Code/RDGeneral/RDThreads.h index 167028314..5f54a0755 100644 --- a/Code/RDGeneral/RDThreads.h +++ b/Code/RDGeneral/RDThreads.h @@ -29,7 +29,7 @@ inline unsigned int getNumThreadsToUse(int target) { return 1; } } -} +} // namespace RDKit #else @@ -38,7 +38,7 @@ inline unsigned int getNumThreadsToUse(int target) { RDUNUSED_PARAM(target); return 1; } -} +} // namespace RDKit #endif #endif diff --git a/Code/RDGeneral/RDValue-doublemagic.h b/Code/RDGeneral/RDValue-doublemagic.h index 0f31e237d..8d2d01a9d 100644 --- a/Code/RDGeneral/RDValue-doublemagic.h +++ b/Code/RDGeneral/RDValue-doublemagic.h @@ -54,8 +54,8 @@ namespace RDKit { - // Inspired by - // https://nikic.github.io/2012/02/02/Pointer-magic-for-efficient-dynamic-value-representations.html +// Inspired by +// https://nikic.github.io/2012/02/02/Pointer-magic-for-efficient-dynamic-value-representations.html // 16 bit storage for value types using Quiet NaN spaces in // doubles // Won't work on Solaris and some other os's as mmaping maps from @@ -112,31 +112,67 @@ static const boost::uint64_t AnyTag = 0xffff000000000007; // 111 // Retrieves the tag (and PtrMask) from the type template inline boost::uint64_t GetTag() { - return AnyTag; } - template<> inline boost::uint64_t GetTag() { return MaxDouble; } - template<> inline boost::uint64_t GetTag() { return FloatTag; } - template<> inline boost::uint64_t GetTag() { return IntTag; } - template<> inline boost::uint64_t GetTag() { return UnsignedIntTag; } - template<> inline boost::uint64_t GetTag() { return BoolTag; } - template<> inline boost::uint64_t GetTag() { return StringTag; } - template<> inline boost::uint64_t GetTag >() { return VecDoubleTag; } - template<> inline boost::uint64_t GetTag >() { return VecFloatTag; } - template<> inline boost::uint64_t GetTag >() { return VecIntTag; } - template<> inline boost::uint64_t GetTag >() { return VecUnsignedIntTag; } - template<> inline boost::uint64_t GetTag >() { return VecStringTag; } - template<> inline boost::uint64_t GetTag() { return AnyTag; } + return AnyTag; } - +template <> +inline boost::uint64_t GetTag() { + return MaxDouble; +} +template <> +inline boost::uint64_t GetTag() { + return FloatTag; +} +template <> +inline boost::uint64_t GetTag() { + return IntTag; +} +template <> +inline boost::uint64_t GetTag() { + return UnsignedIntTag; +} +template <> +inline boost::uint64_t GetTag() { + return BoolTag; +} +template <> +inline boost::uint64_t GetTag() { + return StringTag; +} +template <> +inline boost::uint64_t GetTag>() { + return VecDoubleTag; +} +template <> +inline boost::uint64_t GetTag>() { + return VecFloatTag; +} +template <> +inline boost::uint64_t GetTag>() { + return VecIntTag; +} +template <> +inline boost::uint64_t GetTag>() { + return VecUnsignedIntTag; +} +template <> +inline boost::uint64_t GetTag>() { + return VecStringTag; +} +template <> +inline boost::uint64_t GetTag() { + return AnyTag; +} +} // namespace RDTypeTag struct RDValue { // Bit Twidling for conversion from the Tag to a Pointer - static const boost::uint64_t TagMask = 0xFFFF000000000000; - static const boost::uint64_t PointerTagMask = 0xFFFF000000000007; - static const boost::uint64_t ApplyMask = 0x0000FFFFFFFFFFFF; - static const boost::uint64_t ApplyPtrMask = 0x0000FFFFFFFFFFF8; + static const boost::uint64_t TagMask = 0xFFFF000000000000; + static const boost::uint64_t PointerTagMask = 0xFFFF000000000007; + static const boost::uint64_t ApplyMask = 0x0000FFFFFFFFFFFF; + static const boost::uint64_t ApplyPtrMask = 0x0000FFFFFFFFFFF8; union { - double doubleBits; + double doubleBits; boost::uint64_t otherBits; }; @@ -148,83 +184,99 @@ struct RDValue { // quiet NaNs are used for other types. otherBits = RDTypeTag::NaN; assert(boost::math::isnan(doubleBits)); - } - else + } else doubleBits = number; } inline RDValue(float number) { otherBits = 0 | RDTypeTag::FloatTag; - memcpy(((char*)&otherBits), &number, sizeof(float)); + memcpy(((char *)&otherBits), &number, sizeof(float)); } inline RDValue(int32_t number) { - otherBits = (((boost::uint64_t)number) & ApplyMask ) | RDTypeTag::IntTag; + otherBits = (((boost::uint64_t)number) & ApplyMask) | RDTypeTag::IntTag; } inline RDValue(unsigned int number) { - otherBits = (((boost::uint64_t)number) & ApplyMask ) | RDTypeTag::UnsignedIntTag; + otherBits = + (((boost::uint64_t)number) & ApplyMask) | RDTypeTag::UnsignedIntTag; } inline RDValue(bool number) { - otherBits = (static_cast(number) & ApplyMask) | RDTypeTag::BoolTag; + otherBits = + (static_cast(number) & ApplyMask) | RDTypeTag::BoolTag; } inline RDValue(boost::any *pointer) { // ensure that the pointer really is only 48 bit - assert((reinterpret_cast(pointer) & RDTypeTag::AnyTag) == 0); + assert((reinterpret_cast(pointer) & RDTypeTag::AnyTag) == + 0); otherBits = reinterpret_cast(pointer) | RDTypeTag::AnyTag; } inline RDValue(const boost::any &any) { // ensure that the pointer really is only 48 bit boost::any *pointer = new boost::any(any); - assert((reinterpret_cast(pointer) & RDTypeTag::AnyTag) == 0); + assert((reinterpret_cast(pointer) & RDTypeTag::AnyTag) == + 0); otherBits = reinterpret_cast(pointer) | RDTypeTag::AnyTag; } // Unknown types are stored as boost::any template - inline RDValue(const T&v) { + inline RDValue(const T &v) { boost::any *pointer = new boost::any(v); - assert((reinterpret_cast(pointer) & RDTypeTag::AnyTag) == 0); + assert((reinterpret_cast(pointer) & RDTypeTag::AnyTag) == + 0); otherBits = reinterpret_cast(pointer) | RDTypeTag::AnyTag; } inline RDValue(const std::string &v) { std::string *pointer = new std::string(v); - assert((reinterpret_cast(pointer) & RDTypeTag::StringTag) == 0); - otherBits = reinterpret_cast(pointer) | RDTypeTag::StringTag; + assert((reinterpret_cast(pointer) & + RDTypeTag::StringTag) == 0); + otherBits = + reinterpret_cast(pointer) | RDTypeTag::StringTag; } inline RDValue(const std::vector &v) { std::vector *pointer = new std::vector(v); - assert((reinterpret_cast(pointer) & RDTypeTag::VecDoubleTag) == 0); - otherBits = reinterpret_cast(pointer) | RDTypeTag::VecDoubleTag; + assert((reinterpret_cast(pointer) & + RDTypeTag::VecDoubleTag) == 0); + otherBits = + reinterpret_cast(pointer) | RDTypeTag::VecDoubleTag; } inline RDValue(const std::vector &v) { std::vector *pointer = new std::vector(v); - assert((reinterpret_cast(pointer) & RDTypeTag::VecFloatTag) == 0); - otherBits = reinterpret_cast(pointer) | RDTypeTag::VecFloatTag; + assert((reinterpret_cast(pointer) & + RDTypeTag::VecFloatTag) == 0); + otherBits = + reinterpret_cast(pointer) | RDTypeTag::VecFloatTag; } inline RDValue(const std::vector &v) { std::vector *pointer = new std::vector(v); - assert((reinterpret_cast(pointer) & RDTypeTag::VecIntTag) == 0); - otherBits = reinterpret_cast(pointer) | RDTypeTag::VecIntTag; + assert((reinterpret_cast(pointer) & + RDTypeTag::VecIntTag) == 0); + otherBits = + reinterpret_cast(pointer) | RDTypeTag::VecIntTag; } inline RDValue(const std::vector &v) { std::vector *pointer = new std::vector(v); - assert((reinterpret_cast(pointer) & RDTypeTag::VecIntTag) == 0); - otherBits = reinterpret_cast(pointer) | RDTypeTag::VecUnsignedIntTag; + assert((reinterpret_cast(pointer) & + RDTypeTag::VecIntTag) == 0); + otherBits = reinterpret_cast(pointer) | + RDTypeTag::VecUnsignedIntTag; } inline RDValue(const std::vector &v) { std::vector *pointer = new std::vector(v); - assert((reinterpret_cast(pointer) & RDTypeTag::VecStringTag) == 0); - otherBits = reinterpret_cast(pointer) | RDTypeTag::VecStringTag; + assert((reinterpret_cast(pointer) & + RDTypeTag::VecStringTag) == 0); + otherBits = + reinterpret_cast(pointer) | RDTypeTag::VecStringTag; } boost::uint64_t getTag() const { @@ -234,15 +286,14 @@ struct RDValue { } boost::uint64_t tag = otherBits & TagMask; - if (tag == RDTypeTag::PtrTag) - return otherBits & PointerTagMask; + if (tag == RDTypeTag::PtrTag) return otherBits & PointerTagMask; return tag; } // ptrCast - unsafe, use rdvalue_cast instead. - template - inline T* ptrCast() const { - return reinterpret_cast(otherBits & ~RDTypeTag::GetTag()); + template + inline T *ptrCast() const { + return reinterpret_cast(otherBits & ~RDTypeTag::GetTag()); } // RDValue doesn't have an explicit destructor, it must @@ -250,24 +301,24 @@ struct RDValue { // The idea is that POD types don't need to be destroyed // and this allows the container optimization possibilities. inline void destroy() { - switch(getTag()) { + switch (getTag()) { case RDTypeTag::StringTag: delete ptrCast(); break; case RDTypeTag::VecDoubleTag: - delete ptrCast >(); + delete ptrCast>(); break; case RDTypeTag::VecFloatTag: - delete ptrCast >(); + delete ptrCast>(); break; case RDTypeTag::VecIntTag: - delete ptrCast >(); + delete ptrCast>(); break; case RDTypeTag::VecUnsignedIntTag: - delete ptrCast >(); + delete ptrCast>(); break; case RDTypeTag::VecStringTag: - delete ptrCast >(); + delete ptrCast>(); break; case RDTypeTag::AnyTag: delete ptrCast(); @@ -277,9 +328,7 @@ struct RDValue { } } - static - inline void cleanup_rdvalue(RDValue v) { v.destroy(); } - + static inline void cleanup_rdvalue(RDValue v) { v.destroy(); } }; ///////////////////////////////////////////////////////////////////////////////////// @@ -287,27 +336,26 @@ struct RDValue { // RDValue doesn't have a copy constructor, the default // copy act's like a move for better value semantics. // Containers may need to copy though. -inline void copy_rdvalue(RDValue &dest, - const RDValue &src) { +inline void copy_rdvalue(RDValue &dest, const RDValue &src) { dest.destroy(); - switch(src.getTag()) { + switch (src.getTag()) { case RDTypeTag::StringTag: dest = RDValue(*src.ptrCast()); break; case RDTypeTag::VecDoubleTag: - dest = RDValue(*src.ptrCast >()); + dest = RDValue(*src.ptrCast>()); break; case RDTypeTag::VecFloatTag: - dest = RDValue(*src.ptrCast >()); + dest = RDValue(*src.ptrCast>()); break; case RDTypeTag::VecIntTag: - dest = RDValue(*src.ptrCast >()); + dest = RDValue(*src.ptrCast>()); break; case RDTypeTag::VecUnsignedIntTag: - dest = RDValue(*src.ptrCast >()); + dest = RDValue(*src.ptrCast>()); break; case RDTypeTag::VecStringTag: - dest = RDValue(*src.ptrCast >()); + dest = RDValue(*src.ptrCast>()); break; case RDTypeTag::AnyTag: dest = RDValue(*src.ptrCast()); @@ -320,28 +368,27 @@ inline void copy_rdvalue(RDValue &dest, ///////////////////////////////////////////////////////////////////////////////////// // rdvalue_is -template +template inline bool rdvalue_is(const RDValue_cast_t) { - const short tag = RDTypeTag::GetTag< - typename boost::remove_reference::type>(); - if (v.getTag() == tag) - return true; + const short tag = + RDTypeTag::GetTag::type>(); + if (v.getTag() == tag) return true; // If we are an Any tag, check the any type info - if(v.getTag() == RDTypeTag::AnyTag) { + if (v.getTag() == RDTypeTag::AnyTag) { return v.value.a->type() == typeid(T); } return false; } -template<> +template <> inline bool rdvalue_is(const RDValue_cast_t) { return v.otherBits < RDTypeTag::MaxDouble || - (v.otherBits & RDTypeTag::NaN) == RDTypeTag::NaN; + (v.otherBits & RDTypeTag::NaN) == RDTypeTag::NaN; } -template<> +template <> inline bool rdvalue_is(const RDValue_cast_t) { return rdvalue_is(v); } @@ -367,19 +414,20 @@ inline bool rdvalue_is(const RDValue_cast_t) { // rdvalue_cast &>(RDValue); // ok // rdvalue_cast(RDValue); // bad_any_cast - typedef RDValue RDValue_cast_t; +typedef RDValue RDValue_cast_t; // Get stuff stored in boost any -template +template inline T rdvalue_cast(RDValue_cast_t v) { // Disable reference and pointer casts to POD data. - BOOST_STATIC_ASSERT( !( - (boost::is_pointer::value && ( - boost::is_integral::type>::value || - boost::is_floating_point::type>::value)) || - (boost::is_reference::value && ( - boost::is_integral::type>::value || - boost::is_floating_point::type>::value)) - )); + BOOST_STATIC_ASSERT(!( + (boost::is_pointer::value && + (boost::is_integral::type>::value || + boost::is_floating_point< + typename boost::remove_pointer::type>::value)) || + (boost::is_reference::value && + (boost::is_integral::type>::value || + boost::is_floating_point< + typename boost::remove_reference::type>::value)))); if (rdvalue_is(v)) { return boost::any_cast(*v.ptrCast()); @@ -388,17 +436,17 @@ inline T rdvalue_cast(RDValue_cast_t v) { } // POD casts -template<> +template <> inline double rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) return v.doubleBits; throw boost::bad_any_cast(); } -template<> +template <> inline float rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) { float f; - memcpy(&f, ((char*)&v.otherBits), sizeof(float)); + memcpy(&f, ((char *)&v.otherBits), sizeof(float)); return f; } throw boost::bad_any_cast(); @@ -406,25 +454,25 @@ inline float rdvalue_cast(RDValue_cast_t v) { // n.b. with const expressions, could use ~RDTagTypes::GetTag() // and enable_if -template<> +template <> inline int rdvalue_cast(RDValue_cast_t v) { - if (rdvalue_is(v)) return static_cast(v.otherBits & - ~RDTypeTag::IntTag); + if (rdvalue_is(v)) + return static_cast(v.otherBits & ~RDTypeTag::IntTag); throw boost::bad_any_cast(); } -template<> +template <> inline unsigned int rdvalue_cast(RDValue_cast_t v) { - if (rdvalue_is(v)) return static_cast( - v.otherBits & ~RDTypeTag::UnsignedIntTag); + if (rdvalue_is(v)) + return static_cast(v.otherBits & ~RDTypeTag::UnsignedIntTag); throw boost::bad_any_cast(); } -template<> +template <> inline bool rdvalue_cast(RDValue_cast_t v) { - if (rdvalue_is(v)) return static_cast( - v.otherBits & ~RDTypeTag::BoolTag); + if (rdvalue_is(v)) + return static_cast(v.otherBits & ~RDTypeTag::BoolTag); throw boost::bad_any_cast(); } -} // namespace rdkit +} // namespace RDKit #endif diff --git a/Code/RDGeneral/RDValue-taggedunion.h b/Code/RDGeneral/RDValue-taggedunion.h index fb9d5f6f6..351b1f2e0 100644 --- a/Code/RDGeneral/RDValue-taggedunion.h +++ b/Code/RDGeneral/RDValue-taggedunion.h @@ -122,23 +122,23 @@ inline short GetTag() { return StringTag; } template <> -inline short GetTag >() { +inline short GetTag>() { return VecDoubleTag; } template <> -inline short GetTag >() { +inline short GetTag>() { return VecFloatTag; } template <> -inline short GetTag >() { +inline short GetTag>() { return VecIntTag; } template <> -inline short GetTag >() { +inline short GetTag>() { return VecUnsignedIntTag; } template <> -inline short GetTag >() { +inline short GetTag>() { return VecStringTag; } template <> @@ -190,29 +190,29 @@ inline std::string *valuePtrCast(Value value) { return value.s; } template <> -inline std::vector *valuePtrCast >(Value value) { +inline std::vector *valuePtrCast>(Value value) { return value.vd; } template <> -inline std::vector *valuePtrCast >(Value value) { +inline std::vector *valuePtrCast>(Value value) { return value.vf; } template <> -inline std::vector *valuePtrCast >(Value value) { +inline std::vector *valuePtrCast>(Value value) { return value.vi; } template <> -inline std::vector *valuePtrCast >( +inline std::vector *valuePtrCast>( Value value) { return value.vu; } template <> -inline std::vector *valuePtrCast >( +inline std::vector *valuePtrCast>( Value value) { return value.vs; } -} -} +} // namespace detail +} // namespace RDTypeTag struct RDValue { RDTypeTag::detail::Value value; @@ -342,19 +342,17 @@ typedef const RDValue &RDValue_cast_t; typedef RDValue RDValue_cast_t; #endif - ///////////////////////////////////////////////////////////////////////////////////// // rdvalue_is template inline bool rdvalue_is(RDValue_cast_t v) { - const short tag = RDTypeTag::GetTag< - typename boost::remove_reference::type>(); - if (v.getTag() == tag) - return true; + const short tag = + RDTypeTag::GetTag::type>(); + if (v.getTag() == tag) return true; // If we are an Any tag, check the any type info - if(v.getTag() == RDTypeTag::AnyTag) { + if (v.getTag() == RDTypeTag::AnyTag) { return v.value.a->type() == typeid(T); } @@ -418,5 +416,5 @@ inline bool rdvalue_cast(RDValue_cast_t v) { throw boost::bad_any_cast(); } -} // namespace rdkit +} // namespace RDKit #endif diff --git a/Code/RDGeneral/RDValue.h b/Code/RDGeneral/RDValue.h index f65f6d859..c83dc1d68 100644 --- a/Code/RDGeneral/RDValue.h +++ b/Code/RDGeneral/RDValue.h @@ -42,91 +42,95 @@ namespace RDKit { // Common Casts (POD Casts are implementation dependent) // string casts -template<> +template <> inline std::string rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) return *v.ptrCast(); throw boost::bad_any_cast(); } -template<> -inline std::string & rdvalue_cast(RDValue_cast_t v) { +template <> +inline std::string &rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) return *v.ptrCast(); throw boost::bad_any_cast(); } // Special Vecor Casts -template<> -inline std::vector rdvalue_cast >(RDValue_cast_t v) { - if(rdvalue_is >(v)) - return *v.ptrCast >(); +template <> +inline std::vector rdvalue_cast>(RDValue_cast_t v) { + if (rdvalue_is>(v)) + return *v.ptrCast>(); throw boost::bad_any_cast(); } -template<> -inline std::vector &rdvalue_cast &>(RDValue_cast_t v) { - if(rdvalue_is >(v)) - return *v.ptrCast >(); +template <> +inline std::vector &rdvalue_cast &>( + RDValue_cast_t v) { + if (rdvalue_is>(v)) + return *v.ptrCast>(); throw boost::bad_any_cast(); } -template<> -inline std::vector rdvalue_cast >(RDValue_cast_t v) { - if(rdvalue_is >(v)) - return *v.ptrCast >(); +template <> +inline std::vector rdvalue_cast>(RDValue_cast_t v) { + if (rdvalue_is>(v)) + return *v.ptrCast>(); throw boost::bad_any_cast(); } -template<> -inline std::vector &rdvalue_cast &>(RDValue_cast_t v) { - if(rdvalue_is >(v)) - return *v.ptrCast >(); +template <> +inline std::vector &rdvalue_cast &>( + RDValue_cast_t v) { + if (rdvalue_is>(v)) + return *v.ptrCast>(); throw boost::bad_any_cast(); } -template<> -inline std::vector rdvalue_cast >(RDValue_cast_t v) { - if(rdvalue_is >(v)) - return *v.ptrCast >(); +template <> +inline std::vector rdvalue_cast>( + RDValue_cast_t v) { + if (rdvalue_is>(v)) + return *v.ptrCast>(); throw boost::bad_any_cast(); } -template<> -inline std::vector &rdvalue_cast &>(RDValue_cast_t v) { - if(rdvalue_is >(v)) - return *v.ptrCast >(); +template <> +inline std::vector &rdvalue_cast &>( + RDValue_cast_t v) { + if (rdvalue_is>(v)) + return *v.ptrCast>(); throw boost::bad_any_cast(); } -template<> -inline std::vector rdvalue_cast >(RDValue_cast_t v) { - if(rdvalue_is >(v)) - return *v.ptrCast >(); +template <> +inline std::vector rdvalue_cast>(RDValue_cast_t v) { + if (rdvalue_is>(v)) return *v.ptrCast>(); throw boost::bad_any_cast(); } -template<> +template <> inline std::vector &rdvalue_cast &>(RDValue_cast_t v) { - if(rdvalue_is >(v)) - return *v.ptrCast >(); + if (rdvalue_is>(v)) return *v.ptrCast>(); throw boost::bad_any_cast(); } -template<> -inline std::vector rdvalue_cast >(RDValue_cast_t v) { - if(rdvalue_is >(v)) - return *v.ptrCast >(); +template <> +inline std::vector rdvalue_cast>( + RDValue_cast_t v) { + if (rdvalue_is>(v)) + return *v.ptrCast>(); throw boost::bad_any_cast(); } -template<> -inline std::vector &rdvalue_cast &>(RDValue_cast_t v) { - if(rdvalue_is >(v)) - return *v.ptrCast >(); +template <> +inline std::vector &rdvalue_cast &>( + RDValue_cast_t v) { + if (rdvalue_is>(v)) + return *v.ptrCast>(); throw boost::bad_any_cast(); } // Get boost any -template<> +template <> inline boost::any rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) { return *v.ptrCast(); @@ -134,16 +138,16 @@ inline boost::any rdvalue_cast(RDValue_cast_t v) { throw boost::bad_any_cast(); } -template<> -inline boost::any &rdvalue_cast(RDValue_cast_t v) { +template <> +inline boost::any &rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) { return *v.ptrCast(); } throw boost::bad_any_cast(); } -template<> -inline const boost::any &rdvalue_cast(RDValue_cast_t v) { +template <> +inline const boost::any &rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) { return *v.ptrCast(); } @@ -153,8 +157,8 @@ inline const boost::any &rdvalue_cast(RDValue_cast_t v) { ///////////////////////////////////////////////////////////////////////////////////// // lexical casts... template - std::string vectToString(RDValue val) { - const std::vector &tv = rdvalue_cast&>(val); +std::string vectToString(RDValue val) { + const std::vector &tv = rdvalue_cast &>(val); std::ostringstream sstr; sstr.imbue(std::locale("C")); sstr << std::setprecision(17); @@ -165,7 +169,7 @@ template } inline bool rdvalue_tostring(RDValue_cast_t val, std::string &res) { - Utils::LocaleSwitcher ls; // for lexical cast... + Utils::LocaleSwitcher ls; // for lexical cast... switch (val.getTag()) { case RDTypeTag::StringTag: res = rdvalue_cast(val); @@ -179,7 +183,7 @@ inline bool rdvalue_tostring(RDValue_cast_t val, std::string &res) { case RDTypeTag::UnsignedIntTag: res = boost::lexical_cast(rdvalue_cast(val)); break; -#ifdef RDVALUE_HASBOOL +#ifdef RDVALUE_HASBOOL case RDTypeTag::BoolTag: res = boost::lexical_cast(rdvalue_cast(val)); break; @@ -204,15 +208,15 @@ inline bool rdvalue_tostring(RDValue_cast_t val, std::string &res) { break; case RDTypeTag::AnyTag: try { - res = boost::any_cast(rdvalue_cast(val)); + res = boost::any_cast(rdvalue_cast(val)); } catch (const boost::bad_any_cast &) { - if (rdvalue_cast(val).type() == typeid(long)) { - res = boost::lexical_cast(boost::any_cast( - rdvalue_cast(val))); - } else if (rdvalue_cast(val).type() == typeid(unsigned long)) { - res = - boost::lexical_cast( - boost::any_cast(rdvalue_cast(val))); + if (rdvalue_cast(val).type() == typeid(long)) { + res = boost::lexical_cast( + boost::any_cast(rdvalue_cast(val))); + } else if (rdvalue_cast(val).type() == + typeid(unsigned long)) { + res = boost::lexical_cast( + boost::any_cast(rdvalue_cast(val))); } else { throw; return false; @@ -252,7 +256,5 @@ typename boost::disable_if, T>::type from_rdvalue( RDValue_cast_t arg) { return rdvalue_cast(arg); } -} +} // namespace RDKit #endif - - diff --git a/Code/RDGeneral/Ranking.h b/Code/RDGeneral/Ranking.h index 9da7d0c58..7cc5f91f4 100644 --- a/Code/RDGeneral/Ranking.h +++ b/Code/RDGeneral/Ranking.h @@ -19,14 +19,14 @@ #define RD_RANKING_H #include -#include +#include #include #include #include namespace Rankers { //! functor for implementing > on two std::pairs. The first entries are -//compared. +// compared. template struct pairGreater : public std::binary_function, std::pair, bool> { @@ -37,7 +37,7 @@ struct pairGreater }; //! function for implementing < on two std::pairs. The first entries are -//compared. +// compared. template struct pairLess : public std::binary_function, std::pair, bool> { @@ -69,7 +69,7 @@ void rankVect(const std::vector &vect, T2 &res) { std::vector indices(nEntries); for (unsigned int i = 0; i < nEntries; ++i) indices[i] = i; - std::sort(indices.begin(), indices.end(), argless >(vect)); + std::sort(indices.begin(), indices.end(), argless>(vect)); int currRank = 0; T1 lastV = vect[indices[0]]; @@ -83,5 +83,5 @@ void rankVect(const std::vector &vect, T2 &res) { } } } -} +} // namespace Rankers #endif diff --git a/Code/RDGeneral/StreamOps.h b/Code/RDGeneral/StreamOps.h index 76b166c0f..8ed746691 100644 --- a/Code/RDGeneral/StreamOps.h +++ b/Code/RDGeneral/StreamOps.h @@ -301,36 +301,38 @@ inline std::string getLine(std::istream &inStream) { // n.b. We can't use RDTypeTag directly, they are implementation // specific namespace DTags { - const unsigned char StringTag = 0; - const unsigned char IntTag = 1; - const unsigned char UnsignedIntTag = 2; - const unsigned char BoolTag = 3; - const unsigned char FloatTag = 4; - const unsigned char DoubleTag = 5; - const unsigned char VecStringTag = 6; - const unsigned char VecIntTag = 7; - const unsigned char VecUIntTag = 8; - const unsigned char VecBoolTag = 9; - const unsigned char VecFloatTag = 10; - const unsigned char VecDoubleTag = 11; +const unsigned char StringTag = 0; +const unsigned char IntTag = 1; +const unsigned char UnsignedIntTag = 2; +const unsigned char BoolTag = 3; +const unsigned char FloatTag = 4; +const unsigned char DoubleTag = 5; +const unsigned char VecStringTag = 6; +const unsigned char VecIntTag = 7; +const unsigned char VecUIntTag = 8; +const unsigned char VecBoolTag = 9; +const unsigned char VecFloatTag = 10; +const unsigned char VecDoubleTag = 11; - const unsigned char CustomTag = 0xFE; // custom data - const unsigned char EndTag = 0xFF; -} +const unsigned char CustomTag = 0xFE; // custom data +const unsigned char EndTag = 0xFF; +} // namespace DTags class CustomPropHandler { -public: - virtual ~CustomPropHandler() {}; + public: + virtual ~CustomPropHandler(){}; virtual const char *getPropName() const = 0; virtual bool canSerialize(const RDValue &value) const = 0; virtual bool read(std::istream &ss, RDValue &value) const = 0; virtual bool write(std::ostream &ss, const RDValue &value) const = 0; - virtual CustomPropHandler* clone() const=0; + virtual CustomPropHandler *clone() const = 0; }; -typedef std::vector> CustomPropHandlerVec; - -inline bool isSerializable(const Dict::Pair &pair, const CustomPropHandlerVec &handlers = {}) { +typedef std::vector> + CustomPropHandlerVec; + +inline bool isSerializable(const Dict::Pair &pair, + const CustomPropHandlerVec &handlers = {}) { switch (pair.val.getTag()) { case RDTypeTag::StringTag: case RDTypeTag::IntTag: @@ -346,8 +348,8 @@ inline bool isSerializable(const Dict::Pair &pair, const CustomPropHandlerVec &h case RDTypeTag::VecDoubleTag: return true; case RDTypeTag::AnyTag: - for(auto &handler: handlers) { - if(handler->canSerialize(pair.val)) { + for (auto &handler : handlers) { + if (handler->canSerialize(pair.val)) { return true; } } @@ -361,7 +363,7 @@ inline bool streamWriteProp(std::ostream &ss, const Dict::Pair &pair, if (!isSerializable(pair, handlers)) { return false; } - + streamWrite(ss, pair.key); switch (pair.val.getTag()) { case RDTypeTag::StringTag: @@ -410,8 +412,8 @@ inline bool streamWriteProp(std::ostream &ss, const Dict::Pair &pair, streamWriteVec(ss, rdvalue_cast>(pair.val)); break; default: - for(auto &handler: handlers) { - if(handler->canSerialize(pair.val)) { + for (auto &handler : handlers) { + if (handler->canSerialize(pair.val)) { // The form of a custom tag is // CustomTag // customPropName (must be unique) @@ -422,36 +424,35 @@ inline bool streamWriteProp(std::ostream &ss, const Dict::Pair &pair, return true; } } - + return false; } return true; } inline bool streamWriteProps(std::ostream &ss, const RDProps &props, - bool savePrivate=false, bool saveComputed=false, + bool savePrivate = false, + bool saveComputed = false, const CustomPropHandlerVec &handlers = {}) { STR_VECT propsToSave = props.getPropList(savePrivate, saveComputed); std::set propnames(propsToSave.begin(), propsToSave.end()); - + const Dict &dict = props.getDict(); unsigned int count = 0; - for(Dict::DataType::const_iterator it = dict.getData().begin(); - it != dict.getData().end(); - ++it) { - if(propnames.find(it->key) != propnames.end()) { + for (Dict::DataType::const_iterator it = dict.getData().begin(); + it != dict.getData().end(); ++it) { + if (propnames.find(it->key) != propnames.end()) { if (isSerializable(*it, handlers)) { - count ++; + count++; } } } - streamWrite(ss, count); // packed int? - + streamWrite(ss, count); // packed int? + unsigned int writtenCount = 0; - for(Dict::DataType::const_iterator it = dict.getData().begin(); - it != dict.getData().end(); - ++it) { + for (Dict::DataType::const_iterator it = dict.getData().begin(); + it != dict.getData().end(); ++it) { if (propnames.find(it->key) != propnames.end()) { if (isSerializable(*it, handlers)) { // note - not all properties are serializable, this may be @@ -462,11 +463,12 @@ inline bool streamWriteProps(std::ostream &ss, const RDProps &props, } } } - POSTCONDITION(count==writtenCount, "Estimated property count not equal to written"); + POSTCONDITION(count == writtenCount, + "Estimated property count not equal to written"); return true; } -template +template void readRDValue(std::istream &ss, RDValue &value) { T v; streamRead(ss, v); @@ -482,7 +484,7 @@ void readRDVecValue(std::istream &ss, RDValue &value) { inline void readRDValueString(std::istream &ss, RDValue &value) { std::string v; - int version=0; + int version = 0; streamRead(ss, v, version); value = v; } @@ -495,19 +497,29 @@ inline void readRDStringVecValue(std::istream &ss, RDValue &value) { } inline bool streamReadProp(std::istream &ss, Dict::Pair &pair, - bool& dictHasNonPOD, + bool &dictHasNonPOD, const CustomPropHandlerVec &handlers = {}) { - int version=0; + int version = 0; streamRead(ss, pair.key, version); unsigned char type; streamRead(ss, type); - switch(type) { - case DTags::IntTag: readRDValue(ss, pair.val); break; - case DTags::UnsignedIntTag: readRDValue(ss, pair.val); break; - case DTags::BoolTag: readRDValue(ss, pair.val); break; - case DTags::FloatTag: readRDValue(ss, pair.val); break; - case DTags::DoubleTag: readRDValue(ss, pair.val); break; + switch (type) { + case DTags::IntTag: + readRDValue(ss, pair.val); + break; + case DTags::UnsignedIntTag: + readRDValue(ss, pair.val); + break; + case DTags::BoolTag: + readRDValue(ss, pair.val); + break; + case DTags::FloatTag: + readRDValue(ss, pair.val); + break; + case DTags::DoubleTag: + readRDValue(ss, pair.val); + break; case DTags::StringTag: readRDValueString(ss, pair.val); @@ -533,20 +545,19 @@ inline bool streamReadProp(std::istream &ss, Dict::Pair &pair, readRDVecValue(ss, pair.val); dictHasNonPOD = true; break; - case DTags::CustomTag: - { - std::string propType; - int version=0; - streamRead(ss, propType, version); - for(auto &handler: handlers) { - if(propType == handler->getPropName()) { - handler->read(ss, pair.val); - dictHasNonPOD = true; - return true; - } + case DTags::CustomTag: { + std::string propType; + int version = 0; + streamRead(ss, propType, version); + for (auto &handler : handlers) { + if (propType == handler->getPropName()) { + handler->read(ss, pair.val); + dictHasNonPOD = true; + return true; } - return false; } + return false; + } default: return false; @@ -560,17 +571,17 @@ inline unsigned int streamReadProps(std::istream &ss, RDProps &props, streamRead(ss, count); Dict &dict = props.getDict(); - dict.reset(); // Clear data before repopulating + dict.reset(); // Clear data before repopulating dict.getData().resize(count); - for(unsigned index = 0; index @@ -147,7 +147,7 @@ void hanoisort(int *base, int nel, int *count, int *changed, memmove(base, temp, nel * sizeof(int)); free(temp); } -} +} // namespace RDKit #if defined(_MSC_VER) #pragma warning(pop) diff --git a/Code/RDGeneral/types.h b/Code/RDGeneral/types.h index d9d523713..dea29ac35 100644 --- a/Code/RDGeneral/types.h +++ b/Code/RDGeneral/types.h @@ -153,21 +153,22 @@ RDKIT_RDGENERAL_EXPORT extern const std::string atomLabel; // atom string from CXSMILES // MDL Style Properties (MolFileParser) -RDKIT_RDGENERAL_EXPORT extern const std::string molAtomMapNumber; // int -RDKIT_RDGENERAL_EXPORT extern const std::string molFileAlias; // string -RDKIT_RDGENERAL_EXPORT extern const std::string molFileValue; // string -RDKIT_RDGENERAL_EXPORT extern const std::string molInversionFlag; // int -RDKIT_RDGENERAL_EXPORT extern const std::string molParity; // int -RDKIT_RDGENERAL_EXPORT extern const std::string molRxnComponent; // int -RDKIT_RDGENERAL_EXPORT extern const std::string molRxnRole; // int -RDKIT_RDGENERAL_EXPORT extern const std::string molTotValence; // int -RDKIT_RDGENERAL_EXPORT extern const std::string _MolFileRLabel; // unsigned int +RDKIT_RDGENERAL_EXPORT extern const std::string molAtomMapNumber; // int +RDKIT_RDGENERAL_EXPORT extern const std::string molFileAlias; // string +RDKIT_RDGENERAL_EXPORT extern const std::string molFileValue; // string +RDKIT_RDGENERAL_EXPORT extern const std::string molInversionFlag; // int +RDKIT_RDGENERAL_EXPORT extern const std::string molParity; // int +RDKIT_RDGENERAL_EXPORT extern const std::string molRxnComponent; // int +RDKIT_RDGENERAL_EXPORT extern const std::string molRxnRole; // int +RDKIT_RDGENERAL_EXPORT extern const std::string molTotValence; // int +RDKIT_RDGENERAL_EXPORT extern const std::string _MolFileRLabel; // unsigned int RDKIT_RDGENERAL_EXPORT extern const std::string _MolFileChiralFlag; // int RDKIT_RDGENERAL_EXPORT extern const std::string _MolFileAtomQuery; // int RDKIT_RDGENERAL_EXPORT extern const std::string _MolFileBondQuery; // int RDKIT_RDGENERAL_EXPORT extern const std::string _MolFileBondEndPts; // string RDKIT_RDGENERAL_EXPORT extern const std::string _MolFileBondAttach; // string -RDKIT_RDGENERAL_EXPORT extern const std::string _MolFileBondType; // unsigned int +RDKIT_RDGENERAL_EXPORT extern const std::string + _MolFileBondType; // unsigned int RDKIT_RDGENERAL_EXPORT extern const std::string _MolFileBondStereo; // unsigned int RDKIT_RDGENERAL_EXPORT extern const std::string diff --git a/Code/RDGeneral/utils.h b/Code/RDGeneral/utils.h index 22a75773c..1e72ca819 100644 --- a/Code/RDGeneral/utils.h +++ b/Code/RDGeneral/utils.h @@ -42,7 +42,7 @@ typedef boost::variate_generator int_source_type; typedef boost::variate_generator double_source_type; //! Optionally seed and return a reference to the global (Boost) random -//generator +// generator RDKIT_RDGENERAL_EXPORT rng_type &getRandomGenerator(int seed = -1); //! Return a random double value between 0.0 and 1.0 @@ -80,7 +80,7 @@ unsigned int countSwapsToInterconvert(const T &ref, T probe) { } return nSwaps; } -} +} // namespace RDKit // contribution from dkoes template diff --git a/Code/RDStreams/streams.h b/Code/RDStreams/streams.h index 3a3c6795f..e07e3bb02 100644 --- a/Code/RDStreams/streams.h +++ b/Code/RDStreams/streams.h @@ -4,13 +4,13 @@ #include #include -namespace RDKit -{ +namespace RDKit { // gzstream from a file -class RDKIT_RDSTREAMS_EXPORT gzstream : public boost::iostreams::filtering_istream -{ +class RDKIT_RDSTREAMS_EXPORT gzstream + : public boost::iostreams::filtering_istream { std::ifstream is; -public: + + public: gzstream(const std::string &fname); }; -} +} // namespace RDKit diff --git a/Code/SimDivPickers/DistPicker.h b/Code/SimDivPickers/DistPicker.h index cb8e5b764..43491e2f5 100644 --- a/Code/SimDivPickers/DistPicker.h +++ b/Code/SimDivPickers/DistPicker.h @@ -28,7 +28,9 @@ namespace RDPickers { * if (i > j) : distMat[i*(i-1)/2 + j] * if (j < i) : distMat[j*(j-1)/2 + i] */ -RDKIT_SIMDIVPICKERS_EXPORT double getDistFromLTM(const double *distMat, unsigned int i, unsigned int j); +RDKIT_SIMDIVPICKERS_EXPORT double getDistFromLTM(const double *distMat, + unsigned int i, + unsigned int j); /*! \brief Abstract base class to do perform item picking (typically molecules) *using a @@ -71,6 +73,6 @@ class RDKIT_SIMDIVPICKERS_EXPORT DistPicker { virtual RDKit::INT_VECT pick(const double *distMat, unsigned int poolSize, unsigned int pickSize) const = 0; }; -}; +}; // namespace RDPickers #endif diff --git a/Code/SimDivPickers/HierarchicalClusterPicker.h b/Code/SimDivPickers/HierarchicalClusterPicker.h index 076c37336..9c0813cc8 100644 --- a/Code/SimDivPickers/HierarchicalClusterPicker.h +++ b/Code/SimDivPickers/HierarchicalClusterPicker.h @@ -104,6 +104,6 @@ class RDKIT_SIMDIVPICKERS_EXPORT HierarchicalClusterPicker : public DistPicker { private: ClusterMethod d_method; }; -}; +}; // namespace RDPickers #endif diff --git a/Code/SimDivPickers/MaxMinPicker.h b/Code/SimDivPickers/MaxMinPicker.h index f5a382aa8..0659609fb 100644 --- a/Code/SimDivPickers/MaxMinPicker.h +++ b/Code/SimDivPickers/MaxMinPicker.h @@ -67,7 +67,7 @@ class RDKIT_SIMDIVPICKERS_EXPORT MaxMinPicker : public DistPicker { * poolSize*(poolSize-1) * \param pickSize - the number items to pick from pool (<= poolSize) * \param firstPicks - (optional)the first items in the pick list - * \param seed - (optional) seed for the random number generator. + * \param seed - (optional) seed for the random number generator. * If this is <0 the generator will be seeded with a * random number. */ diff --git a/External/AvalonTools/AvalonTools.cpp b/External/AvalonTools/AvalonTools.cpp index 7281145ee..3928a2aa0 100644 --- a/External/AvalonTools/AvalonTools.cpp +++ b/External/AvalonTools/AvalonTools.cpp @@ -34,423 +34,427 @@ extern void ClearParameters(); // FILE *log_file=NULL; namespace AvalonTools { - using namespace RDKit; - namespace { - int *getCountFp(struct reaccs_molecule_t *molPtr,unsigned int bitFlags, - bool isQuery,unsigned int nBytes){ - PRECONDITION(molPtr,"bad molecule"); - int *res = TypeAlloc(nBytes*sizeof(int), int); - memset(res,0,nBytes*sizeof(int)); - SetFingerprintCountsWithFocus(molPtr, - res,static_cast(nBytes), - static_cast(bitFlags), - static_cast(isQuery), - 0, - 0); - if(!isQuery){ - SetFingerprintCountsWithFocus(molPtr,res,static_cast(nBytes), - static_cast(bitFlags), - static_cast(1), - ACCUMULATE_BITS|USE_DY_AROMATICITY, - 0); - } - return res; - } - char *getFp(struct reaccs_molecule_t *molPtr,unsigned int bitFlags, - bool isQuery,unsigned int nBytes){ - PRECONDITION(molPtr,"bad molecule"); - while(nBytes%4) ++nBytes; - char *fingerprint = TypeAlloc(nBytes, char); - SetFingerprintBits(molPtr,fingerprint,static_cast(nBytes), - static_cast(bitFlags), - static_cast(isQuery),0); - if(!isQuery){ - SetFingerprintBits(molPtr,fingerprint,static_cast(nBytes), - static_cast(bitFlags), - static_cast(0), - ACCUMULATE_BITS|USE_DY_AROMATICITY); - } - return fingerprint; - } - void reaccsToFingerprint(struct reaccs_molecule_t *molPtr,std::vector &res, - unsigned int bitFlags=32767U,bool isQuery=false,bool resetVect=true, - unsigned int nBytes=64){ - if(resetVect) res.clear(); - char *fingerprint=getFp(molPtr,bitFlags,isQuery,nBytes); - for(unsigned int i=0;i(nBytes), + static_cast(bitFlags), + static_cast(isQuery), 0, 0); + if (!isQuery) { + SetFingerprintCountsWithFocus( + molPtr, res, static_cast(nBytes), static_cast(bitFlags), + static_cast(1), ACCUMULATE_BITS | USE_DY_AROMATICITY, 0); + } + return res; +} +char *getFp(struct reaccs_molecule_t *molPtr, unsigned int bitFlags, + bool isQuery, unsigned int nBytes) { + PRECONDITION(molPtr, "bad molecule"); + while (nBytes % 4) ++nBytes; + char *fingerprint = TypeAlloc(nBytes, char); + SetFingerprintBits(molPtr, fingerprint, static_cast(nBytes), + static_cast(bitFlags), static_cast(isQuery), 0); + if (!isQuery) { + SetFingerprintBits(molPtr, fingerprint, static_cast(nBytes), + static_cast(bitFlags), static_cast(0), + ACCUMULATE_BITS | USE_DY_AROMATICITY); + } + return fingerprint; +} +void reaccsToFingerprint(struct reaccs_molecule_t *molPtr, + std::vector &res, + unsigned int bitFlags = 32767U, bool isQuery = false, + bool resetVect = true, unsigned int nBytes = 64) { + if (resetVect) res.clear(); + char *fingerprint = getFp(molPtr, bitFlags, isQuery, nBytes); + for (unsigned int i = 0; i < nBytes; i += 4) { + boost::uint32_t word; + word = fingerprint[i] | (fingerprint[i + 1] << 8) | + (fingerprint[i + 2] << 16) | (fingerprint[i + 3] << 24); + res.push_back(word); + } - MyFree(fingerprint); - }; + MyFree(fingerprint); +}; - void reaccsToCounts(struct reaccs_molecule_t *molPtr,SparseIntVect &res, - unsigned int bitFlags=32767U,bool isQuery=false, - unsigned int nBytes=64){ - PRECONDITION(molPtr,"bad molecule"); - PRECONDITION(res.getLength()>=nBytes,"res too small"); +void reaccsToCounts(struct reaccs_molecule_t *molPtr, + SparseIntVect &res, + unsigned int bitFlags = 32767U, bool isQuery = false, + unsigned int nBytes = 64) { + PRECONDITION(molPtr, "bad molecule"); + PRECONDITION(res.getLength() >= nBytes, "res too small"); - int *fingerprint=getCountFp(molPtr,bitFlags,isQuery,nBytes); + int *fingerprint = getCountFp(molPtr, bitFlags, isQuery, nBytes); - for(unsigned int i=0;i=nBytes*8U,"res too small"); - if(resetVect) res.clearBits(); +void reaccsToFingerprint(struct reaccs_molecule_t *molPtr, ExplicitBitVect &res, + unsigned int bitFlags = 32767U, bool isQuery = false, + bool resetVect = true, unsigned int nBytes = 64) { + PRECONDITION(molPtr, "bad molecule"); + PRECONDITION(res.getNumBits() >= nBytes * 8U, "res too small"); + if (resetVect) res.clearBits(); - char *fingerprint=getFp(molPtr,bitFlags,isQuery,nBytes); + char *fingerprint = getFp(molPtr, bitFlags, isQuery, nBytes); - for(unsigned int i=0;i &res, + unsigned int nBits, bool isQuery, bool resetVect, + unsigned int bitFlags) { + (void)resetVect; + struct reaccs_molecule_t *mp = molToReaccs(mol); + reaccsToCounts(mp, res, bitFlags, isQuery, nBits); + FreeMolecule(mp); +} + +void getAvalonFP(const ROMol &mol, ExplicitBitVect &res, unsigned int nBits, + bool isQuery, bool resetVect, unsigned int bitFlags) { + if (nBits % 8) { + BOOST_LOG(rdWarningLog) + << "Warning: number of bits (" << nBits + << ") is not evenly divisible by 8. Rounding to the nearest byte." + << std::endl; + } + unsigned int nBytes = nBits / 8; + struct reaccs_molecule_t *mp = molToReaccs(mol); + reaccsToFingerprint(mp, res, bitFlags, isQuery, resetVect, nBytes); + FreeMolecule(mp); +} +void getAvalonFP(const ROMol &mol, std::vector &res, + unsigned int nBits, bool isQuery, bool resetVect, + unsigned int bitFlags) { + if (nBits % 8) { + BOOST_LOG(rdWarningLog) + << "Warning: number of bits (" << nBits + << ") is not evenly divisible by 8. Rounding to the nearest byte." + << std::endl; + } + unsigned int nBytes = nBits / 8; + struct reaccs_molecule_t *mp = molToReaccs(mol); + reaccsToFingerprint(mp, res, bitFlags, isQuery, resetVect, nBytes); + FreeMolecule(mp); +} + +unsigned int set2DCoords(ROMol &mol, bool clearConfs) { + auto smiles = MolToSmiles(mol); + struct reaccs_molecule_t *mp = stringToReaccs(smiles, true); + struct reaccs_molecule_t *mp2 = reaccsGetCoords(mp); + TEST_ASSERT(mp2->n_atoms == mol.getNumAtoms()); + + auto *conf = new RDKit::Conformer(mol.getNumAtoms()); + conf->set3D(false); + + // Atoms in the intermediate smiles representation may be ordered + // differently compared to the original input molecule. + // Make sure that output coordinates are assigned in the correct order. + std::vector atomOrdering; + mol.getProp(common_properties::_smilesAtomOutputOrder, atomOrdering); + for (unsigned int i = 0; i < mol.getNumAtoms(); ++i) { + auto x = mp2->atom_array[atomOrdering[i]].x; + auto y = mp2->atom_array[atomOrdering[i]].y; + RDGeom::Point3D loc(x, y, 0.); + conf->setAtomPos(i, loc); } - - void getAvalonCountFP(const ROMol &mol,SparseIntVect &res, - unsigned int nBits, - bool isQuery, - bool resetVect, - unsigned int bitFlags){ - (void)resetVect; - struct reaccs_molecule_t *mp=molToReaccs(mol); - reaccsToCounts(mp,res,bitFlags,isQuery,nBits); - FreeMolecule(mp); + unsigned int res; + if (clearConfs) { + mol.clearConformers(); + conf->setId(0); + mol.addConformer(conf); + res = 0; + } else { + res = mol.addConformer(conf, true); } - void getAvalonFP(const ROMol &mol,ExplicitBitVect &res, - unsigned int nBits, - bool isQuery, - bool resetVect, - unsigned int bitFlags){ - if(nBits%8) { - BOOST_LOG(rdWarningLog)<<"Warning: number of bits ("< &res, - unsigned int nBits, - bool isQuery, - bool resetVect, - unsigned int bitFlags){ - if(nBits%8) { - BOOST_LOG(rdWarningLog)<<"Warning: number of bits ("<n_atoms==mol.getNumAtoms()); - - auto *conf = new RDKit::Conformer(mol.getNumAtoms()); - conf->set3D(false); - - // Atoms in the intermediate smiles representation may be ordered - // differently compared to the original input molecule. - // Make sure that output coordinates are assigned in the correct order. - std::vector atomOrdering; - mol.getProp(common_properties::_smilesAtomOutputOrder, atomOrdering); - for(unsigned int i=0;iatom_array[atomOrdering[i]].x; - auto y = mp2->atom_array[atomOrdering[i]].y; - RDGeom::Point3D loc(x,y,0.); - conf->setAtomPos(i,loc); - } - - unsigned int res; - if (clearConfs) { - mol.clearConformers(); - conf->setId(0); - mol.addConformer(conf); - res=0; - } else { - res=mol.addConformer(conf,true); - } + FreeMolecule(mp); + FreeMolecule(mp2); + return res; +} +std::string set2DCoords(const std::string &data, bool isSmiles) { + struct reaccs_molecule_t *mp = stringToReaccs(data, isSmiles); + std::string res = ""; + if (mp) { + struct reaccs_molecule_t *mp2 = reaccsGetCoords(mp); + Utils::LocaleSwitcher ls; + char *molB = MolToMolStr(mp2); + res = molB; FreeMolecule(mp); FreeMolecule(mp2); - - return res; + MyFree(molB); } - std::string set2DCoords(const std::string &data,bool isSmiles){ - struct reaccs_molecule_t *mp=stringToReaccs(data,isSmiles); - std::string res=""; - if(mp){ - struct reaccs_molecule_t *mp2=reaccsGetCoords(mp); - Utils::LocaleSwitcher ls; - char *molB = MolToMolStr(mp2); - res=molB; - FreeMolecule(mp); - FreeMolecule(mp2); - MyFree(molB); - } - return res; - } - - - std::string getCanonSmiles(const std::string &data,bool isSmiles,int flags){ - if(flags==-1) flags=DB_STEREO | CENTER_STEREO; - char *smiles = nullptr, *canSmiles = nullptr; - if(!isSmiles){ - struct reaccs_molecule_t *mp=stringToReaccs(data,isSmiles); - if(mp){ - smiles = MOLToSMI(mp,ISOMERIC_SMILES); - FreeMolecule(mp); - canSmiles = CanSmiles(smiles, flags); - MyFree(smiles); - } - } else { - canSmiles = CanSmiles((char *)data.c_str(), flags); - } - std::string res=""; - if(canSmiles){ - res=canSmiles; - MyFree(canSmiles); - } else { - BOOST_LOG(rdErrorLog)<<"ERROR: no smiles generated for molecule."< &res, - unsigned int nBits, - bool isQuery, - unsigned int bitFlags){ - struct reaccs_molecule_t *mp=stringToReaccs(data,isSmiles); - if(mp){ - reaccsToCounts(mp,res,bitFlags,isQuery,nBits); - FreeMolecule(mp); - } else { - BOOST_LOG(rdErrorLog)<<"ERROR: no fingeprint generated for molecule."< &res, - unsigned int nBits, - bool isQuery, - bool resetVect, - unsigned int bitFlags){ - if(nBits%8) { - BOOST_LOG(rdWarningLog)<<"Warning: number of bits ("< checkMolString(const std::string &data, bool isSmiles){ - struct reaccs_molecule_t *mp; - int errs = checkMolString(data, isSmiles, &mp); - std::string molStr; - if(mp) { - Utils::LocaleSwitcher ls; - char *tmp=MolToMolStr(mp); - molStr = std::string(tmp); - FreeMolecule(mp); - MyFree(tmp); - } else { - molStr=""; - } - return std::make_pair(molStr,errs); - } - - - void closeCheckMolFiles() { - ClearParameters(); - CloseOpenFiles(); - } - + return res; } + +std::string getCanonSmiles(const std::string &data, bool isSmiles, int flags) { + if (flags == -1) flags = DB_STEREO | CENTER_STEREO; + char *smiles = nullptr, *canSmiles = nullptr; + if (!isSmiles) { + struct reaccs_molecule_t *mp = stringToReaccs(data, isSmiles); + if (mp) { + smiles = MOLToSMI(mp, ISOMERIC_SMILES); + FreeMolecule(mp); + canSmiles = CanSmiles(smiles, flags); + MyFree(smiles); + } + } else { + canSmiles = CanSmiles((char *)data.c_str(), flags); + } + std::string res = ""; + if (canSmiles) { + res = canSmiles; + MyFree(canSmiles); + } else { + BOOST_LOG(rdErrorLog) << "ERROR: no smiles generated for molecule." + << std::endl; + } + return res; +} + +void getAvalonCountFP(const std::string &data, bool isSmiles, + SparseIntVect &res, unsigned int nBits, + bool isQuery, unsigned int bitFlags) { + struct reaccs_molecule_t *mp = stringToReaccs(data, isSmiles); + if (mp) { + reaccsToCounts(mp, res, bitFlags, isQuery, nBits); + FreeMolecule(mp); + } else { + BOOST_LOG(rdErrorLog) << "ERROR: no fingeprint generated for molecule." + << std::endl; + } +} +void getAvalonFP(const std::string &data, bool isSmiles, ExplicitBitVect &res, + unsigned int nBits, bool isQuery, bool resetVect, + unsigned int bitFlags) { + if (nBits % 8) { + BOOST_LOG(rdWarningLog) + << "Warning: number of bits (" << nBits + << ") is not evenly divisible by 8. Rounding to the nearest byte." + << std::endl; + } + unsigned int nBytes = nBits / 8; + struct reaccs_molecule_t *mp = stringToReaccs(data, isSmiles); + if (mp) { + reaccsToFingerprint(mp, res, bitFlags, isQuery, resetVect, nBytes); + FreeMolecule(mp); + } else { + BOOST_LOG(rdErrorLog) << "ERROR: no fingeprint generated for molecule." + << std::endl; + } +} +void getAvalonFP(const std::string &data, bool isSmiles, + std::vector &res, unsigned int nBits, + bool isQuery, bool resetVect, unsigned int bitFlags) { + if (nBits % 8) { + BOOST_LOG(rdWarningLog) + << "Warning: number of bits (" << nBits + << ") is not evenly divisible by 8. Rounding to the nearest byte." + << std::endl; + } + unsigned int nBytes = nBits / 8; + struct reaccs_molecule_t *mp = stringToReaccs(data, isSmiles); + if (mp) { + reaccsToFingerprint(mp, res, bitFlags, isQuery, resetVect, nBytes); + FreeMolecule(mp); + } else { + BOOST_LOG(rdErrorLog) << "ERROR: no fingeprint generated for molecule." + << std::endl; + } +} + +int _checkMolWrapper(struct reaccs_molecule_t **mpp) { + if (!*mpp) return BAD_MOLECULE; + int res; + struct reaccs_molecule_t *tmp = *mpp; + res = RunStruchk(mpp, nullptr); + if (*mpp != tmp) { + FreeMolecule(tmp); + } + return res; +} + +/** + * Wrapper around struchk.CheckMol + * The molecule to check is passed in as a string. isSmiles + * should be set to TRUE if the molecule is encoded as SMILES, + * to FALSE if the molecule is encoded as sn MDL CTAB. + * mp is an output parameter - it will point to the checked + * molecule upon successful checking. In case of errors, mp may be 0. + **/ +int checkMolString(const std::string &data, const bool isSmiles, + struct reaccs_molecule_t **mp) { + // clean msg list from previous call (if no previous call, freemsglist does + // nothing) + FreeMsgList(); + + int errs = 0; + if (isSmiles) { + *mp = SMIToMOL(data.c_str(), DY_AROMATICITY); + } else { + Utils::LocaleSwitcher ls; + *mp = MolStr2Mol((char *)data.c_str()); + } + if (*mp) { + errs = _checkMolWrapper(mp); + } else { + errs = BAD_MOLECULE; + } + return errs; +} + +int initCheckMol(const std::string &optString) { + // n.b. always add a cr to the end for safety + auto *optBuffer = new char[optString.size() + 2]; + optString.copy(optBuffer, optString.size()); + optBuffer[optString.size() - 1] = '\n'; + optBuffer[optString.size()] = '\0'; + int res = InitCheckMol(optBuffer); + delete[] optBuffer; + return res; +} + +std::string getCheckMolLog() { + char *buf = GetMsgList(); + std::string res = buf; + MyFree(buf); + + return res; +} + +RDKit::ROMOL_SPTR checkMol(int &errs, RDKit::ROMol &inMol) { + // clean msg list from previous call (if no previous call, freemsglist does + // nothing) + FreeMsgList(); + + struct reaccs_molecule_t *mp; + RDKit::ROMol *rMol = nullptr; + mp = molToReaccs(inMol); + errs = _checkMolWrapper(&mp); + if (mp) { + Utils::LocaleSwitcher ls; + char *molStr = MolToMolStr(mp); + FreeMolecule(mp); + if (molStr) { + rMol = MolBlockToMol(molStr); + MyFree(molStr); + } + } + return RDKit::ROMOL_SPTR(rMol); +} + +RDKit::ROMOL_SPTR checkMol(int &errs, const std::string &data, + const bool isSmiles) { + struct reaccs_molecule_t *mp; + errs = checkMolString(data, isSmiles, &mp); + if (mp) { + Utils::LocaleSwitcher ls; + char *molStr = MolToMolStr(mp); + RDKit::ROMol *rMol = MolBlockToMol(molStr); + FreeMolecule(mp); + MyFree(molStr); + return RDKit::ROMOL_SPTR(rMol); + } else { + return RDKit::ROMOL_SPTR(); + } +} + +std::pair checkMolString(const std::string &data, + bool isSmiles) { + struct reaccs_molecule_t *mp; + int errs = checkMolString(data, isSmiles, &mp); + std::string molStr; + if (mp) { + Utils::LocaleSwitcher ls; + char *tmp = MolToMolStr(mp); + molStr = std::string(tmp); + FreeMolecule(mp); + MyFree(tmp); + } else { + molStr = ""; + } + return std::make_pair(molStr, errs); +} + +void closeCheckMolFiles() { + ClearParameters(); + CloseOpenFiles(); +} + +} // namespace AvalonTools diff --git a/External/AvalonTools/test1.cpp b/External/AvalonTools/test1.cpp old mode 100755 new mode 100644 index 4e4c8c7b5..7688ebee6 --- a/External/AvalonTools/test1.cpp +++ b/External/AvalonTools/test1.cpp @@ -166,11 +166,11 @@ void testGitHub1062() { << std::endl; { std::string s0 = "C/C=C\\C"; - ROMol * m1 = SmilesToMol(s0); + ROMol *m1 = SmilesToMol(s0); auto s1 = MolToSmiles(*m1); AvalonTools::set2DCoords(*m1); std::string mb = MolToMolBlock(*m1); - ROMol * m2 = MolBlockToMol(mb); + ROMol *m2 = MolBlockToMol(mb); std::string s2 = MolToSmiles(*m2); delete m1; delete m2; @@ -181,12 +181,12 @@ void testGitHub1062() { // to verify that the implementation is not sensitive to the // ordering of atoms std::string s0 = "C/C=C(F)\\C"; - ROMol * m1 = SmilesToMol(s0); + ROMol *m1 = SmilesToMol(s0); auto s1 = MolToSmiles(*m1); TEST_ASSERT(s1 != s0); AvalonTools::set2DCoords(*m1); std::string mb = MolToMolBlock(*m1); - ROMol * m2 = MolBlockToMol(mb); + ROMol *m2 = MolBlockToMol(mb); std::string s2 = MolToSmiles(*m2); delete m1; delete m2; diff --git a/External/FreeSASA/RDFreeSASA.cpp b/External/FreeSASA/RDFreeSASA.cpp index 06d32813c..3ce536fec 100644 --- a/External/FreeSASA/RDFreeSASA.cpp +++ b/External/FreeSASA/RDFreeSASA.cpp @@ -60,18 +60,14 @@ const std::string SASA = namespace FreeSASA { using namespace RDKit; -SASAOpts::SASAOpts() : - algorithm(SASAOpts::LeeRichards), - classifier(SASAOpts::Protor), - probeRadius(FREESASA_DEF_PROBE_RADIUS) {} -SASAOpts::SASAOpts(SASAOpts::Algorithm alg, SASAOpts::Classifier cls) : - algorithm(alg), - classifier(cls), - probeRadius(FREESASA_DEF_PROBE_RADIUS) {} -SASAOpts::SASAOpts(SASAOpts::Algorithm alg, SASAOpts::Classifier cls, double pr) : - algorithm(alg), - classifier(cls), - probeRadius(pr) {} +SASAOpts::SASAOpts() + : algorithm(SASAOpts::LeeRichards), + classifier(SASAOpts::Protor), + probeRadius(FREESASA_DEF_PROBE_RADIUS) {} +SASAOpts::SASAOpts(SASAOpts::Algorithm alg, SASAOpts::Classifier cls) + : algorithm(alg), classifier(cls), probeRadius(FREESASA_DEF_PROBE_RADIUS) {} +SASAOpts::SASAOpts(SASAOpts::Algorithm alg, SASAOpts::Classifier cls, double pr) + : algorithm(alg), classifier(cls), probeRadius(pr) {} bool classifyAtoms(ROMol &mol, std::vector &radii, const SASAOpts &opts) { diff --git a/External/FreeSASA/RDFreeSASA.h b/External/FreeSASA/RDFreeSASA.h index 3280d37f4..eef69d304 100644 --- a/External/FreeSASA/RDFreeSASA.h +++ b/External/FreeSASA/RDFreeSASA.h @@ -40,15 +40,17 @@ namespace common_properties { namespace Atom { RDKIT_FREESASALIB_EXPORT extern const std::string SASA; // Solvent Accessible Surface Area for atom- double -RDKIT_FREESASALIB_EXPORT extern const std::string SASAClass; // Class type, 0,1,2... etc -RDKIT_FREESASALIB_EXPORT extern const std::string SASAClassName; // Class name, Polar, APolar etc... -} +RDKIT_FREESASALIB_EXPORT extern const std::string + SASAClass; // Class type, 0,1,2... etc +RDKIT_FREESASALIB_EXPORT extern const std::string + SASAClassName; // Class name, Polar, APolar etc... +} // namespace Atom namespace Molecule { RDKIT_FREESASALIB_EXPORT extern const std::string SASA; // Total Solvent Accessible Surface area for molecule; } -} -} +} // namespace common_properties +} // namespace RDKit namespace FreeSASA { struct RDKIT_FREESASALIB_EXPORT SASAOpts { @@ -78,8 +80,9 @@ struct RDKIT_FREESASALIB_EXPORT SASAOpts { atom with index idx \return false if no atoms could be classified */ -RDKIT_FREESASALIB_EXPORT bool classifyAtoms(RDKit::ROMol &mol, std::vector &radii, - const FreeSASA::SASAOpts &opts = SASAOpts()); +RDKIT_FREESASALIB_EXPORT bool classifyAtoms( + RDKit::ROMol &mol, std::vector &radii, + const FreeSASA::SASAOpts &opts = SASAOpts()); //! calculate the Solvent Accessible Surface Area using the FreeSASA library. /*! @@ -102,9 +105,11 @@ RDKIT_FREESASALIB_EXPORT bool classifyAtoms(RDKit::ROMol &mol, std::vector &radii, - int confIdx = -1, const RDKit::QueryAtom *query = NULL, - const SASAOpts &opts = SASAOpts()); +RDKIT_FREESASALIB_EXPORT double calcSASA(const RDKit::ROMol &mol, + const std::vector &radii, + int confIdx = -1, + const RDKit::QueryAtom *query = NULL, + const SASAOpts &opts = SASAOpts()); //! Make a query atom returning the FreeSASA supplied apolar atom classification /*! @@ -121,6 +126,6 @@ RDKIT_FREESASALIB_EXPORT const RDKit::QueryAtom *makeFreeSasaAPolarAtomQuery(); \return QueryAtom pointer */ RDKIT_FREESASALIB_EXPORT const RDKit::QueryAtom *makeFreeSasaPolarAtomQuery(); -} +} // namespace FreeSASA #endif diff --git a/External/FreeSASA/testFreeSASA.cpp b/External/FreeSASA/testFreeSASA.cpp index 4524e5a99..6cca2be21 100644 --- a/External/FreeSASA/testFreeSASA.cpp +++ b/External/FreeSASA/testFreeSASA.cpp @@ -376,7 +376,6 @@ void testPDB() { TEST_ASSERT(radii[idx] == ExpectedProtor1d3z[idx].radius); } - { FreeSASA::SASAOpts opts; opts.algorithm = FreeSASA::SASAOpts::ShrakeRupley; diff --git a/External/INCHI-API/inchi.cpp b/External/INCHI-API/inchi.cpp index dd04dc3df..851cffbed 100644 --- a/External/INCHI-API/inchi.cpp +++ b/External/INCHI-API/inchi.cpp @@ -517,7 +517,7 @@ bool _Valence5NCleanUp5(RWMol& mol, Atom* atom, int atomicNum) { PRECONDITION( atomicNum == 8 || atomicNum == 16 || atomicNum == 9 || atomicNum == 17, "this cleanup looks for O or S or Cl or F"); - std::stack stackCharged, stackUncharged, *stack; + std::stack stackCharged, stackUncharged, *stack; // try search for valence-5 N connected to O or S, determined by the // parameter with alternating // bonds if there is a charged Oxygen and an uncharged one both @@ -1164,7 +1164,7 @@ void cleanUp(RWMol& mol) { } // end the switch block } // end the for loop that iterates over atoms } // end cleanUp -} // end inner namespace +} // namespace #if RDK_TEST_MULTITHREADED std::mutex inchiMutex; @@ -1536,15 +1536,15 @@ RWMol* InchiToMol(const std::string& inchi, ExtraInchiReturnValues& rv, << std::endl; break; default: - BOOST_LOG(rdWarningLog) << "Unrecognized stereo0D type (" - << (int)stereo0DPtr->type - << ") is ignored!" << std::endl; + BOOST_LOG(rdWarningLog) + << "Unrecognized stereo0D type (" << (int)stereo0DPtr->type + << ") is ignored!" << std::endl; } // end switch stereotype } // end for loop over all stereo0D entries // set the bond directions if (!assignBondDirs(*m, zBondPairs, eBondPairs)) { - BOOST_LOG(rdWarningLog) << "Cannot assign bond directions!" - << std::endl; + BOOST_LOG(rdWarningLog) + << "Cannot assign bond directions!" << std::endl; ; } } // end if (if stereo0D presents) @@ -1768,9 +1768,9 @@ std::string MolToInchi(const ROMol& mol, ExtraInchiReturnValues& rv, stereo0D.parity = INCHI_PARITY_ODD; pushIt = true; } else { - BOOST_LOG(rdWarningLog) << "unrecognized chirality tag (" - << chiralTag << ") on atom " << i - << " is ignored." << std::endl; + BOOST_LOG(rdWarningLog) + << "unrecognized chirality tag (" << chiralTag << ") on atom " + << i << " is ignored." << std::endl; } } if (pushIt) { @@ -1960,25 +1960,25 @@ std::string MolToInchi(const ROMol& mol, ExtraInchiReturnValues& rv, return inchi; } -std::string MolBlockToInchi(const std::string &molBlock, ExtraInchiReturnValues& rv, - const char* options) { - - // create output +std::string MolBlockToInchi(const std::string& molBlock, + ExtraInchiReturnValues& rv, const char* options) { + // create output inchi_Output output; - memset((void *)&output, 0, sizeof(output)); + memset((void*)&output, 0, sizeof(output)); // call DLL std::string inchi; { #if RDK_TEST_MULTITHREADED std::lock_guard lock(inchiMutex); #endif - char *_options = nullptr; + char* _options = nullptr; if (options) { _options = new char[strlen(options) + 1]; fixOptionSymbol(options, _options); options = _options; } - int retcode = MakeINCHIFromMolfileText( molBlock.c_str(), (char *)options, &output ); + int retcode = + MakeINCHIFromMolfileText(molBlock.c_str(), (char*)options, &output); // generate output rv.returnCode = retcode; @@ -1989,12 +1989,11 @@ std::string MolBlockToInchi(const std::string &molBlock, ExtraInchiReturnValues& // clean up FreeINCHI(&output); - delete [] _options; + delete[] _options; } return inchi; } - std::string InchiToInchiKey(const std::string& inchi) { char inchiKey[29]; char xtra1[65], xtra2[65]; @@ -2031,4 +2030,4 @@ std::string InchiToInchiKey(const std::string& inchi) { BOOST_LOG(rdErrorLog) << error << " in generating InChI Key" << std::endl; return std::string(); } -} +} // namespace RDKit diff --git a/External/INCHI-API/inchi.h b/External/INCHI-API/inchi.h index 68a2d5e55..059f4faa8 100644 --- a/External/INCHI-API/inchi.h +++ b/External/INCHI-API/inchi.h @@ -1,20 +1,21 @@ // // Copyright (c) 2011-2014, Novartis Institutes for BioMedical Research Inc. // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are -// met: +// met: // -// * Redistributions of source code must retain the above copyright +// * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided // with the distribution. -// * Neither the name of Novartis Institutes for BioMedical Research Inc. -// nor the names of its contributors may be used to endorse or promote -// products derived from this software without specific prior written permission. +// * Neither the name of Novartis Institutes for BioMedical Research Inc. +// nor the names of its contributors may be used to endorse or promote +// products derived from this software without specific prior written +// permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -35,72 +36,76 @@ #include #include namespace RDKit { - struct RDKIT_RDINCHILIB_EXPORT ExtraInchiReturnValues { - int returnCode; - std::string messagePtr; - std::string logPtr; - std::string auxInfoPtr; // not used for InchiToMol - }; - /*! Get a RWMol molecule instance for a InChI string. - * \param inchi The input InChI string, which can be standard or not - * \param rv An ExtraInchiReturnValues struct instance that is used to receive - * extra return values such as error messages from InChI API. - * \param sanitize Whether to sanitize the generated molecule before returning - * it - * \param removeHs Whether to remove hydrogens from the generated molecule - * before returning it. - */ - RDKIT_RDINCHILIB_EXPORT RWMol* InchiToMol(const std::string &inchi, ExtraInchiReturnValues& rv, - bool sanitize=true, bool removeHs=true); - /*! Get the InChI string for a given molecule - * \param mol The input molecule - * \param rv An ExtraInchiReturnValues struct instance that is used to receive - * extra return values such as InChI Auxiliary Information and error messages - * from InChI API. - * \param options An null-terminated character string of space-deliminated - * InChI options that is passed to InChI API as is (except that / is naively - * converted to - to non-Windows platforms and - is converted to / on Windows) - * Available options are explained in the InChI technical FAQ: - * http://www.inchi-trust.org/fileadmin/user_upload/html/inchifaq/inchi-faq.html#15.14 - * and the User Guide: - * http://www.inchi-trust.org/fileadmin/user_upload/software/inchi-v1.04/InChI_UserGuide.pdf - */ - RDKIT_RDINCHILIB_EXPORT std::string MolToInchi(const ROMol& mol, ExtraInchiReturnValues& rv, - const char *options=NULL); - /*! Get the InChI string for a given mol block - * \param mol The input mol block - * \param rv An ExtraInchiReturnValues struct instance that is used to receive - * extra return values such as InChI Auxiliary Information and error messages - * from InChI API. - * \param options An null-terminated character string of space-deliminated - * InChI options that is passed to InChI API as is (except that / is naively - * converted to - to non-Windows platforms and - is converted to / on Windows) - * Available options are explained in the InChI technical FAQ: - * http://www.inchi-trust.org/fileadmin/user_upload/html/inchifaq/inchi-faq.html#15.14 - * and the User Guide: - * http://www.inchi-trust.org/fileadmin/user_upload/software/inchi-v1.04/InChI_UserGuide.pdf - */ - RDKIT_RDINCHILIB_EXPORT std::string MolBlockToInchi(const std::string & mol, ExtraInchiReturnValues& rv, - const char *options=NULL); - /*! Get the InChI Key for an input InChI string - * \param inchi The input InChI string, which can be standard or not. - */ - RDKIT_RDINCHILIB_EXPORT std::string InchiToInchiKey(const std::string &inchi); +struct RDKIT_RDINCHILIB_EXPORT ExtraInchiReturnValues { + int returnCode; + std::string messagePtr; + std::string logPtr; + std::string auxInfoPtr; // not used for InchiToMol +}; +/*! Get a RWMol molecule instance for a InChI string. + * \param inchi The input InChI string, which can be standard or not + * \param rv An ExtraInchiReturnValues struct instance that is used to receive + * extra return values such as error messages from InChI API. + * \param sanitize Whether to sanitize the generated molecule before returning + * it + * \param removeHs Whether to remove hydrogens from the generated molecule + * before returning it. + */ +RDKIT_RDINCHILIB_EXPORT RWMol* InchiToMol(const std::string& inchi, + ExtraInchiReturnValues& rv, + bool sanitize = true, + bool removeHs = true); +/*! Get the InChI string for a given molecule + * \param mol The input molecule + * \param rv An ExtraInchiReturnValues struct instance that is used to receive + * extra return values such as InChI Auxiliary Information and error messages + * from InChI API. + * \param options An null-terminated character string of space-deliminated + * InChI options that is passed to InChI API as is (except that / is naively + * converted to - to non-Windows platforms and - is converted to / on Windows) + * Available options are explained in the InChI technical FAQ: + * http://www.inchi-trust.org/fileadmin/user_upload/html/inchifaq/inchi-faq.html#15.14 + * and the User Guide: + * http://www.inchi-trust.org/fileadmin/user_upload/software/inchi-v1.04/InChI_UserGuide.pdf + */ +RDKIT_RDINCHILIB_EXPORT std::string MolToInchi(const ROMol& mol, + ExtraInchiReturnValues& rv, + const char* options = NULL); +/*! Get the InChI string for a given mol block + * \param mol The input mol block + * \param rv An ExtraInchiReturnValues struct instance that is used to receive + * extra return values such as InChI Auxiliary Information and error messages + * from InChI API. + * \param options An null-terminated character string of space-deliminated + * InChI options that is passed to InChI API as is (except that / is naively + * converted to - to non-Windows platforms and - is converted to / on Windows) + * Available options are explained in the InChI technical FAQ: + * http://www.inchi-trust.org/fileadmin/user_upload/html/inchifaq/inchi-faq.html#15.14 + * and the User Guide: + * http://www.inchi-trust.org/fileadmin/user_upload/software/inchi-v1.04/InChI_UserGuide.pdf + */ +RDKIT_RDINCHILIB_EXPORT std::string MolBlockToInchi(const std::string& mol, + ExtraInchiReturnValues& rv, + const char* options = NULL); +/*! Get the InChI Key for an input InChI string + * \param inchi The input InChI string, which can be standard or not. + */ +RDKIT_RDINCHILIB_EXPORT std::string InchiToInchiKey(const std::string& inchi); - /*! Get the InChI key for a given molecule directly - * \param mol The input molecule - * \param options An null-terminated character string of space-deliminated - * InChI options that is passed to InChI API as is (except that / is naively - * converted to - to non-Windows platforms and - is converted to / on Windows) - * Available options are explained in the InChI technical FAQ: - * http://www.inchi-trust.org/fileadmin/user_upload/html/inchifaq/inchi-faq.html#15.14 - * and the User Guide: - * http://www.inchi-trust.org/fileadmin/user_upload/software/inchi-v1.04/InChI_UserGuide.pdf - */ - inline std::string MolToInchiKey(const ROMol& mol, const char *options=NULL){ - ExtraInchiReturnValues rv; - return InchiToInchiKey(MolToInchi(mol,rv,options)); - }; +/*! Get the InChI key for a given molecule directly + * \param mol The input molecule + * \param options An null-terminated character string of space-deliminated + * InChI options that is passed to InChI API as is (except that / is naively + * converted to - to non-Windows platforms and - is converted to / on Windows) + * Available options are explained in the InChI technical FAQ: + * http://www.inchi-trust.org/fileadmin/user_upload/html/inchifaq/inchi-faq.html#15.14 + * and the User Guide: + * http://www.inchi-trust.org/fileadmin/user_upload/software/inchi-v1.04/InChI_UserGuide.pdf + */ +inline std::string MolToInchiKey(const ROMol& mol, const char* options = NULL) { + ExtraInchiReturnValues rv; + return InchiToInchiKey(MolToInchi(mol, rv, options)); +}; -} +} // namespace RDKit #endif diff --git a/External/INCHI-API/test.cpp b/External/INCHI-API/test.cpp index 1fdedf3e0..8895449fb 100644 --- a/External/INCHI-API/test.cpp +++ b/External/INCHI-API/test.cpp @@ -568,9 +568,7 @@ void testGithubIssue1572() { void testMolBlockToInchi() { BOOST_LOG(rdErrorLog) << "-------------------------------------" << std::endl; - BOOST_LOG(rdInfoLog) - << "testing mol block to InChI" - << std::endl; + BOOST_LOG(rdInfoLog) << "testing mol block to InChI" << std::endl; { std::string molb = R"MOL( @@ -593,10 +591,10 @@ M END )MOL"; ExtraInchiReturnValues tmp; std::string inchi = MolBlockToInchi(molb, tmp); - TEST_ASSERT(inchi=="InChI=1S/C5H8O/c1-2-4-6-5-3-1/h1-2H,3-5H2"); + TEST_ASSERT(inchi == "InChI=1S/C5H8O/c1-2-4-6-5-3-1/h1-2H,3-5H2"); } -{ - std::string molb=R"MOL(BDBM163075 + { + std::string molb = R"MOL(BDBM163075 RDKit 2D 27 30 0 0 0 0 0 0 0 0999 V2000 @@ -663,13 +661,16 @@ M END ExtraInchiReturnValues tmp; std::string inchi = MolBlockToInchi(molb, tmp); - TEST_ASSERT(inchi=="InChI=1S/C23H23N3O/c1-2-27-15-9-14-20-22(24-17-19-12-7-4-8-13-19)25-21(26-23(20)27)16-18-10-5-3-6-11-18/h3-15H,2,16-17H2,1H3,(H,24,25,26)"); - TEST_ASSERT(tmp.messagePtr == "Charges were rearranged; Accepted unusual valence(s): O(4)"); -} + TEST_ASSERT(inchi == + "InChI=1S/C23H23N3O/" + "c1-2-27-15-9-14-20-22(24-17-19-12-7-4-8-13-19)25-21(26-23(20)" + "27)16-18-10-5-3-6-11-18/h3-15H,2,16-17H2,1H3,(H,24,25,26)"); + TEST_ASSERT(tmp.messagePtr == + "Charges were rearranged; Accepted unusual valence(s): O(4)"); + } - -{ - std::string molb=R"MOL( + { + std::string molb = R"MOL( Mrv1824 02121905282D 10 11 0 0 0 0 999 V2000 @@ -697,20 +698,23 @@ M END M END )MOL"; { - ExtraInchiReturnValues tmp; - std::string inchi = MolBlockToInchi(molb, tmp); - TEST_ASSERT(inchi=="InChI=1S/C8H8N2/c1-6-7-4-2-3-5-8(7)10-9-6/h2-5H,1H3,(H,9,10)"); + ExtraInchiReturnValues tmp; + std::string inchi = MolBlockToInchi(molb, tmp); + TEST_ASSERT( + inchi == + "InChI=1S/C8H8N2/c1-6-7-4-2-3-5-8(7)10-9-6/h2-5H,1H3,(H,9,10)"); } { - ExtraInchiReturnValues tmp; - std::string inchi = MolBlockToInchi(molb, tmp, "/FixedH"); - TEST_ASSERT(inchi=="InChI=1/C8H8N2/c1-6-7-4-2-3-5-8(7)10-9-6/h2-5H,1H3,(H,9,10)/f/h10H"); + ExtraInchiReturnValues tmp; + std::string inchi = MolBlockToInchi(molb, tmp, "/FixedH"); + TEST_ASSERT( + inchi == + "InChI=1/C8H8N2/c1-6-7-4-2-3-5-8(7)10-9-6/h2-5H,1H3,(H,9,10)/f/h10H"); } -} + } BOOST_LOG(rdInfoLog) << "done" << std::endl; } - //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*