rdkit-esm 0.6.0 → 0.7.0-rc.1

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/dist/index.d.ts CHANGED
@@ -15,15 +15,26 @@ interface JSMol {
15
15
  * See {@link https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management | Emscripten docs} for more details
16
16
  */
17
17
  delete(): void;
18
- /** Returns true if the underlying C++ object has already been deleted (added by Emscripten) */
19
- isDeleted(): boolean; // string representations
20
- /** Returns the SMILES string */
18
+ /**
19
+ * Returns true if the underlying C++ object has already been deleted (added by Emscripten)
20
+ */
21
+ isDeleted(): boolean;
22
+ // string representations
23
+ /**
24
+ * Returns the SMILES string
25
+ */
21
26
  get_smiles(details_json?: JSONString): string;
22
- /** Returns the Chemaxon Extended SMILES string */
27
+ /**
28
+ * Returns the Chemaxon Extended SMILES string
29
+ */
23
30
  get_cxsmiles(details_json?: JSONString): string;
24
- /** Returns the SMARTS string */
31
+ /**
32
+ * Returns the SMARTS string
33
+ */
25
34
  get_smarts(details_json?: JSONString): string;
26
- /** Returns the Chemaxon Extended SMARTS string */
35
+ /**
36
+ * Returns the Chemaxon Extended SMARTS string
37
+ */
27
38
  get_cxsmarts(details_json?: JSONString): string;
28
39
  /**
29
40
  * Returns the V2000 Molfile string, unless the molecule contains V3000 features,
@@ -37,30 +48,58 @@ interface JSMol {
37
48
  */
38
49
  get_v2Kmolblock(): string;
39
50
  get_v2Kmolblock(options: JSONString): string;
51
+ /**
52
+ * Extras (not in official MinimalLib, see `wasm/README.md`).
53
+ * Runs an MMFF94 force-field job on the first conformer, falling back to UFF
54
+ * when MMFF94 has no parameters for the molecule.
55
+ * @param details `RDKitForceFieldDetails` as a stringified JSON
56
+ * @returns `RDKitForceFieldEnergyResult` or `RDKitMinimizeResult` as a JSON string,
57
+ * or `""` on failure (the reason is logged to `rdApp.error`)
58
+ */
59
+ run_forcefield(details: JSONString): string;
60
+ /**
61
+ * Extras (not in official MinimalLib, see `wasm/README.md`).
62
+ * Replaces the molecule's conformers with ETKDGv3 conformers.
63
+ * @param details `RDKitGenerateConformersDetails` as a stringified JSON
64
+ * @returns `RDKitGenerateConformersResult` as a JSON string,
65
+ * or `""` on failure (the reason is logged to `rdApp.error`)
66
+ */
67
+ generate_conformers(details: JSONString): string;
40
68
  /** Returns the V3000 Molfile string
41
69
  * @param RDKitGetMolBlockOpt as a stringifyed JSON
42
70
  */
43
71
  get_v3Kmolblock(): string;
44
72
  get_v3Kmolblock(options: JSONString): string;
45
- /** Return the InChI string */
73
+ /**
74
+ * Return the InChI string
75
+ */
46
76
  get_inchi(): string;
47
77
  /**
48
78
  * @param args InchI CLI arguments
49
79
  * @example mol.get_inchi("-FixedH -RecMet -SaveOpt -SUU -SLUUD")
50
80
  */
51
81
  get_inchi(args: string): string;
52
- /** Returns the JSON representation */
53
- get_json(): string; // array representation
54
- /** Returns an unsigned integer array representation */
55
- get_as_uint8array(options?: JSONString): Uint8Array; // SVG representations
56
- /** Returns an SVG of the molecule */
82
+ /**
83
+ * Returns the JSON representation
84
+ */
85
+ get_json(): string;
86
+ // array representation
87
+ /**
88
+ * Returns an unsigned integer array representation
89
+ */
90
+ get_as_uint8array(options?: JSONString): Uint8Array;
91
+ // SVG representations
92
+ /**
93
+ * Returns an SVG of the molecule
94
+ */
57
95
  get_svg(): string;
58
96
  /**
59
97
  * Returns an SVG of the molcule, with atoms highlighted
60
98
  *
61
99
  * @param details A stringified JSON object containing any of the following options https://www.rdkitjs.com/#drawing-molecules-all-options
62
100
  */
63
- get_svg_with_highlights(details: string): string; // substructure match methods
101
+ get_svg_with_highlights(details: string): string;
102
+ // substructure match methods
64
103
  /**
65
104
  * Returns a substructure match string
66
105
  *
@@ -74,9 +113,13 @@ interface JSMol {
74
113
  * @param q query molecule
75
114
  * @returns A stringified JSON object containing the matched atoms and bonds of the parent molecule
76
115
  */
77
- get_substruct_matches(q: JSMol): string; // molecular descriptors
78
- /** Returns a stringified JSON object of molecular descriptors */
79
- get_descriptors(): string; // fingerprint methods
116
+ get_substruct_matches(q: JSMol): string;
117
+ // molecular descriptors
118
+ /**
119
+ * Returns a stringified JSON object of molecular descriptors
120
+ */
121
+ get_descriptors(): string;
122
+ // fingerprint methods
80
123
  /**
81
124
  * Returns the Morgan fingerprint as string
82
125
  */
@@ -236,7 +279,8 @@ interface JSMol {
236
279
  * Requires RDKit to be built with Avalon support (RDK_BUILD_AVALON_SUPPORT).
237
280
  * @param options stringified JSON with fingerprint options (nBits, isQuery, bitFlags)
238
281
  */
239
- get_avalon_fp_as_uint8array(options: JSONString): Uint8Array; // abbreviation methods
282
+ get_avalon_fp_as_uint8array(options: JSONString): Uint8Array;
283
+ // abbreviation methods
240
284
  condense_abbreviations(): string;
241
285
  condense_abbreviations(maxCoverage: number, useLinkers: boolean): string;
242
286
  /**
@@ -272,9 +316,14 @@ interface JSMol {
272
316
  * @param {boolean} acceptFailure
273
317
  */
274
318
  generate_aligned_coords(templateMol: JSMol, options: JSONString): string;
275
- /** Returns true if the molecule's structure is valid */
319
+ /**
320
+ * Returns true if the molecule's structure is valid
321
+ * @deprecated An invalid molecule is `null`. Kept for backward compatibility.
322
+ */
276
323
  is_valid(): boolean;
277
- /** Returns the total number of atoms in the molecule */
324
+ /**
325
+ * Returns the total number of atoms in the molecule
326
+ */
278
327
  get_num_atoms(): number;
279
328
  /**
280
329
  * Returns the number of atoms in the molecule
@@ -282,20 +331,32 @@ interface JSMol {
282
331
  */
283
332
  get_num_atoms(heavyOnly: boolean): number;
284
333
  get_num_bonds(): number;
285
- /** Check is the molecule has any 2D coordinates generated */
334
+ /**
335
+ * Check is the molecule has any 2D coordinates generated
336
+ */
286
337
  has_coords(): 0 | 2 | 3;
287
- /** Returns a stringified JSON object containing the atoms and bonds of stereo centers */
338
+ /**
339
+ * Returns a stringified JSON object containing the atoms and bonds of stereo centers
340
+ */
288
341
  get_stereo_tags(): string;
289
- /** Returns the V2000 Molfile representation of the aromatic form of the molecule */
342
+ /**
343
+ * Returns the V2000 Molfile representation of the aromatic form of the molecule
344
+ */
290
345
  get_aromatic_form(): string;
291
- /** Returns the V2000 Molfile representation of the kekule form of the molecule */
346
+ /**
347
+ * Returns the V2000 Molfile representation of the kekule form of the molecule
348
+ */
292
349
  get_kekule_form(): string;
293
- /** Returns the disconnected fragments of the molecule */
350
+ /**
351
+ * Returns the disconnected fragments of the molecule
352
+ */
294
353
  get_frags(details_json?: string): {
295
354
  mappings: JSONString;
296
355
  molList: MolList;
297
356
  };
298
- /** Generate new 2D coordinates */
357
+ /**
358
+ * Generate new 2D coordinates
359
+ */
299
360
  set_new_coords(): boolean;
300
361
  /**
301
362
  * Generate new 2D coordinates
@@ -303,21 +364,26 @@ interface JSMol {
303
364
  * @param useCoordGen use the CoordGen algorithm
304
365
  */
305
366
  set_new_coords(useCoordGen: boolean): boolean;
306
- /** Return a V2000 Molfile string with newly generated coordinates */
367
+ /**
368
+ * Return a V2000 Molfile string with newly generated coordinates
369
+ */
307
370
  get_new_coords(): string;
308
371
  /**
309
372
  * Return a V2000 Molfile string with newly generated coordinates
310
373
  *
311
374
  * @param useCoordGen use the CoordGen algorithm
312
375
  */
313
- get_new_coords(useCoordGen: boolean): string; // property methods
376
+ get_new_coords(useCoordGen: boolean): string;
377
+ // property methods
314
378
  /**
315
379
  * Check whether the molecule has a certain property
316
380
  *
317
381
  * @param key property name
318
382
  */
319
383
  has_prop(key: string): boolean;
320
- /** Returns the list of property names */
384
+ /**
385
+ * Returns the list of property names
386
+ */
321
387
  get_prop_list(): StringList;
322
388
  get_prop_list(includePrivate: boolean): StringList;
323
389
  get_prop_list(includePrivate: boolean, includeComputed: boolean): StringList;
@@ -347,7 +413,8 @@ interface JSMol {
347
413
  *
348
414
  * @param key property name
349
415
  */
350
- clear_prop(key: string): boolean; // hydrogen methods
416
+ clear_prop(key: string): boolean;
417
+ // hydrogen methods
351
418
  /**
352
419
  * Remove explicit hydrogens
353
420
  *
@@ -355,7 +422,9 @@ interface JSMol {
355
422
  */
356
423
  remove_hs(): string;
357
424
  remove_hs(options: JSONString): string;
358
- /** Remove explicit hydrogens from the molecule */
425
+ /**
426
+ * Remove explicit hydrogens from the molecule
427
+ */
359
428
  remove_hs_in_place(): boolean;
360
429
  remove_hs_in_place(options: JSONString): boolean;
361
430
  /**
@@ -364,20 +433,27 @@ interface JSMol {
364
433
  * @returns V2000 Molfile string with explicit hydrogens
365
434
  */
366
435
  add_hs(): string;
367
- /** Add explicit hydrogens on the molecule */
368
- add_hs_in_place(): boolean; // aromaticity methods
436
+ /**
437
+ * Add explicit hydrogens on the molecule
438
+ */
439
+ add_hs_in_place(): boolean;
440
+ // aromaticity methods
369
441
  convert_to_aromatic_form(): void;
370
442
  convert_to_kekule_form(): void;
371
443
  /** Add component to the molecule object
372
444
  * @param options stringified JSON object with { offset: [number, number, number] }
373
445
  */
374
446
  combine_with(other: JSMol, options?: string): void;
375
- /** Returns a copy of the molecule */
376
- copy(): JSMol; // depiction methods
447
+ /**
448
+ * Returns a copy of the molecule
449
+ */
450
+ copy(): JSMol;
451
+ // depiction methods
377
452
  normalize_depiction(): number;
378
453
  normalize_depiction(canonicalize: number): number;
379
454
  normalize_depiction(canonicalize: number, scaleFactor: number): number;
380
- straighten_depiction(smallRotation?: boolean): void; // canvas methods
455
+ straighten_depiction(smallRotation?: boolean): void;
456
+ // canvas methods
381
457
  /**
382
458
  * Draw the molecule to an HTML5 canvas
383
459
  *
@@ -402,7 +478,8 @@ interface JSMol {
402
478
  * @param width width in pixels
403
479
  * @param height height in pixels
404
480
  */
405
- draw_to_canvas_with_offset(canvas: HTMLCanvasElement, offsetx: number, offsety: number, width: number, height: number): void; // PNG I/O
481
+ draw_to_canvas_with_offset(canvas: HTMLCanvasElement, offsetx: number, offsety: number, width: number, height: number): void;
482
+ // PNG I/O
406
483
  /**
407
484
  * Embeds molecule data (pickle, SMILES, molblock) into a PNG.
408
485
  * Returns the updated PNG as a Uint8Array.
@@ -410,13 +487,17 @@ interface JSMol {
410
487
  * @param png PNG data as Uint8Array
411
488
  */
412
489
  add_to_png_blob(png: Uint8Array): Uint8Array;
413
- /** @see add_to_png_blob */
414
- add_to_png_blob(png: Uint8Array, details: JSONString): Uint8Array; // coordinates
490
+ /**
491
+ * @see add_to_png_blob
492
+ */
493
+ add_to_png_blob(png: Uint8Array, details: JSONString): Uint8Array;
494
+ // coordinates
415
495
  /**
416
496
  * Returns the 3D atom coordinates of the molecule's conformer.
417
497
  * Each entry is a `[x, y, z]` triple.
418
498
  */
419
- get_coords(): [number, number, number][]; // MMPA fragmentation
499
+ get_coords(): [number, number, number][];
500
+ // MMPA fragmentation
420
501
  /**
421
502
  * Performs MMPA (Matched Molecular Pairs Analysis) fragmentation.
422
503
  * Returns cores and sidechains as two `MolList` objects.
@@ -527,7 +608,9 @@ interface SubstructLibrary {
527
608
  * @param numThreads number of threads to use
528
609
  */
529
610
  count_matches(q: JSMol, useChirality: boolean, numThreads: number): number;
530
- /** Return the number of molecules in the library */
611
+ /**
612
+ * Return the number of molecules in the library
613
+ */
531
614
  size(): number;
532
615
  /**
533
616
  * Get all molecules from the library matching the substructure query.
@@ -598,16 +681,22 @@ interface MolList {
598
681
  */
599
682
  size: () => number;
600
683
  }
601
- /** Emscripten vector<T> wrapper — raw std::vector binding with get/size/delete */
684
+ /**
685
+ * Emscripten vector<T> wrapper — raw std::vector binding with get/size/delete
686
+ */
602
687
  interface EmscriptenVector<T> {
603
688
  size(): number;
604
689
  get(i: number): T;
605
690
  delete(): void;
606
691
  }
607
- /** Emscripten vector<string> wrapper */
692
+ /**
693
+ * Emscripten vector<string> wrapper
694
+ */
608
695
  interface StringList extends EmscriptenVector<string> {}
609
696
  // constructor interfaces
610
- /** Returns a new SubstructLibrary instance */
697
+ /**
698
+ * Returns a new SubstructLibrary instance
699
+ */
611
700
  interface SubstructLibraryConstructor {
612
701
  new (): SubstructLibrary;
613
702
  new (numBits: number): SubstructLibrary;
@@ -618,11 +707,13 @@ interface MolListConstructor {
618
707
  interface RGroupDecomposition {
619
708
  add(mol: JSMol): number;
620
709
  process(): boolean;
621
- get_rgroups_as_columns(): { [key in 'Core' | `R${number}`]: MolList };
622
- get_rgroups_as_rows(): { [key in 'Core' | `R${number}`]: JSMol }[];
710
+ get_rgroups_as_columns(): { [key in 'Core' | `R${number}`]: MolList; };
711
+ get_rgroups_as_rows(): { [key in 'Core' | `R${number}`]: JSMol; }[];
623
712
  delete(): void;
624
713
  }
625
- /** The main RDKit module */
714
+ /**
715
+ * The main RDKit module
716
+ */
626
717
  interface RDKitModule {
627
718
  SubstructLibrary: SubstructLibraryConstructor;
628
719
  MolList: MolListConstructor;
@@ -638,9 +729,8 @@ interface RDKitModule {
638
729
  * Create a molecule from an integer array
639
730
  *
640
731
  * @param pklAsUInt8Array unsigned integer array
641
- * @param details_json RDKitGetMolFromPickleOtions
642
732
  */
643
- get_mol_from_uint8array(pklAsUInt8Array: Uint8Array, details_json?: string): JSMol;
733
+ get_mol_from_uint8array(pklAsUInt8Array: Uint8Array): JSMol;
644
734
  /**
645
735
  * Create a copy of a molecule
646
736
  *
@@ -697,7 +787,7 @@ interface RDKitModule {
697
787
  *
698
788
  * @param value
699
789
  */
700
- use_legacy_stereo_perception(value: boolean): void;
790
+ use_legacy_stereo_perception(value: boolean): boolean;
701
791
  enable_logging(logName?: string): boolean;
702
792
  disable_logging(logName?: string): boolean;
703
793
  /**
@@ -751,7 +841,10 @@ declare global {
751
841
  type RDKitDescriptorNames = 'exactmw' | 'amw' | 'lipinskiHBA' | 'lipinskiHBD' | 'NumRotatableBonds' | 'NumHBD' | 'NumHBA' | 'NumHeavyAtoms' | 'NumAtoms' | 'NumHeteroatoms' | 'NumAmideBonds' | 'FractionCSP3' | 'NumRings' | 'NumAromaticRings' | 'NumAliphaticRings' | 'NumSaturatedRings' | 'NumHeterocycles' | 'NumAromaticHeterocycles' | 'NumSaturatedHeterocycles' | 'NumAliphaticHeterocycles' | 'NumSpiroAtoms' | 'NumBridgeheadAtoms' | 'NumAtomStereoCenters' | 'NumUnspecifiedAtomStereoCenters' | 'labuteASA' | 'tpsa' | 'CrippenClogP' | 'CrippenMR' | 'chi0v' | 'chi1v' | 'chi2v' | 'chi3v' | 'chi4v' | 'chi0n' | 'chi1n' | 'chi2n' | 'chi3n' | 'chi4n' | 'hallKierAlpha' | 'kappa1' | 'kappa2' | 'kappa3' | 'Phi';
752
842
  type RDKitDescriptors = Record<RDKitDescriptorNames, number>;
753
843
  type RDKitJsonAtom = {
754
- chg: number; /** Implicit Hydrogens count */
844
+ chg: number;
845
+ /**
846
+ * Implicit Hydrogens count
847
+ */
755
848
  impHs: number;
756
849
  isotope: number;
757
850
  nRad: number;
@@ -759,7 +852,10 @@ type RDKitJsonAtom = {
759
852
  z: number;
760
853
  };
761
854
  type RDKitJsonBond = {
762
- /** Bond order */bo: number;
855
+ /**
856
+ * Bond order
857
+ */
858
+ bo: number;
763
859
  stereo: 'unspecified' | 'cis' | 'trans' | 'either';
764
860
  stereoAtoms: [number, number];
765
861
  atoms: [number, number];
@@ -801,102 +897,365 @@ type ColourPalette = {
801
897
  [k: number]: DrawColour;
802
898
  };
803
899
  type ColourPaletteName = 'default' | 'avalon' | 'cdk' | 'darkmode' | 'bw';
804
- /** Flags controlling which elements are included when computing drawing extents.
900
+ /**
901
+ * Flags controlling which elements are included when computing drawing extents.
805
902
  * Each key corresponds to a DrawElement enum value; `true` includes it, `false` excludes it.
806
- * Example: `{ ALL: true, HIGHLIGHTS: false }` includes everything except highlights. */
903
+ * Example: `{ ALL: true, HIGHLIGHTS: false }` includes everything except highlights.
904
+ */
807
905
  type DrawingExtentsInclude = Partial<Record<'NONE' | 'PRESHAPES' | 'BONDS' | 'ATOMLABELS' | 'HIGHLIGHTS' | 'ANNOTATIONS' | 'RADICALS' | 'POSTSHAPES' | 'ALL', boolean>>;
808
906
  type RDKitDepictionDetails = {
809
- /** Drawing width in pixels */width: number; /** Drawing height in pixels */
810
- height: number; /** X offset for drawing origin in pixels */
811
- offsetx: number; /** Y offset for drawing origin in pixels */
812
- offsety: number; /** Toggles replacing 2H with D and 3H with T */
813
- atomLabelDeuteriumTritium: boolean; /** Draws "breaks" at dummy atoms */
814
- dummiesAreAttachments: boolean; /** Draws circles under highlighted atoms */
815
- circleAtoms: boolean; /** Split bonds into per-atom segments; most useful for dynamic manipulation of drawing, especially for SVG */
816
- splitBonds: boolean; /** Default highlight color */
817
- highlightColour: DrawColour; /** Highlight by drawing an outline *underneath* the molecule */
818
- continuousHighlight: boolean; /** Fill the areas used to highlight atoms and atom regions */
819
- fillHighlights: boolean; /** Default highlight radius if nothing given for a particular atom; units are Angstrom */
820
- highlightRadius: number; /** If positive, used as a cutoff (in pixels) for highlighting close contacts */
821
- flagCloseContactsDist: number; /** Toggles inclusion of atom tags in the output; does not make sense for all renderers */
822
- includeAtomTags: boolean; /** Toggles clearing the background before drawing a molecule */
823
- clearBackground: boolean; /** Color to be used while clearing the background */
824
- backgroundColour: DrawColour; /** Color to be used for query bonds */
825
- queryColour: DrawColour; /** Font size (in pixels) to be used for the legend (if present) */
826
- legendFontSize: number; /** Fraction of the draw panel to be used for the legend if present */
827
- legendFraction: number; /** Maximum size in pixels for font in drawn molecule; -1 means no max */
828
- maxFontSize: number; /** Minimum size in pixels for font in drawn molecule; -1 means no min */
829
- minFontSize: number; /** Font size to use, in pixels; default -1 means not fixed. If set, always used irrespective of scale, minFontSize and maxFontSize */
830
- fixedFontSize: number; /** Scales font relative to atom labels for atom and bond annotation */
831
- annotationFontScale: number; /** Name of font file for freetype rendering; if given, over-rides default (BuiltinTelexRegular). Can also be BuiltinRobotoRegular */
832
- fontFile: string; /** Color to be used for the legend (if present) */
833
- legendColour: DrawColour; /** Offset for the extra lines in a multiple bond, as a fraction of mean bond length */
834
- multipleBondOffset: number; /** Fraction of empty space to leave around the molecule */
835
- padding: number; /** Fraction of empty space to leave around each component in a reaction drawing */
836
- componentPadding: number; /** Additional padding to leave around atom labels; expressed as a fraction of the font size */
837
- additionalAtomLabelPadding: number; /** Replacement labels for atoms */
838
- atomLabels: Record<number, string>; /** Disables inclusion of atom labels in the rendering */
839
- noAtomLabels: boolean; /** Atom regions */
840
- atomRegions: number[][]; /** Color to be used for the symbols and arrows in reactions */
841
- symbolColour: DrawColour; /** Color to be used for annotations */
842
- annotationColour: DrawColour; /** Color to be used for atom indices and notes */
843
- atomNoteColour: DrawColour; /** Color to be used for bond indices and notes */
844
- bondNoteColour: DrawColour; /** Default line width when drawing bonds */
845
- bondLineWidth: number; /** Whether to apply scale() to the bond width */
846
- scaleBondWidth: boolean; /** Whether to apply scale() to bond highlight widths */
847
- scaleHighlightBondWidth: boolean; /** Multiplier for standard bond width used for highlighting */
848
- highlightBondWidthMultiplier: number; /** Call prepareMolForDrawing() on each molecule passed to drawMolecules() */
849
- prepareMolsBeforeDrawing: boolean; /** Defines 10 default colors for highlighting atoms and bonds or reactants in reactions */
850
- highlightColourPalette: DrawColour[]; /** The palette used to assign colors to atoms based on atomic number */
851
- atomColourPalette: ColourPalette | ColourPaletteName; /** Fixes scale to this fraction of draw window width so an average bond is this fraction of the width; -1.0 means no fix */
852
- fixedScale: number; /** Fixes the bond length (and hence the scale) to always be this number of pixels; -1.0 means no fix. If both fixedScale and fixedBondLength are > 0, fixedScale wins */
853
- fixedBondLength: number; /** Angle in degrees to rotate coords by about centre before drawing */
854
- rotate: number; /** Adds atom indices to drawings */
855
- addAtomIndices: boolean; /** Adds bond indices to drawings */
856
- addBondIndices: boolean; /** Adds isotope labels to non-dummy atoms */
857
- isotopeLabels: boolean; /** Adds isotope labels to dummy atoms */
858
- dummyIsotopeLabels: boolean; /** Adds E/Z and R/S stereo annotations to drawings */
859
- addStereoAnnotation: boolean; /** Show CIP codes for 'or' and 'and' StereoGroups that are normally hidden */
860
- showAllCIPCodes: boolean; /** Forces atom highlights always to be circles; default (false) puts ellipses round longer labels */
861
- atomHighlightsAreCircles: boolean; /** Highlight style for multi-colour highlights */
862
- multiColourHighlightStyle: 'CIRCLEANDLINE' | 'LASSO'; /** Moves the centre of the drawn molecule to (0,0) */
907
+ /**
908
+ * Drawing width in pixels
909
+ */
910
+ width: number;
911
+ /**
912
+ * Drawing height in pixels
913
+ */
914
+ height: number;
915
+ /**
916
+ * X offset for drawing origin in pixels
917
+ */
918
+ offsetx: number;
919
+ /**
920
+ * Y offset for drawing origin in pixels
921
+ */
922
+ offsety: number;
923
+ /**
924
+ * Toggles replacing 2H with D and 3H with T
925
+ */
926
+ atomLabelDeuteriumTritium: boolean;
927
+ /**
928
+ * Draws "breaks" at dummy atoms
929
+ */
930
+ dummiesAreAttachments: boolean;
931
+ /**
932
+ * Draws circles under highlighted atoms
933
+ */
934
+ circleAtoms: boolean;
935
+ /**
936
+ * Split bonds into per-atom segments; most useful for dynamic manipulation of drawing, especially for SVG
937
+ */
938
+ splitBonds: boolean;
939
+ /**
940
+ * Default highlight color
941
+ */
942
+ highlightColour: DrawColour;
943
+ /**
944
+ * Highlight by drawing an outline *underneath* the molecule
945
+ */
946
+ continuousHighlight: boolean;
947
+ /**
948
+ * Fill the areas used to highlight atoms and atom regions
949
+ */
950
+ fillHighlights: boolean;
951
+ /**
952
+ * Default highlight radius if nothing given for a particular atom; units are Angstrom
953
+ */
954
+ highlightRadius: number;
955
+ /**
956
+ * If positive, used as a cutoff (in pixels) for highlighting close contacts
957
+ */
958
+ flagCloseContactsDist: number;
959
+ /**
960
+ * Toggles inclusion of atom tags in the output; does not make sense for all renderers
961
+ */
962
+ includeAtomTags: boolean;
963
+ /**
964
+ * Toggles clearing the background before drawing a molecule
965
+ */
966
+ clearBackground: boolean;
967
+ /**
968
+ * Color to be used while clearing the background
969
+ */
970
+ backgroundColour: DrawColour;
971
+ /**
972
+ * Color to be used for query bonds
973
+ */
974
+ queryColour: DrawColour;
975
+ /**
976
+ * Font size (in pixels) to be used for the legend (if present)
977
+ */
978
+ legendFontSize: number;
979
+ /**
980
+ * Fraction of the draw panel to be used for the legend if present
981
+ */
982
+ legendFraction: number;
983
+ /**
984
+ * Maximum size in pixels for font in drawn molecule; -1 means no max
985
+ */
986
+ maxFontSize: number;
987
+ /**
988
+ * Minimum size in pixels for font in drawn molecule; -1 means no min
989
+ */
990
+ minFontSize: number;
991
+ /**
992
+ * Font size to use, in pixels; default -1 means not fixed. If set, always used irrespective of scale, minFontSize and maxFontSize
993
+ */
994
+ fixedFontSize: number;
995
+ /**
996
+ * Scales font relative to atom labels for atom and bond annotation
997
+ */
998
+ annotationFontScale: number;
999
+ /**
1000
+ * Name of font file for freetype rendering; if given, over-rides default (BuiltinTelexRegular). Can also be BuiltinRobotoRegular
1001
+ */
1002
+ fontFile: string;
1003
+ /**
1004
+ * Color to be used for the legend (if present)
1005
+ */
1006
+ legendColour: DrawColour;
1007
+ /**
1008
+ * Offset for the extra lines in a multiple bond, as a fraction of mean bond length
1009
+ */
1010
+ multipleBondOffset: number;
1011
+ /**
1012
+ * Fraction of empty space to leave around the molecule
1013
+ */
1014
+ padding: number;
1015
+ /**
1016
+ * Fraction of empty space to leave around each component in a reaction drawing
1017
+ */
1018
+ componentPadding: number;
1019
+ /**
1020
+ * Additional padding to leave around atom labels; expressed as a fraction of the font size
1021
+ */
1022
+ additionalAtomLabelPadding: number;
1023
+ /**
1024
+ * Replacement labels for atoms
1025
+ */
1026
+ atomLabels: Record<number, string>;
1027
+ /**
1028
+ * Disables inclusion of atom labels in the rendering
1029
+ */
1030
+ noAtomLabels: boolean;
1031
+ /**
1032
+ * Atom regions
1033
+ */
1034
+ atomRegions: number[][];
1035
+ /**
1036
+ * Color to be used for the symbols and arrows in reactions
1037
+ */
1038
+ symbolColour: DrawColour;
1039
+ /**
1040
+ * Color to be used for annotations
1041
+ */
1042
+ annotationColour: DrawColour;
1043
+ /**
1044
+ * Color to be used for atom indices and notes
1045
+ */
1046
+ atomNoteColour: DrawColour;
1047
+ /**
1048
+ * Color to be used for bond indices and notes
1049
+ */
1050
+ bondNoteColour: DrawColour;
1051
+ /**
1052
+ * Default line width when drawing bonds
1053
+ */
1054
+ bondLineWidth: number;
1055
+ /**
1056
+ * Whether to apply scale() to the bond width
1057
+ */
1058
+ scaleBondWidth: boolean;
1059
+ /**
1060
+ * Whether to apply scale() to bond highlight widths
1061
+ */
1062
+ scaleHighlightBondWidth: boolean;
1063
+ /**
1064
+ * Multiplier for standard bond width used for highlighting
1065
+ */
1066
+ highlightBondWidthMultiplier: number;
1067
+ /**
1068
+ * Call prepareMolForDrawing() on each molecule passed to drawMolecules()
1069
+ */
1070
+ prepareMolsBeforeDrawing: boolean;
1071
+ /**
1072
+ * Defines 10 default colors for highlighting atoms and bonds or reactants in reactions
1073
+ */
1074
+ highlightColourPalette: DrawColour[];
1075
+ /**
1076
+ * The palette used to assign colors to atoms based on atomic number
1077
+ */
1078
+ atomColourPalette: ColourPalette | ColourPaletteName;
1079
+ /**
1080
+ * Fixes scale to this fraction of draw window width so an average bond is this fraction of the width; -1.0 means no fix
1081
+ */
1082
+ fixedScale: number;
1083
+ /**
1084
+ * Fixes the bond length (and hence the scale) to always be this number of pixels; -1.0 means no fix. If both fixedScale and fixedBondLength are > 0, fixedScale wins
1085
+ */
1086
+ fixedBondLength: number;
1087
+ /**
1088
+ * Angle in degrees to rotate coords by about centre before drawing
1089
+ */
1090
+ rotate: number;
1091
+ /**
1092
+ * Adds atom indices to drawings
1093
+ */
1094
+ addAtomIndices: boolean;
1095
+ /**
1096
+ * Adds bond indices to drawings
1097
+ */
1098
+ addBondIndices: boolean;
1099
+ /**
1100
+ * Adds isotope labels to non-dummy atoms
1101
+ */
1102
+ isotopeLabels: boolean;
1103
+ /**
1104
+ * Adds isotope labels to dummy atoms
1105
+ */
1106
+ dummyIsotopeLabels: boolean;
1107
+ /**
1108
+ * Adds E/Z and R/S stereo annotations to drawings
1109
+ */
1110
+ addStereoAnnotation: boolean;
1111
+ /**
1112
+ * Show CIP codes for 'or' and 'and' StereoGroups that are normally hidden
1113
+ */
1114
+ showAllCIPCodes: boolean;
1115
+ /**
1116
+ * Forces atom highlights always to be circles; default (false) puts ellipses round longer labels
1117
+ */
1118
+ atomHighlightsAreCircles: boolean;
1119
+ /**
1120
+ * Highlight style for multi-colour highlights
1121
+ */
1122
+ multiColourHighlightStyle: 'CIRCLEANDLINE' | 'LASSO';
1123
+ /**
1124
+ * Moves the centre of the drawn molecule to (0,0)
1125
+ */
863
1126
  centreMoleculesBeforeDrawing: boolean;
864
1127
  /** Which elements should be included when computing drawing extents.
865
1128
  * Pass an object with DrawElement flag names as keys and boolean values.
866
1129
  * Example: `{ ALL: true, HIGHLIGHTS: false }` = include everything except highlights. */
867
- drawingExtentsInclude: DrawingExtentsInclude; /** Draw terminal methyl and related groups as CH3 */
868
- explicitMethyl: boolean; /** Include radicals in the drawing; can be useful to turn off for reactions and queries */
869
- includeRadicals: boolean; /** When possible, include metadata about molecules and reactions in the output to allow them to be reconstructed */
870
- includeMetadata: boolean; /** Simulate hand-drawn lines for bonds; when combined with a font like Comic-Sans or Comic-Neue, gives xkcd-like drawings */
871
- comicMode: boolean; /** Multiplier for standard bond width used for variable attachment points */
872
- variableBondWidthMultiplier: number; /** Radius value to use for atoms involved in variable attachment points */
873
- variableAtomRadius: number; /** Colour to use for variable attachment points */
874
- variableAttachmentColour: DrawColour; /** Add a molecule annotation with "ABS" if the chiral flag is set */
875
- includeChiralFlagLabel: boolean; /** If all specified stereocenters are in a single StereoGroup, show a molecule-level annotation instead of the individual labels */
876
- simplifiedStereoGroupLabel: boolean; /** If true, double bonds with unspecified stereo are drawn crossed; potential stereocenters with unspecified stereo are drawn with a wavy bond */
877
- unspecifiedStereoIsUnknown: boolean; /** If true, wedged and dashed bonds are drawn using symbolColour rather than inheriting their colour from the atoms */
878
- singleColourWedgeBonds: boolean; /** If the molecule came from a MolBlock, prefer the wedging information it provides; if false, use RDKit rules */
879
- useMolBlockWedging: boolean; /** Scaling factor used for pixels-to-angstrom conversion when auto scaling is being used */
880
- scalingFactor: number; /** When > 0, sets the baseFontSize for text drawing; reference: default DrawText::baseFontSize is 0.6 */
881
- baseFontSize: number; /** When drawing multiple molecules with DrawMolecules, forces them to use the same scale */
882
- drawMolsSameScale: boolean; /** Replace any-atom, any-hetero, any-halo queries with complex query symbols A, Q, X, M, optionally followed by H if hydrogen is included (except for AH, which stays *) */
883
- useComplexQueryAtomSymbols: boolean; /** If true, puts brackets round atom lists in query atoms */
884
- bracketsAroundAtomLists: boolean; /** Atom indices to highlight */
885
- atoms: number[]; /** Bond indices to highlight */
886
- bonds: number[]; /** Per-atom highlight colors, keyed by atom index */
887
- highlightAtomColors: Record<number, DrawColour>; /** Per-bond highlight colors, keyed by bond index */
888
- highlightBondColors: Record<number, DrawColour>; /** Per-atom highlight radii, keyed by atom index */
889
- highlightAtomRadii: Record<number, number>; /** If true, highlighted hetero atoms are drawn in standard colours rather than black */
890
- standardColoursForHighlightedAtoms: boolean; // Drawing call parameters (parsed from the details JSON by common.h, not part of MolDrawOptions)
891
- /** Caption text to display below the molecule (distinct from legendFontSize/legendColour which control its appearance) */
892
- legend: string; /** Panel width in pixels for multi-panel or grid drawings */
893
- panelWidth: number; /** Panel height in pixels for multi-panel or grid drawings */
894
- panelHeight: number; /** Disable freetype font rendering and use the built-in font instead */
895
- noFreetype: boolean; /** Pre-kekulize the molecule before drawing */
896
- kekulize: boolean; /** Add chiral hydrogen atoms before drawing */
897
- addChiralHs: boolean; /** Control bond wedging in the drawing */
898
- wedgeBonds: boolean; /** Force use of existing coordinates rather than generating new ones */
899
- forceCoords: boolean; /** Draw wavy bonds for double bonds with unspecified stereo */
1130
+ drawingExtentsInclude: DrawingExtentsInclude;
1131
+ /**
1132
+ * Draw terminal methyl and related groups as CH3
1133
+ */
1134
+ explicitMethyl: boolean;
1135
+ /**
1136
+ * Include radicals in the drawing; can be useful to turn off for reactions and queries
1137
+ */
1138
+ includeRadicals: boolean;
1139
+ /**
1140
+ * When possible, include metadata about molecules and reactions in the output to allow them to be reconstructed
1141
+ */
1142
+ includeMetadata: boolean;
1143
+ /**
1144
+ * Simulate hand-drawn lines for bonds; when combined with a font like Comic-Sans or Comic-Neue, gives xkcd-like drawings
1145
+ */
1146
+ comicMode: boolean;
1147
+ /**
1148
+ * Multiplier for standard bond width used for variable attachment points
1149
+ */
1150
+ variableBondWidthMultiplier: number;
1151
+ /**
1152
+ * Radius value to use for atoms involved in variable attachment points
1153
+ */
1154
+ variableAtomRadius: number;
1155
+ /**
1156
+ * Colour to use for variable attachment points
1157
+ */
1158
+ variableAttachmentColour: DrawColour;
1159
+ /**
1160
+ * Add a molecule annotation with "ABS" if the chiral flag is set
1161
+ */
1162
+ includeChiralFlagLabel: boolean;
1163
+ /**
1164
+ * If all specified stereocenters are in a single StereoGroup, show a molecule-level annotation instead of the individual labels
1165
+ */
1166
+ simplifiedStereoGroupLabel: boolean;
1167
+ /**
1168
+ * If true, double bonds with unspecified stereo are drawn crossed; potential stereocenters with unspecified stereo are drawn with a wavy bond
1169
+ */
1170
+ unspecifiedStereoIsUnknown: boolean;
1171
+ /**
1172
+ * If true, wedged and dashed bonds are drawn using symbolColour rather than inheriting their colour from the atoms
1173
+ */
1174
+ singleColourWedgeBonds: boolean;
1175
+ /**
1176
+ * If the molecule came from a MolBlock, prefer the wedging information it provides; if false, use RDKit rules
1177
+ */
1178
+ useMolBlockWedging: boolean;
1179
+ /**
1180
+ * Scaling factor used for pixels-to-angstrom conversion when auto scaling is being used
1181
+ */
1182
+ scalingFactor: number;
1183
+ /**
1184
+ * When > 0, sets the baseFontSize for text drawing; reference: default DrawText::baseFontSize is 0.6
1185
+ */
1186
+ baseFontSize: number;
1187
+ /**
1188
+ * When drawing multiple molecules with DrawMolecules, forces them to use the same scale
1189
+ */
1190
+ drawMolsSameScale: boolean;
1191
+ /**
1192
+ * Replace any-atom, any-hetero, any-halo queries with complex query symbols A, Q, X, M, optionally followed by H if hydrogen is included (except for AH, which stays *)
1193
+ */
1194
+ useComplexQueryAtomSymbols: boolean;
1195
+ /**
1196
+ * If true, puts brackets round atom lists in query atoms
1197
+ */
1198
+ bracketsAroundAtomLists: boolean;
1199
+ /**
1200
+ * Atom indices to highlight
1201
+ */
1202
+ atoms: number[];
1203
+ /**
1204
+ * Bond indices to highlight
1205
+ */
1206
+ bonds: number[];
1207
+ /**
1208
+ * Per-atom highlight colors, keyed by atom index
1209
+ */
1210
+ highlightAtomColors: Record<number, DrawColour>;
1211
+ /**
1212
+ * Per-bond highlight colors, keyed by bond index
1213
+ */
1214
+ highlightBondColors: Record<number, DrawColour>;
1215
+ /**
1216
+ * Per-atom highlight radii, keyed by atom index
1217
+ */
1218
+ highlightAtomRadii: Record<number, number>;
1219
+ /**
1220
+ * If true, highlighted hetero atoms are drawn in standard colours rather than black
1221
+ */
1222
+ standardColoursForHighlightedAtoms: boolean;
1223
+ // Drawing call parameters (parsed from the details JSON by common.h, not part of MolDrawOptions)
1224
+ /**
1225
+ * Caption text to display below the molecule (distinct from legendFontSize/legendColour which control its appearance)
1226
+ */
1227
+ legend: string;
1228
+ /**
1229
+ * Panel width in pixels for multi-panel or grid drawings
1230
+ */
1231
+ panelWidth: number;
1232
+ /**
1233
+ * Panel height in pixels for multi-panel or grid drawings
1234
+ */
1235
+ panelHeight: number;
1236
+ /**
1237
+ * Disable freetype font rendering and use the built-in font instead
1238
+ */
1239
+ noFreetype: boolean;
1240
+ /**
1241
+ * Pre-kekulize the molecule before drawing
1242
+ */
1243
+ kekulize: boolean;
1244
+ /**
1245
+ * Add chiral hydrogen atoms before drawing
1246
+ */
1247
+ addChiralHs: boolean;
1248
+ /**
1249
+ * Control bond wedging in the drawing
1250
+ */
1251
+ wedgeBonds: boolean;
1252
+ /**
1253
+ * Force use of existing coordinates rather than generating new ones
1254
+ */
1255
+ forceCoords: boolean;
1256
+ /**
1257
+ * Draw wavy bonds for double bonds with unspecified stereo
1258
+ */
900
1259
  wavyBonds: boolean;
901
1260
  /** Return atom drawing coordinates in the output JSON
902
1261
  * IMPORTANT: this changes the output format in the case of get_svg...()
@@ -944,25 +1303,67 @@ type RDKitGetMolOpt = {
944
1303
  removeHs: boolean;
945
1304
  assignStereo: boolean;
946
1305
  mergeQueryHs: boolean;
947
- assignCIPLabels: boolean; /** Assign chiral types from molfile parity flags */
948
- assignChiralTypesFromMolParity: boolean; /** Convert mapped dummy atoms to query atoms */
949
- makeDummiesQueries: boolean; /** Apply strict parsing rules to CXSMILES input */
950
- strictCXSMILES: boolean; /** Apply strict parsing rules to Molfile input (molblock input only) */
951
- strictParsing: boolean; /** Parse aromatic bond type from RDKit JSON input (RDKit JSON input only) */
952
- setAromaticBonds: boolean; /** Apply strict valence check when parsing RDKit JSON input (RDKit JSON input only) */
953
- strictValenceCheck: boolean; /** Parse molecule properties from RDKit JSON input (RDKit JSON input only) */
954
- parseProperties: boolean; /** Parse conformers from RDKit JSON input (RDKit JSON input only) */
1306
+ assignCIPLabels: boolean;
1307
+ /**
1308
+ * Assign chiral types from molfile parity flags
1309
+ */
1310
+ assignChiralTypesFromMolParity: boolean;
1311
+ /**
1312
+ * Convert mapped dummy atoms to query atoms
1313
+ */
1314
+ makeDummiesQueries: boolean;
1315
+ /**
1316
+ * Apply strict parsing rules to CXSMILES input
1317
+ */
1318
+ strictCXSMILES: boolean;
1319
+ /**
1320
+ * Apply strict parsing rules to Molfile input (molblock input only)
1321
+ */
1322
+ strictParsing: boolean;
1323
+ /**
1324
+ * Parse aromatic bond type from RDKit JSON input (RDKit JSON input only)
1325
+ */
1326
+ setAromaticBonds: boolean;
1327
+ /**
1328
+ * Apply strict valence check when parsing RDKit JSON input (RDKit JSON input only)
1329
+ */
1330
+ strictValenceCheck: boolean;
1331
+ /**
1332
+ * Parse molecule properties from RDKit JSON input (RDKit JSON input only)
1333
+ */
1334
+ parseProperties: boolean;
1335
+ /**
1336
+ * Parse conformers from RDKit JSON input (RDKit JSON input only)
1337
+ */
955
1338
  parseConformers: boolean;
956
1339
  };
957
1340
  type RDKitGetMolBlockOptions = {
958
- /** @default true */includeStereo: boolean; /** @default true */
959
- kekulize: boolean; /** @default false */
960
- useMolBlockWedging: boolean; /** @default false */
961
- addChiralHs: boolean; /** @default 'AUTO' */
1341
+ /**
1342
+ * @default true
1343
+ */
1344
+ includeStereo: boolean;
1345
+ /**
1346
+ * @default true
1347
+ */
1348
+ kekulize: boolean;
1349
+ /**
1350
+ * @default false
1351
+ */
1352
+ useMolBlockWedging: boolean;
1353
+ /**
1354
+ * @default false
1355
+ */
1356
+ addChiralHs: boolean;
1357
+ /**
1358
+ * @default 'AUTO'
1359
+ */
962
1360
  forceMDLVersion: 'AUTO' | 'V2000' | 'V3000';
963
1361
  };
964
1362
  type RDKitGetSmilesOptions = {
965
- /** Include stereochemistry and isotope information @default true */doIsomericSmiles: boolean;
1363
+ /**
1364
+ * Include stereochemistry and isotope information @default true
1365
+ */
1366
+ doIsomericSmiles: boolean;
966
1367
  /**
967
1368
  * Kekulize the molecule before generating the SMILES and output
968
1369
  * single/double bonds. NOTE that the output is not canonical and that this
@@ -975,9 +1376,18 @@ type RDKitGetSmilesOptions = {
975
1376
  * is not canonical and the value of the canonical parameter will be ignored.
976
1377
  * @default -1
977
1378
  */
978
- rootedAtAtom: number; /** Generate canonical SMILES @default true */
979
- canonical: boolean; /** Include symbols for all bonds @default false */
980
- allBondsExplicit: boolean; /** Provide hydrogen counts for every atom @default false */
1379
+ rootedAtAtom: number;
1380
+ /**
1381
+ * Generate canonical SMILES @default true
1382
+ */
1383
+ canonical: boolean;
1384
+ /**
1385
+ * Include symbols for all bonds @default false
1386
+ */
1387
+ allBondsExplicit: boolean;
1388
+ /**
1389
+ * Provide hydrogen counts for every atom @default false
1390
+ */
981
1391
  allHsExplicit: boolean;
982
1392
  /**
983
1393
  * Randomize the output order. The resulting SMILES is not canonical and
@@ -986,15 +1396,17 @@ type RDKitGetSmilesOptions = {
986
1396
  */
987
1397
  doRandom: boolean;
988
1398
  };
989
- /** CX extension field names (without the `CX_` prefix) */
1399
+ /**
1400
+ * CX extension field names (without the `CX_` prefix)
1401
+ */
990
1402
  type CxSmilesField = 'NONE' | 'ATOM_LABELS' | 'MOLFILE_VALUES' | 'COORDS' | 'RADICALS' | 'ATOM_PROPS' | 'LINKNODES' | 'ENHANCEDSTEREO' | 'SGROUPS' | 'POLYMER' | 'BOND_CFG' | 'BOND_ATROPISOMER' | 'COORDINATE_BONDS' | 'HYDROGEN_BONDS' | 'ZERO_BONDS' | 'ALL' | 'ALL_BUT_COORDS';
991
1403
  type PropertyPickleOptionsKeys = 'NoProps' // no data pickled, single precision coordinates
992
- | 'MolProps' // only public non computed properties
993
- | 'AtomProps' | 'BondProps' // | 'QueryAtomData' // DEPRECATED, same as AtomProps when set
994
- | 'PrivateProps' | 'ComputedProps' | 'AllProps' // all data pickled
995
- | 'CoordsAsDouble' // save coordinates in double precision
996
- | 'NoConformers';
997
- // do not include conformers or associated properties
1404
+ | 'MolProps' // only public non computed properties
1405
+ | 'AtomProps' | 'BondProps' |
1406
+ // | 'QueryAtomData' // DEPRECATED, same as AtomProps when set
1407
+ 'PrivateProps' | 'ComputedProps' | 'AllProps' // all data pickled
1408
+ | 'CoordsAsDouble' // save coordinates in double precision
1409
+ | 'NoConformers'; // do not include conformers or associated properties
998
1410
  type RDKitGetMCSOptions = {
999
1411
  MaximizeBonds: boolean;
1000
1412
  Threshold: number;
@@ -1033,58 +1445,187 @@ type RDKitMCSResult = {
1033
1445
  smarts: string | string[];
1034
1446
  };
1035
1447
  type RDKitMorganFPOptions = {
1036
- /** @default 2 */radius: number; /** @default 2048 */
1037
- nBits: number; /** @default false */
1038
- useCountSimulation: boolean; /** @default false */
1039
- useChirality: boolean; /** @default true */
1040
- useBondTypes: boolean; /** @default false */
1041
- includeRedundantEnvironments: boolean; /** @default false */
1448
+ /**
1449
+ * @default 2
1450
+ */
1451
+ radius: number;
1452
+ /**
1453
+ * @default 2048
1454
+ */
1455
+ nBits: number;
1456
+ /**
1457
+ * @default false
1458
+ */
1459
+ useCountSimulation: boolean;
1460
+ /**
1461
+ * @default false
1462
+ */
1463
+ useChirality: boolean;
1464
+ /**
1465
+ * @default true
1466
+ */
1467
+ useBondTypes: boolean;
1468
+ /**
1469
+ * @default false
1470
+ */
1471
+ includeRedundantEnvironments: boolean;
1472
+ /**
1473
+ * @default false
1474
+ */
1042
1475
  onlyNonzeroInvariants: boolean;
1043
1476
  };
1044
1477
  type RDKitPatternFPOptions = {
1045
- /** @default 2048 */nBits: number; /** @default false */
1478
+ /**
1479
+ * @default 2048
1480
+ */
1481
+ nBits: number;
1482
+ /**
1483
+ * @default false
1484
+ */
1046
1485
  tautomericFingerprint: boolean;
1047
1486
  };
1048
1487
  type RDKitTopologicalTorsionFPOptions = {
1049
- /** @default 2048 */nBits: number; /** @default false */
1050
- useChirality: boolean; /** @default 4 */
1051
- torsionAtomCount: number; /** @default true */
1488
+ /**
1489
+ * @default 2048
1490
+ */
1491
+ nBits: number;
1492
+ /**
1493
+ * @default false
1494
+ */
1495
+ useChirality: boolean;
1496
+ /**
1497
+ * @default 4
1498
+ */
1499
+ torsionAtomCount: number;
1500
+ /**
1501
+ * @default true
1502
+ */
1052
1503
  useCountSimulation: boolean;
1053
1504
  };
1054
1505
  type RDKitRdkitFpOptions = {
1055
- /** @default 2048 */nBits: number; /** @default 2 */
1056
- nBitsPerHash: number; /** @default 1 */
1057
- minPath: number; /** @default 7 */
1058
- maxPath: number; /** @default true */
1059
- useBondOrder: boolean; /** @default true */
1060
- branchedPaths: boolean; /** @default false */
1061
- useCountSimulation: boolean; /** @default true */
1506
+ /**
1507
+ * @default 2048
1508
+ */
1509
+ nBits: number;
1510
+ /**
1511
+ * @default 2
1512
+ */
1513
+ nBitsPerHash: number;
1514
+ /**
1515
+ * @default 1
1516
+ */
1517
+ minPath: number;
1518
+ /**
1519
+ * @default 7
1520
+ */
1521
+ maxPath: number;
1522
+ /**
1523
+ * @default true
1524
+ */
1525
+ useBondOrder: boolean;
1526
+ /**
1527
+ * @default true
1528
+ */
1529
+ branchedPaths: boolean;
1530
+ /**
1531
+ * @default false
1532
+ */
1533
+ useCountSimulation: boolean;
1534
+ /**
1535
+ * @default true
1536
+ */
1062
1537
  useHs: boolean;
1063
1538
  };
1064
1539
  type RDKitAtomPairFPOptions = {
1065
- /** @default 2048 */nBits: number; /** @default false */
1066
- useChirality: boolean; /** @default 1 */
1067
- minLength: number; /** @default 30 */
1068
- maxLength: number; /** @default true */
1069
- useCountSimulation: boolean; /** @default true */
1540
+ /**
1541
+ * @default 2048
1542
+ */
1543
+ nBits: number;
1544
+ /**
1545
+ * @default false
1546
+ */
1547
+ useChirality: boolean;
1548
+ /**
1549
+ * @default 1
1550
+ */
1551
+ minLength: number;
1552
+ /**
1553
+ * @default 30
1554
+ */
1555
+ maxLength: number;
1556
+ /**
1557
+ * @default true
1558
+ */
1559
+ useCountSimulation: boolean;
1560
+ /**
1561
+ * @default true
1562
+ */
1070
1563
  use2D: boolean;
1071
1564
  };
1072
1565
  type RDKitRemoveHsOptions = {
1073
- /** @default false — hydrogens that have no bonds */removeDegreeZero: boolean; /** @default false — hydrogens with two (or more) bonds */
1074
- removeHigherDegrees: boolean; /** @default false — hydrogens with bonds only to other hydrogens */
1075
- removeOnlyHNeighbors: boolean; /** @default false — hydrogens with non-default isotopes */
1076
- removeIsotopes: boolean; /** @default false — removes isotopic Hs, tracks them via _isotopicHs property */
1077
- removeAndTrackIsotopes: boolean; /** @default false — hydrogens with at least one dummy-atom neighbor */
1078
- removeDummyNeighbors: boolean; /** @default false — hydrogens defining bond stereochemistry */
1079
- removeDefiningBondStereo: boolean; /** @default true — hydrogens with wedged bonds */
1080
- removeWithWedgedBond: boolean; /** @default false — hydrogens with queries defined */
1081
- removeWithQuery: boolean; /** @default true — mapped hydrogens */
1082
- removeMapped: boolean; /** @default true — hydrogens in SubstanceGroups */
1083
- removeInSGroups: boolean; /** @default true — display warnings for Hs that are not removed */
1084
- showWarnings: boolean; /** @default true @deprecated — equivalent of !implicitOnly */
1085
- removeNonimplicit: boolean; /** @default false @deprecated */
1086
- updateExplicitCount: boolean; /** @default false — remove hydrides */
1087
- removeHydrides: boolean; /** @default false — remove Hs bonded to atoms with non-tetrahedral stereochemistry */
1566
+ /**
1567
+ * @default false — hydrogens that have no bonds
1568
+ */
1569
+ removeDegreeZero: boolean;
1570
+ /**
1571
+ * @default false — hydrogens with two (or more) bonds
1572
+ */
1573
+ removeHigherDegrees: boolean;
1574
+ /**
1575
+ * @default false — hydrogens with bonds only to other hydrogens
1576
+ */
1577
+ removeOnlyHNeighbors: boolean;
1578
+ /**
1579
+ * @default false — hydrogens with non-default isotopes
1580
+ */
1581
+ removeIsotopes: boolean;
1582
+ /**
1583
+ * @default false — removes isotopic Hs, tracks them via _isotopicHs property
1584
+ */
1585
+ removeAndTrackIsotopes: boolean;
1586
+ /**
1587
+ * @default false — hydrogens with at least one dummy-atom neighbor
1588
+ */
1589
+ removeDummyNeighbors: boolean;
1590
+ /**
1591
+ * @default false — hydrogens defining bond stereochemistry
1592
+ */
1593
+ removeDefiningBondStereo: boolean;
1594
+ /**
1595
+ * @default true — hydrogens with wedged bonds
1596
+ */
1597
+ removeWithWedgedBond: boolean;
1598
+ /**
1599
+ * @default false — hydrogens with queries defined
1600
+ */
1601
+ removeWithQuery: boolean;
1602
+ /**
1603
+ * @default true — mapped hydrogens
1604
+ */
1605
+ removeMapped: boolean;
1606
+ /**
1607
+ * @default true — hydrogens in SubstanceGroups
1608
+ */
1609
+ removeInSGroups: boolean;
1610
+ /**
1611
+ * @default true — display warnings for Hs that are not removed
1612
+ */
1613
+ showWarnings: boolean;
1614
+ /**
1615
+ * @default true @deprecated — equivalent of !implicitOnly
1616
+ */
1617
+ removeNonimplicit: boolean;
1618
+ /**
1619
+ * @default false @deprecated
1620
+ */
1621
+ updateExplicitCount: boolean;
1622
+ /**
1623
+ * @default false — remove hydrides
1624
+ */
1625
+ removeHydrides: boolean;
1626
+ /**
1627
+ * @default false — remove Hs bonded to atoms with non-tetrahedral stereochemistry
1628
+ */
1088
1629
  removeNontetrahedralNeighbors: boolean;
1089
1630
  };
1090
1631
  type RDKitAlignedCoordsOptions = {
@@ -1128,9 +1669,106 @@ type RDKitGetRgdOptions = {
1128
1669
  chunkSize: number;
1129
1670
  };
1130
1671
  type RDKitGetFragsOptions = {
1131
- /** Whether to sanitize the fragment molecules. @default true */sanitizeFrags: boolean; /** Whether to copy conformers to the fragment molecules. @default true */
1672
+ /**
1673
+ * Whether to sanitize the fragment molecules. @default true
1674
+ */
1675
+ sanitizeFrags: boolean;
1676
+ /**
1677
+ * Whether to copy conformers to the fragment molecules. @default true
1678
+ */
1132
1679
  copyConformers: boolean;
1133
1680
  };
1681
+ // -- Force-field and conformer extras (not in official MinimalLib, see wasm/README.md) --
1682
+ /**
1683
+ * Force field used by a computation. UFF is only used when MMFF94 has no
1684
+ * parameters for the molecule.
1685
+ */
1686
+ type RDKitForceFieldName = 'MMFF94' | 'UFF';
1687
+ type RDKitForceFieldEnergyDetails = {
1688
+ job: 'energy';
1689
+ };
1690
+ type RDKitMinimizeDetails = {
1691
+ job: 'minimize';
1692
+ /**
1693
+ * Maximum number of BFGS iterations. The minimization stops earlier when it converges.
1694
+ * @default 200
1695
+ */
1696
+ maxIterations: number;
1697
+ /**
1698
+ * Record a frame every `snapshotFrequency` iterations. `0` records no intermediate frames.
1699
+ * @default 0
1700
+ */
1701
+ snapshotFrequency: number;
1702
+ /**
1703
+ * Indices of atoms that keep their exact coordinates. At least one atom must stay free.
1704
+ * @default []
1705
+ */
1706
+ fixedAtoms: number[];
1707
+ };
1708
+ /** Details accepted by `JSMol.run_forcefield` */
1709
+ type RDKitForceFieldDetails = RDKitForceFieldEnergyDetails | (Pick<RDKitMinimizeDetails, 'job'> & Partial<Omit<RDKitMinimizeDetails, 'job'>>);
1710
+ type RDKitForceFieldFrame = {
1711
+ /** Force-field energy in kcal/mol */
1712
+ energy: number;
1713
+ /** Flat atom coordinates in Å: `[x0, y0, z0, x1, y1, z1, …]` */
1714
+ positions: number[];
1715
+ };
1716
+ type RDKitForceFieldEnergyResult = {
1717
+ forcefield: RDKitForceFieldName;
1718
+ /** `true` when UFF was used because MMFF94 has no parameters for the molecule */
1719
+ fallback: boolean;
1720
+ /** Force-field energy in kcal/mol */
1721
+ energy: number;
1722
+ };
1723
+ type RDKitMinimizeResult = {
1724
+ forcefield: RDKitForceFieldName;
1725
+ /** `true` when UFF was used because MMFF94 has no parameters for the molecule */
1726
+ fallback: boolean;
1727
+ /** Energy of the starting geometry in kcal/mol */
1728
+ initialEnergy: number;
1729
+ /** Energy of the final geometry in kcal/mol */
1730
+ finalEnergy: number;
1731
+ /** `false` when `maxIterations` was reached before convergence */
1732
+ converged: boolean;
1733
+ /**
1734
+ * Minimization trajectory, in order: the starting geometry, one frame every
1735
+ * `snapshotFrequency` iterations (plus the converged geometry when the minimizer
1736
+ * converges), and the final geometry. Consecutive identical frames are not repeated.
1737
+ */
1738
+ frames: RDKitForceFieldFrame[];
1739
+ };
1740
+ /** Details accepted by `JSMol.generate_conformers` */
1741
+ type RDKitGenerateConformersDetails = {
1742
+ /**
1743
+ * Number of conformers to embed. `0` removes all conformers.
1744
+ * @default 10
1745
+ */
1746
+ count: number;
1747
+ /**
1748
+ * Seed for the random number generator. `-1` uses a random seed.
1749
+ * @default -1
1750
+ */
1751
+ randomSeed: number;
1752
+ /**
1753
+ * Heavy-atom RMSD in Å below which two conformers are considered duplicates and
1754
+ * only one is kept. A negative value disables pruning.
1755
+ * @default -1
1756
+ */
1757
+ pruneRmsThreshold: number;
1758
+ /**
1759
+ * MMFF94 (or UFF) minimization iterations applied to each conformer. `0` disables minimization.
1760
+ * @default 0
1761
+ */
1762
+ minimizeIterations: number;
1763
+ };
1764
+ type RDKitGenerateConformersResult = {
1765
+ /** Number of conformers that were minimized */
1766
+ minimizedCount: number;
1767
+ /** Force field used for minimization, or `null` when no conformer was minimized */
1768
+ forcefield: RDKitForceFieldName | null;
1769
+ /** Flat coordinates in Å of each conformer, in conformer order */
1770
+ conformers: number[][];
1771
+ };
1134
1772
  //#endregion
1135
1773
  //#region src/mol-array.d.ts
1136
1774
  /**
@@ -1142,7 +1780,7 @@ type RDKitGetFragsOptions = {
1142
1780
  * Call {@link delete} (or use the `using` keyword) to delete every `Mol`
1143
1781
  * in the array at once.
1144
1782
  */
1145
- declare class MolArray extends Array<Mol> implements Disposable {
1783
+ export declare class MolArray extends Array<Mol> implements Disposable {
1146
1784
  /** Deletes every Mol in this array */
1147
1785
  delete(): void;
1148
1786
  /** Disposable support — allows use with the `using` keyword */
@@ -1153,30 +1791,52 @@ declare class MolArray extends Array<Mol> implements Disposable {
1153
1791
  type InChI_Flags = 'DoNotAddH' | 'SNon' | 'SRel' | 'SRac' | 'SUCF' | 'ChiralFlagON' | 'ChiralFlagOff' | 'SUU' | 'SLUUD' | 'FixedH' | 'RecMet' | 'KET' | '15T' | 'AuxNone';
1154
1792
  //#endregion
1155
1793
  //#region src/types/rdkit-esm.typings.d.ts
1156
- /** Wrapper-level CX SMILES options with ergonomic `fields` array */
1794
+ /**
1795
+ * Wrapper-level CX SMILES options with ergonomic `fields` array
1796
+ */
1157
1797
  type RDKitGetCxSmilesOptions = RDKitGetSmilesOptions & {
1158
- /** CX extension fields to include. Omit for all fields (default). Empty array for none. */fields: CxSmilesField[]; /** Restore bond direction option. Accepts `true`, `'true'`, or `'clear'`. */
1798
+ /**
1799
+ * CX extension fields to include. Omit for all fields (default). Empty array for none.
1800
+ */
1801
+ fields: CxSmilesField[];
1802
+ /**
1803
+ * Restore bond direction option. Accepts `true`, `'true'`, or `'clear'`.
1804
+ */
1159
1805
  restoreBondDirOption: true | 'true' | 'clear';
1160
1806
  };
1161
1807
  type RDKitGetUint8ArrayOptions = {
1162
- /** Properties to include in the binary export (pickle)
1808
+ /**
1809
+ * Properties to include in the binary export (pickle)
1163
1810
  * @default: when `properties` is omitted, all data properties are included except the computed properties.
1164
1811
  */
1165
1812
  properties: PropertyPickleOptionsKeys[];
1166
1813
  };
1167
1814
  type RDKitConfigureOptions = {
1168
- /** Switch between RDKit's built-in coordinate generator and CoordGen. */preferCoordgen: boolean; /** Use the legacy stereo perception algorithm. */
1169
- useLegacyStereoPerception: boolean; /** Perceive chirality on non-tetrahedral stereocenters (square-planar, trigonal-bipyramidal, etc.). */
1815
+ /**
1816
+ * Switch between RDKit's built-in coordinate generator and CoordGen.
1817
+ */
1818
+ preferCoordgen: boolean;
1819
+ /**
1820
+ * Use the legacy stereo perception algorithm.
1821
+ */
1822
+ useLegacyStereoPerception: boolean;
1823
+ /**
1824
+ * Perceive chirality on non-tetrahedral stereocenters (square-planar, trigonal-bipyramidal, etc.).
1825
+ */
1170
1826
  allowNonTetrahedralChirality: boolean;
1171
1827
  /** When true, RDKit error messages also appear in the console (uses set_log_tee).
1172
1828
  * Default: false (capture-only when a fail listener is set). */
1173
1829
  enableLogging: boolean;
1174
1830
  };
1175
1831
  type RDKitParseOperation = 'getMol' | 'getQMol' | 'getRxn';
1832
+ /** `Mol` computations that report failures through the error listener */
1833
+ type RDKitMolOperation = 'getForceFieldEnergy' | 'minimize' | 'generateConformers';
1834
+ type RDKitOperation = RDKitParseOperation | RDKitMolOperation;
1176
1835
  type RDKitParseErrorEvent = {
1836
+ /** Parsed input for parse operations; the molecule's SMILES for `Mol` operations */
1177
1837
  input: string | Uint8Array;
1178
1838
  message: string;
1179
- operation: RDKitParseOperation;
1839
+ operation: RDKitOperation;
1180
1840
  };
1181
1841
  type RDKitFailCallback = (event: RDKitParseErrorEvent) => void;
1182
1842
  type RDKitEvents = {
@@ -1191,8 +1851,15 @@ type RDKitGetQMolOptions = {
1191
1851
  type RDKitGetRxnOptions = RDKitRxnDetails & {
1192
1852
  throwOnError: boolean;
1193
1853
  };
1854
+ type RDKitGetSVGOptions = Omit<RDKitDepictionDetails, 'returnDrawCoords'>;
1194
1855
  type RDKitMmpaFragsOptions = {
1195
- /** Minimum number of bonds to simultaneously cut. */minCuts: number; /** Maximum number of bonds to simultaneously cut. */
1856
+ /**
1857
+ * Minimum number of bonds to simultaneously cut.
1858
+ */
1859
+ minCuts: number;
1860
+ /**
1861
+ * Maximum number of bonds to simultaneously cut.
1862
+ */
1196
1863
  maxCuts: number;
1197
1864
  /**
1198
1865
  * Fragmentation is aborted when the molecule has more cuttable bonds
@@ -1236,9 +1903,42 @@ type SubstructLibrarySearchOptions = {
1236
1903
  maxResults?: number;
1237
1904
  };
1238
1905
  type RDKitCondenseAbbreviationsOptions = {
1239
- /** @default 0.4 */maxCoverage: number; /** @default false */
1906
+ /**
1907
+ * @default 0.4
1908
+ */
1909
+ maxCoverage: number;
1910
+ /**
1911
+ * @default false
1912
+ */
1240
1913
  useLinkers: boolean;
1241
1914
  };
1915
+ type RDKitForceFieldEnergyOptions = {
1916
+ throwOnError: boolean;
1917
+ };
1918
+ type RDKitMinimizeOptions = Omit<RDKitMinimizeDetails, 'job'> & {
1919
+ throwOnError: boolean;
1920
+ };
1921
+ type RDKitMinimizationFrame = {
1922
+ /** Force-field energy in kcal/mol */
1923
+ energy: number;
1924
+ /** Atom coordinates in Å, in the same shape as `Mol.getCoords()` */
1925
+ coords: [number, number, number][];
1926
+ };
1927
+ type RDKitMinimization = Omit<RDKitMinimizeResult, 'frames'> & {
1928
+ /**
1929
+ * Minimization trajectory, in order: the starting geometry, one frame every
1930
+ * `snapshotFrequency` iterations (plus the converged geometry when the minimizer
1931
+ * converges), and the final geometry. Consecutive identical frames are not repeated.
1932
+ */
1933
+ frames: RDKitMinimizationFrame[];
1934
+ };
1935
+ type RDKitGenerateConformersOptions = RDKitGenerateConformersDetails & {
1936
+ throwOnError: boolean;
1937
+ };
1938
+ type RDKitConformers = Omit<RDKitGenerateConformersResult, 'conformers'> & {
1939
+ /** Atom coordinates in Å of each conformer, in the same shape as `Mol.getCoords()` */
1940
+ conformers: [number, number, number][][];
1941
+ };
1242
1942
  //#endregion
1243
1943
  //#region src/fingerprints/fingerprints.types.d.ts
1244
1944
  type FingerprintType = 'Morgan' | 'Pattern' | 'AtomPair' | 'TopologicalTorsion' | 'RDKit' | 'MACCS';
@@ -1250,7 +1950,7 @@ type TverskySimilarityOptions = {
1250
1950
  };
1251
1951
  //#endregion
1252
1952
  //#region src/fingerprints/fingerprint.d.ts
1253
- declare class Fingerprint {
1953
+ export declare class Fingerprint {
1254
1954
  readonly nBits: number;
1255
1955
  readonly fpU32: Uint32Array;
1256
1956
  readonly fpU8: Uint8Array;
@@ -1282,9 +1982,13 @@ type MMPAFragmentation = {
1282
1982
  sidechains: Mol;
1283
1983
  };
1284
1984
  type RDKitMmpaFragsResult = {
1285
- /** Core fragments. */cores: MolArray; /** Sidechains fragments. */
1286
- sidechains: MolArray; /** Number of fragmentations. */
1287
- readonly length: number; /** Iterate over fragmentations by index. */
1985
+ /** Core fragments. */
1986
+ cores: MolArray;
1987
+ /** Sidechains fragments. */
1988
+ sidechains: MolArray;
1989
+ /** Number of fragmentations. */
1990
+ readonly length: number;
1991
+ /** Iterate over fragmentations by index. */
1288
1992
  [Symbol.iterator](): Iterator<MMPAFragmentation>;
1289
1993
  delete(): void;
1290
1994
  [Symbol.dispose](): void;
@@ -1303,7 +2007,7 @@ type RDKitMmpaFragsResult = {
1303
2007
  * // mol is automatically deleted when the scope exits
1304
2008
  * ```
1305
2009
  */
1306
- declare class Mol implements Disposable {
2010
+ export declare class Mol implements Disposable {
1307
2011
  protected _jsMol: JSMol | null;
1308
2012
  protected module: RDKitModule;
1309
2013
  constructor(jsMol: JSMol, module: RDKitModule);
@@ -1377,7 +2081,11 @@ declare class Mol implements Disposable {
1377
2081
  * // With atom highlighting
1378
2082
  * const svg = mol.getSVG({ atoms: [0, 1, 2], highlightColour: [1, 0, 0, 1] });
1379
2083
  */
1380
- getSVG(options?: Partial<RDKitDepictionDetails>): string;
2084
+ getSVG(options?: Partial<RDKitGetSVGOptions>): string;
2085
+ getSVGWithDrawCoords(options?: Partial<RDKitGetSVGOptions>): {
2086
+ svg: string;
2087
+ drawCoords: [number, number][];
2088
+ };
1381
2089
  /**
1382
2090
  * Returns the first substructure match
1383
2091
  *
@@ -1445,8 +2153,6 @@ declare class Mol implements Disposable {
1445
2153
  includePrivate?: boolean;
1446
2154
  includeComputed?: boolean;
1447
2155
  }): Map<string, any>;
1448
- /** Returns true if the molecule's structure is valid */
1449
- isValid(): boolean;
1450
2156
  /** Returns the number of atoms in the molecule */
1451
2157
  get numAtoms(): number;
1452
2158
  /** Returns the number of heavy atoms in the molecule (excluding hydrogens and dummy atoms) */
@@ -1485,6 +2191,65 @@ declare class Mol implements Disposable {
1485
2191
  offset: [number, number, number];
1486
2192
  }): void;
1487
2193
  zipWith(other: Mol, options?: RDKitMolZipOptions): void;
2194
+ /**
2195
+ * Runs a force-field or conformer extra and parses its JSON result.
2196
+ * An empty result means failure: the reason is reported through the logger.
2197
+ */
2198
+ private runExtra;
2199
+ /**
2200
+ * Computes the force-field energy of the first conformer with MMFF94,
2201
+ * falling back to UFF when MMFF94 has no parameters for the molecule.
2202
+ *
2203
+ * @remarks Add explicit hydrogens first (`addHsInPlace()`), otherwise RDKit logs a
2204
+ * warning and the energy is not physically meaningful.
2205
+ *
2206
+ * @returns The energy in kcal/mol and the force field used, or null on failure
2207
+ * (e.g. the molecule has no coordinates).
2208
+ * Pass `{ throwOnError: true }` to throw a {@link RDKitOperationError} instead.
2209
+ */
2210
+ getForceFieldEnergy(): RDKitForceFieldEnergyResult | null;
2211
+ getForceFieldEnergy(options: Partial<RDKitForceFieldEnergyOptions> & {
2212
+ throwOnError: true;
2213
+ }): RDKitForceFieldEnergyResult;
2214
+ getForceFieldEnergy(options?: Partial<RDKitForceFieldEnergyOptions>): RDKitForceFieldEnergyResult | null;
2215
+ /**
2216
+ * Minimizes the first conformer with MMFF94, falling back to UFF when MMFF94 has
2217
+ * no parameters for the molecule. The conformer is updated in place.
2218
+ *
2219
+ * @remarks
2220
+ * - Add explicit hydrogens first (`addHsInPlace()`), otherwise RDKit logs a warning.
2221
+ * - 2D coordinates are accepted, but a perfectly flat structure stays flat:
2222
+ * there is no force out of the plane. Use `generateConformers()` to get 3D coordinates.
2223
+ *
2224
+ * @param options - Minimization options
2225
+ * @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).
2227
+ * Pass `{ throwOnError: true }` to throw a {@link RDKitOperationError} instead.
2228
+ */
2229
+ minimize(): RDKitMinimization | null;
2230
+ minimize(options: Partial<RDKitMinimizeOptions> & {
2231
+ throwOnError: true;
2232
+ }): RDKitMinimization;
2233
+ minimize(options?: Partial<RDKitMinimizeOptions>): RDKitMinimization | null;
2234
+ /**
2235
+ * Replaces the molecule's conformers with 3D conformers embedded with ETKDGv3,
2236
+ * optionally minimized with MMFF94 (or UFF).
2237
+ *
2238
+ * @remarks
2239
+ * - Add explicit hydrogens first (`addHsInPlace()`), otherwise RDKit logs a warning.
2240
+ * - All conformers are kept on the molecule, but `getCoords()`, `getMolblock()` and
2241
+ * `minimize()` only use the first one. All of them are returned here and in `getJSON()`.
2242
+ *
2243
+ * @param options - Embedding options
2244
+ * @returns The coordinates of each conformer, or null on failure
2245
+ * (e.g. the molecule cannot be embedded).
2246
+ * Pass `{ throwOnError: true }` to throw a {@link RDKitOperationError} instead.
2247
+ */
2248
+ generateConformers(): RDKitConformers | null;
2249
+ generateConformers(options: Partial<RDKitGenerateConformersOptions> & {
2250
+ throwOnError: true;
2251
+ }): RDKitConformers;
2252
+ generateConformers(options?: Partial<RDKitGenerateConformersOptions>): RDKitConformers | null;
1488
2253
  /**
1489
2254
  * Generates new 2D coordinates for the molecule
1490
2255
  * @param useCoordGen - Use the CoordGen algorithm
@@ -1519,7 +2284,7 @@ declare class Mol implements Disposable {
1519
2284
  * @param options - Abbreviation options
1520
2285
  */
1521
2286
  condenseAbbreviations(options?: Partial<RDKitCondenseAbbreviationsOptions>): RDKitSubstructMatch;
1522
- drawToCanvas(canvas: HTMLCanvasElement, options?: Partial<RDKitDepictionDetails>): void;
2287
+ drawToCanvas(canvas: HTMLCanvasElement, options?: Partial<RDKitGetSVGOptions>): void;
1523
2288
  /**
1524
2289
  * Returns the disconnected fragments of the molecule
1525
2290
  * @warning The `mols` array contains new `Mol` instances that must be
@@ -1575,7 +2340,7 @@ declare class Mol implements Disposable {
1575
2340
  * const products = rxn.runReactants(['CO']);
1576
2341
  * ```
1577
2342
  */
1578
- declare class Reaction implements Disposable {
2343
+ export declare class Reaction implements Disposable {
1579
2344
  protected _jsReaction: JSReaction | null;
1580
2345
  protected module: RDKitModule;
1581
2346
  constructor(jsReaction: JSReaction, module: RDKitModule);
@@ -1625,8 +2390,11 @@ declare class Reaction implements Disposable {
1625
2390
  //#endregion
1626
2391
  //#region src/substruct-library.d.ts
1627
2392
  type SubstructLibraryEntry = {
1628
- /** Index in the library */index: number; /** RDKit-canonical SMILES */
1629
- smiles: string; /** Pattern fingerprint used for pre-screening */
2393
+ /** Index in the library */
2394
+ index: number;
2395
+ /** RDKit-canonical SMILES */
2396
+ smiles: string;
2397
+ /** Pattern fingerprint used for pre-screening */
1630
2398
  patternFp: Fingerprint;
1631
2399
  /**
1632
2400
  * Lazily creates a Mol from the stored SMILES.
@@ -1641,8 +2409,11 @@ type SubstructLibraryEntry = {
1641
2409
  };
1642
2410
  /** Result of a {@link SubstructLibraryWrapper.getMatches} call */
1643
2411
  type SubstructLibrarySearchResult = {
1644
- /** Matching molecule indices */readonly indices: Uint32Array; /** Number of matches (same as `indices.length`) */
1645
- readonly count: number; /** Iterate over the matching library entries */
2412
+ /** Matching molecule indices */
2413
+ readonly indices: Uint32Array;
2414
+ /** Number of matches (same as `indices.length`) */
2415
+ readonly count: number;
2416
+ /** Iterate over the matching library entries */
1646
2417
  [Symbol.iterator](): Iterator<SubstructLibraryEntry>;
1647
2418
  };
1648
2419
  /**
@@ -1659,7 +2430,7 @@ type SubstructLibrarySearchResult = {
1659
2430
  * console.log(result.count, Array.from(result.indices));
1660
2431
  * ```
1661
2432
  */
1662
- declare class SubstructLibraryWrapper implements Disposable {
2433
+ export declare class SubstructLibraryWrapper implements Disposable {
1663
2434
  protected readonly lib: SubstructLibrary;
1664
2435
  protected readonly module: RDKitModule;
1665
2436
  /** use {@link RDKit.createSubstructLibraryWrapper} */
@@ -1734,7 +2505,7 @@ declare class RGDResult extends Array<RGDRow> implements Disposable {
1734
2505
  declare const computeFingerprintSimilarity: (a: Fingerprint, b: Fingerprint, metric?: SimilarityMetric, options?: TverskySimilarityOptions) => number;
1735
2506
  //#endregion
1736
2507
  //#region src/logger.d.ts
1737
- declare class RDKitParseError extends Error {
2508
+ export declare class RDKitParseError extends Error {
1738
2509
  readonly input: string | Uint8Array;
1739
2510
  readonly rdkitMessage: string;
1740
2511
  constructor(input: string | Uint8Array, rdkitMessage: string);
@@ -1757,7 +2528,34 @@ declare class RDKitParseError extends Error {
1757
2528
  * }
1758
2529
  * ```
1759
2530
  */
1760
- declare const isRDKitParseError: (error: unknown) => error is RDKitParseError;
2531
+ export declare const isRDKitParseError: (error: unknown) => error is RDKitParseError;
2532
+ /**
2533
+ * Error thrown when a computation on an existing molecule fails
2534
+ * (e.g. force-field minimization or conformer generation) and `throwOnError` is set.
2535
+ */
2536
+ export declare class RDKitOperationError extends Error {
2537
+ readonly operation: RDKitMolOperation;
2538
+ /** SMILES of the molecule the operation was run on */
2539
+ readonly input: string;
2540
+ readonly rdkitMessage: string;
2541
+ constructor(operation: RDKitMolOperation, input: string, rdkitMessage: string);
2542
+ }
2543
+ /**
2544
+ * Type guard for RDKitOperationError.
2545
+ * @param error The error to check.
2546
+ * @returns True if the error is an instance of RDKitOperationError, false otherwise.
2547
+ * @example
2548
+ * ```ts
2549
+ * try {
2550
+ * mol.minimize({ throwOnError: true });
2551
+ * } catch (e) {
2552
+ * if (isRDKitOperationError(e)) {
2553
+ * console.error(`${e.operation} failed:`, e.rdkitMessage);
2554
+ * }
2555
+ * }
2556
+ * ```
2557
+ */
2558
+ export declare const isRDKitOperationError: (error: unknown) => error is RDKitOperationError;
1761
2559
  /**
1762
2560
  * RDKitLogger manages RDKit error capture and dispatch to listeners, as well as optional console logging.
1763
2561
  */
@@ -1777,15 +2575,17 @@ declare class RDKitLogger {
1777
2575
  /** Single callback slot — replaces any previous. Returns cleanup function. */
1778
2576
  addCallback(fn: RDKitFailCallback): () => void;
1779
2577
  /**
1780
- * Call before each WASM parse operation.
2578
+ * Call before each WASM operation that can fail.
1781
2579
  * Stores throwOnError state, activates capture if needed, clears the buffer.
1782
2580
  * Fast path: no-op when neither throwOnError nor capture is active.
1783
2581
  */
1784
2582
  reset(throwOnError: boolean): void;
1785
2583
  /**
1786
- * Call on null return from WASM. Reads buffer, fires callback, throws if throwOnError.
2584
+ * Call on a failed WASM operation. Reads buffer, fires callback, throws if throwOnError:
2585
+ * `RDKitParseError` for parse operations, `RDKitOperationError` otherwise.
1787
2586
  * No-op when reset() took the fast path (capture still null).
1788
2587
  */
2588
+ handleError(input: string, operation: RDKitMolOperation): void;
1789
2589
  handleError(input: string | Uint8Array, operation: RDKitParseOperation): void;
1790
2590
  }
1791
2591
  //#endregion
@@ -1818,7 +2618,7 @@ interface MCSResult extends Disposable {
1818
2618
  * const mol = rdkit.getMol('c1ccccc1');
1819
2619
  * ```
1820
2620
  */
1821
- declare class RDKit {
2621
+ export declare class RDKit {
1822
2622
  protected readonly mod: RDKitModule;
1823
2623
  protected readonly logger: RDKitLogger;
1824
2624
  readonly events: RDKitEvents;
@@ -1832,7 +2632,8 @@ declare class RDKit {
1832
2632
  * @returns A Mol instance, or null if the input is invalid.
1833
2633
  * Pass `{ throwOnError: true }` to throw a {@link RDKitParseError} instead.
1834
2634
  */
1835
- getMol(input: string | Uint8Array, options?: Partial<RDKitGetMolOptions> & {
2635
+ getMol(input: string | Uint8Array): Mol | null;
2636
+ getMol(input: string | Uint8Array, options: Partial<RDKitGetMolOptions> & {
1836
2637
  throwOnError: true;
1837
2638
  }): Mol;
1838
2639
  getMol(input: string | Uint8Array, options?: Partial<RDKitGetMolOptions>): Mol | null;
@@ -1843,7 +2644,8 @@ declare class RDKit {
1843
2644
  * @returns A Mol instance, or null if the input is invalid.
1844
2645
  * Pass `{ throwOnError: true }` to throw a {@link RDKitParseError} instead.
1845
2646
  */
1846
- getQMol(input: string, options?: Partial<RDKitGetQMolOptions> & {
2647
+ getQMol(input: string): Mol | null;
2648
+ getQMol(input: string, options: Partial<RDKitGetQMolOptions> & {
1847
2649
  throwOnError: true;
1848
2650
  }): Mol;
1849
2651
  getQMol(input: string, options?: Partial<RDKitGetQMolOptions>): Mol | null;
@@ -1945,7 +2747,7 @@ interface InitRDKitOptions {
1945
2747
  * };
1946
2748
  * ```
1947
2749
  */
1948
- declare function initRDKit(options?: Partial<InitRDKitOptions>): Promise<RDKit>;
1949
- declare function initRDKit<T extends typeof RDKit>(options: Partial<InitRDKitOptions> | undefined, constructor: T): Promise<InstanceType<T>>;
2750
+ export declare function initRDKit(options?: Partial<InitRDKitOptions>): Promise<RDKit>;
2751
+ export declare function initRDKit<T extends typeof RDKit>(options: Partial<InitRDKitOptions> | undefined, constructor: T): Promise<InstanceType<T>>;
1950
2752
  //#endregion
1951
- export { type ColourPalette, type ColourPaletteName, type DrawColour, type DrawingExtentsInclude, Fingerprint, type InitRDKitOptions, type JSMol, type JSReaction, type MCSResult, type MMPAFragmentation, Mol, MolArray, type MolList, RDKit, type RDKitAlignedCoordsOptions, type RDKitAtomPairFPOptions, type RDKitConfigureOptions, type RDKitDepictionDetails, type RDKitDescriptors, type RDKitEvents, type RDKitFailCallback, type RDKitGetFragsOptions, type RDKitGetMCSOptions, type RDKitGetMolBlockOptions, type RDKitGetMolOpt, type RDKitGetMolOptions, type RDKitGetQMolOptions, type RDKitGetRgdOptions, type RDKitGetRxnOptions, type RDKitGetSmilesOptions, type RDKitJson, type RDKitJsonAtom, type RDKitJsonBond, type RDKitJsonConformer2D, type RDKitJsonConformer3D, type RDKitJsonExtension, type RDKitJsonMolecule, type RDKitMCSResult, type RDKitMmpaFragsOptions, type RDKitMmpaFragsResult, type RDKitModule, type RDKitMorganFPOptions, RDKitParseError, type RDKitParseErrorEvent, type RDKitParseOperation, type RDKitPatternFPOptions, type RDKitRdkitFpOptions, type RDKitRemoveHsOptions, type RDKitRxnDetails, type RDKitSanitizeFlags, type RDKitStereoTags, type RDKitSubstructMatch, type RDKitTopologicalTorsionFPOptions, type RGDRow, Reaction, type SimilarityMetric, type SubstructLibraryAddOptions, type SubstructLibraryEntry, type SubstructLibraryOptions, type SubstructLibrarySearchOptions, type SubstructLibrarySearchResult, SubstructLibraryWrapper, type TverskySimilarityOptions, initRDKit, isRDKitParseError };
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 };