Commit 9ec0eae4 by maarten

backup

git-svn-id: svn+ssh://gitlab/srv/svn-repos/pdb-redo/trunk@488 a1961a4f-ab94-4bcc-80e8-33b5a54de466
parent f2449abb
......@@ -260,6 +260,15 @@ inline PointF<F> CrossProduct(const PointF<F>& a, const PointF<F>& b)
}
template<typename F>
double Angle(const PointF<F>& p1, const PointF<F>& p2, const PointF<F>& p3)
{
PointF<F> v1 = p1 - p2;
PointF<F> v2 = p3 - p2;
return std::acos(DotProduct(v1, v2) / (v1.length() * v2.length())) * 180 / kPI;
}
template<typename F>
double DihedralAngle(const PointF<F>& p1, const PointF<F>& p2, const PointF<F>& p3, const PointF<F>& p4)
{
PointF<F> v12 = p1 - p2; // vector from p2 to p1
......
......@@ -372,14 +372,14 @@ class Structure
const std::vector<Residue>& nonPolymers() const { return mNonPolymers; }
Atom getAtomById(std::string id) const;
Atom getAtomByLocation(Point pt, float maxDistance) const;
// Atom getAtomByLocation(Point pt, float maxDistance) const;
Atom getAtomForLabel(const std::string& atomId, const std::string& asymId,
Atom getAtomByLabel(const std::string& atomId, const std::string& asymId,
const std::string& compId, int seqId, const std::string& altId = "");
Atom getAtomForAuth(const std::string& atomId, const std::string& asymId,
const std::string& compId, int seqId, const std::string& altId = "",
const std::string& pdbxAuthInsCode = "");
// Atom getAtomByAuth(const std::string& atomId, const std::string& asymId,
// const std::string& compId, int seqId, const std::string& altId = "",
// const std::string& pdbxAuthInsCode = "");
// map between auth and label locations
......
......@@ -361,6 +361,11 @@ struct AtomImpl
return d;
}
void swapAtomLabels(AtomImpl& b)
{
std::swap(mAtomID, b.mAtomID);
}
const File& mFile;
string mId;
AtomType mType;
......@@ -1527,6 +1532,23 @@ Atom Structure::getAtomById(string id) const
return mAtoms[*i];
}
Atom Structure::getAtomByLabel(const string& atomId, const string& asymId, const string& compId, int seqId, const string& altId)
{
for (auto& a: mAtoms)
{
if (a.labelAtomId() == atomId and
a.labelAsymId() == asymId and
a.labelCompId() == compId and
a.labelSeqId() == seqId and
a.labelAltId() == altId)
{
return a;
}
}
throw out_of_range("Could not find atom with specified label");
}
File& Structure::getFile() const
{
return mFile;
......@@ -1835,6 +1857,8 @@ void Structure::swapAtoms(Atom& a1, Atom& a2)
auto l2 = r2.front()["label_atom_id"];
l1.swap(l2);
a1.mImpl->swapAtomLabels(*a2.mImpl);
auto l3 = r1.front()["auth_atom_id"];
auto l4 = r2.front()["auth_atom_id"];
l3.swap(l4);
......
......@@ -175,10 +175,10 @@ int32_t GetRotationalIndexNumber(int spacegroup, const clipper::RTop_frac& rt)
}
const size_t N = sizeof(kSymopNrTable) / sizeof(SymopDataBlock);
size_t L = 0, R = N - 1;
int32_t L = 0, R = static_cast<int32_t>(N - 1);
while (L <= R)
{
size_t i = (L + R) / 2;
int32_t i = (L + R) / 2;
if (kSymopNrTable[i].spacegroupNr < spacegroup)
L = i + 1;
else
......
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