Skip to content
Snippets Groups Projects
Unverified Commit 3bf4a8f8 authored by David Sehnal's avatar David Sehnal Committed by GitHub
Browse files

optimize computeInterUnitBonds (#830)

parent 71121e52
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,8 @@ Note that since we don't clearly distinguish between a public and private interf ...@@ -6,6 +6,8 @@ Note that since we don't clearly distinguish between a public and private interf
## [Unreleased] ## [Unreleased]
- Optimize inter unit bond compute
## [v3.35.0] - 2023-05-14 ## [v3.35.0] - 2023-05-14
- Enable odd dash count (1,3,5) - Enable odd dash count (1,3,5)
......
...@@ -243,10 +243,8 @@ function computeInterUnitBonds(structure: Structure, props?: Partial<InterBondCo ...@@ -243,10 +243,8 @@ function computeInterUnitBonds(structure: Structure, props?: Partial<InterBondCo
...p, ...p,
validUnit: (props && props.validUnit) || (u => Unit.isAtomic(u)), validUnit: (props && props.validUnit) || (u => Unit.isAtomic(u)),
validUnitPair: (props && props.validUnitPair) || ((s, a, b) => { validUnitPair: (props && props.validUnitPair) || ((s, a, b) => {
// In case both units have a struct conn record, ignore other criteria const isValidPair = Structure.validUnitPair(s, a, b);
if (hasCommonStructConnRecord(a, b)) { if (!isValidPair) return false;
return Structure.validUnitPair(s, a, b);
}
const mtA = a.model.atomicHierarchy.derived.residue.moleculeType; const mtA = a.model.atomicHierarchy.derived.residue.moleculeType;
const mtB = b.model.atomicHierarchy.derived.residue.moleculeType; const mtB = b.model.atomicHierarchy.derived.residue.moleculeType;
...@@ -258,7 +256,13 @@ function computeInterUnitBonds(structure: Structure, props?: Partial<InterBondCo ...@@ -258,7 +256,13 @@ function computeInterUnitBonds(structure: Structure, props?: Partial<InterBondCo
const notIonA = (!Unit.isAtomic(a) || mtA[a.residueIndex[a.elements[0]]] !== MoleculeType.Ion); const notIonA = (!Unit.isAtomic(a) || mtA[a.residueIndex[a.elements[0]]] !== MoleculeType.Ion);
const notIonB = (!Unit.isAtomic(b) || mtB[b.residueIndex[b.elements[0]]] !== MoleculeType.Ion); const notIonB = (!Unit.isAtomic(b) || mtB[b.residueIndex[b.elements[0]]] !== MoleculeType.Ion);
const notIon = notIonA && notIonB; const notIon = notIonA && notIonB;
return Structure.validUnitPair(s, a, b) && (notWater || !p.ignoreWater) && (notIon || !p.ignoreIon);
const check = (notWater || !p.ignoreWater) && (notIon || !p.ignoreIon);
if (!check) {
// In case both units have a struct conn record, ignore other criteria
return hasCommonStructConnRecord(a, b);
}
return true;
}), }),
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment