rdkit-esm 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  RDKit minimal lib for the modern web.
4
4
 
5
- ![RDKit v2026.03.1](https://img.shields.io/badge/RDKit-v2026--03--1-brightgreen?style=flat)
5
+ ![RDKit v2026.09.1](https://img.shields.io/badge/RDKit-v2026--09--1-brightgreen?style=flat)
6
6
 
7
7
  ## About
8
8
 
Binary file
package/dist/index.d.ts CHANGED
@@ -107,6 +107,14 @@ interface JSMol {
107
107
  * @returns A stringified JSON object containing the matched atoms and bonds of the parent molecule
108
108
  */
109
109
  get_substruct_match(q: JSMol): string;
110
+ /**
111
+ * Returns a substructure match string
112
+ *
113
+ * @param q query molecule
114
+ * @param details stringified JSON of `RDKitSubstructMatchOptions` (e.g. `uniquify`, `maxMatches`, `useChirality`)
115
+ * @returns A stringified JSON object containing the matched atoms and bonds of the parent molecule
116
+ */
117
+ get_substruct_match(q: JSMol, details: string): string;
110
118
  /**
111
119
  * Returns all substructure matches
112
120
  *
@@ -114,6 +122,14 @@ interface JSMol {
114
122
  * @returns A stringified JSON object containing the matched atoms and bonds of the parent molecule
115
123
  */
116
124
  get_substruct_matches(q: JSMol): string;
125
+ /**
126
+ * Returns all substructure matches
127
+ *
128
+ * @param q query molecule
129
+ * @param details stringified JSON of `RDKitSubstructMatchOptions` (e.g. `uniquify`, `maxMatches`, `useChirality`)
130
+ * @returns A stringified JSON object containing the matched atoms and bonds of the parent molecule
131
+ */
132
+ get_substruct_matches(q: JSMol, details: string): string;
117
133
  // molecular descriptors
118
134
  /**
119
135
  * Returns a stringified JSON object of molecular descriptors
@@ -1282,6 +1298,69 @@ type RDKitSubstructMatch = {
1282
1298
  atoms: number[];
1283
1299
  bonds: number[];
1284
1300
  };
1301
+ /**
1302
+ * Substructure matching options, mirroring RDKit's `SubstructMatchParameters` JSON keys
1303
+ * (see `updateSubstructMatchParamsFromJSON` in `SubstructUtils.cpp`).
1304
+ */
1305
+ type RDKitSubstructMatchOptions = {
1306
+ /**
1307
+ * Use chirality in determining whether or not atoms/bonds match
1308
+ * @default false
1309
+ */
1310
+ useChirality: boolean;
1311
+ /**
1312
+ * Use enhanced stereochemistry in determining whether atoms/bonds match
1313
+ * @default false
1314
+ */
1315
+ useEnhancedStereo: boolean;
1316
+ /**
1317
+ * Aromatic and conjugated bonds match each other
1318
+ * @default false
1319
+ */
1320
+ aromaticMatchesConjugated: boolean;
1321
+ /**
1322
+ * Consider query-query matches, not just simple matches
1323
+ * @default false
1324
+ */
1325
+ useQueryQueryMatches: boolean;
1326
+ /**
1327
+ * Allow recursive queries
1328
+ * @default true
1329
+ */
1330
+ recursionPossible: boolean;
1331
+ /**
1332
+ * Uniquify match results by atom indices: matches covering the same set of atoms in a different
1333
+ * order (e.g. a flipped phenyl ring) are collapsed into one. Set to `false` to get every mapping.
1334
+ * @default true
1335
+ */
1336
+ uniquify: boolean;
1337
+ /**
1338
+ * Maximum number of matches to return
1339
+ * @default 1000
1340
+ */
1341
+ maxMatches: number;
1342
+ /**
1343
+ * Maximum number of matches that the recursive substructure matching should return
1344
+ * @default 1000
1345
+ */
1346
+ maxRecursiveMatches: number;
1347
+ /**
1348
+ * Number of threads to use when multi-threading is possible
1349
+ * @default 1
1350
+ */
1351
+ numThreads: number;
1352
+ /**
1353
+ * Atoms and bonds with specified stereochemistry in the query match atoms and bonds with
1354
+ * unspecified stereochemistry in the molecule
1355
+ * @default false
1356
+ */
1357
+ specifiedStereoQueryMatchesUnspecified: boolean;
1358
+ /**
1359
+ * Aromatic bonds match single or double bonds
1360
+ * @default false
1361
+ */
1362
+ aromaticMatchesSingleOrDouble: boolean;
1363
+ };
1285
1364
  /**
1286
1365
  * Flags controlling which sanitization steps are run when `sanitize` is an object.
1287
1366
  * Each key corresponds to a `MolOps::SanitizeFlags` enum value; `true` enables it,
@@ -1687,6 +1766,23 @@ type RDKitForceFieldName = 'MMFF94' | 'UFF';
1687
1766
  type RDKitForceFieldEnergyDetails = {
1688
1767
  job: 'energy';
1689
1768
  };
1769
+ /** Atoms tethered to their starting coordinates during a minimization */
1770
+ type RDKitPositionRestraint = {
1771
+ /** Indices of the restrained atoms */
1772
+ atoms: number[];
1773
+ /**
1774
+ * Distance in Å an atom can move from its starting position without penalty.
1775
+ * `0` gives a plain harmonic restraint.
1776
+ * @default 0
1777
+ */
1778
+ maxDisplacement?: number;
1779
+ /**
1780
+ * Force constant in kcal/mol/Ų applied beyond `maxDisplacement`: the penalty is
1781
+ * `0.5 * forceConstant * (distance - maxDisplacement)²`.
1782
+ * @default 100
1783
+ */
1784
+ forceConstant?: number;
1785
+ };
1690
1786
  type RDKitMinimizeDetails = {
1691
1787
  job: 'minimize';
1692
1788
  /**
@@ -1704,6 +1800,15 @@ type RDKitMinimizeDetails = {
1704
1800
  * @default []
1705
1801
  */
1706
1802
  fixedAtoms: number[];
1803
+ /**
1804
+ * Groups of atoms tethered to their starting coordinates. Unlike `fixedAtoms`, restrained
1805
+ * atoms can still move when the force field pushes them hard enough. An atom can be in
1806
+ * at most one group and cannot also be in `fixedAtoms`.
1807
+ *
1808
+ * Restraint penalties are included in the reported energies.
1809
+ * @default []
1810
+ */
1811
+ positionRestraints: RDKitPositionRestraint[];
1707
1812
  };
1708
1813
  /** Details accepted by `JSMol.run_forcefield` */
1709
1814
  type RDKitForceFieldDetails = RDKitForceFieldEnergyDetails | (Pick<RDKitMinimizeDetails, 'job'> & Partial<Omit<RDKitMinimizeDetails, 'job'>>);
@@ -2090,16 +2195,19 @@ export declare class Mol implements Disposable {
2090
2195
  * Returns the first substructure match
2091
2196
  *
2092
2197
  * @param query - A Mol instance or a SMARTS string to use as query
2198
+ * @param options - Substructure matching options (e.g. `useChirality`)
2093
2199
  * @returns The matched atom and bond indices
2094
2200
  */
2095
- getSubstructMatch(query: Mol | string): RDKitSubstructMatch;
2201
+ getSubstructMatch(query: Mol | string, options?: Partial<RDKitSubstructMatchOptions>): RDKitSubstructMatch;
2096
2202
  /**
2097
2203
  * Returns all substructure matches
2098
2204
  *
2099
2205
  * @param query - A Mol instance or a SMARTS string to use as query
2206
+ * @param options - Substructure matching options. Set `uniquify: false` to also get the
2207
+ * matches covering the same atoms in a different order (e.g. symmetric groups).
2100
2208
  * @returns An array of matched atom and bond indices
2101
2209
  */
2102
- getSubstructMatches(query: Mol | string): RDKitSubstructMatch[];
2210
+ getSubstructMatches(query: Mol | string, options?: Partial<RDKitSubstructMatchOptions>): RDKitSubstructMatch[];
2103
2211
  /** Returns molecular descriptors as a typed object */
2104
2212
  getDescriptors(): RDKitDescriptors | null;
2105
2213
  /**
@@ -2220,10 +2328,13 @@ export declare class Mol implements Disposable {
2220
2328
  * - Add explicit hydrogens first (`addHsInPlace()`), otherwise RDKit logs a warning.
2221
2329
  * - 2D coordinates are accepted, but a perfectly flat structure stays flat:
2222
2330
  * there is no force out of the plane. Use `generateConformers()` to get 3D coordinates.
2331
+ * - With `positionRestraints`, the reported energies include the restraint penalties, so
2332
+ * `finalEnergy` can differ from `getForceFieldEnergy()` on the result.
2223
2333
  *
2224
2334
  * @param options - Minimization options
2225
2335
  * @returns Energies, convergence and the minimization trajectory, or null on failure
2226
- * (e.g. the molecule has no coordinates, or `fixedAtoms` is out of range).
2336
+ * (e.g. the molecule has no coordinates, or `fixedAtoms` / `positionRestraints` are out of
2337
+ * range or overlap).
2227
2338
  * Pass `{ throwOnError: true }` to throw a {@link RDKitOperationError} instead.
2228
2339
  */
2229
2340
  minimize(): RDKitMinimization | null;
@@ -2750,4 +2861,4 @@ interface InitRDKitOptions {
2750
2861
  export declare function initRDKit(options?: Partial<InitRDKitOptions>): Promise<RDKit>;
2751
2862
  export declare function initRDKit<T extends typeof RDKit>(options: Partial<InitRDKitOptions> | undefined, constructor: T): Promise<InstanceType<T>>;
2752
2863
  //#endregion
2753
- export type { ColourPalette, ColourPaletteName, DrawColour, DrawingExtentsInclude, InitRDKitOptions, JSMol, JSReaction, MCSResult, MMPAFragmentation, MolList, RDKitAlignedCoordsOptions, RDKitAtomPairFPOptions, RDKitCondenseAbbreviationsOptions, RDKitConfigureOptions, RDKitConformers, RDKitDescriptors, RDKitEvents, RDKitFailCallback, RDKitForceFieldDetails, RDKitForceFieldEnergyDetails, RDKitForceFieldEnergyOptions, RDKitForceFieldEnergyResult, RDKitForceFieldFrame, RDKitForceFieldName, RDKitGenerateConformersDetails, RDKitGenerateConformersOptions, RDKitGenerateConformersResult, RDKitGetCxSmilesOptions, RDKitGetFragsOptions, RDKitGetMCSOptions, RDKitGetMolBlockOptions, RDKitGetMolOpt, RDKitGetMolOptions, RDKitGetQMolOptions, RDKitGetRgdOptions, RDKitGetRxnOptions, RDKitGetSVGOptions, RDKitGetSmilesOptions, RDKitJson, RDKitJsonAtom, RDKitJsonBond, RDKitJsonConformer2D, RDKitJsonConformer3D, RDKitJsonExtension, RDKitJsonMolecule, RDKitMCSResult, RDKitMinimization, RDKitMinimizationFrame, RDKitMinimizeDetails, RDKitMinimizeOptions, RDKitMinimizeResult, RDKitMmpaFragsOptions, RDKitMmpaFragsResult, RDKitModule, RDKitMolOperation, RDKitMorganFPOptions, RDKitOperation, RDKitParseErrorEvent, RDKitParseOperation, RDKitPatternFPOptions, RDKitRdkitFpOptions, RDKitRemoveHsOptions, RDKitRxnDetails, RDKitSanitizeFlags, RDKitStereoTags, RDKitSubstructMatch, RDKitTopologicalTorsionFPOptions, RGDRow, SimilarityMetric, SubstructLibraryAddOptions, SubstructLibraryEntry, SubstructLibraryOptions, SubstructLibrarySearchOptions, SubstructLibrarySearchResult, TverskySimilarityOptions };
2864
+ export type { ColourPalette, ColourPaletteName, DrawColour, DrawingExtentsInclude, InitRDKitOptions, JSMol, JSReaction, MCSResult, MMPAFragmentation, MolList, RDKitAlignedCoordsOptions, RDKitAtomPairFPOptions, RDKitCondenseAbbreviationsOptions, RDKitConfigureOptions, RDKitConformers, RDKitDescriptors, RDKitEvents, RDKitFailCallback, RDKitForceFieldDetails, RDKitForceFieldEnergyDetails, RDKitForceFieldEnergyOptions, RDKitForceFieldEnergyResult, RDKitForceFieldFrame, RDKitForceFieldName, RDKitGenerateConformersDetails, RDKitGenerateConformersOptions, RDKitGenerateConformersResult, RDKitGetCxSmilesOptions, RDKitGetFragsOptions, RDKitGetMCSOptions, RDKitGetMolBlockOptions, RDKitGetMolOpt, RDKitGetMolOptions, RDKitGetQMolOptions, RDKitGetRgdOptions, RDKitGetRxnOptions, RDKitGetSVGOptions, RDKitGetSmilesOptions, RDKitJson, RDKitJsonAtom, RDKitJsonBond, RDKitJsonConformer2D, RDKitJsonConformer3D, RDKitJsonExtension, RDKitJsonMolecule, RDKitMCSResult, RDKitMinimization, RDKitMinimizationFrame, RDKitMinimizeDetails, RDKitMinimizeOptions, RDKitMinimizeResult, RDKitMmpaFragsOptions, RDKitMmpaFragsResult, RDKitModule, RDKitMolOperation, RDKitMorganFPOptions, RDKitOperation, RDKitParseErrorEvent, RDKitParseOperation, RDKitPatternFPOptions, RDKitPositionRestraint, RDKitRdkitFpOptions, RDKitRemoveHsOptions, RDKitRxnDetails, RDKitSanitizeFlags, RDKitStereoTags, RDKitSubstructMatch, RDKitSubstructMatchOptions, RDKitTopologicalTorsionFPOptions, RGDRow, SimilarityMetric, SubstructLibraryAddOptions, SubstructLibraryEntry, SubstructLibraryOptions, SubstructLibrarySearchOptions, SubstructLibrarySearchResult, TverskySimilarityOptions };