Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix residue not initializing id in default constructor #1786

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading