Commit d3194f8c by maarten

backup

git-svn-id: svn+ssh://gitlab/srv/svn-repos/pdb-redo/trunk@192 a1961a4f-ab94-4bcc-80e8-33b5a54de466
parent 2a9bb575
...@@ -95,6 +95,9 @@ class Atom ...@@ -95,6 +95,9 @@ class Atom
bool isWater() const; bool isWater() const;
int charge() const; int charge() const;
float uIso() const;
float occupancy() const;
template<typename T> template<typename T>
T property(const std::string& name) const; T property(const std::string& name) const;
......
...@@ -307,6 +307,24 @@ Atom& Atom::operator=(const Atom& rhs) ...@@ -307,6 +307,24 @@ Atom& Atom::operator=(const Atom& rhs)
return *this; return *this;
} }
template<>
string Atom::property<string>(const std::string& name) const
{
return mImpl->mRow[name].as<string>();
}
template<>
int Atom::property<int>(const std::string& name) const
{
return mImpl->mRow[name].as<int>();
}
template<>
float Atom::property<float>(const std::string& name) const
{
return mImpl->mRow[name].as<float>();
}
string Atom::id() const string Atom::id() const
{ {
return mImpl->mId; return mImpl->mId;
...@@ -319,58 +337,56 @@ AtomType Atom::type() const ...@@ -319,58 +337,56 @@ AtomType Atom::type() const
int Atom::charge() const int Atom::charge() const
{ {
int charge; return property<int>("pdbx_formal_charge");
cif::tie(charge) = mImpl->mRow.get("pdbx_formal_charge"); }
return charge; float Atom::uIso() const
{
float result;
if (not mImpl->mRow["U_iso_or_equiv"].empty())
result = mImpl->mRow["U_iso_or_equiv"].as<float>();
else if (not mImpl->mRow["B_iso_or_equiv"].empty())
result = mImpl->mRow["B_iso_or_equiv"].as<float>() / (8 * kPI * kPI);
else
throw runtime_error("Missing B_iso or U_iso");
return result;
} }
string Atom::labelAtomId() const float Atom::occupancy() const
{ {
string atomId; return property<float>("occupancy");
cif::tie(atomId) = mImpl->mRow.get("label_atom_id"); }
return atomId; string Atom::labelAtomId() const
{
return property<string>("label_atom_id");
} }
string Atom::labelCompId() const string Atom::labelCompId() const
{ {
string compId; return property<string>("label_comp_id");
cif::tie(compId) = mImpl->mRow.get("label_comp_id");
return compId;
} }
string Atom::labelAsymId() const string Atom::labelAsymId() const
{ {
string asymId; return property<string>("label_asym_id");
cif::tie(asymId) = mImpl->mRow.get("label_asym_id");
return asymId;
} }
int Atom::labelSeqId() const int Atom::labelSeqId() const
{ {
int seqId; return property<int>("label_seq_id");
cif::tie(seqId) = mImpl->mRow.get("label_seq_id");
return seqId;
} }
string Atom::authAsymId() const string Atom::authAsymId() const
{ {
string asymId; return property<string>("auth_asym_id");
cif::tie(asymId) = mImpl->mRow.get("auth_asym_id");
return asymId;
} }
int Atom::authSeqId() const int Atom::authSeqId() const
{ {
int seqId; return property<int>("auth_seq_id");
cif::tie(seqId) = mImpl->mRow.get("auth_seq_id");
return seqId;
} }
Point Atom::location() const Point Atom::location() const
...@@ -388,18 +404,6 @@ bool Atom::isWater() const ...@@ -388,18 +404,6 @@ bool Atom::isWater() const
return mImpl->isWater(); return mImpl->isWater();
} }
template<>
string Atom::property<string>(const std::string& name) const
{
return mImpl->mRow[name].as<string>();
}
template<>
float Atom::property<float>(const std::string& name) const
{
return stof(mImpl->mRow[name].as<string>());
}
bool Atom::operator==(const Atom& rhs) const bool Atom::operator==(const Atom& rhs) const
{ {
return mImpl == rhs.mImpl or return mImpl == rhs.mImpl or
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment