message: Structure.ofModel: merge consecutive water chains
diff: @@ -702,8 +702,20 @@ namespace Structure {
  // note that it assumes there are no "zero atom residues"
  let singleAtomResidues = AtomicHierarchy.chainResidueCount(model.atomicHierarchy, c) === chains.offsets[c + 1] - chains.offsets[c];
  - // merge all consecutive "single atom chains" with same entity_id and same auth_asym_id
  let multiChain = false;
  +
  + if (isWaterChain(model, c)) {
  + // merge consecutive water chains
  + while (c + 1 < chains.count && isWaterChain(model, c + 1 as ChainIndex)) {
  + const op1 = atomicChainOperatorMappinng.get(c);
  + const op2 = atomicChainOperatorMappinng.get(c + 1 as ChainIndex);
  + if (op1 !== op2) break;
  +
  + multiChain = true;
  + c++;
  + }
  + } else {
  + // merge consecutive "single atom chains" with same entity_id and auth_asym_id
  while (c + 1 < chains.count
  && chains.offsets[c + 1] - chains.offsets[c] === 1
  && chains.offsets[c + 2] - chains.offsets[c + 1] === 1
  @@ -724,6 +736,7 @@ namespace Structure {
  multiChain = true;
  c++;
  }
  + }
  const elements = SortedArray.ofBounds(start as ElementIndex, chains.offsets[c + 1] as ElementIndex);
  