Skip to content

Commit

Permalink
Fix object-passing code mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
aerkiaga committed Mar 10, 2022
1 parent 7028fc4 commit c2e8dd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions avogadro/io/pdbformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ std::vector<std::string> PdbFormat::mimeTypes() const
return mime;
}

void PdbFormat::perceiveSubstitutedCations(Core::Molecule mol)
void PdbFormat::perceiveSubstitutedCations(Core::Molecule& molecule)
{
for (Index i = 0; i < mol.atomCount(); i++) {
for (Index i = 0; i < molecule.atomCount(); i++) {
unsigned char requiredBondCount(0);
switch(mol.atomicNumber(i)) {
switch(molecule.atomicNumber(i)) {
case 7:
case 15:
case 33:
Expand All @@ -246,15 +246,15 @@ void PdbFormat::perceiveSubstitutedCations(Core::Molecule mol)

unsigned char bondCount(0);
Index j = 0;
for (const auto &bond : mol.bonds(i)) {
for (const auto &bond : molecule.bonds(i)) {
unsigned char otherAtomicNumber(0);
Index index1(bond.atom1().index());
Index index2(bond.atom2().index());
if (index1 == i) {
otherAtomicNumber = mol.atomicNumber(index2);
otherAtomicNumber = molecule.atomicNumber(index2);
bondCount += bond.order();
} else if (index2 == i) {
otherAtomicNumber = mol.atomicNumber(index1);
otherAtomicNumber = molecule.atomicNumber(index1);
bondCount += bond.order();
}
if (otherAtomicNumber && otherAtomicNumber != 6) {
Expand All @@ -265,7 +265,7 @@ void PdbFormat::perceiveSubstitutedCations(Core::Molecule mol)
}

if (bondCount == requiredBondCount) {
mol.setFormalCharge(i, 1);
molecule.setFormalCharge(i, 1);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion avogadro/io/pdbformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class AVOGADROIO_EXPORT PdbFormat : public FileFormat
return false;
}

void perceiveSubstitutedCations(Core::Molecule);
void perceiveSubstitutedCations(Core::Molecule& molecule);
};

} // namespace Io
Expand Down

0 comments on commit c2e8dd5

Please sign in to comment.