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

Merge pull request #660 from molstar/struct-conn-ions-fix

Fix struct_conn bond assignment for ions
parents b21fb270 e98d7931
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ Note that since we don't clearly distinguish between a public and private interf
- Add per-pixel object clipping
- Fix `QualityAssessment` assignment bug for structures with different auth vs label sequence numbering
- Refresh `ApplyActionControl`'s param definition when toggling expanded state
- Fix `struct_conn` bond assignment for ions
## [v3.26.0] - 2022-12-04
......
......@@ -249,13 +249,29 @@ function computeInterUnitBonds(structure: Structure, props?: Partial<InterBondCo
(!Unit.isAtomic(a) || mtA[a.residueIndex[a.elements[0]]] !== MoleculeType.Water) &&
(!Unit.isAtomic(b) || mtB[b.residueIndex[b.elements[0]]] !== MoleculeType.Water)
);
const notIon = (
(!Unit.isAtomic(a) || mtA[a.residueIndex[a.elements[0]]] !== MoleculeType.Ion) &&
(!Unit.isAtomic(b) || mtB[b.residueIndex[b.elements[0]]] !== MoleculeType.Ion)
);
const sameModel = a.model === b.model;
const notIonA = (!Unit.isAtomic(a) || mtA[a.residueIndex[a.elements[0]]] !== MoleculeType.Ion) || (sameModel && hasStructConnRecord(a));
const notIonB = (!Unit.isAtomic(b) || mtB[b.residueIndex[b.elements[0]]] !== MoleculeType.Ion) || (sameModel && hasStructConnRecord(b));
const notIon = notIonA && notIonB;
return Structure.validUnitPair(s, a, b) && (notWater || !p.ignoreWater) && (notIon || !p.ignoreIon);
}),
});
}
function hasStructConnRecord(unit: Unit) {
if (!Unit.isAtomic(unit)) return false;
const elements = unit.elements;
const structConn = StructConn.Provider.get(unit.model);
if (structConn) {
for (let i = 0, _i = elements.length; i < _i; i++) {
if (structConn.byAtomIndex.get(elements[i])) {
return true;
}
}
}
return false;
}
export { computeInterUnitBonds };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment