Browse Source

don't split small single atom polymer chains

Alexander Rose 4 years ago
parent
commit
f14b57fe30
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/mol-model/structure/structure/structure.ts

+ 7 - 1
src/mol-model/structure/structure/structure.ts

@@ -705,7 +705,8 @@ namespace Structure {
 
             const elements = SortedArray.ofBounds(start as ElementIndex, chains.offsets[c + 1] as ElementIndex);
 
-            if (singleAtomResidues) {
+            // check for polymer to exclude CA/P-only models
+            if (singleAtomResidues && !isPolymerChain(model, c)) {
                 partitionAtomicUnitByAtom(model, elements, builder, multiChain, operator);
             } else if (elements.length > 200000 || isWaterChain(model, c)) {
                 // split up very large chains e.g. lipid bilayers, micelles or water with explicit H
@@ -733,6 +734,11 @@ namespace Structure {
         return model.entities.data.type.value(e) === 'water';
     }
 
+    function isPolymerChain(model: Model, chainIndex: ChainIndex) {
+        const e = model.atomicHierarchy.index.getEntityFromChain(chainIndex);
+        return model.entities.data.type.value(e) === 'polymer';
+    }
+
     function partitionAtomicUnitByAtom(model: Model, indices: SortedArray, builder: StructureBuilder, multiChain: boolean, operator: SymmetryOperator) {
         const { x, y, z } = model.atomicConformation;
         const position = { x, y, z, indices };