Handle CCD bonds with Deuterium atoms

This commit is contained in:
Alexander Rose
2026-03-26 16:23:32 -07:00
parent ae2493b6e3
commit 6c99c575bc
3 changed files with 17 additions and 6 deletions

View File

@@ -22,6 +22,7 @@ Note that since we don't clearly distinguish between a public and private interf
- MolViewSpec
- Add `VolumeStreamingExtension` (`molstar_volume_streaming` custom property)
- Fix focusing empty selections
- Handle CCD bonds with Deuterium atoms
## [v5.7.0] - 2026-02-28
- Text label improvements

View File

@@ -49,3 +49,6 @@
* Assembly symmetries
* 5M30 (Assembly 1, C3 local and pseudo)
* 1RB8 (Assembly 1, I global)
* Deuterium atoms
* 3CWH (XUL with D and DOD)
* 8TT8 (HOH and other with D)

View File

@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017-2025 Mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2017-2026 Mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
@@ -213,11 +213,14 @@ function findBonds(unit: Unit.Atomic, props: BondComputationProps): IntraUnitBon
lastResidue = raI;
const aeI = getElementIdx(elemA);
const atomIdA = label_atom_id.value(aI);
const isHa = isHydrogen(aeI);
let atomIdA = label_atom_id.value(aI);
if (isHa && atomIdA.startsWith('D') && compId !== 'DOD') {
atomIdA = 'H' + atomIdA.substring(1);
}
const componentPairs = componentMap ? componentMap.get(atomIdA) : void 0;
const { indices, count, squaredDistances } = query3d.find(x[aI], y[aI], z[aI], maxRadius);
const isHa = isHydrogen(aeI);
const thresholdA = getElementThreshold(aeI);
const altA = label_alt_id.value(aI);
const metalA = MetalsSet.has(aeI);
@@ -248,7 +251,11 @@ function findBonds(unit: Unit.Atomic, props: BondComputationProps): IntraUnitBon
const rbI = residueIndex[bI];
// handle "component dictionary" bonds.
if (raI === rbI && componentPairs) {
const e = componentPairs.get(label_atom_id.value(bI)!);
let atomIdB = label_atom_id.value(bI)!;
if (isHb && atomIdB.startsWith('D') && compId !== 'DOD') {
atomIdB = 'H' + atomIdB.substring(1);
}
const e = componentPairs.get(atomIdB);
if (e) {
atomA[atomA.length] = _aI;
atomB[atomB.length] = _bI;
@@ -284,7 +291,7 @@ function findBonds(unit: Unit.Atomic, props: BondComputationProps): IntraUnitBon
if (flag) {
atomA[atomA.length] = _aI;
atomB[atomB.length] = _bI;
order[order.length] = getIntraBondOrderFromTable(compId, atomIdA, label_atom_id.value(bI));
order[order.length] = getIntraBondOrderFromTable(compId, label_atom_id.value(aI), label_atom_id.value(bI));
flags[flags.length] = (isMetal ? BondType.Flag.MetallicCoordination : BondType.Flag.Covalent) | BondType.Flag.Computed;
key[key.length] = -1;