openchemlib 9.22.1 → 9.24.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.
@@ -246,6 +246,17 @@ export interface Rectangle {
246
246
  height: number;
247
247
  }
248
248
 
249
+ export interface Coordinates {
250
+ /** X-coordinate. */
251
+ x: number;
252
+
253
+ /** Y-coordinate. */
254
+ y: number;
255
+
256
+ /** Z-coordinate. */
257
+ z: number;
258
+ }
259
+
249
260
  export declare class Molecule {
250
261
  /**
251
262
  * Construct a new molecule.
@@ -1804,6 +1815,33 @@ export declare class Molecule {
1804
1815
 
1805
1816
  scaleCoords(f: number): void;
1806
1817
 
1818
+ /**
1819
+ * Returns a copy of the atom's 3D coordinates. Mutating it does not change the
1820
+ * molecule; use `setCoordinates` (or `setAtomX`/`setAtomY`/`setAtomZ`) to
1821
+ * write the values back.
1822
+ */
1823
+ getCoordinates(atom: number): Coordinates;
1824
+
1825
+ setCoordinates(atom: number, coordinates: Coordinates): void;
1826
+
1827
+ /**
1828
+ * 3D translation of every atom by a `{ x, y, z }` vector (`translateCoords` is
1829
+ * 2D and ignores z).
1830
+ */
1831
+ translate(coordinates: Coordinates): void;
1832
+
1833
+ /**
1834
+ * Rotates every atom in 3D by a 3x3 matrix. OpenChemLib uses the row-vector
1835
+ * convention: `x' = x*m[0][0] + y*m[1][0] + z*m[2][0]` (and likewise for y, z).
1836
+ */
1837
+ rotate(matrix: number[][]): void;
1838
+
1839
+ /** Translate the molecule so its center of gravity is at the origin. */
1840
+ center(): void;
1841
+
1842
+ /** Center of gravity (all atoms with equal weight); `{ x: 0, y: 0, z: 0 }` if there are no atoms. */
1843
+ getCenterOfGravity(): Coordinates;
1844
+
1807
1845
  zoomAndRotateInit(x: number, y: number): void;
1808
1846
 
1809
1847
  zoomAndRotate(zoom: number, angle: number, selected: boolean): void;
@@ -3617,6 +3655,60 @@ export declare class SSSearcherWithIndex {
3617
3655
  createIndex(molecule: Molecule): number[];
3618
3656
  }
3619
3657
 
3658
+ export type MCSRingMatchMode =
3659
+ | 'cleaveRings'
3660
+ | 'keepRings'
3661
+ | 'keepAromaticRings';
3662
+
3663
+ export interface MCSOptions {
3664
+ /**
3665
+ * How rings of the fragment are handled when building common substructures.
3666
+ * - `cleaveRings`: rings may be broken, so a partial ring can be part of the result.
3667
+ * - `keepRings`: a ring is only kept if it is entirely part of the common substructure.
3668
+ * - `keepAromaticRings`: same as `keepRings` but restricted to aromatic rings.
3669
+ * @default 'cleaveRings'
3670
+ */
3671
+ ringMatchMode?: MCSRingMatchMode;
3672
+ }
3673
+
3674
+ /**
3675
+ * Computes the maximum common substructure (MCS) between two molecules.
3676
+ */
3677
+ export declare class MCS {
3678
+ /**
3679
+ * Creates a new maximum common substructure finder.
3680
+ */
3681
+ constructor(options?: MCSOptions);
3682
+
3683
+ /**
3684
+ * Sets the pair of molecules to compare. `molecule` should contain at least
3685
+ * as many bonds as `fragment`. If `fragment` contains more than one disconnected
3686
+ * structure, only the biggest one is considered.
3687
+ * @param molecule - the (usually larger) target molecule.
3688
+ * @param fragment - the molecule whose common substructure with `molecule` is searched.
3689
+ */
3690
+ set(molecule: Molecule, fragment: Molecule): void;
3691
+
3692
+ /**
3693
+ * Returns the maximum common substructure as a `Molecule`, or `null` if no
3694
+ * common substructure was found.
3695
+ */
3696
+ getMCS(): Molecule | null;
3697
+
3698
+ /**
3699
+ * Returns the score of the maximum common substructure, defined as the number
3700
+ * of bonds of the MCS divided by the larger bond count of the two input molecules.
3701
+ * `getMCS()` (or `getAllCommonSubstructures()`) must be called first.
3702
+ */
3703
+ getScore(): number;
3704
+
3705
+ /**
3706
+ * Returns all distinct common substructures (the largest first), or `null` if
3707
+ * none was found.
3708
+ */
3709
+ getAllCommonSubstructures(): Molecule[] | null;
3710
+ }
3711
+
3620
3712
  export declare class Transformer {
3621
3713
  constructor(reactant: Molecule, product: Molecule, name: string);
3622
3714
  setMolecule(molecule: Molecule, countMode: number): number;