Sfoglia il codice sorgente

renamed 'link' to 'bond' as appropriate

Alexander Rose 5 anni fa
parent
commit
48a75927f6
72 ha cambiato i file con 649 aggiunte e 657 eliminazioni
  1. 18 18
      src/apps/structure-info/model.ts
  2. 2 2
      src/examples/proteopedia-wrapper/coloring.ts
  3. 2 2
      src/mol-math/graph/inter-unit-graph.ts
  4. 3 3
      src/mol-model-formats/structure/mmcif/bonds/comp.ts
  5. 6 6
      src/mol-model-formats/structure/mmcif/bonds/struct_conn.ts
  6. 1 1
      src/mol-model-props/computed/accessible-surface-area/shrake-rupley/radii.ts
  7. 4 4
      src/mol-model-props/computed/chemistry/functional-group.ts
  8. 3 3
      src/mol-model-props/computed/chemistry/util.ts
  9. 21 21
      src/mol-model-props/computed/chemistry/valence-model.ts
  10. 2 2
      src/mol-model/location.ts
  11. 14 14
      src/mol-model/loci.ts
  12. 6 6
      src/mol-model/structure/model/types.ts
  13. 17 17
      src/mol-model/structure/query/context.ts
  14. 38 38
      src/mol-model/structure/query/queries/filters.ts
  15. 37 37
      src/mol-model/structure/query/queries/generators.ts
  16. 3 3
      src/mol-model/structure/query/queries/internal.ts
  17. 43 43
      src/mol-model/structure/query/queries/modifiers.ts
  18. 2 2
      src/mol-model/structure/structure.ts
  19. 4 4
      src/mol-model/structure/structure/carbohydrates/compute.ts
  20. 3 3
      src/mol-model/structure/structure/structure.ts
  21. 8 8
      src/mol-model/structure/structure/unit.ts
  22. 50 50
      src/mol-model/structure/structure/unit/bonds.ts
  23. 2 2
      src/mol-model/structure/structure/unit/bonds/common.ts
  24. 11 11
      src/mol-model/structure/structure/unit/bonds/data.ts
  25. 17 17
      src/mol-model/structure/structure/unit/bonds/inter-compute.ts
  26. 12 12
      src/mol-model/structure/structure/unit/bonds/intra-compute.ts
  27. 6 6
      src/mol-model/structure/structure/unit/rings/compute.ts
  28. 3 3
      src/mol-plugin/behavior/dynamic/selection/structure-representation-interaction.ts
  29. 3 3
      src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts
  30. 7 7
      src/mol-plugin/util/structure-selection-helper.ts
  31. 2 2
      src/mol-repr/structure/complex-representation.ts
  32. 7 7
      src/mol-repr/structure/representation/ball-and-stick.ts
  33. 8 8
      src/mol-repr/structure/representation/ellipsoid.ts
  34. 2 2
      src/mol-repr/structure/units-representation.ts
  35. 34 34
      src/mol-repr/structure/visual/bond-inter-unit-cylinder.ts
  36. 36 36
      src/mol-repr/structure/visual/bond-intra-unit-cylinder.ts
  37. 14 14
      src/mol-repr/structure/visual/carbohydrate-link-cylinder.ts
  38. 15 15
      src/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.ts
  39. 14 14
      src/mol-repr/structure/visual/cross-link-restraint-cylinder.ts
  40. 15 15
      src/mol-repr/structure/visual/interactions-intra-unit-cylinder.ts
  41. 0 8
      src/mol-repr/structure/visual/polymer-gap-cylinder.ts
  42. 29 29
      src/mol-repr/structure/visual/util/bond.ts
  43. 7 7
      src/mol-repr/structure/visual/util/polymer.ts
  44. 25 25
      src/mol-script/language/symbol-table/structure-query.ts
  45. 21 21
      src/mol-script/runtime/query/table.ts
  46. 3 3
      src/mol-script/script/mol-script/examples.ts
  47. 11 11
      src/mol-script/script/mol-script/symbols.ts
  48. 2 2
      src/mol-theme/color/carbohydrate-symbol.ts
  49. 2 2
      src/mol-theme/color/chain-id.ts
  50. 3 3
      src/mol-theme/color/cross-link.ts
  51. 2 2
      src/mol-theme/color/element-index.ts
  52. 2 2
      src/mol-theme/color/element-symbol.ts
  53. 2 2
      src/mol-theme/color/entity-source.ts
  54. 2 2
      src/mol-theme/color/hydrophobicity.ts
  55. 2 2
      src/mol-theme/color/illustrative.ts
  56. 2 2
      src/mol-theme/color/interaction-type.ts
  57. 2 2
      src/mol-theme/color/model-index.ts
  58. 2 2
      src/mol-theme/color/molecule-type.ts
  59. 2 2
      src/mol-theme/color/occupancy.ts
  60. 2 2
      src/mol-theme/color/operator-hkl.ts
  61. 2 2
      src/mol-theme/color/operator-name.ts
  62. 2 2
      src/mol-theme/color/polymer-id.ts
  63. 2 2
      src/mol-theme/color/polymer-index.ts
  64. 2 2
      src/mol-theme/color/residue-name.ts
  65. 2 2
      src/mol-theme/color/secondary-structure.ts
  66. 2 2
      src/mol-theme/color/sequence-id.ts
  67. 2 2
      src/mol-theme/color/uncertainty.ts
  68. 2 2
      src/mol-theme/color/unit-index.ts
  69. 7 7
      src/mol-theme/label.ts
  70. 2 2
      src/mol-theme/size/physical.ts
  71. 2 2
      src/mol-theme/size/uncertainty.ts
  72. 4 4
      src/perf-tests/structure.ts

+ 18 - 18
src/apps/structure-info/model.ts

@@ -65,14 +65,14 @@ export function printSecStructure(model: Model) {
     }
 }
 
