Skip to content
Snippets Groups Projects
Commit 527e91c9 authored by Alexander Rose's avatar Alexander Rose
Browse files

fix Structure.unitIndexMap creation when units are unsorted

parent 9e2ef876
No related branches found
No related tags found
No related merge requests found
......@@ -275,13 +275,15 @@ class Structure {
for (let i = 0, _i = units.length; i < _i; i++) {
const u = units[i];
unitMap.set(u.id, u);
unitIndexMap.set(u.id, i);
elementCount += u.elements.length;
polymerResidueCount += u.polymerElements.length;
if (u.id < lastId) isSorted = false;
lastId = u.id;
}
if (!isSorted) sort(units, 0, units.length, cmpUnits, arraySwap);
for (let i = 0, _i = units.length; i < _i; i++) {
unitIndexMap.set(units[i].id, i);
}
this._props.elementCount = elementCount;
this._props.polymerResidueCount = polymerResidueCount;
return { unitMap, unitIndexMap };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment