Browse Source

improved hbond param handling

Alexander Rose 5 years ago
parent
commit
2b73f9cafd

+ 12 - 12
src/mol-model-props/computed/interactions/hydrogen-bonds.ts

@@ -22,12 +22,12 @@ export interface HydrogenBonds {
 }
 
 export const HydrogenBondsParams = {
-    maxHbondDist: PD.Numeric(3.5, { min: 1, max: 5, step: 0.1 }),
-    maxHbondSulfurDist: PD.Numeric(4.1, { min: 1, max: 5, step: 0.1 }),
-    maxHbondAccAngleDev: PD.Numeric(45, { min: 0, max: 180, step: 1 }, { description: 'Max deviation from ideal acceptor angle' }),
-    maxHbondDonAngleDev: PD.Numeric(45, { min: 0, max: 180, step: 1 }, { description: 'Max deviation from ideal donor angle' }),
-    maxHbondAccOutOfPlaneAngle: PD.Numeric(90, { min: 0, max: 180, step: 1 }),
-    maxHbondDonOutOfPlaneAngle: PD.Numeric(45, { min: 0, max: 180, step: 1 }),
+    maxDist: PD.Numeric(3.5, { min: 1, max: 5, step: 0.1 }),
+    maxSulfurDist: PD.Numeric(4.1, { min: 1, max: 5, step: 0.1 }),
+    maxAccAngleDev: PD.Numeric(45, { min: 0, max: 180, step: 1 }, { description: 'Max deviation from ideal acceptor angle' }),
+    maxDonAngleDev: PD.Numeric(45, { min: 0, max: 180, step: 1 }, { description: 'Max deviation from ideal donor angle' }),
+    maxAccOutOfPlaneAngle: PD.Numeric(90, { min: 0, max: 180, step: 1 }),
+    maxDonOutOfPlaneAngle: PD.Numeric(45, { min: 0, max: 180, step: 1 }),
 }
 export type HydrogenBondsParams = typeof HydrogenBondsParams
 export type HydrogenBondsProps = PD.Values<HydrogenBondsParams>
@@ -235,12 +235,12 @@ function Info(structure: Structure, unit: Unit.Atomic, features: Features) {
 
 function getOptions(props: HydrogenBondsProps) {
     return {
-        maxAccAngleDev: degToRad(props.maxHbondAccAngleDev),
-        maxDonAngleDev: degToRad(props.maxHbondDonAngleDev),
-        maxAccOutOfPlaneAngle: degToRad(props.maxHbondAccOutOfPlaneAngle),
-        maxDonOutOfPlaneAngle: degToRad(props.maxHbondDonOutOfPlaneAngle),
-        maxDist: Math.max(props.maxHbondDist, props.maxHbondSulfurDist),
-        maxHbondDistSq: props.maxHbondDist * props.maxHbondDist,
+        maxAccAngleDev: degToRad(props.maxAccAngleDev),
+        maxDonAngleDev: degToRad(props.maxDonAngleDev),
+        maxAccOutOfPlaneAngle: degToRad(props.maxAccOutOfPlaneAngle),
+        maxDonOutOfPlaneAngle: degToRad(props.maxDonOutOfPlaneAngle),
+        maxDist: Math.max(props.maxDist, props.maxSulfurDist),
+        maxHbondDistSq: props.maxDist * props.maxDist,
     }
 }
 type Options = ReturnType<typeof getOptions>

+ 5 - 5
src/mol-model-props/computed/interactions/interactions.ts

@@ -112,7 +112,7 @@ namespace Interactions {
             case InteractionType.CationPi:
                 return 'Cation-Pi Interaction'
             case InteractionType.PiStacking:
-                return 'Pi-Pi Stacking'
+                return 'Pi Stacking'
             case InteractionType.WeakHydrogenBond:
                 return 'Weak Hydrogen Bond'
             case InteractionType.Unknown:
@@ -122,7 +122,7 @@ namespace Interactions {
 }
 
 export const InteractionsParams = {
-    ...HydrogenBondsParams,
+    hydrogenBonds: PD.Group(HydrogenBondsParams),
 }
 export type InteractionsParams = typeof InteractionsParams
 export type InteractionsProps = PD.Values<InteractionsParams>
@@ -158,7 +158,7 @@ function findIntraUnitLinksAndFeatures(structure: Structure, unit: Unit, props:
 
     const linksBuilder = IntraLinksBuilder.create(features, unit.elements.length)
     if (Unit.isAtomic(unit)) {
-        addUnitHydrogenBonds(structure, unit, features, linksBuilder, props)
+        addUnitHydrogenBonds(structure, unit, features, linksBuilder, props.hydrogenBonds)
     }
 
     return { features, links: linksBuilder.getLinks() }
@@ -188,9 +188,9 @@ function findInterUnitLinks(structure: Structure, unitsFeatures: IntMap<Features
             const featuresB = unitsFeatures.get(unitB.id)
 
             if (unitB.elements.length >= unitA.elements.length) {
-                addStructureHydrogenBonds(structure, unitA, featuresA, unitB, featuresB, builder, props)
+                addStructureHydrogenBonds(structure, unitA, featuresA, unitB, featuresB, builder, props.hydrogenBonds)
             } else {
-                addStructureHydrogenBonds(structure, unitB, featuresB, unitA, featuresA, builder, props)
+                addStructureHydrogenBonds(structure, unitB, featuresB, unitA, featuresA, builder, props.hydrogenBonds)
             }
         }
     }