From e403c371e9e83118ec6f5e84113fb6d8e58f3bad Mon Sep 17 00:00:00 2001
From: Sebastian Bittrich <bittrich@hs-mittweida.de>
Date: Thu, 21 Mar 2019 10:37:26 -0700
Subject: [PATCH] cleanup

---
 .../utils/accessible-surface-area.ts          | 22 ++++++-------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/mol-model/structure/model/properties/utils/accessible-surface-area.ts b/src/mol-model/structure/model/properties/utils/accessible-surface-area.ts
index 8fb4ae37a..40c376d06 100644
--- a/src/mol-model/structure/model/properties/utils/accessible-surface-area.ts
+++ b/src/mol-model/structure/model/properties/utils/accessible-surface-area.ts
@@ -1,6 +1,7 @@
 import { Vec3 } from 'mol-math/linear-algebra';
 import { AtomicHierarchy, AtomicConformation } from '../atomic';
-import { ElementSymbol, VdwRadii, MaxAsa, DefaultMaxAsa } from '../../types';
+import { ElementSymbol, MaxAsa, DefaultMaxAsa, MoleculeType } from '../../types';
+import { VdwRadius } from '../atomic/measures';
 
 const defaultNumberOfPoints = 960;
 const defaultProbeSize = 1.4;
@@ -24,24 +25,14 @@ export function computeModelASA(hierarchy: AtomicHierarchy, conformation: Atomic
         conformation
     }
 
-    return calculateASA(ctx);
-}
-
-const valueForIgnoredAtom = -1.0;
-
-function calculateASA(ctx: ASAContext) {
     const { probeSize, spherePoints, cons } = ctx;
     const { atoms, residues, residueAtomSegments, derived } = ctx.hierarchy;
     const { type_symbol } = atoms;
     const { x, y, z } = ctx.conformation;
 
     const radii: number[] = [];
-    // const atomAsa: number[] = [];
     const residueAsa: number[] = [];
 
-    console.log(ctx.hierarchy);
-    console.log(ctx.conformation);
-
     const position = (i: number, v: Vec3) => Vec3.set(v, x[i], y[i], z[i]);
     const a1Pos = Vec3.zero();
     const a2Pos = Vec3.zero();
@@ -59,7 +50,7 @@ function calculateASA(ctx: ASAContext) {
         const groupIndex = residueAtomSegments.index[i];
 
         // skip entities not part of a peptide chain
-        if (derived.residue.moleculeType[groupIndex] !== 4) {
+        if (derived.residue.moleculeType[groupIndex] !== MoleculeType.protein) {
             radii[radii.length] = valueForIgnoredAtom;
             continue;
         }
@@ -144,10 +135,12 @@ function calculateASA(ctx: ASAContext) {
         residueAsa[i] /= (maxAsa === undefined ? DefaultMaxAsa : maxAsa);
     }
 
-    // console.log(residueAsa);
+    console.log(residueAsa);
     return residueAsa;
 }
 
+const valueForIgnoredAtom = -1.0;
+
 /**
  * Gets the van der Waals radius of the given atom following the values defined by Chothia (1976)
  * J.Mol.Biol.105,1-14. NOTE: the vdw values defined by the paper assume no Hydrogens and thus "inflates" slightly
@@ -178,8 +171,7 @@ function determineRadius(atomId: string, element: ElementSymbol, compId: string)
             }
         }
     }
-    // TODO could potentially use logging or error thrown
-    return (VdwRadii as any)[atomId];
+    return VdwRadius(element);
 }
 
 /** Creates a collection of points on a sphere by the Golden Section Spiral algorithm. */
-- 
GitLab