Skip to content

Commit

Permalink
Merge pull request #1786 from ghutchis/minor-residue-fix
Browse files Browse the repository at this point in the history
Fix residue not initializing id in default constructor
  • Loading branch information
ghutchis authored Nov 16, 2024
2 parents a0ca28b + 1e7190c commit 990956e
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions avogadro/core/residue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,40 @@
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/

#include "molecule.h"
#include "residue.h"
#include "molecule.h"
#include "residuecolors.h"
#include "residuedata.h"

namespace Avogadro::Core {

Residue::Residue(std::string& name)
: m_residueName(name), m_chainId('A'), m_heterogen(false), m_color(0,0,0), m_customColorSet(false), m_secondaryStructure(undefined)
{}
: m_residueName(name), m_residueId(0), m_chainId('A'), m_heterogen(false),
m_color(0, 0, 0), m_customColorSet(false), m_secondaryStructure(undefined)
{
}

Residue::Residue(std::string& name, Index& number)
: m_residueName(name), m_residueId(number), m_chainId('A'), m_heterogen(false), m_color(0,0,0), m_customColorSet(false), m_secondaryStructure(undefined)
{}
: m_residueName(name), m_residueId(number), m_chainId('A'),
m_heterogen(false), m_color(0, 0, 0), m_customColorSet(false),
m_secondaryStructure(undefined)
{
}

Residue::Residue(std::string& name, Index& number, char& id)
: m_residueName(name), m_residueId(number), m_chainId(id), m_heterogen(false), m_color(0,0,0), m_customColorSet(false), m_secondaryStructure(undefined)
{}
: m_residueName(name), m_residueId(number), m_chainId(id), m_heterogen(false),
m_color(0, 0, 0), m_customColorSet(false), m_secondaryStructure(undefined)
{
}

Residue::Residue(const Residue& other)
: m_residueName(other.m_residueName), m_residueId(other.m_residueId),
m_chainId(other.m_chainId), m_atomNameMap(other.m_atomNameMap),
m_heterogen(other.m_heterogen), m_color(other.m_color),
m_heterogen(other.m_heterogen), m_color(other.m_color),
m_customColorSet(other.m_customColorSet),
m_secondaryStructure(other.m_secondaryStructure)
{}
{
}

Residue& Residue::operator=(Residue other)
{
Expand All @@ -51,7 +59,7 @@ void Residue::addResidueAtom(const std::string& name, const Atom& atom)
std::vector<Atom> Residue::residueAtoms() const
{
std::vector<Atom> res;
for (const auto & it : m_atomNameMap) {
for (const auto& it : m_atomNameMap) {
res.push_back(it.second);
}
return res;
Expand All @@ -70,7 +78,7 @@ Atom Residue::getAtomByName(std::string name) const

std::string Residue::getAtomName(const Atom atom) const
{
for (const auto & it : m_atomNameMap) {
for (const auto& it : m_atomNameMap) {
if (it.second == atom) {
return it.first;
}
Expand All @@ -80,7 +88,7 @@ std::string Residue::getAtomName(const Atom atom) const

std::string Residue::getAtomName(const Index index) const
{
for (const auto & it : m_atomNameMap) {
for (const auto& it : m_atomNameMap) {
if (it.second.index() == index) {
return it.first;
}
Expand Down

0 comments on commit 990956e

Please sign in to comment.