Skip to content

Commit

Permalink
Only apply fix when atomic number is negative.
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Dec 3, 2021
1 parent 80c5794 commit 0122d3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion corelib/src/libs/SireIO/amber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,9 @@ static void setAtomParameters(AtomEditor &editatom, MolEditor &editmol,
{
Element elem;

if (element[atomNumber-1] <= 0 and mass[atomNumber-1] > 0)
// Infer element from mass if atomic number is negative, which
// can be the case for files generated by Acellara's "parameterize".
if (element[atomNumber-1] < 0 and mass[atomNumber-1] > 0)
{
elem = Element::elementWithMass(mass[atomNumber-1] * g_per_mol);
}
Expand Down
5 changes: 3 additions & 2 deletions corelib/src/libs/SireIO/amberprm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3946,8 +3946,9 @@ AmberParams AmberPrm::getAmberParams(int molidx, const MoleculeInfoData &molinfo

Element element;

if (int(atomic_num_array[atom_idx]) <= 0 and
mass_array[atom_idx] > 0)
// Infer element from mass if atomic number is negative, which
// can be the case for files generated by Acellara's "parameterize".
if (int(atomic_num_array[atom_idx]) < 0 and mass_array[atom_idx] > 0)
{
element = Element::elementWithMass(mass_array[atom_idx] * g_per_mol);
}
Expand Down

0 comments on commit 0122d3f

Please sign in to comment.