-export function printLinks(structure: Structure, showIntra: boolean, showInter: boolean) {
+export function printBonds(structure: Structure, showIntra: boolean, showInter: boolean) {
     if (showIntra) {
-        console.log('\nIntra Unit Links\n=============');
+        console.log('\nIntra Unit Bonds\n=============');
         for (const unit of structure.units) {
             if (!Unit.isAtomic(unit)) continue;
 
             const elements = unit.elements;
-            const { a, b, edgeCount } = unit.links;
+            const { a, b, edgeCount } = unit.bonds;
             const { model } = unit;
 
             if (!edgeCount) continue;
@@ -86,20 +86,20 @@ export function printLinks(structure: Structure, showIntra: boolean, showInter:
     }
 
     if (showInter) {
-        console.log('\nInter Unit Links\n=============');
-        const links = structure.interUnitBonds;
+        console.log('\nInter Unit Bonds\n=============');
+        const bonds = structure.interUnitBonds;
         for (const unit of structure.units) {
             if (!Unit.isAtomic(unit)) continue;
 
-            for (const pairLinks of links.getLinkedUnits(unit)) {
-                if (!pairLinks.areUnitsOrdered || pairLinks.edgeCount === 0) continue;
+            for (const pairBonds of bonds.getConnectedUnits(unit)) {
+                if (!pairBonds.areUnitsOrdered || pairBonds.edgeCount === 0) continue;
 
-                const { unitA, unitB } = pairLinks;
-                console.log(`${pairLinks.unitA.id} - ${pairLinks.unitB.id}: ${pairLinks.edgeCount} bond(s)`);
+                const { unitA, unitB } = pairBonds;
+                console.log(`${pairBonds.unitA.id} - ${pairBonds.unitB.id}: ${pairBonds.edgeCount} bond(s)`);
 
-                for (const aI of pairLinks.connectedIndices) {
-                    for (const link of pairLinks.getEdges(aI)) {
-                        console.log(`${atomLabel(unitA.model, unitA.elements[aI])} -- ${atomLabel(unitB.model, unitB.elements[link.indexB])}`);
+                for (const aI of pairBonds.connectedIndices) {
+                    for (const bond of pairBonds.getEdges(aI)) {
+                        console.log(`${atomLabel(unitA.model, unitA.elements[aI])} -- ${atomLabel(unitB.model, unitB.elements[bond.indexB])}`);
                     }
                 }
             }
@@ -214,8 +214,8 @@ async function run(frame: CifFrame, args: Args) {
     if (args.units) printUnits(structure);
     if (args.sym) printSymmetryInfo(models[0]);
     if (args.rings) printRings(structure);
-    if (args.intraLinks) printLinks(structure, true, false);
-    if (args.interLinks) printLinks(structure, false, true);
+    if (args.intraBonds) printBonds(structure, true, false);
+    if (args.interBonds) printBonds(structure, false, true);
     if (args.mod) printModRes(models[0]);
     if (args.sec) printSecStructure(models[0]);
 }
@@ -242,8 +242,8 @@ parser.addArgument(['--seq'], { help: 'print sequence', action: 'storeTrue' });
 parser.addArgument(['--units'], { help: 'print units', action: 'storeTrue' });
 parser.addArgument(['--sym'], { help: 'print symmetry', action: 'storeTrue' });
 parser.addArgument(['--rings'], { help: 'print rings', action: 'storeTrue' });
-parser.addArgument(['--intraLinks'], { help: 'print intra unit links', action: 'storeTrue' });
-parser.addArgument(['--interLinks'], { help: 'print inter unit links', action: 'storeTrue' });
+parser.addArgument(['--intraBonds'], { help: 'print intra unit bonds', action: 'storeTrue' });
+parser.addArgument(['--interBonds'], { help: 'print inter unit bonds', action: 'storeTrue' });
 parser.addArgument(['--mod'], { help: 'print modified residues', action: 'storeTrue' });
 parser.addArgument(['--sec'], { help: 'print secoundary structure', action: 'storeTrue' });
 interface Args {
@@ -256,8 +256,8 @@ interface Args {
     units?: boolean,
     sym?: boolean,
     rings?: boolean,
-    intraLinks?: boolean,
-    interLinks?: boolean,
+    intraBonds?: boolean,
+    interBonds?: boolean,
     mod?: boolean,
     sec?: boolean,
 }

+ 2 - 2
src/examples/proteopedia-wrapper/coloring.ts

@@ -6,7 +6,7 @@
  */
 
 
-import { Unit, StructureProperties, StructureElement, Link } from '../../mol-model/structure';
+import { Unit, StructureProperties, StructureElement, Bond } from '../../mol-model/structure';
 
 import { Color } from '../../mol-util/color';
 import { Location } from '../../mol-model/location';
@@ -71,7 +71,7 @@ export function createProteopediaCustomTheme(colors: number[]) {
                     const asym_id = getAsymId(location.unit);
                     const o = asymIdSerialMap.get(asym_id(location)) || 0;
                     return colors[o % colorCount].color;
-                } else if (Link.isLocation(location)) {
+                } else if (Bond.isLocation(location)) {
                     const asym_id = getAsymId(location.aUnit)
                     l.unit = location.aUnit
                     l.element = location.aUnit.elements[location.aIndex]

+ 2 - 2
src/mol-math/graph/inter-unit-graph.ts

@@ -15,8 +15,8 @@ class InterUnitGraph<Unit extends InterUnitGraph.UnitBase, VertexIndex extends n
     private readonly edgeKeyIndex: Map<string, number>
     private readonly vertexKeyIndex: Map<string, number[]>
 
-    /** Get an array of unit-pair-edges that are linked to the given unit */
-    getLinkedUnits(unit: Unit): ReadonlyArray<InterUnitGraph.UnitPairEdges<Unit, VertexIndex, EdgeProps>> {
+    /** Get an array of unit-pair-edges that are connected to the given unit */
+    getConnectedUnits(unit: Unit): ReadonlyArray<InterUnitGraph.UnitPairEdges<Unit, VertexIndex, EdgeProps>> {
         if (!this.map.has(unit.id)) return emptyArray;
         return this.map.get(unit.id)!;
     }

+ 3 - 3
src/mol-model-formats/structure/mmcif/bonds/comp.ts

@@ -6,7 +6,7 @@
  */
 
 import { Model } from '../../../../mol-model/structure/model/model'
-import { LinkType } from '../../../../mol-model/structure/model/types'
+import { BondType } from '../../../../mol-model/structure/model/types'
 import { CustomPropertyDescriptor } from '../../../../mol-model/structure';
 import { mmCIF_Database, mmCIF_Schema } from '../../../../mol-io/reader/cif/schema/mmcif';
 import { CifWriter } from '../../../../mol-io/writer/cif'
@@ -118,9 +118,9 @@ export namespace ComponentBond {
                 entry = compBond.addEntry(id);
             }
 
-            let flags: number = LinkType.Flag.Covalent;
+            let flags: number = BondType.Flag.Covalent;
             let ord = 1;
-            if (aromatic) flags |= LinkType.Flag.Aromatic;
+            if (aromatic) flags |= BondType.Flag.Aromatic;
             switch (order.toLowerCase()) {
                 case 'doub':
                 case 'delo':

+ 6 - 6
src/mol-model-formats/structure/mmcif/bonds/struct_conn.ts

@@ -7,7 +7,7 @@
 
 import { Model } from '../../../../mol-model/structure/model/model'
 import { Structure } from '../../../../mol-model/structure'
-import { LinkType } from '../../../../mol-model/structure/model/types'
+import { BondType } from '../../../../mol-model/structure/model/types'
 import { findEntityIdByAsymId, findAtomIndexByLabelName } from '../util'
 import { Column } from '../../../../mol-data/db'
 import { CustomPropertyDescriptor } from '../../../../mol-model/structure';
@@ -214,7 +214,7 @@ export namespace StructConn {
 
             const type = conn_type_id.value(i)
             const orderType = (pdbx_value_order.value(i) || '').toLowerCase();
-            let flags = LinkType.Flag.None;
+            let flags = BondType.Flag.None;
             let order = 1;
 
             switch (orderType) {
@@ -233,13 +233,13 @@ export namespace StructConn {
 
             switch (type) {
                 case 'covale':
-                    flags = LinkType.Flag.Covalent;
+                    flags = BondType.Flag.Covalent;
                     break;
-                case 'disulf': flags = LinkType.Flag.Covalent | LinkType.Flag.Sulfide; break;
+                case 'disulf': flags = BondType.Flag.Covalent | BondType.Flag.Sulfide; break;
                 case 'hydrog':
-                    flags = LinkType.Flag.Hydrogen;
+                    flags = BondType.Flag.Hydrogen;
                     break;
-                case 'metalc': flags = LinkType.Flag.MetallicCoordination; break;
+                case 'metalc': flags = BondType.Flag.MetallicCoordination; break;
             }
 
             entries.push({ rowIndex: i, flags, order, distance: pdbx_dist_value.value(i), partners });

+ 1 - 1
src/mol-model-props/computed/accessible-surface-area/shrake-rupley/radii.ts

@@ -6,7 +6,7 @@
  */
 
 import { ShrakeRupleyContext, VdWLookup } from './common';
-import { getElementIdx, isHydrogen } from '../../../../mol-model/structure/structure/unit/links/common';
+import { getElementIdx, isHydrogen } from '../../../../mol-model/structure/structure/unit/bonds/common';
 import { isPolymer, isNucleic, MoleculeType, ElementSymbol } from '../../../../mol-model/structure/model/types';
 import { VdwRadius } from '../../../../mol-model/structure/model/properties/atomic';
 import { StructureElement, StructureProperties } from '../../../../mol-model/structure/structure';

+ 4 - 4
src/mol-model-props/computed/chemistry/functional-group.ts

@@ -7,14 +7,14 @@
 import { Structure, Unit } from '../../../mol-model/structure';
 import { StructureElement } from '../../../mol-model/structure/structure';
 import { Elements, isHalogen } from '../../../mol-model/structure/model/properties/atomic/types';
-import { ElementSymbol, LinkType } from '../../../mol-model/structure/model/types';
+import { ElementSymbol, BondType } from '../../../mol-model/structure/model/types';
 import { eachBondedAtom, bondCount, typeSymbol, bondToElementCount } from './util';
 
 function isAromatic(unit: Unit.Atomic, index: StructureElement.UnitIndex) {
     // TODO also extend unit.rings with geometry/composition-based aromaticity detection and use it here in addition
-    const { offset, edgeProps } = unit.links
+    const { offset, edgeProps } = unit.bonds
     for (let i = offset[index], il = offset[index + 1]; i < il; ++i) {
-        if (LinkType.is(LinkType.Flag.Aromatic, edgeProps.flags[i])) return true
+        if (BondType.is(BondType.Flag.Aromatic, edgeProps.flags[i])) return true
     }
     return false
 }
@@ -137,7 +137,7 @@ export function isHalocarbon (structure: Structure, unit: Unit.Atomic, index: St
 export function isCarbonyl(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) {
     let flag = false
     if (typeSymbol(unit, index) === Elements.C) {
-        const { offset, edgeProps, b } = unit.links
+        const { offset, edgeProps, b } = unit.bonds
         for (let i = offset[index], il = offset[index + 1]; i < il; ++i) {
             if (edgeProps.order[i] === 2 && typeSymbol(unit, b[i] as StructureElement.UnitIndex) === Elements.O) {
                 flag = true

+ 3 - 3
src/mol-model-props/computed/chemistry/util.ts

@@ -35,7 +35,7 @@ export function interBondCount(structure: Structure, unit: Unit.Atomic, index: S
 }
 
 export function intraBondCount(unit: Unit.Atomic, index: StructureElement.UnitIndex): number {
-    const { offset } = unit.links
+    const { offset } = unit.bonds
     return offset[index + 1] - offset[index]
 }
 
@@ -54,7 +54,7 @@ export function bondToElementCount(structure: Structure, unit: Unit.Atomic, inde
 //
 
 export function intraConnectedTo(unit: Unit.Atomic, indexA: StructureElement.UnitIndex, indexB: StructureElement.UnitIndex) {
-    const { offset, b } = unit.links
+    const { offset, b } = unit.bonds
     for (let i = offset[indexA], il = offset[indexA + 1]; i < il; ++i) {
         if (b[i] === indexB) return true
     }
@@ -74,7 +74,7 @@ export function eachInterBondedAtom(structure: Structure, unit: Unit.Atomic, ind
 
 export function eachIntraBondedAtom(unit: Unit.Atomic, index: StructureElement.UnitIndex, cb: (unit: Unit.Atomic, index: StructureElement.UnitIndex) => void): void {
     // intra
-    const { offset, b } = unit.links
+    const { offset, b } = unit.bonds
     for (let i = offset[index], il = offset[index + 1]; i < il; ++i) {
         cb(unit, b[i] as StructureElement.UnitIndex)
     }

+ 21 - 21
src/mol-model-props/computed/chemistry/valence-model.ts

@@ -5,7 +5,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Structure, StructureElement, Unit, Link } from '../../../mol-model/structure';
+import { Structure, StructureElement, Unit, Bond } from '../../../mol-model/structure';
 import { Elements, isMetal } from '../../../mol-model/structure/model/properties/atomic/types';
 import { AtomGeometry, assignGeometry } from './geometry';
 import { bondCount, typeSymbol, formalCharge, bondToElementCount } from './util';
@@ -24,8 +24,8 @@ import { isDebugMode } from '../../../mol-util/debug';
  *
  */
 
-const tmpConjLinkItA = new Link.ElementLinkIterator()
-const tmpConjLinkItB = new Link.ElementLinkIterator()
+const tmpConjBondItA = new Bond.ElementBondIterator()
+const tmpConjBondItB = new Bond.ElementBondIterator()
 
 /**
  * Are we involved in some kind of pi system. Either explicitly forming
@@ -40,15 +40,15 @@ function isConjugated (structure: Structure, unit: Unit.Atomic, index: Structure
 
     if (hetero && bondCount(structure, unit, index) === 4) return false
 
-    tmpConjLinkItA.setElement(structure, unit, index)
-    while (tmpConjLinkItA.hasNext) {
-        const bA = tmpConjLinkItA.move()
+    tmpConjBondItA.setElement(structure, unit, index)
+    while (tmpConjBondItA.hasNext) {
+        const bA = tmpConjBondItA.move()
         if (bA.order > 1) return true
         if (hetero) {
             const elementB = typeSymbol(bA.otherUnit, bA.otherIndex)
-            tmpConjLinkItB.setElement(structure, bA.otherUnit, bA.otherIndex)
-            while (tmpConjLinkItB.hasNext) {
-                const bB = tmpConjLinkItB.move()
+            tmpConjBondItB.setElement(structure, bA.otherUnit, bA.otherIndex)
+            while (tmpConjBondItB.hasNext) {
+                const bB = tmpConjBondItB.move()
                 if (bB.order > 1) {
                     if ((elementB === Elements.P || elementB === Elements.S) &&
                             typeSymbol(bB.otherUnit, bB.otherIndex) === Elements.O) {
@@ -66,15 +66,15 @@ function isConjugated (structure: Structure, unit: Unit.Atomic, index: Structure
 export function explicitValence (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) {
     let v = 0
     // intra-unit bonds
-    const { offset, edgeProps } = unit.links
+    const { offset, edgeProps } = unit.bonds
     for (let i = offset[index], il = offset[index + 1]; i < il; ++i) v += edgeProps.order[i]
     // inter-unit bonds
     structure.interUnitBonds.getEdgeIndices(index, unit).forEach(b => v += structure.interUnitBonds.edges[b].props.order)
     return v
 }
 
-const tmpChargeLinkItA = new Link.ElementLinkIterator()
-const tmpChargeLinkItB = new Link.ElementLinkIterator()
+const tmpChargeBondItA = new Bond.ElementBondIterator()
+const tmpChargeBondItB = new Bond.ElementBondIterator()
 
 /**
  * Attempts to produce a consistent charge and implicit
@@ -145,9 +145,9 @@ export function calculateHydrogensCharge (structure: Structure, unit: Unit.Atomi
                     // Sulfonamide nitrogen and classed as sp3 in conjugation model but
                     // they won't be charged
                     // Don't assign charge to nitrogens bound to metals
-                    tmpChargeLinkItA.setElement(structure, unit, index)
-                    while (tmpChargeLinkItA.hasNext) {
-                        const b = tmpChargeLinkItA.move()
+                    tmpChargeBondItA.setElement(structure, unit, index)
+                    while (tmpChargeBondItA.hasNext) {
+                        const b = tmpChargeBondItA.move()
                         const elementB = typeSymbol(b.otherUnit, b.otherIndex)
                         if (elementB === Elements.S || isMetal(elementB)) {
                             charge = 0
@@ -183,12 +183,12 @@ export function calculateHydrogensCharge (structure: Structure, unit: Unit.Atomi
                     charge = valence - 2
                 }
                 if (valence === 1) {
-                    tmpChargeLinkItA.setElement(structure, unit, index)
-                    b1: while (tmpChargeLinkItA.hasNext) {
-                        const bA = tmpChargeLinkItA.move()
-                        tmpChargeLinkItB.setElement(structure, bA.otherUnit, bA.otherIndex)
-                        while (tmpChargeLinkItB.hasNext) {
-                            const bB = tmpChargeLinkItB.move()
+                    tmpChargeBondItA.setElement(structure, unit, index)
+                    b1: while (tmpChargeBondItA.hasNext) {
+                        const bA = tmpChargeBondItA.move()
+                        tmpChargeBondItB.setElement(structure, bA.otherUnit, bA.otherIndex)
+                        while (tmpChargeBondItB.hasNext) {
+                            const bB = tmpChargeBondItB.move()
                             if (
                                 !(bB.otherUnit === unit && bB.otherIndex === index) &&
                                 typeSymbol(bB.otherUnit, bB.otherIndex) === Elements.O &&

+ 2 - 2
src/mol-model/location.ts

@@ -5,7 +5,7 @@
  */
 
 import { StructureElement } from './structure'
-import { Link } from './structure/structure/unit/links'
+import { Bond } from './structure/structure/unit/bonds'
 import { ShapeGroup } from './shape/shape';
 
 /** A null value Location */
@@ -15,4 +15,4 @@ export function isNullLocation(x: any): x is NullLocation {
     return !!x && x.kind === 'null-location';
 }
 
-export type Location = StructureElement.Location | Link.Location | ShapeGroup.Location | NullLocation
+export type Location = StructureElement.Location | Bond.Location | ShapeGroup.Location | NullLocation

+ 14 - 14
src/mol-model/loci.ts

@@ -5,7 +5,7 @@
  */
 
 import { StructureElement } from './structure'
-import { Link } from './structure/structure/unit/links'
+import { Bond } from './structure/structure/unit/bonds'
 import { Shape, ShapeGroup } from './shape';
 import { Sphere3D } from '../mol-math/geometry';
 import { CentroidHelper } from '../mol-math/geometry/centroid-helper';
@@ -51,7 +51,7 @@ export function createDataLoci(data: any, tag: string, indices: OrderedSet<numbe
 
 export { Loci }
 
-type Loci = StructureElement.Loci | Structure.Loci | Link.Loci | EveryLoci | EmptyLoci | DataLoci | Shape.Loci | ShapeGroup.Loci
+type Loci = StructureElement.Loci | Structure.Loci | Bond.Loci | EveryLoci | EmptyLoci | DataLoci | Shape.Loci | ShapeGroup.Loci
 
 namespace Loci {
     interface FiniteArray<T, L extends number = number> extends ReadonlyArray<T> { length: L };
@@ -69,8 +69,8 @@ namespace Loci {
         if (StructureElement.Loci.is(lociA) && StructureElement.Loci.is(lociB)) {
             return StructureElement.Loci.areEqual(lociA, lociB)
         }
-        if (Link.isLoci(lociA) && Link.isLoci(lociB)) {
-            return Link.areLociEqual(lociA, lociB)
+        if (Bond.isLoci(lociA) && Bond.isLoci(lociB)) {
+            return Bond.areLociEqual(lociA, lociB)
         }
         if (Shape.isLoci(lociA) && Shape.isLoci(lociB)) {
             return Shape.areLociEqual(lociA, lociB)
@@ -91,7 +91,7 @@ namespace Loci {
         if (isDataLoci(loci)) return isDataLociEmpty(loci)
         if (Structure.isLoci(loci)) return Structure.isLociEmpty(loci)
         if (StructureElement.Loci.is(loci)) return StructureElement.Loci.isEmpty(loci)
-        if (Link.isLoci(loci)) return Link.isLociEmpty(loci)
+        if (Bond.isLoci(loci)) return Bond.isLociEmpty(loci)
         if (Shape.isLoci(loci)) return Shape.isLociEmpty(loci)
         if (ShapeGroup.isLoci(loci)) return ShapeGroup.isLociEmpty(loci)
         return false
@@ -103,8 +103,8 @@ namespace Loci {
                 loci = StructureElement.Loci.remap(loci, data)
             } else if (Structure.isLoci(loci)) {
                 loci = Structure.remapLoci(loci, data)
-            } else if (Link.isLoci(loci)) {
-                loci = Link.remapLoci(loci, data)
+            } else if (Bond.isLoci(loci)) {
+                loci = Bond.remapLoci(loci, data)
             }
         }
         return loci
@@ -122,15 +122,15 @@ namespace Loci {
             return Sphere3D.copy(boundingSphere, loci.structure.boundary.sphere)
         } else if (loci.kind === 'element-loci') {
             return StructureElement.Loci.getBoundary(loci).sphere;
-        } else if (loci.kind === 'link-loci') {
-            for (const e of loci.links) {
+        } else if (loci.kind === 'bond-loci') {
+            for (const e of loci.bonds) {
                 e.aUnit.conformation.position(e.aUnit.elements[e.aIndex], tempPos);
                 sphereHelper.includeStep(tempPos);
                 e.bUnit.conformation.position(e.bUnit.elements[e.bIndex], tempPos);
                 sphereHelper.includeStep(tempPos);
             }
             sphereHelper.finishedIncludeStep();
-            for (const e of loci.links) {
+            for (const e of loci.bonds) {
                 e.aUnit.conformation.position(e.aUnit.elements[e.aIndex], tempPos);
                 sphereHelper.radiusStep(tempPos);
                 e.aUnit.conformation.position(e.bUnit.elements[e.bIndex], tempPos);
@@ -165,7 +165,7 @@ namespace Loci {
             return StructureElement.Loci.getPrincipalAxes(Structure.toStructureElementLoci(loci.structure))
         } else if (loci.kind === 'element-loci') {
             return StructureElement.Loci.getPrincipalAxes(loci)
-        } else if (loci.kind === 'link-loci') {
+        } else if (loci.kind === 'bond-loci') {
             // TODO
             return void 0;
         } else if (loci.kind === 'shape-loci') {
@@ -237,9 +237,9 @@ namespace Loci {
      * granularity if given
     */
     export function normalize(loci: Loci, granularity?: Granularity) {
-        if (granularity !== 'element' && Link.isLoci(loci)) {
-            // convert Link.Loci to a StructureElement.Loci so granularity can be applied
-            loci = Link.toStructureElementLoci(loci)
+        if (granularity !== 'element' && Bond.isLoci(loci)) {
+            // convert Bond.Loci to a StructureElement.Loci so granularity can be applied
+            loci = Bond.toStructureElementLoci(loci)
         }
         if (Structure.isLoci(loci)) {
             // convert to StructureElement.Loci

+ 6 - 6
src/mol-model/structure/model/types.ts

@@ -585,9 +585,9 @@ export const MaxAsa = {
 }
 export const DefaultMaxAsa = 121.0
 
-export type LinkType = BitFlags<LinkType.Flag>
-export namespace LinkType {
-    export const is: (b: LinkType, f: Flag) => boolean = BitFlags.has
+export type BondType = BitFlags<BondType.Flag>
+export namespace BondType {
+    export const is: (b: BondType, f: Flag) => boolean = BitFlags.has
     export const enum Flag {
         None                 = 0x0,
         Covalent             = 0x1,
@@ -600,12 +600,12 @@ export namespace LinkType {
         // currently at most 16 flags are supported!!
     }
 
-    export function create(flags: Flag): LinkType {
+    export function create(flags: Flag): BondType {
         return BitFlags.create(flags);
     }
 
-    export function isCovalent(flags: LinkType.Flag) {
-        return (flags & LinkType.Flag.Covalent) !== 0;
+    export function isCovalent(flags: BondType.Flag) {
+        return (flags & BondType.Flag.Covalent) !== 0;
     }
 }
 

+ 17 - 17
src/mol-model/structure/query/context.ts

@@ -7,9 +7,9 @@
 import { Structure, StructureElement, Unit } from '../structure';
 import { now } from '../../../mol-util/now';
 import { ElementIndex } from '../model';
-import { LinkType } from '../model/types';
+import { BondType } from '../model/types';
 import { StructureSelection } from './selection';
-import { defaultLinkTest } from './queries/internal';
+import { defaultBondTest } from './queries/internal';
 
 export interface QueryContextView {
     readonly element: StructureElement.Location;
@@ -18,7 +18,7 @@ export interface QueryContextView {
 
 export class QueryContext implements QueryContextView {
     private currentElementStack: StructureElement.Location[] = [];
-    private currentAtomicLinkStack: QueryContextLinkInfo<Unit.Atomic>[] = [];
+    private currentAtomicBondStack: QueryContextBondInfo<Unit.Atomic>[] = [];
     private currentStructureStack: Structure[] = [];
     private inputStructureStack: Structure[] = [];
 
@@ -31,8 +31,8 @@ export class QueryContext implements QueryContextView {
     readonly element = StructureElement.Location.create();
     currentStructure: Structure = void 0 as any;
 
-    /** Current link between atoms */
-    readonly atomicLink = new QueryContextLinkInfo<Unit.Atomic>();
+    /** Current bond between atoms */
+    readonly atomicBond = new QueryContextBondInfo<Unit.Atomic>();
 
     /** Supply this from the outside. Used by the internal.generator.current symbol */
     currentSelection: StructureSelection | undefined = void 0;
@@ -52,17 +52,17 @@ export class QueryContext implements QueryContextView {
         (this.element as StructureElement.Location) = this.currentElementStack.pop()!;
     }
 
-    pushCurrentLink() {
-        if (this.atomicLink) this.currentAtomicLinkStack.push(this.atomicLink);
-        (this.atomicLink as QueryContextLinkInfo<Unit.Atomic>) = new QueryContextLinkInfo();
-        return this.atomicLink;
+    pushCurrentBond() {
+        if (this.atomicBond) this.currentAtomicBondStack.push(this.atomicBond);
+        (this.atomicBond as QueryContextBondInfo<Unit.Atomic>) = new QueryContextBondInfo();
+        return this.atomicBond;
     }
 
-    popCurrentLink() {
-        if (this.currentAtomicLinkStack.length > 0) {
-            (this.atomicLink as QueryContextLinkInfo<Unit.Atomic>) = this.currentAtomicLinkStack.pop()!;
+    popCurrentBond() {
+        if (this.currentAtomicBondStack.length > 0) {
+            (this.atomicBond as QueryContextBondInfo<Unit.Atomic>) = this.currentAtomicBondStack.pop()!;
         } else {
-            (this.atomicLink as any) = void 0;
+            (this.atomicBond as any) = void 0;
         }
     }
 
@@ -112,18 +112,18 @@ export interface QueryContextOptions {
 export interface QueryPredicate { (ctx: QueryContext): boolean }
 export interface QueryFn<T = any> { (ctx: QueryContext): T }
 
-export class QueryContextLinkInfo<U extends Unit = Unit> {
+export class QueryContextBondInfo<U extends Unit = Unit> {
     a: StructureElement.Location<U> = StructureElement.Location.create();
     aIndex: StructureElement.UnitIndex = 0 as StructureElement.UnitIndex;
     b: StructureElement.Location<U> = StructureElement.Location.create();
     bIndex: StructureElement.UnitIndex = 0 as StructureElement.UnitIndex;
-    type: LinkType = LinkType.Flag.None;
+    type: BondType = BondType.Flag.None;
     order: number = 0;
 
-    private testFn: QueryPredicate = defaultLinkTest;
+    private testFn: QueryPredicate = defaultBondTest;
 
     setTestFn(fn?: QueryPredicate) {
-        this.testFn = fn || defaultLinkTest;
+        this.testFn = fn || defaultBondTest;
     }
 
     test(ctx: QueryContext, trySwap: boolean) {

+ 38 - 38
src/mol-model/structure/query/queries/filters.ts

@@ -236,19 +236,19 @@ interface IsConnectedToCtx {
 
 function checkConnected(ctx: IsConnectedToCtx, structure: Structure) {
     const { queryCtx, input, target, disjunct } = ctx;
-    const atomicLink = queryCtx.atomicLink;
+    const atomicBond = queryCtx.atomicBond;
 
-    const interLinks = input.interUnitBonds;
+    const interBonds = input.interUnitBonds;
     for (const unit of structure.units) {
         if (!Unit.isAtomic(unit)) continue;
 
         const inputUnit = input.unitMap.get(unit.id) as Unit.Atomic;
 
-        const { offset, b, edgeProps: { flags, order } } = inputUnit.links;
-        const linkedUnits = interLinks.getLinkedUnits(unit);
-        const luCount = linkedUnits.length;
+        const { offset, b, edgeProps: { flags, order } } = inputUnit.bonds;
+        const bondedUnits = interBonds.getConnectedUnits(unit);
+        const buCount = bondedUnits.length;
 
-        atomicLink.a.unit = inputUnit;
+        atomicBond.a.unit = inputUnit;
 
         const srcElements = unit.elements;
         const inputElements = inputUnit.elements;
@@ -256,43 +256,43 @@ function checkConnected(ctx: IsConnectedToCtx, structure: Structure) {
         for (let i = 0 as StructureElement.UnitIndex, _i = srcElements.length; i < _i; i++) {
             const inputIndex = SortedArray.indexOf(inputElements, srcElements[i]) as StructureElement.UnitIndex;
 
-            atomicLink.a.unit = inputUnit;
-            atomicLink.b.unit = inputUnit;
+            atomicBond.a.unit = inputUnit;
+            atomicBond.b.unit = inputUnit;
 
             // tElement.unit = unit;
             for (let l = offset[inputIndex], _l = offset[inputIndex + 1]; l < _l; l++) {
                 // tElement.element = inputElements[b[l]];
-                atomicLink.b.element = inputUnit.elements[b[l]];
-                if (disjunct && SortedArray.has(unit.elements, atomicLink.b.element)) continue;
-                if (!target.hasElement(atomicLink.b)) continue;
-
-                atomicLink.aIndex = inputIndex;
-                atomicLink.a.element = srcElements[i];
-                atomicLink.bIndex = b[l] as StructureElement.UnitIndex;
-                atomicLink.type = flags[l];
-                atomicLink.order = order[l];
-                if (atomicLink.test(queryCtx, true)) return true;
+                atomicBond.b.element = inputUnit.elements[b[l]];
+                if (disjunct && SortedArray.has(unit.elements, atomicBond.b.element)) continue;
+                if (!target.hasElement(atomicBond.b)) continue;
+
+                atomicBond.aIndex = inputIndex;
+                atomicBond.a.element = srcElements[i];
+                atomicBond.bIndex = b[l] as StructureElement.UnitIndex;
+                atomicBond.type = flags[l];
+                atomicBond.order = order[l];
+                if (atomicBond.test(queryCtx, true)) return true;
             }
 
-            for (let li = 0; li < luCount; li++) {
-                const lu = linkedUnits[li];
+            for (let li = 0; li < buCount; li++) {
+                const lu = bondedUnits[li];
                 const bElements = lu.unitB.elements;
                 const bonds = lu.getEdges(inputIndex);
                 for (let bi = 0, _bi = bonds.length; bi < _bi; bi++) {
                     const bond = bonds[bi];
-                    atomicLink.b.unit = lu.unitB;
-                    atomicLink.b.element = bElements[bond.indexB];
-                    if (!target.hasElement(atomicLink.b)) continue;
-                    if (disjunct && structure.hasElement(atomicLink.b)) continue;
-
-                    atomicLink.a.unit = inputUnit;
-                    atomicLink.aIndex = inputIndex;
-                    atomicLink.a.element = srcElements[i];
-
-                    atomicLink.bIndex = bond.indexB;
-                    atomicLink.type = bond.props.flag;
-                    atomicLink.order = bond.props.order;
-                    if (atomicLink.test(queryCtx, true)) return true;
+                    atomicBond.b.unit = lu.unitB;
+                    atomicBond.b.element = bElements[bond.indexB];
+                    if (!target.hasElement(atomicBond.b)) continue;
+                    if (disjunct && structure.hasElement(atomicBond.b)) continue;
+
+                    atomicBond.a.unit = inputUnit;
+                    atomicBond.aIndex = inputIndex;
+                    atomicBond.a.element = srcElements[i];
+
+                    atomicBond.bIndex = bond.indexB;
+                    atomicBond.type = bond.props.flag;
+                    atomicBond.order = bond.props.order;
+                    if (atomicBond.test(queryCtx, true)) return true;
                 }
             }
         }
@@ -304,12 +304,12 @@ function checkConnected(ctx: IsConnectedToCtx, structure: Structure) {
 export interface IsConnectedToParams {
     query: StructureQuery,
     target: StructureQuery,
-    linkTest?: QueryFn<boolean>,
+    bondTest?: QueryFn<boolean>,
     disjunct: boolean,
     invert: boolean
 }
 
-export function isConnectedTo({ query, target, disjunct, invert, linkTest }: IsConnectedToParams): StructureQuery {
+export function isConnectedTo({ query, target, disjunct, invert, bondTest }: IsConnectedToParams): StructureQuery {
     return ctx => {
         const targetSel = target(ctx);
         if (StructureSelection.isEmpty(targetSel)) return targetSel;
@@ -324,8 +324,8 @@ export function isConnectedTo({ query, target, disjunct, invert, linkTest }: IsC
         }
 
         const ret = StructureSelection.LinearBuilder(ctx.inputStructure);
-        ctx.pushCurrentLink();
-        ctx.atomicLink.setTestFn(linkTest);
+        ctx.pushCurrentBond();
+        ctx.atomicBond.setTestFn(bondTest);
 
         StructureSelection.forEach(selection, (s, sI) => {
             if (checkConnected(connCtx, s)) {
@@ -335,7 +335,7 @@ export function isConnectedTo({ query, target, disjunct, invert, linkTest }: IsC
             }
             if (sI % 5 === 0) ctx.throwIfTimedOut();
         })
-        ctx.popCurrentLink();
+        ctx.popCurrentBond();
 
         return ret.getSelection();
     }

+ 37 - 37
src/mol-model/structure/query/queries/generators.ts

@@ -276,41 +276,41 @@ export function querySelection(selection: StructureQuery, query: StructureQuery,
     }
 }
 
-export function linkedAtomicPairs(linkTest?: QueryPredicate): StructureQuery {
-    return function query_linkedAtomicPairs(ctx) {
+export function bondedAtomicPairs(bondTest?: QueryPredicate): StructureQuery {
+    return function query_bondedAtomicPairs(ctx) {
         const structure = ctx.inputStructure;
 
-        const interLinks = structure.interUnitBonds;
-        // Note: each link is called twice, that's why we need the unique builder.
+        const interBonds = structure.interUnitBonds;
+        // Note: each bond is called twice, that's why we need the unique builder.
         const ret = StructureSelection.UniqueBuilder(ctx.inputStructure);
 
-        ctx.pushCurrentLink();
-        const atomicLink = ctx.atomicLink;
-        atomicLink.setTestFn(linkTest);
+        ctx.pushCurrentBond();
+        const atomicBond = ctx.atomicBond;
+        atomicBond.setTestFn(bondTest);
 
-        // Process intra unit links
+        // Process intra unit bonds
         for (const unit of structure.units) {
             if (unit.kind !== Unit.Kind.Atomic) continue;
 
-            const { offset: intraLinkOffset, b: intraLinkB, edgeProps: { flags, order } } = unit.links;
-            atomicLink.a.unit = unit;
-            atomicLink.b.unit = unit;
+            const { offset: intraBondOffset, b: intraBondB, edgeProps: { flags, order } } = unit.bonds;
+            atomicBond.a.unit = unit;
+            atomicBond.b.unit = unit;
             for (let i = 0 as StructureElement.UnitIndex, _i = unit.elements.length; i < _i; i++) {
-                atomicLink.aIndex = i as StructureElement.UnitIndex;
-                atomicLink.a.element = unit.elements[i];
-
-                // check intra unit links
-                for (let lI = intraLinkOffset[i], _lI = intraLinkOffset[i + 1]; lI < _lI; lI++) {
-                    atomicLink.bIndex = intraLinkB[lI] as StructureElement.UnitIndex;
-                    atomicLink.b.element = unit.elements[intraLinkB[lI]];
-                    atomicLink.type = flags[lI];
-                    atomicLink.order = order[lI];
+                atomicBond.aIndex = i as StructureElement.UnitIndex;
+                atomicBond.a.element = unit.elements[i];
+
+                // check intra unit bonds
+                for (let lI = intraBondOffset[i], _lI = intraBondOffset[i + 1]; lI < _lI; lI++) {
+                    atomicBond.bIndex = intraBondB[lI] as StructureElement.UnitIndex;
+                    atomicBond.b.element = unit.elements[intraBondB[lI]];
+                    atomicBond.type = flags[lI];
+                    atomicBond.order = order[lI];
                     // No need to "swap test" because each bond direction will be visited eventually.
-                    if (atomicLink.test(ctx, false)) {
+                    if (atomicBond.test(ctx, false)) {
                         const b = structure.subsetBuilder(false);
                         b.beginUnit(unit.id);
-                        b.addElement(atomicLink.a.element);
-                        b.addElement(atomicLink.b.element);
+                        b.addElement(atomicBond.a.element);
+                        b.addElement(atomicBond.b.element);
                         b.commitUnit();
                         ret.add(b.getStructure());
                     }
@@ -318,27 +318,27 @@ export function linkedAtomicPairs(linkTest?: QueryPredicate): StructureQuery {
             }
         }
 
-        // Process inter unit links
-        for (const bond of interLinks.edges) {
-            atomicLink.a.unit = bond.unitA;
-            atomicLink.a.element = bond.unitA.elements[bond.indexA];
-            atomicLink.aIndex = bond.indexA;
-            atomicLink.b.unit = bond.unitB;
-            atomicLink.b.element = bond.unitB.elements[bond.indexB];
-            atomicLink.bIndex = bond.indexB;
-            atomicLink.order = bond.props.order;
-            atomicLink.type = bond.props.flag;
+        // Process inter unit bonds
+        for (const bond of interBonds.edges) {
+            atomicBond.a.unit = bond.unitA;
+            atomicBond.a.element = bond.unitA.elements[bond.indexA];
+            atomicBond.aIndex = bond.indexA;
+            atomicBond.b.unit = bond.unitB;
+            atomicBond.b.element = bond.unitB.elements[bond.indexB];
+            atomicBond.bIndex = bond.indexB;
+            atomicBond.order = bond.props.order;
+            atomicBond.type = bond.props.flag;
 
             // No need to "swap test" because each bond direction will be visited eventually.
-            if (atomicLink.test(ctx, false)) {
+            if (atomicBond.test(ctx, false)) {
                 const b = structure.subsetBuilder(false);
-                b.addToUnit(atomicLink.a.unit.id, atomicLink.a.element);
-                b.addToUnit(atomicLink.b.unit.id, atomicLink.b.element);
+                b.addToUnit(atomicBond.a.unit.id, atomicBond.a.element);
+                b.addToUnit(atomicBond.b.unit.id, atomicBond.b.element);
                 ret.add(b.getStructure());
             }
         }
 
-        ctx.popCurrentLink();
+        ctx.popCurrentBond();
         return ret.getSelection();
     };
 }

+ 3 - 3
src/mol-model/structure/query/queries/internal.ts

@@ -11,12 +11,12 @@ import Structure from '../../structure/structure';
 import { StructureQuery } from '../query';
 import { StructureSelection } from '../selection';
 import { QueryContext } from '../context';
-import { LinkType } from '../../model/types';
+import { BondType } from '../../model/types';
 import { BundleElement, Bundle } from '../../structure/element/bundle';
 import { UnitIndex } from '../../structure/element/element';
 
-export function defaultLinkTest(ctx: QueryContext) {
-    return LinkType.isCovalent(ctx.atomicLink.type);
+export function defaultBondTest(ctx: QueryContext) {
+    return BondType.isCovalent(ctx.atomicBond.type);
 }
 
 export function atomicSequence(): StructureQuery {

+ 43 - 43
src/mol-model/structure/query/queries/modifiers.ts

@@ -298,18 +298,18 @@ export function expandProperty(query: StructureQuery, property: QueryFn): Struct
 
 export interface IncludeConnectedParams {
     query: StructureQuery,
-    linkTest?: QueryFn<boolean>,
+    bondTest?: QueryFn<boolean>,
     layerCount: number,
     wholeResidues: boolean
 }
 
-export function includeConnected({ query, layerCount, wholeResidues, linkTest }: IncludeConnectedParams): StructureQuery {
+export function includeConnected({ query, layerCount, wholeResidues, bondTest }: IncludeConnectedParams): StructureQuery {
     const lc = Math.max(layerCount, 0);
     return function query_includeConnected(ctx) {
         const builder = StructureSelection.UniqueBuilder(ctx.inputStructure);
         const src = query(ctx);
-        ctx.pushCurrentLink();
-        ctx.atomicLink.setTestFn(linkTest);
+        ctx.pushCurrentBond();
+        ctx.atomicBond.setTestFn(bondTest);
         StructureSelection.forEach(src, (s, sI) => {
             let incl = s;
             for (let i = 0; i < lc; i++) {
@@ -318,7 +318,7 @@ export function includeConnected({ query, layerCount, wholeResidues, linkTest }:
             builder.add(incl);
             if (sI % 10 === 0) ctx.throwIfTimedOut();
         });
-        ctx.popCurrentLink();
+        ctx.popCurrentBond();
 
         return builder.getSelection();
     }
@@ -332,15 +332,15 @@ function includeConnectedStep(ctx: QueryContext, wholeResidues: boolean, structu
 
 function expandConnected(ctx: QueryContext, structure: Structure) {
     const inputStructure = ctx.inputStructure;
-    const interLinks = inputStructure.interUnitBonds;
+    const interBonds = inputStructure.interUnitBonds;
     const builder = new StructureUniqueSubsetBuilder(inputStructure);
 
-    // Note: each link is visited twice so that link.atom-a and link.atom-b both get the "swapped values"
+    // Note: each bond is visited twice so that bond.atom-a and bond.atom-b both get the "swapped values"
     const visitedSourceUnits = new Set<number>();
 
-    const atomicLink = ctx.atomicLink;
+    const atomicBond = ctx.atomicBond;
 
-    // Process intra unit links
+    // Process intra unit bonds
     for (const unit of structure.units) {
         if (unit.kind !== Unit.Kind.Atomic) {
             // add the whole unit
@@ -353,64 +353,64 @@ function expandConnected(ctx: QueryContext, structure: Structure) {
         }
 
         const inputUnitA = inputStructure.unitMap.get(unit.id) as Unit.Atomic;
-        const { offset: intraLinkOffset, b: intraLinkB, edgeProps: { flags, order } } = inputUnitA.links;
+        const { offset: intraBondOffset, b: intraBondB, edgeProps: { flags, order } } = inputUnitA.bonds;
 
-        // Process intra unit links
-        atomicLink.a.unit = inputUnitA;
-        atomicLink.b.unit = inputUnitA;
+        // Process intra unit bonds
+        atomicBond.a.unit = inputUnitA;
+        atomicBond.b.unit = inputUnitA;
         for (let i = 0, _i = unit.elements.length; i < _i; i++) {
             // add the current element
             builder.addToUnit(unit.id, unit.elements[i]);
 
             const aIndex = SortedArray.indexOf(inputUnitA.elements, unit.elements[i]) as StructureElement.UnitIndex;
 
-            // check intra unit links
-            for (let lI = intraLinkOffset[aIndex], _lI = intraLinkOffset[aIndex + 1]; lI < _lI; lI++) {
-                const bIndex = intraLinkB[lI] as StructureElement.UnitIndex;
+            // check intra unit bonds
+            for (let lI = intraBondOffset[aIndex], _lI = intraBondOffset[aIndex + 1]; lI < _lI; lI++) {
+                const bIndex = intraBondB[lI] as StructureElement.UnitIndex;
                 const bElement = inputUnitA.elements[bIndex];
 
                 // Check if the element is already present:
                 if (SortedArray.has(unit.elements, bElement) || builder.has(unit.id, bElement)) continue;
 
-                atomicLink.aIndex = aIndex;
-                atomicLink.a.element = unit.elements[i];
-                atomicLink.bIndex = bIndex;
-                atomicLink.b.element = bElement;
-                atomicLink.type = flags[lI];
-                atomicLink.order = order[lI];
+                atomicBond.aIndex = aIndex;
+                atomicBond.a.element = unit.elements[i];
+                atomicBond.bIndex = bIndex;
+                atomicBond.b.element = bElement;
+                atomicBond.type = flags[lI];
+                atomicBond.order = order[lI];
 
-                if (atomicLink.test(ctx, true)) {
+                if (atomicBond.test(ctx, true)) {
                     builder.addToUnit(unit.id, bElement);
                 }
             }
         }
 
-        // Process inter unit links
-        for (const linkedUnit of interLinks.getLinkedUnits(inputUnitA)) {
-            if (visitedSourceUnits.has(linkedUnit.unitB.id)) continue;
-            const currentUnitB = structure.unitMap.get(linkedUnit.unitB.id);
+        // Process inter unit bonds
+        for (const bondedUnit of interBonds.getConnectedUnits(inputUnitA)) {
+            if (visitedSourceUnits.has(bondedUnit.unitB.id)) continue;
+            const currentUnitB = structure.unitMap.get(bondedUnit.unitB.id);
 
-            for (const aI of linkedUnit.connectedIndices) {
+            for (const aI of bondedUnit.connectedIndices) {
                 // check if the element is in the expanded structure
                 if (!SortedArray.has(unit.elements, inputUnitA.elements[aI])) continue;
 
-                for (const bond of linkedUnit.getEdges(aI)) {
-                    const bElement = linkedUnit.unitB.elements[bond.indexB];
+                for (const bond of bondedUnit.getEdges(aI)) {
+                    const bElement = bondedUnit.unitB.elements[bond.indexB];
 
                     // Check if the element is already present:
-                    if ((currentUnitB && SortedArray.has(currentUnitB.elements, bElement)) || builder.has(linkedUnit.unitB.id, bElement)) continue;
-
-                    atomicLink.a.unit = inputUnitA;
-                    atomicLink.aIndex = aI;
-                    atomicLink.a.element = inputUnitA.elements[aI];
-                    atomicLink.b.unit = linkedUnit.unitB;
-                    atomicLink.bIndex = bond.indexB;
-                    atomicLink.b.element = bElement;
-                    atomicLink.type = bond.props.flag;
-                    atomicLink.order = bond.props.order;
-
-                    if (atomicLink.test(ctx, true)) {
-                        builder.addToUnit(linkedUnit.unitB.id, bElement);
+                    if ((currentUnitB && SortedArray.has(currentUnitB.elements, bElement)) || builder.has(bondedUnit.unitB.id, bElement)) continue;
+
+                    atomicBond.a.unit = inputUnitA;
+                    atomicBond.aIndex = aI;
+                    atomicBond.a.element = inputUnitA.elements[aI];
+                    atomicBond.b.unit = bondedUnit.unitB;
+                    atomicBond.bIndex = bond.indexB;
+                    atomicBond.b.element = bElement;
+                    atomicBond.type = bond.props.flag;
+                    atomicBond.order = bond.props.order;
+
+                    if (atomicBond.test(ctx, true)) {
+                        builder.addToUnit(bondedUnit.unitB.id, bElement);
                     }
                 }
             }

+ 2 - 2
src/mol-model/structure/structure.ts

@@ -8,9 +8,9 @@ import StructureElement from './structure/element'
 import Structure from './structure/structure'
 import Unit from './structure/unit'
 import StructureSymmetry from './structure/symmetry'
-import { Link } from './structure/unit/links'
+import { Bond } from './structure/unit/bonds'
 import StructureProperties from './structure/properties'
 
-export { StructureElement, Link, Structure, Unit, StructureSymmetry, StructureProperties }
+export { StructureElement, Bond, Structure, Unit, StructureSymmetry, StructureProperties }
 export * from './structure/unit/rings'
 export * from './export/mmcif'

+ 4 - 4
src/mol-model/structure/structure/carbohydrates/compute.ts

@@ -33,7 +33,7 @@ function getAnomericCarbon(unit: Unit.Atomic, ringAtoms: ArrayLike<StructureElem
     let indexHasTwoOxygen = -1, indexHasOxygenAndCarbon = -1, indexHasC1Name = -1, indexIsCarbon = -1
     const { elements } = unit
     const { type_symbol, label_atom_id } = unit.model.atomicHierarchy.atoms
-    const { b: neighbor, offset } = unit.links;
+    const { b: neighbor, offset } = unit.bonds;
     for (let i = 0, il = ringAtoms.length; i < il; ++i) {
         const ei = elements[ringAtoms[i]]
         if (type_symbol.value(ei) !== C) continue
@@ -220,7 +220,7 @@ export function computeCarbohydrates(structure: Structure): Carbohydrates {
                     const rc = ringCombinations[j];
                     const r0 = rings.all[sugarRings[rc[0]]], r1 = rings.all[sugarRings[rc[1]]];
                     // 1,6 glycosidic links are distance 3 and 1,4 glycosidic links are distance 2
-                    if (IntAdjacencyGraph.areVertexSetsConnected(unit.links, r0, r1, 3)) {
+                    if (IntAdjacencyGraph.areVertexSetsConnected(unit.bonds, r0, r1, 3)) {
                         const re0 = ringElements[rc[0]]
                         const re1 = ringElements[rc[1]]
                         if (elements[re0].ringAltId === elements[re1].ringAltId) {
@@ -246,7 +246,7 @@ export function computeCarbohydrates(structure: Structure): Carbohydrates {
     for (let i = 0, il = elements.length; i < il; ++i) {
         const carbohydrate = elements[i]
         const { unit, residueIndex, anomericCarbon } = carbohydrate
-        const { offset, b } = unit.links
+        const { offset, b } = unit.bonds
         const ac = SortedArray.indexOf(unit.elements, anomericCarbon) as StructureElement.UnitIndex
 
         for (let j = offset[ac], jl = offset[ac + 1]; j < jl; ++j) {
@@ -276,7 +276,7 @@ export function computeCarbohydrates(structure: Structure): Carbohydrates {
         const unit = structure.units[i]
         if (!Unit.isAtomic(unit)) continue
 
-        structure.interUnitBonds.getLinkedUnits(unit).forEach(pairBonds => {
+        structure.interUnitBonds.getConnectedUnits(unit).forEach(pairBonds => {
             pairBonds.connectedIndices.forEach(indexA => {
                 pairBonds.getEdges(indexA).forEach(bondInfo => {
                     const { unitA, unitB } = pairBonds

+ 3 - 3
src/mol-model/structure/structure/structure.ts

@@ -15,7 +15,7 @@ import Unit from './unit'
 import { StructureLookup3D } from './util/lookup3d';
 import { CoarseElements } from '../model/properties/coarse';
 import { StructureSubsetBuilder } from './util/subset-builder';
-import { InterUnitBonds, computeInterUnitBonds, Link } from './unit/links';
+import { InterUnitBonds, computeInterUnitBonds, Bond } from './unit/bonds';
 import { PairRestraints, CrossLinkRestraint, extractCrossLinkRestraints } from './unit/pair-restraints';
 import StructureSymmetry from './symmetry';
 import StructureProperties from './properties';
@@ -91,7 +91,7 @@ class Structure {
     /** Count of all bonds (intra- and inter-unit) in the structure */
     get bondCount() {
         if (!this._props.bondCount) {
-            this._props.bondCount = this.interUnitBonds.edgeCount + Link.getIntraUnitBondCount(this)
+            this._props.bondCount = this.interUnitBonds.edgeCount + Bond.getIntraUnitBondCount(this)
         }
         return this._props.bondCount;
     }
@@ -305,7 +305,7 @@ class Structure {
         return this._props.model;
     }
 
-    /** The master-model, other models can have links to it  */
+    /** The master-model, other models can have bonds to it  */
     get masterModel(): Model | undefined {
         return this._props.masterModel
     }

+ 8 - 8
src/mol-model/structure/structure/unit.ts

@@ -8,7 +8,7 @@
 import { SymmetryOperator } from '../../../mol-math/geometry/symmetry-operator'
 import { Model } from '../model'
 import { GridLookup3D, Lookup3D } from '../../../mol-math/geometry'
-import { IntraUnitLinks, computeIntraUnitBonds } from './unit/links'
+import { IntraUnitBonds, computeIntraUnitBonds } from './unit/bonds'
 import { CoarseElements, CoarseSphereConformation, CoarseGaussianConformation } from '../model/properties/coarse';
 import { ValueRef, BitFlags } from '../../../mol-util';
 import { UnitRings } from './unit/rings';
@@ -150,7 +150,7 @@ namespace Unit {
     /**
      * A bulding block of a structure that corresponds
      * to a "natural group of atoms" (most often a "chain")
-     * together with a tranformation (rotation and translation)
+     * together with a transformation (rotation and translation)
      * that is dynamically applied to the underlying atom set.
      *
      * An atom set can be referenced by multiple different units which
@@ -199,10 +199,10 @@ namespace Unit {
             return this.props.principalAxes.ref;
         }
 
-        get links() {
-            if (this.props.links.ref) return this.props.links.ref;
-            this.props.links.ref = computeIntraUnitBonds(this);
-            return this.props.links.ref;
+        get bonds() {
+            if (this.props.bonds.ref) return this.props.bonds.ref;
+            this.props.bonds.ref = computeIntraUnitBonds(this);
+            return this.props.bonds.ref;
         }
 
         get rings() {
@@ -271,7 +271,7 @@ namespace Unit {
     interface AtomicProperties {
         lookup3d: ValueRef<Lookup3D | undefined>,
         principalAxes: ValueRef<PrincipalAxes | undefined>,
-        links: ValueRef<IntraUnitLinks | undefined>,
+        bonds: ValueRef<IntraUnitBonds | undefined>,
         rings: ValueRef<UnitRings | undefined>
         polymerElements: ValueRef<SortedArray<ElementIndex> | undefined>
         gapElements: ValueRef<SortedArray<ElementIndex> | undefined>
@@ -284,7 +284,7 @@ namespace Unit {
         return {
             lookup3d: ValueRef.create(void 0),
             principalAxes: ValueRef.create(void 0),
-            links: ValueRef.create(void 0),
+            bonds: ValueRef.create(void 0),
             rings: ValueRef.create(void 0),
             polymerElements: ValueRef.create(void 0),
             gapElements: ValueRef.create(void 0),

+ 50 - 50
src/mol-model/structure/structure/unit/links.ts → src/mol-model/structure/structure/unit/bonds.ts

@@ -7,16 +7,16 @@
 
 import { Unit, StructureElement } from '../../structure'
 import Structure from '../structure';
-import { LinkType } from '../../model/types';
+import { BondType } from '../../model/types';
 import { SortedArray, Iterator } from '../../../../mol-data/int';
 
-export * from './links/data'
-export * from './links/intra-compute'
-export * from './links/inter-compute'
+export * from './bonds/data'
+export * from './bonds/intra-compute'
+export * from './bonds/inter-compute'
 
-namespace Link {
+namespace Bond {
     export interface Location<U extends Unit = Unit> {
-        readonly kind: 'link-location',
+        readonly kind: 'bond-location',
         aUnit: U,
         /** Index into aUnit.elements */
         aIndex: StructureElement.UnitIndex,
@@ -26,11 +26,11 @@ namespace Link {
     }
 
     export function Location(aUnit?: Unit, aIndex?: StructureElement.UnitIndex, bUnit?: Unit, bIndex?: StructureElement.UnitIndex): Location {
-        return { kind: 'link-location', aUnit: aUnit as any, aIndex: aIndex as any, bUnit: bUnit as any, bIndex: bIndex as any };
+        return { kind: 'bond-location', aUnit: aUnit as any, aIndex: aIndex as any, bUnit: bUnit as any, bIndex: bIndex as any };
     }
 
     export function isLocation(x: any): x is Location {
-        return !!x && x.kind === 'link-location';
+        return !!x && x.kind === 'bond-location';
     }
 
     export function areLocationsEqual(locA: Location, locB: Location) {
@@ -41,36 +41,36 @@ namespace Link {
     }
 
     export interface Loci {
-        readonly kind: 'link-loci',
+        readonly kind: 'bond-loci',
         readonly structure: Structure
-        readonly links: ReadonlyArray<Location>
+        readonly bonds: ReadonlyArray<Location>
     }
 
-    export function Loci(structure: Structure, links: ArrayLike<Location>): Loci {
-        return { kind: 'link-loci', structure, links: links as Loci['links'] };
+    export function Loci(structure: Structure, bonds: ArrayLike<Location>): Loci {
+        return { kind: 'bond-loci', structure, bonds: bonds as Loci['bonds'] };
     }
 
     export function isLoci(x: any): x is Loci {
-        return !!x && x.kind === 'link-loci';
+        return !!x && x.kind === 'bond-loci';
     }
 
     export function areLociEqual(a: Loci, b: Loci) {
-        if (a.links.length !== b.links.length) return false
-        for (let i = 0, il = a.links.length; i < il; ++i) {
-            if (!areLocationsEqual(a.links[i], b.links[i])) return false
+        if (a.bonds.length !== b.bonds.length) return false
+        for (let i = 0, il = a.bonds.length; i < il; ++i) {
+            if (!areLocationsEqual(a.bonds[i], b.bonds[i])) return false
         }
         return true
     }
 
     export function isLociEmpty(loci: Loci) {
-        return loci.links.length === 0 ? true : false
+        return loci.bonds.length === 0 ? true : false
     }
 
     export function remapLoci(loci: Loci, structure: Structure): Loci {
         if (structure === loci.structure) return loci
 
-        const links: Loci['links'][0][] = [];
-        loci.links.forEach(l => {
+        const bonds: Loci['bonds'][0][] = [];
+        loci.bonds.forEach(l => {
             const unitA = structure.unitMap.get(l.aUnit.id)
             if (!unitA) return
             const unitB = structure.unitMap.get(l.bUnit.id)
@@ -83,18 +83,18 @@ namespace Link {
             const indexB = SortedArray.indexOf(unitB.elements, elementB) as StructureElement.UnitIndex | -1
             if (indexB === -1) return
 
-            links.push(Location(unitA, indexA, unitB, indexB))
+            bonds.push(Location(unitA, indexA, unitB, indexB))
         });
 
-        return Loci(structure, links);
+        return Loci(structure, bonds);
     }
 
     export function toStructureElementLoci(loci: Loci): StructureElement.Loci {
         const elements: StructureElement.Loci['elements'][0][] = []
         const map = new Map<number, number[]>()
 
-        for (const lociLink of loci.links) {
-            const { aIndex, aUnit, bIndex, bUnit } = lociLink
+        for (const lociBond of loci.bonds) {
+            const { aIndex, aUnit, bIndex, bUnit } = lociBond
             if (aUnit === bUnit) {
                 if (map.has(aUnit.id)) map.get(aUnit.id)!.push(aIndex, bIndex)
                 else map.set(aUnit.id, [aIndex, bIndex])
@@ -116,27 +116,27 @@ namespace Link {
         return StructureElement.Loci(loci.structure, elements);
     }
 
-    export function getType(structure: Structure, link: Location<Unit.Atomic>): LinkType {
-        if (link.aUnit === link.bUnit) {
-            const links = link.aUnit.links;
-            const idx = links.getEdgeIndex(link.aIndex, link.bIndex);
-            if (idx < 0) return LinkType.create(LinkType.Flag.None);
-            return LinkType.create(links.edgeProps.flags[idx]);
+    export function getType(structure: Structure, location: Location<Unit.Atomic>): BondType {
+        if (location.aUnit === location.bUnit) {
+            const bonds = location.aUnit.bonds;
+            const idx = bonds.getEdgeIndex(location.aIndex, location.bIndex);
+            if (idx < 0) return BondType.create(BondType.Flag.None);
+            return BondType.create(bonds.edgeProps.flags[idx]);
         } else {
-            const bond = structure.interUnitBonds.getBondFromLocation(link);
-            if (bond) return LinkType.create(bond.props.flag);
-            return LinkType.create(LinkType.Flag.None);
+            const bond = structure.interUnitBonds.getBondFromLocation(location);
+            if (bond) return BondType.create(bond.props.flag);
+            return BondType.create(BondType.Flag.None);
         }
     }
 
-    export function getOrder(structure: Structure, link: Location<Unit.Atomic>): number {
-        if (link.aUnit === link.bUnit) {
-            const links = link.aUnit.links;
-            const idx = links.getEdgeIndex(link.aIndex, link.bIndex);
+    export function getOrder(structure: Structure, location: Location<Unit.Atomic>): number {
+        if (location.aUnit === location.bUnit) {
+            const bonds = location.aUnit.bonds;
+            const idx = bonds.getEdgeIndex(location.aIndex, location.bIndex);
             if (idx < 0) return 0;
-            return links.edgeProps.order[idx];
+            return bonds.edgeProps.order[idx];
         } else {
-            const bond = structure.interUnitBonds.getBondFromLocation(link);
+            const bond = structure.interUnitBonds.getBondFromLocation(location);
             if (bond) return bond.props.order;
             return 0;
         }
@@ -146,20 +146,20 @@ namespace Link {
         let count = 0
         for (let i = 0, il = structure.units.length; i < il; ++i) {
             const u = structure.units[i]
-            if (Unit.isAtomic(u)) count += u.links.edgeCount / 2 // only count one direction
+            if (Unit.isAtomic(u)) count += u.bonds.edgeCount / 2 // only count one direction
         }
         return count
     }
 
-    export interface ElementLinkData {
+    export interface ElementBondData {
         otherUnit: Unit.Atomic
         otherIndex: StructureElement.UnitIndex
-        type: LinkType
+        type: BondType
         order: number
     }
 
-    export class ElementLinkIterator implements Iterator<ElementLinkData> {
-        private current: ElementLinkData = {} as any
+    export class ElementBondIterator implements Iterator<ElementBondData> {
+        private current: ElementBondData = {} as any
 
         private structure: Structure
         private unit: Unit.Atomic
@@ -173,7 +173,7 @@ namespace Link {
         private intraBondIndex: number
 
         hasNext: boolean;
-        move(): ElementLinkData {
+        move(): ElementBondData {
             this.advance()
             return this.current
         }
@@ -187,8 +187,8 @@ namespace Link {
             this.interBondCount = this.interBondIndices.length
             this.interBondIndex = 0
 
-            this.intraBondEnd = unit.links.offset[index + 1]
-            this.intraBondIndex = unit.links.offset[index]
+            this.intraBondEnd = unit.bonds.offset[index + 1]
+            this.intraBondIndex = unit.bonds.offset[index]
 
             this.hasNext = this.interBondIndex < this.interBondCount || this.intraBondIndex < this.intraBondEnd
         }
@@ -196,9 +196,9 @@ namespace Link {
         private advance() {
             if (this.intraBondIndex < this.intraBondEnd) {
                 this.current.otherUnit = this.unit
-                this.current.otherIndex = this.unit.links.b[this.intraBondIndex] as StructureElement.UnitIndex
-                this.current.type = this.unit.links.edgeProps.flags[this.intraBondIndex]
-                this.current.order = this.unit.links.edgeProps.order[this.intraBondIndex]
+                this.current.otherIndex = this.unit.bonds.b[this.intraBondIndex] as StructureElement.UnitIndex
+                this.current.type = this.unit.bonds.edgeProps.flags[this.intraBondIndex]
+                this.current.order = this.unit.bonds.edgeProps.order[this.intraBondIndex]
                 this.intraBondIndex += 1
             } else if (this.interBondIndex < this.interBondCount) {
                 const b = this.structure.interUnitBonds.edges[this.interBondIndex]
@@ -220,4 +220,4 @@ namespace Link {
     }
 }
 
-export { Link }
+export { Bond }

+ 2 - 2
src/mol-model/structure/structure/unit/links/common.ts → src/mol-model/structure/structure/unit/bonds/common.ts

@@ -6,7 +6,7 @@
 
 import { ElementSymbol } from '../../../model/types';
 
-export interface LinkComputationProps {
+export interface BondComputationProps {
     /**
      * Experimental covalent hydrogen bond lengths
      *
@@ -33,7 +33,7 @@ export interface LinkComputationProps {
     maxCovalentHydrogenBondingLength: number,
     forceCompute: boolean
 }
-export const DefaultLinkComputationProps: LinkComputationProps = {
+export const DefaultBondComputationProps: BondComputationProps = {
     maxCovalentHydrogenBondingLength: 1.45,
     forceCompute: false
 }

+ 11 - 11
src/mol-model/structure/structure/unit/links/data.ts → src/mol-model/structure/structure/unit/bonds/data.ts

@@ -5,29 +5,29 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { LinkType } from '../../../model/types'
+import { BondType } from '../../../model/types'
 import { IntAdjacencyGraph } from '../../../../../mol-math/graph';
 import Unit from '../../unit';
 import StructureElement from '../../element';
-import { Link } from '../links';
+import { Bond } from '../bonds';
 import { InterUnitGraph } from '../../../../../mol-math/graph/inter-unit-graph';
 
-type IntraUnitLinks = IntAdjacencyGraph<{ readonly order: ArrayLike<number>, readonly flags: ArrayLike<LinkType.Flag> }>
+type IntraUnitBonds = IntAdjacencyGraph<{ readonly order: ArrayLike<number>, readonly flags: ArrayLike<BondType.Flag> }>
 
-namespace IntraUnitLinks {
-    export const Empty: IntraUnitLinks = IntAdjacencyGraph.create([], [], [], 0, { flags: [], order: [] });
+namespace IntraUnitBonds {
+    export const Empty: IntraUnitBonds = IntAdjacencyGraph.create([], [], [], 0, { flags: [], order: [] });
 }
 
-type InterUnitEdgeProps = { readonly order: number, readonly flag: LinkType.Flag }
+type InterUnitEdgeProps = { readonly order: number, readonly flag: BondType.Flag }
 
 class InterUnitBonds extends InterUnitGraph<Unit.Atomic, StructureElement.UnitIndex, InterUnitEdgeProps> {
-    /** Get inter-unit bond given a link-location */
-    getBondFromLocation(l: Link.Location) {
+    /** Get inter-unit bond given a bond-location */
+    getBondFromLocation(l: Bond.Location) {
         return Unit.isAtomic(l.aUnit) && Unit.isAtomic(l.bUnit) ? this.getEdge(l.aIndex, l.aUnit, l.bIndex, l.bUnit) : undefined;
     }
 
-    /** Get inter-unit bond index given a link-location */
-    getBondIndexFromLocation(l: Link.Location) {
+    /** Get inter-unit bond index given a bond-location */
+    getBondIndexFromLocation(l: Bond.Location) {
         return Unit.isAtomic(l.aUnit) && Unit.isAtomic(l.bUnit) ? this.getEdgeIndex(l.aIndex, l.aUnit, l.bIndex, l.bUnit) : -1;
     }
 }
@@ -37,4 +37,4 @@ namespace InterUnitBonds {
     export type BondInfo = InterUnitGraph.EdgeInfo<StructureElement.UnitIndex, InterUnitEdgeProps>
 }
 
-export { IntraUnitLinks, InterUnitBonds }
+export { IntraUnitBonds, InterUnitBonds }

+ 17 - 17
src/mol-model/structure/structure/unit/links/inter-compute.ts → src/mol-model/structure/structure/unit/bonds/inter-compute.ts

@@ -5,10 +5,10 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { LinkType } from '../../../model/types';
+import { BondType } from '../../../model/types';
 import Structure from '../../structure';
 import Unit from '../../unit';
-import { getElementIdx, getElementPairThreshold, getElementThreshold, isHydrogen, LinkComputationProps, MetalsSet, DefaultLinkComputationProps } from './common';
+import { getElementIdx, getElementPairThreshold, getElementThreshold, isHydrogen, BondComputationProps, MetalsSet, DefaultBondComputationProps } from './common';
 import { InterUnitBonds } from './data';
 import { UniqueArray } from '../../../../../mol-data/generic';
 import { SortedArray } from '../../../../../mol-data/int';
@@ -16,7 +16,7 @@ import { Vec3, Mat4 } from '../../../../../mol-math/linear-algebra';
 import StructureElement from '../../element';
 import { StructConn } from '../../../../../mol-model-formats/structure/mmcif/bonds';
 import { ElementIndex } from '../../../model/indexing';
-import { getInterBondOrderFromTable } from '../../../../../mol-model/structure/model/properties/atomic/bonds';
+import { getInterBondOrderFromTable } from '../../../model/properties/atomic/bonds';
 
 const MAX_RADIUS = 4;
 
@@ -32,7 +32,7 @@ interface PairState {
     bondedB: UniqueArray<StructureElement.UnitIndex, StructureElement.UnitIndex>
 }
 
-function addLink(indexA: StructureElement.UnitIndex, indexB: StructureElement.UnitIndex, order: number, flag: LinkType.Flag, state: PairState) {
+function addBond(indexA: StructureElement.UnitIndex, indexB: StructureElement.UnitIndex, order: number, flag: BondType.Flag, state: PairState) {
     addMapEntry(state.mapAB, indexA, { indexB, props: { order, flag } });
     addMapEntry(state.mapBA, indexB, { indexB: indexA, props: { order, flag } });
 
@@ -50,7 +50,7 @@ function getDistance(unitA: Unit.Atomic, indexA: ElementIndex, unitB: Unit.Atomi
 
 const _imageTransform = Mat4.zero();
 
-function findPairLinks(unitA: Unit.Atomic, unitB: Unit.Atomic, props: LinkComputationProps, map: Map<number, InterUnitBonds.UnitPairBonds[]>) {
+function findPairBonds(unitA: Unit.Atomic, unitB: Unit.Atomic, props: BondComputationProps, map: Map<number, InterUnitBonds.UnitPairBonds[]>) {
     const state: PairState = { mapAB: new Map(), mapBA: new Map(), bondedA: UniqueArray.create(), bondedB: UniqueArray.create() };
     let bondCount = 0;
 
@@ -93,7 +93,7 @@ function findPairLinks(unitA: Unit.Atomic, unitB: Unit.Atomic, props: LinkComput
                     if (_bI < 0) continue;
                     // check if the bond is within MAX_RADIUS for this pair of units
                     if (getDistance(unitA, aI, unitB, p.atomIndex) > MAX_RADIUS) continue;
-                    addLink(_aI, _bI, se.order, se.flags, state);
+                    addBond(_aI, _bI, se.order, se.flags, state);
                     bondCount++;
                     added = true;
                 }
@@ -132,10 +132,10 @@ function findPairLinks(unitA: Unit.Atomic, unitB: Unit.Atomic, props: LinkComput
 
             if (isHa || isHb) {
                 if (dist < props.maxCovalentHydrogenBondingLength) {
-                    addLink(
+                    addBond(
                         _aI, _bI,
                         1, // covalent bonds involving a hydrogen are always of order 1
-                        LinkType.Flag.Covalent | LinkType.Flag.Computed,
+                        BondType.Flag.Covalent | BondType.Flag.Computed,
                         state
                     );
                     bondCount++;
@@ -151,10 +151,10 @@ function findPairLinks(unitA: Unit.Atomic, unitB: Unit.Atomic, props: LinkComput
             if (dist <= pairingThreshold) {
                 const atomIdB = label_atom_idB.value(bI);
                 const compIdB = label_comp_idB.value(residueIndexB[bI]);
-                addLink(
+                addBond(
                     _aI, _bI,
                     getInterBondOrderFromTable(compIdA, compIdB, atomIdA, atomIdB),
-                    (isMetal ? LinkType.Flag.MetallicCoordination : LinkType.Flag.Covalent) | LinkType.Flag.Computed,
+                    (isMetal ? BondType.Flag.MetallicCoordination : BondType.Flag.Covalent) | BondType.Flag.Computed,
                     state
                 );
                 bondCount++;
@@ -170,11 +170,11 @@ function findPairLinks(unitA: Unit.Atomic, unitB: Unit.Atomic, props: LinkComput
     return bondCount;
 }
 
-export interface InterLinkComputationProps extends LinkComputationProps {
+export interface InterBondComputationProps extends BondComputationProps {
     validUnitPair: (unitA: Unit, unitB: Unit) => boolean
 }
 
-function findLinks(structure: Structure, props: InterLinkComputationProps) {
+function findBonds(structure: Structure, props: InterBondComputationProps) {
     const map = new Map<number, InterUnitBonds.UnitPairBonds[]>();
     if (!structure.units.some(u => Unit.isAtomic(u))) return new InterUnitBonds(map);
 
@@ -192,8 +192,8 @@ function findLinks(structure: Structure, props: InterLinkComputationProps) {
             const other = structure.units[closeUnits.indices[i]];
             if (!Unit.isAtomic(other) || unit.id >= other.id || !validUnitPair(unit, other)) continue;
 
-            if (other.elements.length >= unit.elements.length) findPairLinks(unit, other, props, map);
-            else findPairLinks(other, unit, props, map);
+            if (other.elements.length >= unit.elements.length) findPairBonds(unit, other, props, map);
+            else findPairBonds(other, unit, props, map);
         }
     }
 
@@ -209,9 +209,9 @@ function ValidUnitPair(structure: Structure) {
     }
 }
 
-function computeInterUnitBonds(structure: Structure, props?: Partial<InterLinkComputationProps>): InterUnitBonds {
-    return findLinks(structure, {
-        ...DefaultLinkComputationProps,
+function computeInterUnitBonds(structure: Structure, props?: Partial<InterBondComputationProps>): InterUnitBonds {
+    return findBonds(structure, {
+        ...DefaultBondComputationProps,
         validUnitPair: (props && props.validUnitPair) || ValidUnitPair(structure),
     });
 }

+ 12 - 12
src/mol-model/structure/structure/unit/links/intra-compute.ts → src/mol-model/structure/structure/unit/bonds/intra-compute.ts

@@ -5,16 +5,16 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { LinkType } from '../../../model/types'
-import { IntraUnitLinks } from './data'
+import { BondType } from '../../../model/types'
+import { IntraUnitBonds } from './data'
 import Unit from '../../unit'
 import { IntAdjacencyGraph } from '../../../../../mol-math/graph';
-import { LinkComputationProps, getElementIdx, MetalsSet, getElementThreshold, isHydrogen, getElementPairThreshold, DefaultLinkComputationProps } from './common';
+import { BondComputationProps, getElementIdx, MetalsSet, getElementThreshold, isHydrogen, getElementPairThreshold, DefaultBondComputationProps } from './common';
 import { SortedArray } from '../../../../../mol-data/int';
 import { StructConn, ComponentBond } from '../../../../../mol-model-formats/structure/mmcif/bonds';
-import { getIntraBondOrderFromTable } from '../../../../../mol-model/structure/model/properties/atomic/bonds';
+import { getIntraBondOrderFromTable } from '../../../model/properties/atomic/bonds';
 
-function getGraph(atomA: number[], atomB: number[], _order: number[], _flags: number[], atomCount: number): IntraUnitLinks {
+function getGraph(atomA: number[], atomB: number[], _order: number[], _flags: number[], atomCount: number): IntraUnitBonds {
     const builder = new IntAdjacencyGraph.EdgeBuilder(atomCount, atomA, atomB);
     const flags = new Uint16Array(builder.slotCount);
     const order = new Int8Array(builder.slotCount);
@@ -27,7 +27,7 @@ function getGraph(atomA: number[], atomB: number[], _order: number[], _flags: nu
     return builder.createGraph({ flags, order });
 }
 
-function _computeBonds(unit: Unit.Atomic, props: LinkComputationProps): IntraUnitLinks {
+function _computeBonds(unit: Unit.Atomic, props: BondComputationProps): IntraUnitBonds {
     const MAX_RADIUS = 4;
 
     const { x, y, z } = unit.model.atomicConformation;
@@ -109,8 +109,8 @@ function _computeBonds(unit: Unit.Atomic, props: LinkComputationProps): IntraUni
                     order[order.length] = e.order;
                     let flag = e.flags;
                     if (isMetal) {
-                        if (flag | LinkType.Flag.Covalent) flag ^= LinkType.Flag.Covalent;
-                        flag |= LinkType.Flag.MetallicCoordination;
+                        if (flag | BondType.Flag.Covalent) flag ^= BondType.Flag.Covalent;
+                        flag |= BondType.Flag.MetallicCoordination;
                     }
                     flags[flags.length] = flag;
                 }
@@ -128,7 +128,7 @@ function _computeBonds(unit: Unit.Atomic, props: LinkComputationProps): IntraUni
                     atomA[atomA.length] = _aI;
                     atomB[atomB.length] = _bI;
                     order[order.length] = 1; // covalent bonds involving hydrogen are always of order 1
-                    flags[flags.length] = LinkType.Flag.Covalent | LinkType.Flag.Computed;
+                    flags[flags.length] = BondType.Flag.Covalent | BondType.Flag.Computed;
                 }
                 continue;
             }
@@ -142,7 +142,7 @@ function _computeBonds(unit: Unit.Atomic, props: LinkComputationProps): IntraUni
                 atomA[atomA.length] = _aI;
                 atomB[atomB.length] = _bI;
                 order[order.length] = getIntraBondOrderFromTable(compId, atomIdA, label_atom_id.value(bI));
-                flags[flags.length] = (isMetal ? LinkType.Flag.MetallicCoordination : LinkType.Flag.Covalent) | LinkType.Flag.Computed;
+                flags[flags.length] = (isMetal ? BondType.Flag.MetallicCoordination : BondType.Flag.Covalent) | BondType.Flag.Computed;
             }
         }
     }
@@ -150,8 +150,8 @@ function _computeBonds(unit: Unit.Atomic, props: LinkComputationProps): IntraUni
     return getGraph(atomA, atomB, order, flags, atomCount);
 }
 
-function computeIntraUnitBonds(unit: Unit.Atomic, props?: Partial<LinkComputationProps>) {
-    return _computeBonds(unit, { ...DefaultLinkComputationProps, ...props });
+function computeIntraUnitBonds(unit: Unit.Atomic, props?: Partial<BondComputationProps>) {
+    return _computeBonds(unit, { ...DefaultBondComputationProps, ...props });
 }
 
 export { computeIntraUnitBonds }

+ 6 - 6
src/mol-model/structure/structure/unit/rings/compute.ts

@@ -6,10 +6,10 @@
 
 import { Segmentation, SortedArray } from '../../../../../mol-data/int';
 import { IntAdjacencyGraph } from '../../../../../mol-math/graph';
-import { LinkType } from '../../../model/types';
+import { BondType } from '../../../model/types';
 import { StructureElement } from '../../../structure';
 import Unit from '../../unit';
-import { IntraUnitLinks } from '../links/data';
+import { IntraUnitBonds } from '../bonds/data';
 import { sortArray } from '../../../../../mol-data/util';
 
 export function computeRings(unit: Unit.Atomic) {
@@ -44,7 +44,7 @@ interface State {
     currentColor: number,
 
     rings: SortedArray<StructureElement.UnitIndex>[],
-    bonds: IntraUnitLinks,
+    bonds: IntraUnitBonds,
     unit: Unit.Atomic
 }
 
@@ -62,7 +62,7 @@ function State(unit: Unit.Atomic, capacity: number): State {
         currentColor: 0,
         rings: [],
         unit,
-        bonds: unit.links
+        bonds: unit.bonds
     };
 }
 
@@ -153,7 +153,7 @@ function addRing(state: State, a: number, b: number) {
 
 function findRings(state: State, from: number) {
     const { bonds, startVertex, endVertex, visited, queue, pred } = state;
-    const { b: neighbor, edgeProps: { flags: linkFlags }, offset } = bonds;
+    const { b: neighbor, edgeProps: { flags: bondFlags }, offset } = bonds;
     visited[from] = 1;
     queue[0] = from;
     let head = 0, size = 1;
@@ -165,7 +165,7 @@ function findRings(state: State, from: number) {
 
         for (let i = start; i < end; i++) {
             const b = neighbor[i];
-            if (b < startVertex || b >= endVertex || !LinkType.isCovalent(linkFlags[i])) continue;
+            if (b < startVertex || b >= endVertex || !BondType.isCovalent(bondFlags[i])) continue;
 
             const other = b - startVertex;
 

+ 3 - 3
src/mol-plugin/behavior/dynamic/selection/structure-representation-interaction.ts

@@ -5,7 +5,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Structure, StructureElement, Link } from '../../../../mol-model/structure';
+import { Structure, StructureElement, Bond } from '../../../../mol-model/structure';
 import { PluginBehavior } from '../../../../mol-plugin/behavior';
 import { PluginCommands } from '../../../../mol-plugin/command';
 import { PluginStateObject } from '../../../../mol-plugin/state/objects';
@@ -146,8 +146,8 @@ export class StructureRepresentationInteractionBehavior extends PluginBehavior.W
                 let loci: StructureElement.Loci;
                 if (StructureElement.Loci.is(current.loci)) {
                     loci = current.loci;
-                } else if (Link.isLoci(current.loci)) {
-                    loci = Link.toStructureElementLoci(current.loci);
+                } else if (Bond.isLoci(current.loci)) {
+                    loci = Bond.toStructureElementLoci(current.loci);
                 } else if (Structure.isLoci(current.loci)) {
                     loci = Structure.toStructureElementLoci(current.loci.structure);
                 } else {

+ 3 - 3
src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts

@@ -22,7 +22,7 @@ import { PluginCommands } from '../../../command';
 import { StateSelection } from '../../../../mol-state';
 import { Representation } from '../../../../mol-repr/representation';
 import { ButtonsType, ModifiersKeys } from '../../../../mol-util/input/input-observer';
-import { StructureElement, Link, Structure } from '../../../../mol-model/structure';
+import { StructureElement, Bond, Structure } from '../../../../mol-model/structure';
 import { PluginContext } from '../../../context';
 import { Binding } from '../../../../mol-util/binding';
 import { EmptyLoci, Loci, isEmptyLoci } from '../../../../mol-model/loci';
@@ -259,8 +259,8 @@ export namespace VolumeStreaming {
         private getNormalizedLoci(loci: Loci): StructureElement.Loci | EmptyLoci {
             if (StructureElement.Loci.is(loci)) {
                 return loci;
-            } else if (Link.isLoci(loci)) {
-                return Link.toStructureElementLoci(loci);
+            } else if (Bond.isLoci(loci)) {
+                return Bond.toStructureElementLoci(loci);
             } else if (Structure.isLoci(loci)) {
                 return Structure.toStructureElementLoci(loci.structure);
             } else {

+ 7 - 7
src/mol-plugin/util/structure-selection-helper.ts

@@ -13,7 +13,7 @@ import { compile } from '../../mol-script/runtime/query/compiler';
 import { Loci } from '../../mol-model/loci';
 import { PluginContext } from '../context';
 import Expression from '../../mol-script/language/expression';
-import { LinkType, ProteinBackboneAtoms, NucleicBackboneAtoms, SecondaryStructureType } from '../../mol-model/structure/model/types';
+import { BondType, ProteinBackboneAtoms, NucleicBackboneAtoms, SecondaryStructureType } from '../../mol-model/structure/model/types';
 import { StateTransforms } from '../state/transforms';
 
 export interface StructureSelectionQuery {
@@ -231,10 +231,10 @@ const ligandPlusConnected = StructureSelectionQuery('Ligand with Connected', MS.
                 0: ligand.expression,
                 'layer-count': 1,
                 'as-whole-residues': true,
-                'link-test': MS.core.flags.hasAny([
-                    MS.struct.linkProperty.flags(),
+                'bond-test': MS.core.flags.hasAny([
+                    MS.struct.bondProperty.flags(),
                     MS.core.type.bitflags([
-                        LinkType.Flag.Covalent | LinkType.Flag.MetallicCoordination
+                        BondType.Flag.Covalent | BondType.Flag.MetallicCoordination
                     ])
                 ])
             })
@@ -261,10 +261,10 @@ const connectedOnly = StructureSelectionQuery('Connected to Ligand or Carbohydra
 const disulfideBridges = StructureSelectionQuery('Disulfide Bridges', MS.struct.modifier.union([
     MS.struct.modifier.wholeResidues([
         MS.struct.modifier.union([
-            MS.struct.generator.linkedAtomicPairs({
+            MS.struct.generator.bondedAtomicPairs({
                 0: MS.core.flags.hasAny([
-                    MS.struct.linkProperty.flags(),
-                    MS.core.type.bitflags([LinkType.Flag.Sulfide])
+                    MS.struct.bondProperty.flags(),
+                    MS.core.type.bitflags([BondType.Flag.Sulfide])
                 ])
             })
         ])

+ 2 - 2
src/mol-repr/structure/complex-representation.ts

@@ -8,7 +8,7 @@
 import { ParamDefinition as PD } from '../../mol-util/param-definition';
 import { StructureParams, ComplexVisual, StructureRepresentation, StructureRepresentationStateBuilder, StructureRepresentationState } from './representation';
 import { RepresentationContext, RepresentationParamsGetter } from '../representation';
-import { Structure, StructureElement, Link } from '../../mol-model/structure';
+import { Structure, StructureElement, Bond } from '../../mol-model/structure';
 import { Subject } from 'rxjs';
 import { getNextMaterialId, GraphicsRenderObject } from '../../mol-gl/render-object';
 import { Theme } from '../../mol-theme/theme';
@@ -58,7 +58,7 @@ export function ComplexRepresentation<P extends StructureParams>(label: string,
 
     function mark(loci: Loci, action: MarkerAction) {
         if (!_structure) return false
-        if (Structure.isLoci(loci) || StructureElement.Loci.is(loci) || Link.isLoci(loci)) {
+        if (Structure.isLoci(loci) || StructureElement.Loci.is(loci) || Bond.isLoci(loci)) {
             if (!Structure.areRootsEquivalent(loci.structure, _structure)) return false
             // Remap `loci` from equivalent structure to the current `_structure`
             loci = Loci.remap(loci, _structure)

+ 7 - 7
src/mol-repr/structure/representation/ball-and-stick.ts

@@ -5,8 +5,8 @@
  */
 
 import { getElementSphereVisual, ElementSphereParams } from '../visual/element-sphere';
-import { IntraUnitLinkVisual, IntraUnitLinkParams } from '../visual/intra-unit-link-cylinder';
-import { InterUnitLinkVisual, InterUnitLinkParams } from '../visual/inter-unit-link-cylinder';
+import { IntraUnitBondVisual, IntraUnitBondParams } from '../visual/bond-intra-unit-cylinder';
+import { InterUnitBondVisual, InterUnitBondParams } from '../visual/bond-inter-unit-cylinder';
 import { ParamDefinition as PD } from '../../../mol-util/param-definition';
 import { UnitsRepresentation } from '../units-representation';
 import { ComplexRepresentation } from '../complex-representation';
@@ -18,18 +18,18 @@ import { UnitKind, UnitKindOptions } from '../visual/util/common';
 
 const BallAndStickVisuals = {
     'element-sphere': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, ElementSphereParams>) => UnitsRepresentation('Element sphere mesh', ctx, getParams, getElementSphereVisual(ctx.webgl)),
-    'intra-link': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, IntraUnitLinkParams>) => UnitsRepresentation('Intra-unit link cylinder', ctx, getParams, IntraUnitLinkVisual),
-    'inter-link': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, InterUnitLinkParams>) => ComplexRepresentation('Inter-unit link cylinder', ctx, getParams, InterUnitLinkVisual),
+    'intra-bond': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, IntraUnitBondParams>) => UnitsRepresentation('Intra-unit bond cylinder', ctx, getParams, IntraUnitBondVisual),
+    'inter-bond': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, InterUnitBondParams>) => ComplexRepresentation('Inter-unit bond cylinder', ctx, getParams, InterUnitBondVisual),
 }
 
 export const BallAndStickParams = {
     ...ElementSphereParams,
-    ...IntraUnitLinkParams,
-    ...InterUnitLinkParams,
+    ...IntraUnitBondParams,
+    ...InterUnitBondParams,
     unitKinds: PD.MultiSelect<UnitKind>(['atomic'], UnitKindOptions),
     sizeFactor: PD.Numeric(0.15, { min: 0.01, max: 10, step: 0.01 }),
     sizeAspectRatio: PD.Numeric(2/3, { min: 0.01, max: 3, step: 0.01 }),
-    visuals: PD.MultiSelect(['element-sphere', 'intra-link', 'inter-link'], PD.objectToOptions(BallAndStickVisuals))
+    visuals: PD.MultiSelect(['element-sphere', 'intra-bond', 'inter-bond'], PD.objectToOptions(BallAndStickVisuals))
 }
 export type BallAndStickParams = typeof BallAndStickParams
 export function getBallAndStickParams(ctx: ThemeRegistryContext, structure: Structure) {

+ 8 - 8
src/mol-repr/structure/representation/ellipsoid.ts

@@ -12,24 +12,24 @@ import { UnitsRepresentation, StructureRepresentation, StructureRepresentationSt
 import { EllipsoidMeshParams, EllipsoidMeshVisual } from '../visual/ellipsoid-mesh';
 import { UnitKind, UnitKindOptions } from '../../../mol-repr/structure/visual/util/common';
 import { AtomSiteAnisotrop } from '../../../mol-model-formats/structure/mmcif/anisotropic';
-import { IntraUnitLinkParams, IntraUnitLinkVisual } from '../visual/intra-unit-link-cylinder';
-import { InterUnitLinkParams, InterUnitLinkVisual } from '../visual/inter-unit-link-cylinder';
+import { IntraUnitBondParams, IntraUnitBondVisual } from '../visual/bond-intra-unit-cylinder';
+import { InterUnitBondParams, InterUnitBondVisual } from '../visual/bond-inter-unit-cylinder';
 
 const EllipsoidVisuals = {
     'ellipsoid-mesh': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, EllipsoidMeshParams>) => UnitsRepresentation('Ellipsoid Mesh', ctx, getParams, EllipsoidMeshVisual),
-    'intra-link': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, IntraUnitLinkParams>) => UnitsRepresentation('Intra-unit link cylinder', ctx, getParams, IntraUnitLinkVisual),
-    'inter-link': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, InterUnitLinkParams>) => ComplexRepresentation('Inter-unit link cylinder', ctx, getParams, InterUnitLinkVisual),
+    'intra-bond': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, IntraUnitBondParams>) => UnitsRepresentation('Intra-unit bond cylinder', ctx, getParams, IntraUnitBondVisual),
+    'inter-bond': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, InterUnitBondParams>) => ComplexRepresentation('Inter-unit bond cylinder', ctx, getParams, InterUnitBondVisual),
 }
 
 export const EllipsoidParams = {
     ...EllipsoidMeshParams,
-    ...IntraUnitLinkParams,
-    ...InterUnitLinkParams,
+    ...IntraUnitBondParams,
+    ...InterUnitBondParams,
     unitKinds: PD.MultiSelect<UnitKind>(['atomic'], UnitKindOptions),
     sizeFactor: PD.Numeric(1, { min: 0.01, max: 10, step: 0.01 }),
     sizeAspectRatio: PD.Numeric(0.1, { min: 0.01, max: 3, step: 0.01 }),
-    linkCap: PD.Boolean(true),
-    visuals: PD.MultiSelect(['ellipsoid-mesh', 'intra-link', 'inter-link'], PD.objectToOptions(EllipsoidVisuals)),
+    bondCap: PD.Boolean(true),
+    visuals: PD.MultiSelect(['ellipsoid-mesh', 'intra-bond', 'inter-bond'], PD.objectToOptions(EllipsoidVisuals)),
 }
 export type EllipsoidParams = typeof EllipsoidParams
 export function getEllipsoidParams(ctx: ThemeRegistryContext, structure: Structure) {

+ 2 - 2
src/mol-repr/structure/units-representation.ts

@@ -11,7 +11,7 @@ import { UnitKind, UnitKindOptions } from './visual/util/common';
 import { Visual } from '../visual';
 import { StructureGroup } from './units-visual';
 import { RepresentationContext, RepresentationParamsGetter } from '../representation';
-import { Structure, Unit, StructureElement, Link } from '../../mol-model/structure';
+import { Structure, Unit, StructureElement, Bond } from '../../mol-model/structure';
 import { Subject } from 'rxjs';
 import { getNextMaterialId, GraphicsRenderObject } from '../../mol-gl/render-object';
 import { Theme } from '../../mol-theme/theme';
@@ -167,7 +167,7 @@ export function UnitsRepresentation<P extends UnitsParams>(label: string, ctx: R
     function mark(loci: Loci, action: MarkerAction) {
         let changed = false
         if (!_structure) return false
-        if (Structure.isLoci(loci) || StructureElement.Loci.is(loci) || Link.isLoci(loci)) {
+        if (Structure.isLoci(loci) || StructureElement.Loci.is(loci) || Bond.isLoci(loci)) {
             if (!Structure.areRootsEquivalent(loci.structure, _structure)) return false
             // Remap `loci` from equivalent structure to the current `_structure`
             loci = Loci.remap(loci, _structure)

+ 34 - 34
src/mol-repr/structure/visual/inter-unit-link-cylinder.ts → src/mol-repr/structure/visual/bond-inter-unit-cylinder.ts

@@ -6,12 +6,12 @@
 
 import { ParamDefinition as PD } from '../../../mol-util/param-definition';
 import { VisualContext } from '../../visual';
-import { Structure, StructureElement, Link, Unit } from '../../../mol-model/structure';
+import { Structure, StructureElement, Bond, Unit } from '../../../mol-model/structure';
 import { Theme } from '../../../mol-theme/theme';
 import { Mesh } from '../../../mol-geo/geometry/mesh/mesh';
 import { Vec3 } from '../../../mol-math/linear-algebra';
 import { BitFlags } from '../../../mol-util';
-import { createLinkCylinderMesh, LinkCylinderParams, LinkIterator } from './util/link';
+import { createBondCylinderMesh, BondCylinderParams, BondIterator } from './util/bond';
 import { ComplexMeshParams, ComplexVisual, ComplexMeshVisual } from '../complex-visual';
 import { VisualUpdateState } from '../../util';
 import { PickingId } from '../../../mol-geo/geometry/picking';
@@ -19,11 +19,11 @@ import { EmptyLoci, Loci } from '../../../mol-model/loci';
 import { Interval, OrderedSet } from '../../../mol-data/int';
 import { isHydrogen } from './util/common';
 
-const tmpRefPosLinkIt = new Link.ElementLinkIterator()
+const tmpRefPosBondIt = new Bond.ElementBondIterator()
 function setRefPosition(pos: Vec3, structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) {
-    tmpRefPosLinkIt.setElement(structure, unit, index)
-    while (tmpRefPosLinkIt.hasNext) {
-        const bA = tmpRefPosLinkIt.move()
+    tmpRefPosBondIt.setElement(structure, unit, index)
+    while (tmpRefPosBondIt.hasNext) {
+        const bA = tmpRefPosBondIt.move()
         bA.otherUnit.conformation.position(bA.otherUnit.elements[bA.otherIndex], pos)
         return pos
     }
@@ -33,15 +33,15 @@ function setRefPosition(pos: Vec3, structure: Structure, unit: Unit.Atomic, inde
 const tmpRef = Vec3()
 const tmpLoc = StructureElement.Location.create()
 
-function createInterUnitLinkCylinderMesh(ctx: VisualContext, structure: Structure, theme: Theme, props: PD.Values<InterUnitLinkParams>, mesh?: Mesh) {
-    const links = structure.interUnitBonds
-    const { edgeCount, edges } = links
+function createInterUnitBondCylinderMesh(ctx: VisualContext, structure: Structure, theme: Theme, props: PD.Values<InterUnitBondParams>, mesh?: Mesh) {
+    const bonds = structure.interUnitBonds
+    const { edgeCount, edges } = bonds
     const { sizeFactor, sizeAspectRatio, ignoreHydrogens } = props
 
     if (!edgeCount) return Mesh.createEmpty(mesh)
 
     const builderProps = {
-        linkCount: edgeCount,
+        bondCount: edgeCount,
         referencePosition: (edgeIndex: number) => {
             const b = edges[edgeIndex]
             let unitA: Unit, unitB: Unit
@@ -53,7 +53,7 @@ function createInterUnitLinkCylinderMesh(ctx: VisualContext, structure: Structur
                 unitA = b.unitB, unitB = b.unitA
                 indexA = b.indexB, indexB = b.indexA
             } else {
-                throw new Error('same units in createInterUnitLinkCylinderMesh')
+                throw new Error('same units in createInterUnitBondCylinderMesh')
             }
             return setRefPosition(tmpRef, structure, unitA, indexA) || setRefPosition(tmpRef, structure, unitB, indexB)
         },
@@ -82,49 +82,49 @@ function createInterUnitLinkCylinderMesh(ctx: VisualContext, structure: Structur
         } : () => false
     }
 
-    return createLinkCylinderMesh(ctx, builderProps, props, mesh)
+    return createBondCylinderMesh(ctx, builderProps, props, mesh)
 }
 
-export const InterUnitLinkParams = {
+export const InterUnitBondParams = {
     ...ComplexMeshParams,
-    ...LinkCylinderParams,
+    ...BondCylinderParams,
     sizeFactor: PD.Numeric(0.3, { min: 0, max: 10, step: 0.01 }),
     sizeAspectRatio: PD.Numeric(2/3, { min: 0, max: 3, step: 0.01 }),
     ignoreHydrogens: PD.Boolean(false),
 }
-export type InterUnitLinkParams = typeof InterUnitLinkParams
+export type InterUnitBondParams = typeof InterUnitBondParams
 
-export function InterUnitLinkVisual(materialId: number): ComplexVisual<InterUnitLinkParams> {
-    return ComplexMeshVisual<InterUnitLinkParams>({
-        defaultProps: PD.getDefaultValues(InterUnitLinkParams),
-        createGeometry: createInterUnitLinkCylinderMesh,
-        createLocationIterator: LinkIterator.fromStructure,
-        getLoci: getLinkLoci,
-        eachLocation: eachLink,
-        setUpdateState: (state: VisualUpdateState, newProps: PD.Values<InterUnitLinkParams>, currentProps: PD.Values<InterUnitLinkParams>) => {
+export function InterUnitBondVisual(materialId: number): ComplexVisual<InterUnitBondParams> {
+    return ComplexMeshVisual<InterUnitBondParams>({
+        defaultProps: PD.getDefaultValues(InterUnitBondParams),
+        createGeometry: createInterUnitBondCylinderMesh,
+        createLocationIterator: BondIterator.fromStructure,
+        getLoci: getBondLoci,
+        eachLocation: eachBond,
+        setUpdateState: (state: VisualUpdateState, newProps: PD.Values<InterUnitBondParams>, currentProps: PD.Values<InterUnitBondParams>) => {
             state.createGeometry = (
                 newProps.sizeFactor !== currentProps.sizeFactor ||
                 newProps.sizeAspectRatio !== currentProps.sizeAspectRatio ||
                 newProps.radialSegments !== currentProps.radialSegments ||
-                newProps.linkScale !== currentProps.linkScale ||
-                newProps.linkSpacing !== currentProps.linkSpacing ||
+                newProps.bondScale !== currentProps.bondScale ||
+                newProps.bondSpacing !== currentProps.bondSpacing ||
                 newProps.ignoreHydrogens !== currentProps.ignoreHydrogens ||
-                newProps.linkCap !== currentProps.linkCap
+                newProps.bondCap !== currentProps.bondCap
             )
         }
     }, materialId)
 }
 
-function getLinkLoci(pickingId: PickingId, structure: Structure, id: number) {
+function getBondLoci(pickingId: PickingId, structure: Structure, id: number) {
     const { objectId, groupId } = pickingId
     if (id === objectId) {
         const bond = structure.interUnitBonds.edges[groupId]
-        return Link.Loci(structure, [
-            Link.Location(
+        return Bond.Loci(structure, [
+            Bond.Location(
                 bond.unitA, bond.indexA as StructureElement.UnitIndex,
                 bond.unitB, bond.indexB as StructureElement.UnitIndex
             ),
-            Link.Location(
+            Bond.Location(
                 bond.unitB, bond.indexB as StructureElement.UnitIndex,
                 bond.unitA, bond.indexA as StructureElement.UnitIndex
             )
@@ -133,11 +133,11 @@ function getLinkLoci(pickingId: PickingId, structure: Structure, id: number) {
     return EmptyLoci
 }
 
-function eachLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) {
+function eachBond(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) {
     let changed = false
-    if (Link.isLoci(loci)) {
+    if (Bond.isLoci(loci)) {
         if (!Structure.areEquivalent(loci.structure, structure)) return false
-        for (const b of loci.links) {
+        for (const b of loci.bonds) {
             const idx = structure.interUnitBonds.getBondIndexFromLocation(b)
             if (idx !== -1) {
                 if (apply(Interval.ofSingleton(idx))) changed = true
@@ -153,7 +153,7 @@ function eachLink(loci: Loci, structure: Structure, apply: (interval: Interval)
         for (const e of loci.elements) {
             const { unit } = e
             if (!Unit.isAtomic(unit)) continue
-            structure.interUnitBonds.getLinkedUnits(unit).forEach(b => {
+            structure.interUnitBonds.getConnectedUnits(unit).forEach(b => {
                 const otherLociIndices = map.get(b.unitB.id)
                 if (otherLociIndices) {
                     OrderedSet.forEach(e.indices, v => {

+ 36 - 36
src/mol-repr/structure/visual/intra-unit-link-cylinder.ts → src/mol-repr/structure/visual/bond-intra-unit-cylinder.ts

@@ -7,12 +7,12 @@
 
 import { ParamDefinition as PD } from '../../../mol-util/param-definition';
 import { VisualContext } from '../../visual';
-import { Unit, Structure, StructureElement, Link } from '../../../mol-model/structure';
+import { Unit, Structure, StructureElement, Bond } from '../../../mol-model/structure';
 import { Theme } from '../../../mol-theme/theme';
 import { Mesh } from '../../../mol-geo/geometry/mesh/mesh';
 import { Vec3 } from '../../../mol-math/linear-algebra';
 import { BitFlags } from '../../../mol-util';
-import { createLinkCylinderMesh, LinkCylinderParams, LinkIterator } from './util/link';
+import { createBondCylinderMesh, BondCylinderParams, BondIterator } from './util/bond';
 import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, StructureGroup } from '../units-visual';
 import { VisualUpdateState } from '../../util';
 import { PickingId } from '../../../mol-geo/geometry/picking';
@@ -20,14 +20,14 @@ import { EmptyLoci, Loci } from '../../../mol-model/loci';
 import { Interval, OrderedSet } from '../../../mol-data/int';
 import { isHydrogen } from './util/common';
 
-function createIntraUnitLinkCylinderMesh(ctx: VisualContext, unit: Unit, structure: Structure, theme: Theme, props: PD.Values<IntraUnitLinkParams>, mesh?: Mesh) {
+function createIntraUnitBondCylinderMesh(ctx: VisualContext, unit: Unit, structure: Structure, theme: Theme, props: PD.Values<IntraUnitBondParams>, mesh?: Mesh) {
     if (!Unit.isAtomic(unit)) return Mesh.createEmpty(mesh)
 
     const location = StructureElement.Location.create(unit)
 
     const elements = unit.elements;
-    const links = unit.links
-    const { edgeCount, a, b, edgeProps, offset } = links
+    const bonds = unit.bonds
+    const { edgeCount, a, b, edgeProps, offset } = bonds
     const { order: _order, flags: _flags } = edgeProps
     const { sizeFactor, sizeAspectRatio, ignoreHydrogens } = props
 
@@ -37,7 +37,7 @@ function createIntraUnitLinkCylinderMesh(ctx: VisualContext, unit: Unit, structu
     const pos = unit.conformation.invariantPosition
 
     const builderProps = {
-        linkCount: edgeCount * 2,
+        bondCount: edgeCount * 2,
         referencePosition: (edgeIndex: number) => {
             let aI = a[edgeIndex], bI = b[edgeIndex];
 
@@ -73,53 +73,53 @@ function createIntraUnitLinkCylinderMesh(ctx: VisualContext, unit: Unit, structu
         } : () => false
     }
 
-    return createLinkCylinderMesh(ctx, builderProps, props, mesh)
+    return createBondCylinderMesh(ctx, builderProps, props, mesh)
 }
 
-export const IntraUnitLinkParams = {
+export const IntraUnitBondParams = {
     ...UnitsMeshParams,
-    ...LinkCylinderParams,
+    ...BondCylinderParams,
     sizeFactor: PD.Numeric(0.3, { min: 0, max: 10, step: 0.01 }),
     sizeAspectRatio: PD.Numeric(2/3, { min: 0, max: 3, step: 0.01 }),
     ignoreHydrogens: PD.Boolean(false),
 }
-export type IntraUnitLinkParams = typeof IntraUnitLinkParams
+export type IntraUnitBondParams = typeof IntraUnitBondParams
 
-export function IntraUnitLinkVisual(materialId: number): UnitsVisual<IntraUnitLinkParams> {
-    return UnitsMeshVisual<IntraUnitLinkParams>({
-        defaultProps: PD.getDefaultValues(IntraUnitLinkParams),
-        createGeometry: createIntraUnitLinkCylinderMesh,
-        createLocationIterator: LinkIterator.fromGroup,
-        getLoci: getLinkLoci,
-        eachLocation: eachLink,
-        setUpdateState: (state: VisualUpdateState, newProps: PD.Values<IntraUnitLinkParams>, currentProps: PD.Values<IntraUnitLinkParams>) => {
+export function IntraUnitBondVisual(materialId: number): UnitsVisual<IntraUnitBondParams> {
+    return UnitsMeshVisual<IntraUnitBondParams>({
+        defaultProps: PD.getDefaultValues(IntraUnitBondParams),
+        createGeometry: createIntraUnitBondCylinderMesh,
+        createLocationIterator: BondIterator.fromGroup,
+        getLoci: getBondLoci,
+        eachLocation: eachBond,
+        setUpdateState: (state: VisualUpdateState, newProps: PD.Values<IntraUnitBondParams>, currentProps: PD.Values<IntraUnitBondParams>) => {
             state.createGeometry = (
                 newProps.sizeFactor !== currentProps.sizeFactor ||
                 newProps.sizeAspectRatio !== currentProps.sizeAspectRatio ||
                 newProps.radialSegments !== currentProps.radialSegments ||
-                newProps.linkScale !== currentProps.linkScale ||
-                newProps.linkSpacing !== currentProps.linkSpacing ||
+                newProps.bondScale !== currentProps.bondScale ||
+                newProps.bondSpacing !== currentProps.bondSpacing ||
                 newProps.ignoreHydrogens !== currentProps.ignoreHydrogens ||
-                newProps.linkCap !== currentProps.linkCap
+                newProps.bondCap !== currentProps.bondCap
             )
         }
     }, materialId)
 }
 
-function getLinkLoci(pickingId: PickingId, structureGroup: StructureGroup, id: number) {
+function getBondLoci(pickingId: PickingId, structureGroup: StructureGroup, id: number) {
     const { objectId, instanceId, groupId } = pickingId
     if (id === objectId) {
         const { structure, group } = structureGroup
         const unit = group.units[instanceId]
         if (Unit.isAtomic(unit)) {
-            return Link.Loci(structure, [
-                Link.Location(
-                    unit, unit.links.a[groupId] as StructureElement.UnitIndex,
-                    unit, unit.links.b[groupId] as StructureElement.UnitIndex
+            return Bond.Loci(structure, [
+                Bond.Location(
+                    unit, unit.bonds.a[groupId] as StructureElement.UnitIndex,
+                    unit, unit.bonds.b[groupId] as StructureElement.UnitIndex
                 ),
-                Link.Location(
-                    unit, unit.links.b[groupId] as StructureElement.UnitIndex,
-                    unit, unit.links.a[groupId] as StructureElement.UnitIndex
+                Bond.Location(
+                    unit, unit.bonds.b[groupId] as StructureElement.UnitIndex,
+                    unit, unit.bonds.a[groupId] as StructureElement.UnitIndex
                 )
             ])
         }
@@ -127,18 +127,18 @@ function getLinkLoci(pickingId: PickingId, structureGroup: StructureGroup, id: n
     return EmptyLoci
 }
 
-function eachLink(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) {
+function eachBond(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) {
     let changed = false
-    if (Link.isLoci(loci)) {
+    if (Bond.isLoci(loci)) {
         const { structure, group } = structureGroup
         if (!Structure.areEquivalent(loci.structure, structure)) return false
         const unit = group.units[0]
         if (!Unit.isAtomic(unit)) return false
-        const groupCount = unit.links.edgeCount * 2
-        for (const b of loci.links) {
+        const groupCount = unit.bonds.edgeCount * 2
+        for (const b of loci.bonds) {
             const unitIdx = group.unitIndexMap.get(b.aUnit.id)
             if (unitIdx !== undefined) {
-                const idx = unit.links.getDirectedEdgeIndex(b.aIndex, b.bIndex)
+                const idx = unit.bonds.getDirectedEdgeIndex(b.aIndex, b.bIndex)
                 if (idx !== -1) {
                     if (apply(Interval.ofSingleton(unitIdx * groupCount + idx))) changed = true
                 }
@@ -149,11 +149,11 @@ function eachLink(loci: Loci, structureGroup: StructureGroup, apply: (interval:
         if (!Structure.areEquivalent(loci.structure, structure)) return false
         const unit = group.units[0]
         if (!Unit.isAtomic(unit)) return false
-        const groupCount = unit.links.edgeCount * 2
+        const groupCount = unit.bonds.edgeCount * 2
         for (const e of loci.elements) {
             const unitIdx = group.unitIndexMap.get(e.unit.id)
             if (unitIdx !== undefined) {
-                const { offset, b } = unit.links
+                const { offset, b } = unit.bonds
                 OrderedSet.forEach(e.indices, v => {
                     for (let t = offset[v], _t = offset[v + 1]; t < _t; t++) {
                         if (OrderedSet.has(e.indices, b[t])) {

+ 14 - 14
src/mol-repr/structure/visual/carbohydrate-link-cylinder.ts

@@ -4,13 +4,13 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Structure, Link, StructureElement } from '../../../mol-model/structure';
+import { Structure, Bond, StructureElement } from '../../../mol-model/structure';
 import { Loci, EmptyLoci } from '../../../mol-model/loci';
 import { Vec3 } from '../../../mol-math/linear-algebra';
-import { createLinkCylinderMesh, LinkCylinderParams } from './util/link';
+import { createBondCylinderMesh, BondCylinderParams } from './util/bond';
 import { OrderedSet, Interval } from '../../../mol-data/int';
 import { ComplexMeshVisual, ComplexVisual } from '../complex-visual';
-import { LinkType } from '../../../mol-model/structure/model/types';
+import { BondType } from '../../../mol-model/structure/model/types';
 import { BitFlags } from '../../../mol-util';
 import { UnitsMeshParams } from '../units-visual';
 import { ParamDefinition as PD } from '../../../mol-util/param-definition';
@@ -28,7 +28,7 @@ function createCarbohydrateLinkCylinderMesh(ctx: VisualContext, structure: Struc
     const location = StructureElement.Location.create()
 
     const builderProps = {
-        linkCount: links.length,
+        bondCount: links.length,
         referencePosition: (edgeIndex: number) => null,
         position: (posA: Vec3, posB: Vec3, edgeIndex: number) => {
             const l = links[edgeIndex]
@@ -36,7 +36,7 @@ function createCarbohydrateLinkCylinderMesh(ctx: VisualContext, structure: Struc
             Vec3.copy(posB, elements[l.carbohydrateIndexB].geometry.center)
         },
         order: (edgeIndex: number) => 1,
-        flags: (edgeIndex: number) => BitFlags.create(LinkType.Flag.None),
+        flags: (edgeIndex: number) => BitFlags.create(BondType.Flag.None),
         radius: (edgeIndex: number) => {
             const l = links[edgeIndex]
             location.unit = elements[l.carbohydrateIndexA].unit
@@ -46,12 +46,12 @@ function createCarbohydrateLinkCylinderMesh(ctx: VisualContext, structure: Struc
         ignore: (edgeIndex: number) => false
     }
 
-    return createLinkCylinderMesh(ctx, builderProps, props, mesh)
+    return createBondCylinderMesh(ctx, builderProps, props, mesh)
 }
 
 export const CarbohydrateLinkParams = {
     ...UnitsMeshParams,
-    ...LinkCylinderParams,
+    ...BondCylinderParams,
     linkSizeFactor: PD.Numeric(0.3, { min: 0, max: 3, step: 0.01 }),
 }
 export type CarbohydrateLinkParams = typeof CarbohydrateLinkParams
@@ -67,7 +67,7 @@ export function CarbohydrateLinkVisual(materialId: number): ComplexVisual<Carboh
             state.createGeometry = (
                 newProps.linkSizeFactor !== currentProps.linkSizeFactor ||
                 newProps.radialSegments !== currentProps.radialSegments ||
-                newProps.linkCap !== currentProps.linkCap
+                newProps.bondCap !== currentProps.bondCap
             )
         }
     }, materialId)
@@ -77,7 +77,7 @@ function CarbohydrateLinkIterator(structure: Structure): LocationIterator {
     const { elements, links } = structure.carbohydrates
     const groupCount = links.length
     const instanceCount = 1
-    const location = Link.Location()
+    const location = Bond.Location()
     const getLocation = (groupIndex: number) => {
         const link = links[groupIndex]
         const carbA = elements[link.carbohydrateIndexA]
@@ -103,12 +103,12 @@ function getLinkLoci(pickingId: PickingId, structure: Structure, id: number) {
         const indexA = OrderedSet.indexOf(carbA.unit.elements, carbA.anomericCarbon)
         const indexB = OrderedSet.indexOf(carbB.unit.elements, carbB.anomericCarbon)
         if (indexA !== -1 && indexB !== -1) {
-            return Link.Loci(structure, [
-                Link.Location(
+            return Bond.Loci(structure, [
+                Bond.Location(
                     carbA.unit, indexA as StructureElement.UnitIndex,
                     carbB.unit, indexB as StructureElement.UnitIndex
                 ),
-                Link.Location(
+                Bond.Location(
                     carbB.unit, indexB as StructureElement.UnitIndex,
                     carbA.unit, indexA as StructureElement.UnitIndex
                 )
@@ -120,10 +120,10 @@ function getLinkLoci(pickingId: PickingId, structure: Structure, id: number) {
 
 function eachCarbohydrateLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) {
     let changed = false
-    if (Link.isLoci(loci)) {
+    if (Bond.isLoci(loci)) {
         if (!Structure.areEquivalent(loci.structure, structure)) return false
         const { getLinkIndex } = structure.carbohydrates
-        for (const l of loci.links) {
+        for (const l of loci.bonds) {
             const idx = getLinkIndex(l.aUnit, l.aUnit.elements[l.aIndex], l.bUnit, l.bUnit.elements[l.bIndex])
             if (idx !== undefined) {
                 if (apply(Interval.ofSingleton(idx))) changed = true

+ 15 - 15
src/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.ts

@@ -6,13 +6,13 @@
 
 import { ParamDefinition as PD } from '../../../mol-util/param-definition';
 import { VisualContext } from '../../visual';
-import { Structure, StructureElement, Link } from '../../../mol-model/structure';
+import { Structure, StructureElement, Bond } from '../../../mol-model/structure';
 import { Theme } from '../../../mol-theme/theme';
 import { Mesh } from '../../../mol-geo/geometry/mesh/mesh';
 import { Vec3 } from '../../../mol-math/linear-algebra';
 import { BitFlags } from '../../../mol-util';
-import { LinkType } from '../../../mol-model/structure/model/types';
-import { createLinkCylinderMesh, LinkCylinderParams } from './util/link';
+import { BondType } from '../../../mol-model/structure/model/types';
+import { createBondCylinderMesh, BondCylinderParams } from './util/bond';
 import { UnitsMeshParams } from '../units-visual';
 import { ComplexVisual, ComplexMeshVisual } from '../complex-visual';
 import { VisualUpdateState } from '../../util';
@@ -20,7 +20,7 @@ import { LocationIterator } from '../../../mol-geo/util/location-iterator';
 import { OrderedSet, Interval } from '../../../mol-data/int';
 import { PickingId } from '../../../mol-geo/geometry/picking';
 import { EmptyLoci, Loci } from '../../../mol-model/loci';
-import { getElementIdx, MetalsSet } from '../../../mol-model/structure/structure/unit/links/common';
+import { getElementIdx, MetalsSet } from '../../../mol-model/structure/structure/unit/bonds/common';
 
 function createCarbohydrateTerminalLinkCylinderMesh(ctx: VisualContext, structure: Structure, theme: Theme, props: PD.Values<CarbohydrateTerminalLinkParams>, mesh?: Mesh) {
     const { terminalLinks, elements } = structure.carbohydrates
@@ -29,7 +29,7 @@ function createCarbohydrateTerminalLinkCylinderMesh(ctx: VisualContext, structur
     const location = StructureElement.Location.create()
 
     const builderProps = {
-        linkCount: terminalLinks.length,
+        bondCount: terminalLinks.length,
         referencePosition: (edgeIndex: number) => null,
         position: (posA: Vec3, posB: Vec3, edgeIndex: number) => {
             const l = terminalLinks[edgeIndex]
@@ -46,7 +46,7 @@ function createCarbohydrateTerminalLinkCylinderMesh(ctx: VisualContext, structur
             const l = terminalLinks[edgeIndex]
             const eI = l.elementUnit.elements[l.elementIndex]
             const beI = getElementIdx(l.elementUnit.model.atomicHierarchy.atoms.type_symbol.value(eI));
-            return BitFlags.create(MetalsSet.has(beI) ? LinkType.Flag.MetallicCoordination : LinkType.Flag.None);
+            return BitFlags.create(MetalsSet.has(beI) ? BondType.Flag.MetallicCoordination : BondType.Flag.None);
         },
         radius: (edgeIndex: number) => {
             const l = terminalLinks[edgeIndex]
@@ -62,12 +62,12 @@ function createCarbohydrateTerminalLinkCylinderMesh(ctx: VisualContext, structur
         ignore: (edgeIndex: number) => false
     }
 
-    return createLinkCylinderMesh(ctx, builderProps, props, mesh)
+    return createBondCylinderMesh(ctx, builderProps, props, mesh)
 }
 
 export const CarbohydrateTerminalLinkParams = {
     ...UnitsMeshParams,
-    ...LinkCylinderParams,
+    ...BondCylinderParams,
     terminalLinkSizeFactor: PD.Numeric(0.2, { min: 0, max: 3, step: 0.01 }),
 }
 export type CarbohydrateTerminalLinkParams = typeof CarbohydrateTerminalLinkParams
@@ -83,7 +83,7 @@ export function CarbohydrateTerminalLinkVisual(materialId: number): ComplexVisua
             state.createGeometry = (
                 newProps.terminalLinkSizeFactor !== currentProps.terminalLinkSizeFactor ||
                 newProps.radialSegments !== currentProps.radialSegments ||
-                newProps.linkCap !== currentProps.linkCap
+                newProps.bondCap !== currentProps.bondCap
             )
         }
     }, materialId)
@@ -93,7 +93,7 @@ function CarbohydrateTerminalLinkIterator(structure: Structure): LocationIterato
     const { elements, terminalLinks } = structure.carbohydrates
     const groupCount = terminalLinks.length
     const instanceCount = 1
-    const location = Link.Location()
+    const location = Bond.Location()
     const getLocation = (groupIndex: number) => {
         const terminalLink = terminalLinks[groupIndex]
         const carb = elements[terminalLink.carbohydrateIndex]
@@ -122,12 +122,12 @@ function getTerminalLinkLoci(pickingId: PickingId, structure: Structure, id: num
         const carb = elements[l.carbohydrateIndex]
         const carbIndex = OrderedSet.indexOf(carb.unit.elements, carb.anomericCarbon)
 
-        return Link.Loci(structure, [
-            Link.Location(
+        return Bond.Loci(structure, [
+            Bond.Location(
                 carb.unit, carbIndex as StructureElement.UnitIndex,
                 l.elementUnit, l.elementIndex
             ),
-            Link.Location(
+            Bond.Location(
                 l.elementUnit, l.elementIndex,
                 carb.unit, carbIndex as StructureElement.UnitIndex
             )
@@ -139,9 +139,9 @@ function getTerminalLinkLoci(pickingId: PickingId, structure: Structure, id: num
 function eachTerminalLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) {
     const { getTerminalLinkIndex } = structure.carbohydrates
     let changed = false
-    if (Link.isLoci(loci)) {
+    if (Bond.isLoci(loci)) {
         if (!Structure.areEquivalent(loci.structure, structure)) return false
-        for (const l of loci.links) {
+        for (const l of loci.bonds) {
             const idx = getTerminalLinkIndex(l.aUnit, l.aUnit.elements[l.aIndex], l.bUnit, l.bUnit.elements[l.bIndex])
             if (idx !== undefined) {
                 if (apply(Interval.ofSingleton(idx))) changed = true

+ 14 - 14
src/mol-repr/structure/visual/cross-link-restraint-cylinder.ts

@@ -6,13 +6,13 @@
 
 import { ParamDefinition as PD } from '../../../mol-util/param-definition';
 import { VisualContext } from '../../visual';
-import { Structure, StructureElement, Link } from '../../../mol-model/structure';
+import { Structure, StructureElement, Bond } from '../../../mol-model/structure';
 import { Theme } from '../../../mol-theme/theme';
 import { Mesh } from '../../../mol-geo/geometry/mesh/mesh';
 import { Vec3 } from '../../../mol-math/linear-algebra';
 import { BitFlags } from '../../../mol-util';
-import { LinkType } from '../../../mol-model/structure/model/types';
-import { createLinkCylinderMesh, LinkCylinderParams } from './util/link';
+import { BondType } from '../../../mol-model/structure/model/types';
+import { createBondCylinderMesh, BondCylinderParams } from './util/bond';
 import { ComplexMeshParams, ComplexVisual, ComplexMeshVisual } from '../complex-visual';
 import { VisualUpdateState } from '../../util';
 import { LocationIterator } from '../../../mol-geo/util/location-iterator';
@@ -29,7 +29,7 @@ function createCrossLinkRestraintCylinderMesh(ctx: VisualContext, structure: Str
     const location = StructureElement.Location.create()
 
     const builderProps = {
-        linkCount: crossLinks.count,
+        bondCount: crossLinks.count,
         referencePosition: () => null,
         position: (posA: Vec3, posB: Vec3, edgeIndex: number) => {
             const b = crossLinks.pairs[edgeIndex]
@@ -38,7 +38,7 @@ function createCrossLinkRestraintCylinderMesh(ctx: VisualContext, structure: Str
             uB.conformation.position(uB.elements[b.indexB], posB)
         },
         order: () => 1,
-        flags: () => BitFlags.create(LinkType.Flag.None),
+        flags: () => BitFlags.create(BondType.Flag.None),
         radius: (edgeIndex: number) => {
             const b = crossLinks.pairs[edgeIndex]
             location.unit = b.unitA
@@ -48,12 +48,12 @@ function createCrossLinkRestraintCylinderMesh(ctx: VisualContext, structure: Str
         ignore: () => false
     }
 
-    return createLinkCylinderMesh(ctx, builderProps, props, mesh)
+    return createBondCylinderMesh(ctx, builderProps, props, mesh)
 }
 
 export const CrossLinkRestraintParams = {
     ...ComplexMeshParams,
-    ...LinkCylinderParams,
+    ...BondCylinderParams,
     sizeFactor: PD.Numeric(1, { min: 0, max: 10, step: 0.1 }),
 }
 export type CrossLinkRestraintParams = typeof CrossLinkRestraintParams
@@ -69,7 +69,7 @@ export function CrossLinkRestraintVisual(materialId: number): ComplexVisual<Cros
             state.createGeometry = (
                 newProps.sizeFactor !== currentProps.sizeFactor ||
                 newProps.radialSegments !== currentProps.radialSegments ||
-                newProps.linkCap !== currentProps.linkCap
+                newProps.bondCap !== currentProps.bondCap
             )
         }
     }, materialId)
@@ -79,7 +79,7 @@ function CrossLinkRestraintIterator(structure: Structure): LocationIterator {
     const { pairs } = structure.crossLinkRestraints
     const groupCount = pairs.length
     const instanceCount = 1
-    const location = Link.Location()
+    const location = Bond.Location()
     const getLocation = (groupIndex: number) => {
         const pair = pairs[groupIndex]
         location.aUnit = pair.unitA
@@ -96,9 +96,9 @@ function getLinkLoci(pickingId: PickingId, structure: Structure, id: number) {
     if (id === objectId) {
         const pair = structure.crossLinkRestraints.pairs[groupId]
         if (pair) {
-            return Link.Loci(structure, [
-                Link.Location(pair.unitA, pair.indexA, pair.unitB, pair.indexB),
-                Link.Location(pair.unitB, pair.indexB, pair.unitA, pair.indexA)
+            return Bond.Loci(structure, [
+                Bond.Location(pair.unitA, pair.indexA, pair.unitB, pair.indexB),
+                Bond.Location(pair.unitB, pair.indexB, pair.unitA, pair.indexA)
             ])
         }
     }
@@ -108,9 +108,9 @@ function getLinkLoci(pickingId: PickingId, structure: Structure, id: number) {
 function eachCrossLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) {
     const crossLinks = structure.crossLinkRestraints
     let changed = false
-    if (Link.isLoci(loci)) {
+    if (Bond.isLoci(loci)) {
         if (!Structure.areEquivalent(loci.structure, structure)) return false
-        for (const b of loci.links) {
+        for (const b of loci.bonds) {
             const indices = crossLinks.getPairIndices(b.aIndex, b.aUnit, b.bIndex, b.bUnit)
             if (indices) {
                 for (let i = 0, il = indices.length; i < il; ++i) {

+ 15 - 15
src/mol-repr/structure/visual/interactions-intra-unit-cylinder.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Unit, Link, Structure, StructureElement } from '../../../mol-model/structure';
+import { Unit, Bond, Structure, StructureElement } from '../../../mol-model/structure';
 import { Vec3 } from '../../../mol-math/linear-algebra';
 import { Loci, EmptyLoci } from '../../../mol-model/loci';
 import { Interval, SortedArray, OrderedSet } from '../../../mol-data/int';
@@ -13,9 +13,9 @@ import { Mesh } from '../../../mol-geo/geometry/mesh/mesh';
 import { PickingId } from '../../../mol-geo/geometry/picking';
 import { VisualContext } from '../../visual';
 import { Theme } from '../../../mol-theme/theme';
-import { LinkType } from '../../../mol-model/structure/model/types';
+import { BondType } from '../../../mol-model/structure/model/types';
 import { InteractionsProvider } from '../../../mol-model-props/computed/interactions';
-import { createLinkCylinderMesh, LinkCylinderParams } from './util/link';
+import { createBondCylinderMesh, BondCylinderParams } from './util/bond';
 import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, StructureGroup } from '../units-visual';
 import { VisualUpdateState } from '../../util';
 import { LocationIterator } from '../../../mol-geo/util/location-iterator';
@@ -35,14 +35,14 @@ async function createIntraUnitInteractionsCylinderMesh(ctx: VisualContext, unit:
     if (!edgeCount) return Mesh.createEmpty(mesh)
 
     const builderProps = {
-        linkCount: edgeCount * 2,
+        bondCount: edgeCount * 2,
         referencePosition: () => null,
         position: (posA: Vec3, posB: Vec3, edgeIndex: number) => {
             Vec3.set(posA, x[a[edgeIndex]], y[a[edgeIndex]], z[a[edgeIndex]])
             Vec3.set(posB, x[b[edgeIndex]], y[b[edgeIndex]], z[b[edgeIndex]])
         },
         order: (edgeIndex: number) => 1,
-        flags: (edgeIndex: number) => LinkType.Flag.MetallicCoordination, // TODO
+        flags: (edgeIndex: number) => BondType.Flag.MetallicCoordination, // TODO
         radius: (edgeIndex: number) => sizeFactor,
         ignore: elements !== rootElements ? (edgeIndex: number) => {
             for (let i = offsets[a[edgeIndex]], il = offsets[a[edgeIndex] + 1]; i < il; ++i) {
@@ -55,12 +55,12 @@ async function createIntraUnitInteractionsCylinderMesh(ctx: VisualContext, unit:
         } : () => false
     }
 
-    return createLinkCylinderMesh(ctx, builderProps, props, mesh)
+    return createBondCylinderMesh(ctx, builderProps, props, mesh)
 }
 
 export const InteractionsIntraUnitParams = {
     ...UnitsMeshParams,
-    ...LinkCylinderParams,
+    ...BondCylinderParams,
     sizeFactor: PD.Numeric(0.3, { min: 0, max: 10, step: 0.01 }),
 }
 export type InteractionsIntraUnitParams = typeof InteractionsIntraUnitParams
@@ -76,8 +76,8 @@ export function InteractionsIntraUnitVisual(materialId: number): UnitsVisual<Int
             state.createGeometry = (
                 newProps.sizeFactor !== currentProps.sizeFactor ||
                 newProps.radialSegments !== currentProps.radialSegments ||
-                newProps.linkScale !== currentProps.linkScale ||
-                newProps.linkSpacing !== currentProps.linkSpacing
+                newProps.bondScale !== currentProps.bondScale ||
+                newProps.bondSpacing !== currentProps.bondSpacing
             )
         }
     }, materialId)
@@ -94,12 +94,12 @@ function getLinkLoci(pickingId: PickingId, structureGroup: StructureGroup, id: n
             const { features, links } = interactions.get(unit.id)!
             const { members, offsets } = features
             // TODO this uses the first member elements of the features of an interaction as a representative
-            return Link.Loci(structure.root, [
-                Link.Location(
+            return Bond.Loci(structure.root, [
+                Bond.Location(
                     unit, members[offsets[links.a[groupId]]],
                     unit, members[offsets[links.b[groupId]]]
                 ),
-                Link.Location(
+                Bond.Location(
                     unit, members[offsets[links.b[groupId]]],
                     unit, members[offsets[links.a[groupId]]]
                 )
@@ -111,7 +111,7 @@ function getLinkLoci(pickingId: PickingId, structureGroup: StructureGroup, id: n
 
 function eachInteraction(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) {
     let changed = false
-    if (Link.isLoci(loci)) {
+    if (Bond.isLoci(loci)) {
         const { structure, group } = structureGroup
         if (!Structure.areEquivalent(loci.structure, structure)) return false
         const unit = group.units[0]
@@ -119,7 +119,7 @@ function eachInteraction(loci: Loci, structureGroup: StructureGroup, apply: (int
         const interactions = InteractionsProvider.getValue(structure).value!
         const { links, getLinkIndex } = interactions.get(unit.id)!
         const groupCount = links.edgeCount * 2
-        for (const b of loci.links) {
+        for (const b of loci.bonds) {
             const unitIdx = group.unitIndexMap.get(b.aUnit.id)
             if (unitIdx !== undefined) {
                 const idx = getLinkIndex(b.aIndex, b.bIndex)
@@ -165,7 +165,7 @@ function createInteractionsIterator(structureGroup: StructureGroup): LocationIte
     const { members, offsets } = features
     const groupCount = links.edgeCount * 2
     const instanceCount = group.units.length
-    const location = Link.Location()
+    const location = Bond.Location()
     const getLocation = (groupIndex: number, instanceIndex: number) => {
         const fA = links.a[groupIndex]
         const fB = links.b[groupIndex]

+ 0 - 8
src/mol-repr/structure/visual/polymer-gap-cylinder.ts

@@ -15,7 +15,6 @@ import { CylinderProps } from '../../../mol-geo/primitive/cylinder';
 import { PolymerGapIterator, PolymerGapLocationIterator, getPolymerGapElementLoci, eachPolymerGapElement } from './util/polymer';
 import { addFixedCountDashedCylinder } from '../../../mol-geo/geometry/mesh/builder/cylinder';
 import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual } from '../units-visual';
-import { LinkCylinderParams } from './util/link';
 import { VisualUpdateState } from '../../util';
 // import { TriangularPyramid } from '../../../mol-geo/primitive/pyramid';
 
@@ -80,13 +79,6 @@ function createPolymerGapCylinderMesh(ctx: VisualContext, unit: Unit, structure:
     return MeshBuilder.getMesh(builderState)
 }
 
-export const InterUnitLinkParams = {
-    ...UnitsMeshParams,
-    ...LinkCylinderParams,
-}
-export const DefaultIntraUnitLinkProps = PD.getDefaultValues(InterUnitLinkParams)
-export type IntraUnitLinkProps = typeof DefaultIntraUnitLinkProps
-
 export const PolymerGapParams = {
     ...UnitsMeshParams,
     ...PolymerGapCylinderParams

+ 29 - 29
src/mol-repr/structure/visual/util/link.ts → src/mol-repr/structure/visual/util/bond.ts

@@ -5,25 +5,25 @@
  */
 
 import { Vec3 } from '../../../../mol-math/linear-algebra';
-import { LinkType } from '../../../../mol-model/structure/model/types';
-import { Unit, StructureElement, Structure, Link } from '../../../../mol-model/structure';
+import { BondType } from '../../../../mol-model/structure/model/types';
+import { Unit, StructureElement, Structure, Bond } from '../../../../mol-model/structure';
 import { ParamDefinition as PD } from '../../../../mol-util/param-definition';
 import { Mesh } from '../../../../mol-geo/geometry/mesh/mesh';
 import { MeshBuilder } from '../../../../mol-geo/geometry/mesh/mesh-builder';
 import { CylinderProps } from '../../../../mol-geo/primitive/cylinder';
 import { addFixedCountDashedCylinder, addCylinder, addDoubleCylinder } from '../../../../mol-geo/geometry/mesh/builder/cylinder';
 import { LocationIterator } from '../../../../mol-geo/util/location-iterator';
-import { VisualContext } from '../../../../mol-repr/visual';
+import { VisualContext } from '../../../visual';
 import { StructureGroup } from '../../units-visual';
 
-export const LinkCylinderParams = {
-    linkScale: PD.Numeric(0.4, { min: 0, max: 1, step: 0.1 }),
-    linkSpacing: PD.Numeric(1, { min: 0, max: 2, step: 0.01 }),
-    linkCap: PD.Boolean(false),
+export const BondCylinderParams = {
+    bondScale: PD.Numeric(0.4, { min: 0, max: 1, step: 0.1 }),
+    bondSpacing: PD.Numeric(1, { min: 0, max: 2, step: 0.01 }),
+    bondCap: PD.Boolean(false),
     radialSegments: PD.Numeric(16, { min: 2, max: 56, step: 2 }),
 }
-export const DefaultLinkCylinderProps = PD.getDefaultValues(LinkCylinderParams)
-export type LinkCylinderProps = typeof DefaultLinkCylinderProps
+export const DefaultBondCylinderProps = PD.getDefaultValues(BondCylinderParams)
+export type BondCylinderProps = typeof DefaultBondCylinderProps
 
 const tmpShiftV12 = Vec3.zero()
 const tmpShiftV13 = Vec3.zero()
@@ -54,12 +54,12 @@ export function calculateShiftDir (out: Vec3, v1: Vec3, v2: Vec3, v3: Vec3 | nul
     return Vec3.normalize(out, tmpShiftV13)
 }
 
-export interface LinkCylinderMeshBuilderProps {
-    linkCount: number
+export interface BondCylinderMeshBuilderProps {
+    bondCount: number
     referencePosition(edgeIndex: number): Vec3 | null
     position(posA: Vec3, posB: Vec3, edgeIndex: number): void
     order(edgeIndex: number): number
-    flags(edgeIndex: number): LinkType
+    flags(edgeIndex: number): BondType
     radius(edgeIndex: number): number
     ignore(edgeIndex: number): boolean
 }
@@ -68,14 +68,14 @@ export interface LinkCylinderMeshBuilderProps {
  * Each edge is included twice to allow for coloring/picking
  * the half closer to the first vertex, i.e. vertex a.
  */
-export function createLinkCylinderMesh(ctx: VisualContext, linkBuilder: LinkCylinderMeshBuilderProps, props: LinkCylinderProps, mesh?: Mesh) {
-    const { linkCount, referencePosition, position, order, flags, radius, ignore } = linkBuilder
+export function createBondCylinderMesh(ctx: VisualContext, bondBuilder: BondCylinderMeshBuilderProps, props: BondCylinderProps, mesh?: Mesh) {
+    const { bondCount, referencePosition, position, order, flags, radius, ignore } = bondBuilder
 
-    if (!linkCount) return Mesh.createEmpty(mesh)
+    if (!bondCount) return Mesh.createEmpty(mesh)
 
-    const { linkScale, linkSpacing, radialSegments, linkCap: cap } = props
+    const { bondScale, bondSpacing, radialSegments, bondCap } = props
 
-    const vertexCountEstimate = radialSegments * 2 * linkCount * 2
+    const vertexCountEstimate = radialSegments * 2 * bondCount * 2
     const builderState = MeshBuilder.createState(vertexCountEstimate, vertexCountEstimate / 4, mesh)
 
     const va = Vec3.zero()
@@ -85,11 +85,11 @@ export function createLinkCylinderMesh(ctx: VisualContext, linkBuilder: LinkCyli
         radiusTop: 1,
         radiusBottom: 1,
         radialSegments,
-        topCap: cap,
-        bottomCap: cap
+        topCap: bondCap,
+        bottomCap: bondCap
     }
 
-    for (let edgeIndex = 0, _eI = linkCount; edgeIndex < _eI; ++edgeIndex) {
+    for (let edgeIndex = 0, _eI = bondCount; edgeIndex < _eI; ++edgeIndex) {
         if (ignore(edgeIndex)) continue
 
         position(va, vb, edgeIndex)
@@ -99,27 +99,27 @@ export function createLinkCylinderMesh(ctx: VisualContext, linkBuilder: LinkCyli
         const f = flags(edgeIndex)
         builderState.currentGroup = edgeIndex
 
-        if (LinkType.is(f, LinkType.Flag.MetallicCoordination) || LinkType.is(f, LinkType.Flag.Hydrogen)) {
+        if (BondType.is(f, BondType.Flag.MetallicCoordination) || BondType.is(f, BondType.Flag.Hydrogen)) {
             // show metall coordinations and hydrogen bonds with dashed cylinders
             cylinderProps.radiusTop = cylinderProps.radiusBottom = linkRadius / 3
             cylinderProps.topCap = cylinderProps.bottomCap = true
             addFixedCountDashedCylinder(builderState, va, vb, 0.5, 7, cylinderProps)
         } else if (o === 2 || o === 3) {
             // show bonds with order 2 or 3 using 2 or 3 parallel cylinders
-            const multiRadius = linkRadius * (linkScale / (0.5 * o))
-            const absOffset = (linkRadius - multiRadius) * linkSpacing
+            const multiRadius = linkRadius * (bondScale / (0.5 * o))
+            const absOffset = (linkRadius - multiRadius) * bondSpacing
 
             calculateShiftDir(vShift, va, vb, referencePosition(edgeIndex))
             Vec3.setMagnitude(vShift, vShift, absOffset)
 
             cylinderProps.radiusTop = cylinderProps.radiusBottom = multiRadius
-            cylinderProps.topCap = cylinderProps.bottomCap = cap
+            cylinderProps.topCap = cylinderProps.bottomCap = bondCap
 
             if (o === 3) addCylinder(builderState, va, vb, 0.5, cylinderProps)
             addDoubleCylinder(builderState, va, vb, 0.5, vShift, cylinderProps)
         } else {
             cylinderProps.radiusTop = cylinderProps.radiusBottom = linkRadius
-            cylinderProps.topCap = cylinderProps.bottomCap = cap
+            cylinderProps.topCap = cylinderProps.bottomCap = bondCap
             addCylinder(builderState, va, vb, 0.5, cylinderProps)
         }
     }
@@ -127,17 +127,17 @@ export function createLinkCylinderMesh(ctx: VisualContext, linkBuilder: LinkCyli
     return MeshBuilder.getMesh(builderState)
 }
 
-export namespace LinkIterator {
+export namespace BondIterator {
     export function fromGroup(structureGroup: StructureGroup): LocationIterator {
         const { group } = structureGroup
         const unit = group.units[0]
-        const groupCount = Unit.isAtomic(unit) ? unit.links.edgeCount * 2 : 0
+        const groupCount = Unit.isAtomic(unit) ? unit.bonds.edgeCount * 2 : 0
         const instanceCount = group.units.length
         const location = StructureElement.Location.create()
         const getLocation = (groupIndex: number, instanceIndex: number) => {
             const unit = group.units[instanceIndex]
             location.unit = unit
-            location.element = unit.elements[(unit as Unit.Atomic).links.a[groupIndex]]
+            location.element = unit.elements[(unit as Unit.Atomic).bonds.a[groupIndex]]
             return location
         }
         return LocationIterator(groupCount, instanceCount, getLocation)
@@ -146,7 +146,7 @@ export namespace LinkIterator {
     export function fromStructure(structure: Structure): LocationIterator {
         const groupCount = structure.interUnitBonds.edgeCount
         const instanceCount = 1
-        const location = Link.Location()
+        const location = Bond.Location()
         const getLocation = (groupIndex: number) => {
             const bond = structure.interUnitBonds.edges[groupIndex]
             location.aUnit = bond.unitA

+ 7 - 7
src/mol-repr/structure/visual/util/polymer.ts

@@ -5,7 +5,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Unit, ElementIndex, StructureElement, Link, Structure, ResidueIndex } from '../../../../mol-model/structure';
+import { Unit, ElementIndex, StructureElement, Bond, Structure, ResidueIndex } from '../../../../mol-model/structure';
 import SortedRanges from '../../../../mol-data/int/sorted-ranges';
 import { OrderedSet, Interval, SortedArray } from '../../../../mol-data/int';
 import { EmptyLoci, Loci } from '../../../../mol-model/loci';
@@ -216,9 +216,9 @@ export function getPolymerGapElementLoci(pickingId: PickingId, structureGroup: S
         const unitIndexA = OrderedSet.indexOf(unit.elements, unit.gapElements[groupId]) as StructureElement.UnitIndex
         const unitIndexB = OrderedSet.indexOf(unit.elements, unit.gapElements[groupId % 2 ? groupId - 1 : groupId + 1]) as StructureElement.UnitIndex
         if (unitIndexA !== -1 && unitIndexB !== -1) {
-            return Link.Loci(structure, [
-                Link.Location(unit, unitIndexA, unit, unitIndexB),
-                Link.Location(unit, unitIndexB, unit, unitIndexA)
+            return Bond.Loci(structure, [
+                Bond.Location(unit, unitIndexA, unit, unitIndexB),
+                Bond.Location(unit, unitIndexB, unit, unitIndexA)
             ])
         }
     }
@@ -227,12 +227,12 @@ export function getPolymerGapElementLoci(pickingId: PickingId, structureGroup: S
 
 export function eachPolymerGapElement(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) {
     let changed = false
-    if (Link.isLoci(loci)) {
+    if (Bond.isLoci(loci)) {
         const { structure, group } = structureGroup
         if (!Structure.areRootsEquivalent(loci.structure, structure)) return false
-        loci = Link.remapLoci(loci, structure)
+        loci = Bond.remapLoci(loci, structure)
         const groupCount = group.units[0].gapElements.length
-        for (const b of loci.links) {
+        for (const b of loci.bonds) {
             const unitIdx = group.unitIndexMap.get(b.aUnit.id)
             if (unitIdx !== undefined) {
                 const idxA = OrderedSet.indexOf(b.aUnit.gapElements, b.aUnit.elements[b.aIndex])

+ 25 - 25
src/mol-script/language/symbol-table/structure-query.ts

@@ -14,8 +14,8 @@ export namespace Types {
     export const ElementSymbol = Type.Value('Structure', 'ElementSymbol');
     export const AtomName = Type.Value('Structure', 'AtomName');
 
-    export const LinkFlag = Type.OneOf('Structure', 'LinkFlag', Type.Str, ['covalent', 'metallic', 'ion', 'hydrogen', 'sulfide', 'computed', 'aromatic']);
-    export const LinkFlags = Core.Types.Flags(LinkFlag, 'LinkFlags');
+    export const BondFlag = Type.OneOf('Structure', 'BondFlag', Type.Str, ['covalent', 'metallic', 'ion', 'hydrogen', 'sulfide', 'computed', 'aromatic']);
+    export const BondFlags = Core.Types.Flags(BondFlag, 'BondFlags');
 
     export const SecondaryStructureFlag = Type.OneOf('Structure', 'SecondaryStructureFlag', Type.Str, ['alpha', 'beta', '3-10', 'pi', 'sheet', 'strand', 'helix', 'turn', 'none']);
     export const SecondaryStructureFlags = Core.Types.Flags(SecondaryStructureFlag, 'SecondaryStructureFlag');
@@ -47,10 +47,10 @@ const type = {
         Types.EntityType,
         `Create normalized representation of entity type: ${Type.oneOfValues(Types.EntityType).join(', ')}.`),
 
-    linkFlags: symbol(
-        Arguments.List(Types.LinkFlag),
-        Types.LinkFlags,
-        `Create link flags representation from a list of strings. Allowed flags: ${Type.oneOfValues(Types.LinkFlag).join(', ')}.`),
+    bondFlags: symbol(
+        Arguments.List(Types.BondFlag),
+        Types.BondFlags,
+        `Create bond flags representation from a list of strings. Allowed flags: ${Type.oneOfValues(Types.BondFlag).join(', ')}.`),
 
     ringFingerprint: symbol(
         Arguments.List(Types.ElementSymbol, { nonEmpty: true }),
@@ -93,10 +93,10 @@ const generator = {
         'group-by': Argument(Type.Any, { isOptional: true, defaultValue: `atom-key`, description: 'Group atoms to sets based on this property. Default: each atom has its own set' }),
     }), Types.ElementSelectionQuery, 'Return all atoms for which the tests are satisfied, grouped into sets.'),
 
-    linkedAtomicPairs: symbol(Arguments.Dictionary({
-        0: Argument(Type.Bool, { isOptional: true, defaultValue: 'true for covalent links' as any, description: 'Test each link with this predicate. Each link is visited twice with swapped atom order.' }),
+    bondedAtomicPairs: symbol(Arguments.Dictionary({
+        0: Argument(Type.Bool, { isOptional: true, defaultValue: 'true for covalent bonds' as any, description: 'Test each bond with this predicate. Each bond is visited twice with swapped atom order.' }),
         // TODO: shoud we support this or just use queryEach to get similar behavior
-        // 'group-by': Argument(Type.Any, { isOptional: true, defaultValue: ``, description: 'Group the links using the privided value' }),
+        // 'group-by': Argument(Type.Any, { isOptional: true, defaultValue: ``, description: 'Group the bonds using the privided value' }),
     }), Types.ElementSelectionQuery, 'Return all pairs of atoms for which the test is satisfied.'),
 
     rings: symbol(Arguments.List(Types.RingFingerprint), Types.ElementSelectionQuery, 'Return rings with the specified fingerprint(s). If no fingerprints are given, return all rings.'),
@@ -154,8 +154,8 @@ const modifier = {
 
     includeConnected: symbol(Arguments.Dictionary({
         0: Argument(Types.ElementSelectionQuery),
-        'link-test': Argument(Type.Bool, { isOptional: true, defaultValue: 'true for covalent links' as any }),
-        'layer-count': Argument(Type.Num, { isOptional: true, defaultValue: 1, description: 'Number of linked layers to include.' }),
+        'bond-test': Argument(Type.Bool, { isOptional: true, defaultValue: 'true for covalent bonds' as any }),
+        'layer-count': Argument(Type.Num, { isOptional: true, defaultValue: 1, description: 'Number of bonded layers to include.' }),
         'as-whole-residues': Argument(Type.Bool, { isOptional: true })
     }), Types.ElementSelectionQuery, 'Pick all atom sets that are connected to the target.'),
 
@@ -203,8 +203,8 @@ const filter = {
     isConnectedTo: symbol(Arguments.Dictionary({
         0: Argument(Types.ElementSelectionQuery),
         target: Argument(Types.ElementSelectionQuery),
-        'link-test': Argument(Type.Bool, { isOptional: true, defaultValue: 'true for covalent links' as any }),
-        disjunct: Argument(Type.Bool, { isOptional: true, defaultValue: true, description: 'If true, there must exist a link to an atom that lies outside the given atom set to pass test.' }),
+        'bond-test': Argument(Type.Bool, { isOptional: true, defaultValue: 'true for covalent bonds' as any }),
+        disjunct: Argument(Type.Bool, { isOptional: true, defaultValue: true, description: 'If true, there must exist a bond to an atom that lies outside the given atom set to pass test.' }),
         invert: Argument(Type.Bool, { isOptional: true, defaultValue: false, description: 'If true, return atom sets that are not connected.' })
     }), Types.ElementSelectionQuery, 'Pick all atom sets that are connected to the target.'),
 }
@@ -256,10 +256,10 @@ const atomProperty = {
 
         atomKey: atomProp(Type.AnyValue, 'Unique value for each atom. Main use case is grouping of atoms.'),
 
-        linkCount: symbol(Arguments.Dictionary({
+        bondCount: symbol(Arguments.Dictionary({
             0: Argument(Types.ElementReference, { isOptional: true, defaultValue: 'slot.current-atom' }),
-            flags: Argument(Types.LinkFlags, { isOptional: true, defaultValue: 'covalent' as any }),
-        }), Type.Num, 'Number of links (by default only covalent links are counted).'),
+            flags: Argument(Types.BondFlags, { isOptional: true, defaultValue: 'covalent' as any }),
+        }), Type.Num, 'Number of bonds (by default only covalent bonds are counted).'),
 
         sourceIndex: atomProp(Type.Num, 'Index of the atom/element in the input file.'),
         operatorName: atomProp(Type.Str, 'Name of the symmetry operator applied to this element.'),
@@ -316,21 +316,21 @@ const atomProperty = {
     }
 }
 
-const linkProperty = {
-    '@header': 'Link Properties',
+const bondProperty = {
+    '@header': 'Bond Properties',
 
-    flags: linkProp(Types.LinkFlags),
-    order: linkProp(Type.Num),
-    length: linkProp(Type.Num),
-    atomA: linkProp(Types.ElementReference),
-    atomB: linkProp(Types.ElementReference)
+    flags: bondProp(Types.BondFlags),
+    order: bondProp(Type.Num),
+    length: bondProp(Type.Num),
+    atomA: bondProp(Types.ElementReference),
+    atomB: bondProp(Types.ElementReference)
 }
 
 function atomProp(type: Type, description?: string) {
     return symbol(Arguments.Dictionary({ 0: Argument(Types.ElementReference, { isOptional: true, defaultValue: 'slot.current-atom' }) }), type, description);
 }
 
-function linkProp(type: Type, description?: string) {
+function bondProp(type: Type, description?: string) {
     return symbol(Arguments.None, type, description);
 }
 
@@ -344,5 +344,5 @@ export default {
     combinator,
     atomSet,
     atomProperty,
-    linkProperty
+    bondProperty: bondProperty
 }

+ 21 - 21
src/mol-script/runtime/query/table.ts

@@ -8,7 +8,7 @@
 import { MolScriptSymbolTable as MolScript } from '../../language/symbol-table';
 import { DefaultQueryRuntimeTable, QuerySymbolRuntime, QueryRuntimeArguments } from './compiler';
 import { Queries, StructureProperties, StructureElement, QueryContext, UnitRing } from '../../../mol-model/structure';
-import { ElementSymbol, LinkType, SecondaryStructureType } from '../../../mol-model/structure/model/types';
+import { ElementSymbol, BondType, SecondaryStructureType } from '../../../mol-model/structure/model/types';
 import { SetUtils } from '../../../mol-util/set';
 import { upperCaseAny } from '../../../mol-util/string';
 import { VdwRadius, AtomWeight, AtomNumber } from '../../../mol-model/structure/model/properties/atomic';
@@ -175,12 +175,12 @@ const symbols = [
     // ============= TYPES ================
     C(MolScript.structureQuery.type.elementSymbol, (ctx, v) => ElementSymbol(v[0](ctx))),
     C(MolScript.structureQuery.type.atomName, (ctx, v) => upperCaseAny(v[0](ctx))),
-    C(MolScript.structureQuery.type.linkFlags, (ctx, xs) => {
-        let ret: LinkType = LinkType.Flag.None;
+    C(MolScript.structureQuery.type.bondFlags, (ctx, xs) => {
+        let ret: BondType = BondType.Flag.None;
         if (typeof xs.length === 'number') {
-            for (let i = 0, _i = xs.length; i < _i; i++) ret = linkFlag(ret, xs[i](ctx));
+            for (let i = 0, _i = xs.length; i < _i; i++) ret = bondFlag(ret, xs[i](ctx));
         } else {
-            for (const k of Object.keys(xs)) ret = linkFlag(ret, xs[k](ctx));
+            for (const k of Object.keys(xs)) ret = bondFlag(ret, xs[k](ctx));
         }
         return ret;
     }),
@@ -224,7 +224,7 @@ const symbols = [
         target: xs['target'] as any,
         disjunct: xs['disjunct'] as any,
         invert: xs['invert'] as any,
-        linkTest: xs['link-test']
+        bondTest: xs['bond-test']
     })(ctx)),
 
     // ============= GENERATORS ================
@@ -238,7 +238,7 @@ const symbols = [
 
     D(MolScript.structureQuery.generator.all, function structureQuery_generator_all(ctx) { return Queries.generators.all(ctx) }),
     D(MolScript.structureQuery.generator.empty, function structureQuery_generator_empty(ctx) { return Queries.generators.none(ctx) }),
-    D(MolScript.structureQuery.generator.linkedAtomicPairs, function structureQuery_generator_linkedAtomicPairs(ctx, xs) { return Queries.generators.linkedAtomicPairs(xs && xs[0])(ctx) }),
+    D(MolScript.structureQuery.generator.bondedAtomicPairs, function structureQuery_generator_bondedAtomicPairs(ctx, xs) { return Queries.generators.bondedAtomicPairs(xs && xs[0])(ctx) }),
     D(MolScript.structureQuery.generator.rings, function structureQuery_generator_rings(ctx, xs) { return Queries.generators.rings(getArray(ctx, xs))(ctx) }),
 
     // ============= MODIFIERS ================
@@ -254,7 +254,7 @@ const symbols = [
     D(MolScript.structureQuery.modifier.exceptBy, function structureQuery_modifier_exceptBy(ctx, xs) { return Queries.modifiers.exceptBy(xs[0] as any, xs['by'] as any)(ctx) }),
     D(MolScript.structureQuery.modifier.includeConnected, function structureQuery_modifier_includeConnected(ctx, xs) { return Queries.modifiers.includeConnected({
         query: xs[0] as any,
-        linkTest: xs['link-test'],
+        bondTest: xs['bond-test'],
         wholeResidues: !!(xs['as-whole-residues'] && xs['as-whole-residues'](ctx)),
         layerCount: (xs['layer-count'] && xs['layer-count'](ctx)) || 1
     })(ctx) }),
@@ -334,11 +334,11 @@ const symbols = [
     D(MolScript.structureQuery.atomProperty.macromolecular.chemCompType, atomProp(StructureProperties.residue.chem_comp_type)),
 
     // ============= BOND PROPERTIES ================
-    D(MolScript.structureQuery.linkProperty.order, (ctx, xs) => ctx.atomicLink.order),
-    D(MolScript.structureQuery.linkProperty.flags, (ctx, xs) => ctx.atomicLink.type),
-    D(MolScript.structureQuery.linkProperty.atomA, (ctx, xs) => ctx.atomicLink.a),
-    D(MolScript.structureQuery.linkProperty.atomB, (ctx, xs) => ctx.atomicLink.b),
-    D(MolScript.structureQuery.linkProperty.length, (ctx, xs) => ctx.atomicLink.length),
+    D(MolScript.structureQuery.bondProperty.order, (ctx, xs) => ctx.atomicBond.order),
+    D(MolScript.structureQuery.bondProperty.flags, (ctx, xs) => ctx.atomicBond.type),
+    D(MolScript.structureQuery.bondProperty.atomA, (ctx, xs) => ctx.atomicBond.a),
+    D(MolScript.structureQuery.bondProperty.atomB, (ctx, xs) => ctx.atomicBond.b),
+    D(MolScript.structureQuery.bondProperty.length, (ctx, xs) => ctx.atomicBond.length),
 
 
     ////////////////////////////////////
@@ -352,15 +352,15 @@ function atomProp(p: (e: StructureElement.Location) => any): (ctx: QueryContext,
     return (ctx, xs) => p((xs && xs[0] && xs[0](ctx) as any) || ctx.element);
 }
 
-function linkFlag(current: LinkType, f: string): LinkType {
+function bondFlag(current: BondType, f: string): BondType {
     switch (f.toLowerCase()) {
-        case 'covalent': return current | LinkType.Flag.Covalent;
-        case 'metallic': return current | LinkType.Flag.MetallicCoordination;
-        case 'ionic': return current | LinkType.Flag.Ionic;
-        case 'hydrogen': return current | LinkType.Flag.Hydrogen;
-        case 'sulfide': return current | LinkType.Flag.Sulfide;
-        case 'aromatic': return current | LinkType.Flag.Aromatic;
-        case 'computed': return current | LinkType.Flag.Computed;
+        case 'covalent': return current | BondType.Flag.Covalent;
+        case 'metallic': return current | BondType.Flag.MetallicCoordination;
+        case 'ionic': return current | BondType.Flag.Ionic;
+        case 'hydrogen': return current | BondType.Flag.Hydrogen;
+        case 'sulfide': return current | BondType.Flag.Sulfide;
+        case 'aromatic': return current | BondType.Flag.Aromatic;
+        case 'computed': return current | BondType.Flag.Computed;
         default: return current;
     }
 }

+ 3 - 3
src/mol-script/script/mol-script/examples.ts

@@ -10,7 +10,7 @@
 //   sel.atom.res
 //   :target (sel.atom.res (= atom.label_comp_id HEM))
 //   ;; default bond test allows only covalent bonds
-//   :link-test true
+//   :bond-test true
 //   :disjunct true)`
 // }, {
 //     name: 'All C or N atoms in ALA residues',
@@ -46,8 +46,8 @@
 //   value: `(sel.atom.include-connected
 //   (sel.atom.res (= atom.label_comp_id HEM))
 //   ;; default bond test allows only covalent bonds
-//   ;; another option is to use :link-test true to allow any connection
-//   :link-test (bond.is metallic covalent)
+//   ;; another option is to use :bond-test true to allow any connection
+//   :bond-test (bond.is metallic covalent)
 //   :layer-count 2
 //   :as-whole-residues true)`
 // }, {

+ 11 - 11
src/mol-script/script/mol-script/symbols.ts

@@ -93,7 +93,7 @@ export const SymbolTable = [
             Alias(MolScript.structureQuery.type.authResidueId, 'auth-resid'),
             Alias(MolScript.structureQuery.type.labelResidueId, 'label-resid'),
             Alias(MolScript.structureQuery.type.ringFingerprint, 'ringfp'),
-            Alias(MolScript.structureQuery.type.linkFlags, 'bond-flags'),
+            Alias(MolScript.structureQuery.type.bondFlags, 'bond-flags'),
         ],
         [
             'Slots',
@@ -106,7 +106,7 @@ export const SymbolTable = [
             Alias(MolScript.structureQuery.generator.rings, 'sel.atom.rings'),
             Alias(MolScript.structureQuery.generator.empty, 'sel.atom.empty'),
             Alias(MolScript.structureQuery.generator.all, 'sel.atom.all'),
-            Alias(MolScript.structureQuery.generator.linkedAtomicPairs, 'sel.atom.linked-pairs'),
+            Alias(MolScript.structureQuery.generator.bondedAtomicPairs, 'sel.atom.bonded-pairs'),
 
             Macro(MSymbol('sel.atom.atoms', Arguments.Dictionary({
                 0: Argument(Type.Bool, { isOptional: true, defaultValue: true, description: 'Test applied to each atom.' })
@@ -207,7 +207,7 @@ export const SymbolTable = [
             Alias(MolScript.structureQuery.atomProperty.core.modelIndex, 'atom.model-index'),
             Alias(MolScript.structureQuery.atomProperty.core.modelLabel, 'atom.model-label'),
             Alias(MolScript.structureQuery.atomProperty.core.atomKey, 'atom.key'),
-            Alias(MolScript.structureQuery.atomProperty.core.linkCount, 'atom.link-count'),
+            Alias(MolScript.structureQuery.atomProperty.core.bondCount, 'atom.bond-count'),
 
             Alias(MolScript.structureQuery.atomProperty.topology.connectedComponentKey, 'atom.key.molecule'),
 
@@ -247,14 +247,14 @@ export const SymbolTable = [
             // args => B.core.flags.hasAny([B.struct.atomProperty.macromolecular.secondaryStructureFlags(), B.struct.type.secondaryStructureFlags(args)])),
         ],
         [
-            'Link Properties',
-            Alias(MolScript.structureQuery.linkProperty.order, 'link.order'),
-            Alias(MolScript.structureQuery.linkProperty.length, 'link.length'),
-            Alias(MolScript.structureQuery.linkProperty.atomA, 'link.atom-a'),
-            Alias(MolScript.structureQuery.linkProperty.atomB, 'link.atom-b'),
-            Macro(MSymbol('link.is', Arguments.List(StructureQueryTypes.LinkFlag), Type.Bool,
-                `Test if the current link has at least one (or all if partial = false) of the specified flags: ${Type.oneOfValues(StructureQueryTypes.LinkFlag).join(', ')}`),
-            args => B.core.flags.hasAny([B.struct.linkProperty.flags(), B.struct.type.linkFlags(getPositionalArgs(args))])),
+            'Bond Properties',
+            Alias(MolScript.structureQuery.bondProperty.order, 'bond.order'),
+            Alias(MolScript.structureQuery.bondProperty.length, 'bond.length'),
+            Alias(MolScript.structureQuery.bondProperty.atomA, 'bond.atom-a'),
+            Alias(MolScript.structureQuery.bondProperty.atomB, 'bond.atom-b'),
+            Macro(MSymbol('bond.is', Arguments.List(StructureQueryTypes.BondFlag), Type.Bool,
+                `Test if the current bond has at least one (or all if partial = false) of the specified flags: ${Type.oneOfValues(StructureQueryTypes.BondFlag).join(', ')}`),
+            args => B.core.flags.hasAny([B.struct.bondProperty.flags(), B.struct.type.bondFlags(getPositionalArgs(args))])),
         ]
     ]
 ];

+ 2 - 2
src/mol-theme/color/carbohydrate-symbol.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { StructureElement, Link, ElementIndex, Unit } from '../../mol-model/structure';
+import { StructureElement, Bond, ElementIndex, Unit } from '../../mol-model/structure';
 import { SaccharideColors, MonosaccharidesColorTable } from '../../mol-model/structure/structure/carbohydrates/constants';
 import { Location } from '../../mol-model/location';
 import { ColorTheme, LocationColor } from '../color';
@@ -44,7 +44,7 @@ export function CarbohydrateSymbolColorTheme(ctx: ThemeDataContext, props: PD.Va
             } else {
                 if (StructureElement.Location.is(location)) {
                     return getColor(location.unit, location.element)
-                } else if (Link.isLocation(location)) {
+                } else if (Bond.isLocation(location)) {
                     return getColor(location.aUnit, location.aUnit.elements[location.aIndex])
                 }
             }

+ 2 - 2
src/mol-theme/color/chain-id.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Unit, StructureProperties, StructureElement, Link, Structure } from '../../mol-model/structure';
+import { Unit, StructureProperties, StructureElement, Bond, Structure } from '../../mol-model/structure';
 import { Color } from '../../mol-util/color';
 import { Location } from '../../mol-model/location';
 import { ColorTheme, LocationColor } from '../color';
@@ -95,7 +95,7 @@ export function ChainIdColorTheme(ctx: ThemeDataContext, props: PD.Values<ChainI
             if (StructureElement.Location.is(location)) {
                 const asym_id = getAsymId(location.unit)
                 serial = asymIdSerialMap.get(asym_id(location))
-            } else if (Link.isLocation(location)) {
+            } else if (Bond.isLocation(location)) {
                 const asym_id = getAsymId(location.aUnit)
                 l.unit = location.aUnit
                 l.element = location.aUnit.elements[location.aIndex]

+ 3 - 3
src/mol-theme/color/cross-link.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Link } from '../../mol-model/structure';
+import { Bond } from '../../mol-model/structure';
 import { Color, ColorScale } from '../../mol-util/color';
 import { Location } from '../../mol-model/location';
 import { ColorTheme, LocationColor } from '../color';
@@ -26,7 +26,7 @@ export function getCrossLinkColorThemeParams(ctx: ThemeDataContext) {
 }
 
 const distVecA = Vec3.zero(), distVecB = Vec3.zero()
-function linkDistance(link: Link.Location) {
+function linkDistance(link: Bond.Location) {
     link.aUnit.conformation.position(link.aUnit.elements[link.aIndex], distVecA)
     link.bUnit.conformation.position(link.bUnit.elements[link.bIndex], distVecB)
     return Vec3.distance(distVecA, distVecB)
@@ -45,7 +45,7 @@ export function CrossLinkColorTheme(ctx: ThemeDataContext, props: PD.Values<Cros
         const scaleColor = scale.color
 
         color = (location: Location): Color => {
-            if (Link.isLocation(location)) {
+            if (Bond.isLocation(location)) {
                 const pairs = crosslinks.getPairs(location.aIndex, location.aUnit, location.bIndex, location.bUnit)
                 if (pairs) {
                     return scaleColor(linkDistance(location) - pairs[0].distanceThreshold)

+ 2 - 2
src/mol-theme/color/element-index.ts

@@ -6,7 +6,7 @@
 
 import { Color } from '../../mol-util/color';
 import { Location } from '../../mol-model/location';
-import { StructureElement, Link } from '../../mol-model/structure';
+import { StructureElement, Bond } from '../../mol-model/structure';
 import { OrderedSet } from '../../mol-data/int';
 import { ColorTheme, LocationColor } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -50,7 +50,7 @@ export function ElementIndexColorTheme(ctx: ThemeDataContext, props: PD.Values<E
                 const unitIndex = unitIdIndex.get(location.unit.id)!
                 const unitElementIndex = OrderedSet.findPredecessorIndex(units[unitIndex].elements, location.element)
                 return palette.color(cummulativeElementCount.get(unitIndex)! + unitElementIndex)
-            } else if (Link.isLocation(location)) {
+            } else if (Bond.isLocation(location)) {
                 const unitIndex = unitIdIndex.get(location.aUnit.id)!
                 const unitElementIndex = OrderedSet.findPredecessorIndex(units[unitIndex].elements, location.aUnit.elements[location.aIndex])
                 return palette.color(cummulativeElementCount.get(unitIndex)! + unitElementIndex)

+ 2 - 2
src/mol-theme/color/element-symbol.ts

@@ -6,7 +6,7 @@
 
 import { ElementSymbol } from '../../mol-model/structure/model/types';
 import { Color, ColorMap } from '../../mol-util/color';
-import { StructureElement, Unit, Link } from '../../mol-model/structure';
+import { StructureElement, Unit, Bond } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { ColorTheme } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -46,7 +46,7 @@ export function ElementSymbolColorTheme(ctx: ThemeDataContext, props: PD.Values<
                 const { type_symbol } = location.unit.model.atomicHierarchy.atoms
                 return elementSymbolColor(colorMap, type_symbol.value(location.element))
             }
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             if (Unit.isAtomic(location.aUnit)) {
                 const { type_symbol } = location.aUnit.model.atomicHierarchy.atoms
                 return elementSymbolColor(colorMap, type_symbol.value(location.aUnit.elements[location.aIndex]))

+ 2 - 2
src/mol-theme/color/entity-source.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { StructureProperties, StructureElement, Link, Model } from '../../mol-model/structure';
+import { StructureProperties, StructureElement, Bond, Model } from '../../mol-model/structure';
 import { Color } from '../../mol-util/color';
 import { Location } from '../../mol-model/location';
 import { ColorTheme, LocationColor } from '../color';
@@ -151,7 +151,7 @@ export function EntitySourceColorTheme(ctx: ThemeDataContext, props: PD.Values<E
         color = (location: Location): Color => {
             if (StructureElement.Location.is(location)) {
                 return getSrcColor(location)
-            } else if (Link.isLocation(location)) {
+            } else if (Bond.isLocation(location)) {
                 l.unit = location.aUnit
                 l.element = location.aUnit.elements[location.aIndex]
                 return getSrcColor(l)

+ 2 - 2
src/mol-theme/color/hydrophobicity.ts

@@ -5,7 +5,7 @@
  */
 
 import { Color, ColorScale } from '../../mol-util/color';
-import { StructureElement, Unit, Link, ElementIndex } from '../../mol-model/structure';
+import { StructureElement, Unit, Bond, ElementIndex } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { ColorTheme } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -78,7 +78,7 @@ export function HydrophobicityColorTheme(ctx: ThemeDataContext, props: PD.Values
             } else {
                 compId = getCoarseCompId(location.unit, location.element)
             }
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             if (Unit.isAtomic(location.aUnit)) {
                 compId = getAtomicCompId(location.aUnit, location.aUnit.elements[location.aIndex])
             } else {

+ 2 - 2
src/mol-theme/color/illustrative.ts

@@ -6,7 +6,7 @@
 
 import { ElementSymbol, isNucleic, isProtein, MoleculeType } from '../../mol-model/structure/model/types';
 import { Color } from '../../mol-util/color';
-import { StructureElement, Unit, Link } from '../../mol-model/structure';
+import { StructureElement, Unit, Bond } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { ColorTheme } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -53,7 +53,7 @@ export function IllustrativeColorTheme(ctx: ThemeDataContext, props: PD.Values<I
                 const typeSymbol = location.unit.model.atomicHierarchy.atoms.type_symbol.value(location.element)
                 return illustrativeColor(colorMap, typeSymbol, moleculeType)
             }
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             if (Unit.isAtomic(location.aUnit)) {
                 const elementIndex = location.aUnit.elements[location.aIndex]
                 const moleculeType = location.aUnit.model.atomicHierarchy.derived.residue.moleculeType[location.aUnit.residueIndex[elementIndex]]

+ 2 - 2
src/mol-theme/color/interaction-type.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Link } from '../../mol-model/structure';
+import { Bond } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { Color, ColorMap } from '../../mol-util/color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -80,7 +80,7 @@ export function InteractionTypeColorTheme(ctx: ThemeDataContext, props: PD.Value
     if (interactions && interactions.value) {
         const map = interactions.value
         color = (location: Location) => {
-            if (Link.isLocation(location)) {
+            if (Bond.isLocation(location)) {
                 const unitInteractions = map.get(location.aUnit.id)
                 if (unitInteractions) {
                     const { links, getLinkIndex } = unitInteractions

+ 2 - 2
src/mol-theme/color/model-index.ts

@@ -6,7 +6,7 @@
 
 import { Color } from '../../mol-util/color';
 import { Location } from '../../mol-model/location';
-import { StructureElement, Link } from '../../mol-model/structure';
+import { StructureElement, Bond } from '../../mol-model/structure';
 import { ColorTheme, LocationColor } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
 import { ThemeDataContext } from '../../mol-theme/theme';
@@ -40,7 +40,7 @@ export function ModelIndexColorTheme(ctx: ThemeDataContext, props: PD.Values<Mod
         color = (location: Location): Color => {
             if (StructureElement.Location.is(location)) {
                 return modelColor.get(location.unit.model.id)!
-            } else if (Link.isLocation(location)) {
+            } else if (Bond.isLocation(location)) {
                 return modelColor.get(location.aUnit.model.id)!
             }
             return DefaultColor

+ 2 - 2
src/mol-theme/color/molecule-type.ts

@@ -5,7 +5,7 @@
  */
 
 import { Color, ColorMap } from '../../mol-util/color';
-import { StructureElement, Unit, Link, ElementIndex } from '../../mol-model/structure';
+import { StructureElement, Unit, Bond, ElementIndex } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { ColorTheme } from '../color';
 import { MoleculeType } from '../../mol-model/structure/model/types';
@@ -58,7 +58,7 @@ export function MoleculeTypeColorTheme(ctx: ThemeDataContext, props: PD.Values<M
     function color(location: Location): Color {
         if (StructureElement.Location.is(location)) {
             return moleculeTypeColor(colorMap, location.unit, location.element)
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             return moleculeTypeColor(colorMap, location.aUnit, location.aUnit.elements[location.aIndex])
         }
         return DefaultMoleculeTypeColor

+ 2 - 2
src/mol-theme/color/occupancy.ts

@@ -5,7 +5,7 @@
  */
 
 import { Color, ColorScale } from '../../mol-util/color';
-import { StructureElement, Unit, Link, ElementIndex } from '../../mol-model/structure';
+import { StructureElement, Unit, Bond, ElementIndex } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { ColorTheme } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -42,7 +42,7 @@ export function OccupancyColorTheme(ctx: ThemeDataContext, props: PD.Values<Occu
     function color(location: Location): Color {
         if (StructureElement.Location.is(location)) {
             return scale.color(getOccupancy(location.unit, location.element))
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             return scale.color(getOccupancy(location.aUnit, location.aUnit.elements[location.aIndex]))
         }
         return DefaultOccupancyColor

+ 2 - 2
src/mol-theme/color/operator-hkl.ts

@@ -5,7 +5,7 @@
  */
 
 import { Color } from '../../mol-util/color';
-import { StructureElement, Link, Structure } from '../../mol-model/structure';
+import { StructureElement, Bond, Structure } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { ColorTheme, LocationColor } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -97,7 +97,7 @@ export function OperatorHklColorTheme(ctx: ThemeDataContext, props: PD.Values<Op
             if (StructureElement.Location.is(location)) {
                 const k = hklKey(location.unit.conformation.operator.hkl)
                 serial = map.get(k)
-            } else if (Link.isLocation(location)) {
+            } else if (Bond.isLocation(location)) {
                 const k = hklKey(location.aUnit.conformation.operator.hkl)
                 serial = map.get(k)
             }

+ 2 - 2
src/mol-theme/color/operator-name.ts

@@ -5,7 +5,7 @@
  */
 
 import { Color } from '../../mol-util/color';
-import { StructureElement, Link, Structure } from '../../mol-model/structure';
+import { StructureElement, Bond, Structure } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { ColorTheme, LocationColor } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -63,7 +63,7 @@ export function OperatorNameColorTheme(ctx: ThemeDataContext, props: PD.Values<O
             if (StructureElement.Location.is(location)) {
                 const name = location.unit.conformation.operator.name
                 serial = operatorNameSerialMap.get(name)
-            } else if (Link.isLocation(location)) {
+            } else if (Bond.isLocation(location)) {
                 const name = location.aUnit.conformation.operator.name
                 serial = operatorNameSerialMap.get(name)
             }

+ 2 - 2
src/mol-theme/color/polymer-id.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Unit, StructureProperties, StructureElement, Link, Structure } from '../../mol-model/structure';
+import { Unit, StructureProperties, StructureElement, Bond, Structure } from '../../mol-model/structure';
 
 import { Color } from '../../mol-util/color';
 import { Location } from '../../mol-model/location';
@@ -104,7 +104,7 @@ export function PolymerIdColorTheme(ctx: ThemeDataContext, props: PD.Values<Poly
             if (StructureElement.Location.is(location)) {
                 const asym_id = getAsymId(location.unit)
                 serial = polymerAsymIdSerialMap.get(asym_id(location))
-            } else if (Link.isLocation(location)) {
+            } else if (Bond.isLocation(location)) {
                 const asym_id = getAsymId(location.aUnit)
                 l.unit = location.aUnit
                 l.element = location.aUnit.elements[location.aIndex]

+ 2 - 2
src/mol-theme/color/polymer-index.ts

@@ -6,7 +6,7 @@
 
 import { Color } from '../../mol-util/color';
 import { Location } from '../../mol-model/location';
-import { StructureElement, Link, Structure } from '../../mol-model/structure';
+import { StructureElement, Bond, Structure } from '../../mol-model/structure';
 import { ColorTheme, LocationColor } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
 import { ThemeDataContext } from '../../mol-theme/theme';
@@ -67,7 +67,7 @@ export function PolymerIndexColorTheme(ctx: ThemeDataContext, props: PD.Values<P
             let color: Color | undefined
             if (StructureElement.Location.is(location)) {
                 color = unitIdColor.get(location.unit.id)
-            } else if (Link.isLocation(location)) {
+            } else if (Bond.isLocation(location)) {
                 color = unitIdColor.get(location.aUnit.id)
             }
             return color !== undefined ? color : DefaultColor

+ 2 - 2
src/mol-theme/color/residue-name.ts

@@ -5,7 +5,7 @@
  */
 
 import { Color, ColorMap } from '../../mol-util/color';
-import { StructureElement, Unit, Link, ElementIndex } from '../../mol-model/structure';
+import { StructureElement, Unit, Bond, ElementIndex } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { ColorTheme } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -110,7 +110,7 @@ export function ResidueNameColorTheme(ctx: ThemeDataContext, props: PD.Values<Re
                 const compId = getCoarseCompId(location.unit, location.element)
                 if (compId) return residueNameColor(colorMap, compId)
             }
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             if (Unit.isAtomic(location.aUnit)) {
                 const compId = getAtomicCompId(location.aUnit, location.aUnit.elements[location.aIndex])
                 return residueNameColor(colorMap, compId)

+ 2 - 2
src/mol-theme/color/secondary-structure.ts

@@ -5,7 +5,7 @@
  */
 
 import { Color, ColorMap } from '../../mol-util/color';
-import { StructureElement, Unit, Link, ElementIndex } from '../../mol-model/structure';
+import { StructureElement, Unit, Bond, ElementIndex } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { ColorTheme } from '../color';
 import { SecondaryStructureType, MoleculeType } from '../../mol-model/structure/model/types';
@@ -92,7 +92,7 @@ export function SecondaryStructureColorTheme(ctx: ThemeDataContext, props: PD.Va
     function color(location: Location): Color {
         if (StructureElement.Location.is(location)) {
             return secondaryStructureColor(colorMap, location.unit, location.element, computedSecondaryStructure?.value)
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             return secondaryStructureColor(colorMap, location.aUnit, location.aUnit.elements[location.aIndex], computedSecondaryStructure?.value)
         }
         return DefaultSecondaryStructureColor

+ 2 - 2
src/mol-theme/color/sequence-id.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Unit, StructureElement, Link, ElementIndex } from '../../mol-model/structure';
+import { Unit, StructureElement, Bond, ElementIndex } from '../../mol-model/structure';
 
 import { ColorScale, Color } from '../../mol-util/color';
 import { Location } from '../../mol-model/location';
@@ -78,7 +78,7 @@ export function SequenceIdColorTheme(ctx: ThemeDataContext, props: PD.Values<Seq
                 scale.setDomain(0, getSequenceLength(unit, element) - 1)
                 return scale.color(seq_id)
             }
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             const { aUnit, aIndex } = location
             const seq_id = getSeqId(aUnit, aUnit.elements[aIndex])
             if (seq_id > 0) {

+ 2 - 2
src/mol-theme/color/uncertainty.ts

@@ -5,7 +5,7 @@
  */
 
 import { Color, ColorScale } from '../../mol-util/color';
-import { StructureElement, Unit, Link, ElementIndex } from '../../mol-model/structure';
+import { StructureElement, Unit, Bond, ElementIndex } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { ColorTheme } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -46,7 +46,7 @@ export function UncertaintyColorTheme(ctx: ThemeDataContext, props: PD.Values<Un
     function color(location: Location): Color {
         if (StructureElement.Location.is(location)) {
             return scale.color(getUncertainty(location.unit, location.element))
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             return scale.color(getUncertainty(location.aUnit, location.aUnit.elements[location.aIndex]))
         }
         return DefaultUncertaintyColor

+ 2 - 2
src/mol-theme/color/unit-index.ts

@@ -6,7 +6,7 @@
 
 import { Color } from '../../mol-util/color';
 import { Location } from '../../mol-model/location';
-import { StructureElement, Link } from '../../mol-model/structure';
+import { StructureElement, Bond } from '../../mol-model/structure';
 import { ColorTheme, LocationColor } from '../color';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
 import { ThemeDataContext } from '../../mol-theme/theme';
@@ -52,7 +52,7 @@ export function UnitIndexColorTheme(ctx: ThemeDataContext, props: PD.Values<Unit
         color = (location: Location): Color => {
             if (StructureElement.Location.is(location)) {
                 return unitIdColor.get(location.unit.id)!
-            } else if (Link.isLocation(location)) {
+            } else if (Bond.isLocation(location)) {
                 return unitIdColor.get(location.aUnit.id)!
             }
             return DefaultColor

+ 7 - 7
src/mol-theme/label.ts

@@ -5,7 +5,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Unit, StructureElement, StructureProperties as Props, Link } from '../mol-model/structure';
+import { Unit, StructureElement, StructureProperties as Props, Bond } from '../mol-model/structure';
 import { Loci } from '../mol-model/loci';
 import { OrderedSet } from '../mol-data/int';
 import { capitalize, stripTags } from '../mol-util/string';
@@ -27,9 +27,9 @@ export function lociLabel(loci: Loci, options: Partial<LabelOptions> = {}): stri
             return loci.structure.models.map(m => m.entry).join(', ')
         case 'element-loci':
             return structureElementStatsLabel(StructureElement.Stats.ofLoci(loci), options)
-        case 'link-loci':
-            const link = loci.links[0]
-            return link ? linkLabel(link) : 'Unknown'
+        case 'bond-loci':
+            const bond = loci.bonds[0]
+            return bond ? bondLabel(bond) : 'Unknown'
         case 'shape-loci':
             return loci.shape.name
         case 'group-loci':
@@ -110,9 +110,9 @@ function _structureElementStatsLabel(stats: StructureElement.Stats, countsOnly =
     }
 }
 
-export function linkLabel(link: Link.Location): string {
-    const locA = StructureElement.Location.create(link.aUnit, link.aUnit.elements[link.aIndex])
-    const locB = StructureElement.Location.create(link.bUnit, link.bUnit.elements[link.bIndex])
+export function bondLabel(bond: Bond.Location): string {
+    const locA = StructureElement.Location.create(bond.aUnit, bond.aUnit.elements[bond.aIndex])
+    const locB = StructureElement.Location.create(bond.bUnit, bond.bUnit.elements[bond.bIndex])
     const labelA = _elementLabel(locA)
     const labelB = _elementLabel(locB)
     let offset = 0

+ 2 - 2
src/mol-theme/size/physical.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { StructureElement, Unit, Link, ElementIndex } from '../../mol-model/structure';
+import { StructureElement, Unit, Bond, ElementIndex } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { SizeTheme } from '../size';
 import { VdwRadius } from '../../mol-model/structure/model/properties/atomic';
@@ -39,7 +39,7 @@ export function PhysicalSizeTheme(ctx: ThemeDataContext, props: PD.Values<Physic
         let size: number
         if (StructureElement.Location.is(location)) {
             size = getPhysicalRadius(location.unit, location.element)
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             size = getPhysicalRadius(location.aUnit, location.aUnit.elements[location.aIndex])
         } else {
             size = DefaultSize

+ 2 - 2
src/mol-theme/size/uncertainty.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { StructureElement, Unit, Link, ElementIndex } from '../../mol-model/structure';
+import { StructureElement, Unit, Bond, ElementIndex } from '../../mol-model/structure';
 import { Location } from '../../mol-model/location';
 import { SizeTheme } from '../size';
 import { ParamDefinition as PD } from '../../mol-util/param-definition'
@@ -37,7 +37,7 @@ export function UncertaintySizeTheme(ctx: ThemeDataContext, props: PD.Values<Unc
         let size = props.baseSize
         if (StructureElement.Location.is(location)) {
             size += getUncertainty(location.unit, location.element, props)
-        } else if (Link.isLocation(location)) {
+        } else if (Bond.isLocation(location)) {
             size += getUncertainty(location.aUnit, location.aUnit.elements[location.aIndex], props)
         }
         return size

+ 4 - 4
src/perf-tests/structure.ts

@@ -372,11 +372,11 @@ export namespace PropertyAccess {
         return StructureQuery.run(q, s);
     }
 
-    export async function runLinks() {
+    export async function runBonds() {
         const { structures } = await readCIF('e:/test/quick/3j3q_full.bcif');
-        console.time('links');
+        console.time('bonds');
         structures[0].interUnitBonds
-        console.timeEnd('links');
+        console.timeEnd('bonds');
     }
 
     export async function run() {
@@ -487,4 +487,4 @@ export namespace PropertyAccess {
     }
 }
 
-PropertyAccess.runLinks();
+PropertyAccess.runBonds();