Pārlūkot izejas kodu

tweaked bond calc

- use avg element threshold
Alexander Rose 5 gadi atpakaļ
vecāks
revīzija
2a925cdd6a

+ 3 - 1
src/mol-model/structure/structure/unit/bonds/inter-compute.ts

@@ -137,7 +137,9 @@ function findPairBonds(unitA: Unit.Atomic, unitB: Unit.Atomic, props: BondComput
             const thresholdAB = getElementPairThreshold(aeI, beI);
             const pairingThreshold = thresholdAB > 0
                 ? thresholdAB
-                : beI < 0 ? thresholdA : Math.max(thresholdA, getElementThreshold(beI));
+                : beI < 0
+                    ? thresholdA
+                    : (thresholdA + getElementThreshold(beI)) / 2; // not sure if avg or min but max is too big
 
             if (dist <= pairingThreshold) {
                 const atomIdB = label_atom_idB.value(bI);

+ 8 - 1
src/mol-model/structure/structure/unit/bonds/intra-compute.ts

@@ -155,9 +155,16 @@ function _computeBonds(unit: Unit.Atomic, props: BondComputationProps): IntraUni
             if (dist === 0) continue;
 
             const thresholdAB = getElementPairThreshold(aeI, beI);
+            console.log({
+                thresholdAB,
+                atomIdA,
+                atomIdB: label_atom_id.value(bI)
+            })
             const pairingThreshold = thresholdAB > 0
                 ? thresholdAB
-                : beI < 0 ? thresholdA : Math.max(thresholdA, getElementThreshold(beI));
+                : beI < 0
+                    ? thresholdA
+                    : (thresholdA + getElementThreshold(beI)) / 2; // not sure if avg or min but max is too big
 
             if (dist <= pairingThreshold) {
                 atomA[atomA.length] = _aI;