HydrogenAdder.cpp (pymol-open-source-2.2.0) | : | HydrogenAdder.cpp (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 243 | skipping to change at line 243 | |||
break; | break; | |||
} | } | |||
if (n_missing > n_system - n_present) { | if (n_missing > n_system - n_present) { | |||
n_missing = n_system - n_present; | n_missing = n_system - n_present; | |||
} | } | |||
// adding coordinates will invalidate pointer | // adding coordinates will invalidate pointer | |||
float center_coord_copy[3]; | float center_coord_copy[3]; | |||
copy3f(center_coord, center_coord_copy); | copy3f(center_coord, center_coord_copy); | |||
center_coord = NULL; | center_coord = nullptr; | |||
for (int i = 0; i < n_missing; ++i) { | for (int i = 0; i < n_missing; ++i) { | |||
float bondlength = AtomInfoGetBondLength(G, | float bondlength = AtomInfoGetBondLength(G, | |||
I->AtomInfo + atm, | I->AtomInfo + atm, | |||
I->AtomInfo + missing_atm[i]); | I->AtomInfo + missing_atm[i]); | |||
float* coord = cbuf + (n_present + i) * 3; | float* coord = cbuf + (n_present + i) * 3; | |||
scale3f(coord, bondlength, coord); | scale3f(coord, bondlength, coord); | |||
add3f(coord, center_coord_copy, coord); | add3f(coord, center_coord_copy, coord); | |||
if (h_fix && (idx = cs->atmToIdx(missing_atm[i])) != -1) { | if (h_fix && (idx = cs->atmToIdx(missing_atm[i])) != -1) { | |||
skipping to change at line 325 | skipping to change at line 325 | |||
// atom | // atom | |||
auto atom = I->AtomInfo + I->NAtom++; | auto atom = I->AtomInfo + I->NAtom++; | |||
atom->protons = cAN_H; | atom->protons = cAN_H; | |||
atom->geom = cAtomInfoSingle; | atom->geom = cAtomInfoSingle; | |||
atom->valence = 1; | atom->valence = 1; | |||
ObjectMoleculePrepareAtom(I, atm, atom, /* uniquefy */ false); | ObjectMoleculePrepareAtom(I, atm, atom, /* uniquefy */ false); | |||
} | } | |||
} | } | |||
// grow index arrays | // grow index arrays | |||
for (StateIterator iter(G, NULL, cSelectorUpdateTableAllStates, I->NCSet); | for (StateIterator iter(G, nullptr, cSelectorUpdateTableAllStates, I->NCSet); | |||
iter.next();) { | iter.next();) { | |||
CoordSet* cs = I->CSet[iter.state]; | CoordSet* cs = I->CSet[iter.state]; | |||
if (cs) | if (cs) | |||
cs->extendIndices(I->NAtom); | cs->extendIndices(I->NAtom); | |||
} | } | |||
ObjectMoleculeInvalidate(I, cRepAll, cRepInvBonds, state); | ObjectMoleculeInvalidate(I, cRepAll, cRepInvBonds, state); | |||
ObjectMoleculeUpdateNeighbors(I); | ObjectMoleculeUpdateNeighbors(I); | |||
AtomInfoUniquefyNames(G, | AtomInfoUniquefyNames(G, | |||
I->AtomInfo, n_atom_old, | I->AtomInfo, n_atom_old, | |||
I->AtomInfo + n_atom_old, NULL, | I->AtomInfo + n_atom_old, nullptr, | |||
I->NAtom - n_atom_old); | I->NAtom - n_atom_old); | |||
// fill coordinates | // fill coordinates | |||
for (StateIterator iter(G, I->Obj.Setting, state, I->NCSet); iter.next();) { | for (StateIterator iter(G, I->Obj.Setting, state, I->NCSet); iter.next();) { | |||
CoordSet* cs = I->CSet[iter.state]; | CoordSet* cs = I->CSet[iter.state]; | |||
if (!cs) | if (!cs) | |||
continue; | continue; | |||
for (unsigned idx = 0; idx < cs->NIndex; ++idx) { | for (unsigned idx = 0; idx < cs->NIndex; ++idx) { | |||
auto atm = cs->IdxToAtm[idx]; | auto atm = cs->IdxToAtm[idx]; | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |