/** * Copyright (c) 2019-2024 Mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose * @author David Sehnal */ import { CustomPropertyDescriptor } from '../../../../mol-model/custom-property.js'; import { IntAdjacencyGraph } from '../../../../mol-math/graph.js'; import { Column } from '../../../../mol-data/db.js'; import { FormatPropertyProvider } from '../../common/property.js'; import { BondType } from '../../../../mol-model/structure/model/types.js'; import { ElementIndex } from '../../../../mol-model/structure.js'; export type IndexPairsProps = { readonly key: ArrayLike; readonly operatorA: ArrayLike; readonly operatorB: ArrayLike; readonly order: ArrayLike; readonly distance: ArrayLike; readonly flag: ArrayLike; }; export type IndexPairs = IntAdjacencyGraph; export type IndexPairBonds = { bonds: IndexPairs; /** Distance in Angstrom. If negative, element-based threshold is used. */ maxDistance: number; /** Can be cached in `ElementSetIntraBondCache` */ cacheable: boolean; /** Has operatorA & operatorB set for each bond */ hasOperators: boolean; /** Bonds with same operator grouped together */ bySameOperator: Map>; }; export declare namespace IndexPairBonds { const Descriptor: CustomPropertyDescriptor; const Provider: FormatPropertyProvider; type Data = { pairs: { indexA: Column; indexB: Column; key?: Column; /** Operator key for indexA. Used in bond computation. */ operatorA?: Column; /** Operator key for indexB. Used in bond computation. */ operatorB?: Column; order?: Column; /** * Useful for bonds in periodic cells. That is, only bonds within the given * distance are added. This allows for bond between periodic image but * avoids unwanted bonds with wrong distances. If negative, test using the * `maxDistance` option from `Props`. */ distance?: Column; flag?: Column; }; count: number; }; const DefaultProps: { /** * If negative, test using element-based threshold, otherwise distance in Angstrom. * * This option exists to handle bonds in periodic cells. For systems that are * made from beads (as opposed to atomic elements), set to a specific distance. * * Note that `Data` has a `distance` field which allows specifying a distance * for each bond individually which takes precedence over this option. */ maxDistance: number; /** Can be cached in `ElementSetIntraBondCache` */ cacheable: boolean; }; type Props = typeof DefaultProps; function fromData(data: Data, props?: Partial): IndexPairBonds; /** Like `getEdgeIndex` but taking `edgeProps.operatorA` and `edgeProps.operatorB` into account */ function getEdgeIndexForOperators(bonds: IndexPairs, i: ElementIndex, j: ElementIndex, opI: number, opJ: number): number; }