Commit 54b8cb5c by maarten

met torsions

git-svn-id: svn+ssh://gitlab/srv/svn-repos/pdb-redo/trunk@272 a1961a4f-ab94-4bcc-80e8-33b5a54de466
parent 8bf1f019
...@@ -68,6 +68,18 @@ struct CompoundAngle ...@@ -68,6 +68,18 @@ struct CompoundAngle
// struct containing information about the bond-angles // struct containing information about the bond-angles
// This information comes from the CCP4 monomer library. // This information comes from the CCP4 monomer library.
struct CompoundTorsion
{
std::string atomID[4];
float angle;
float esd;
int period;
};
// --------------------------------------------------------------------
// struct containing information about the bond-angles
// This information comes from the CCP4 monomer library.
struct CompoundPlane struct CompoundPlane
{ {
std::string id; std::string id;
...@@ -127,6 +139,7 @@ class Compound ...@@ -127,6 +139,7 @@ class Compound
std::vector<CompoundChiralCentre> chiralCentres() const std::vector<CompoundChiralCentre> chiralCentres() const
{ return mChiralCentres; } { return mChiralCentres; }
std::vector<CompoundPlane> planes() const { return mPlanes; } std::vector<CompoundPlane> planes() const { return mPlanes; }
std::vector<CompoundTorsion> torsions() const { return mTorsions; }
CompoundAtom getAtomById(const std::string& atomId) const; CompoundAtom getAtomById(const std::string& atomId) const;
...@@ -157,6 +170,7 @@ class Compound ...@@ -157,6 +170,7 @@ class Compound
std::vector<CompoundAtom> mAtoms; std::vector<CompoundAtom> mAtoms;
std::vector<CompoundBond> mBonds; std::vector<CompoundBond> mBonds;
std::vector<CompoundAngle> mAngles; std::vector<CompoundAngle> mAngles;
std::vector<CompoundTorsion>mTorsions;
std::vector<CompoundChiralCentre> std::vector<CompoundChiralCentre>
mChiralCentres; mChiralCentres;
std::vector<CompoundPlane> mPlanes; std::vector<CompoundPlane> mPlanes;
...@@ -192,6 +206,18 @@ struct LinkAngle ...@@ -192,6 +206,18 @@ struct LinkAngle
}; };
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// struct containing information about the bond-torsions
// This information comes from the CCP4 monomer library.
struct LinkTorsion
{
LinkAtom atom[4];
float angle;
float esd;
int period;
};
// --------------------------------------------------------------------
// struct containing information about the bond-angles // struct containing information about the bond-angles
// This information comes from the CCP4 monomer library. // This information comes from the CCP4 monomer library.
...@@ -233,6 +259,7 @@ class Link ...@@ -233,6 +259,7 @@ class Link
std::vector<LinkAngle> angles() const { return mAngles; } std::vector<LinkAngle> angles() const { return mAngles; }
std::vector<LinkChiralCentre> chiralCentres() const { return mChiralCentres; } std::vector<LinkChiralCentre> chiralCentres() const { return mChiralCentres; }
std::vector<LinkPlane> planes() const { return mPlanes; } std::vector<LinkPlane> planes() const { return mPlanes; }
std::vector<LinkTorsion> torsions() const { return mTorsions; }
private: private:
...@@ -241,6 +268,7 @@ class Link ...@@ -241,6 +268,7 @@ class Link
std::string mId; std::string mId;
std::vector<LinkBond> mBonds; std::vector<LinkBond> mBonds;
std::vector<LinkAngle> mAngles; std::vector<LinkAngle> mAngles;
std::vector<LinkTorsion> mTorsions;
std::vector<LinkChiralCentre> mChiralCentres; std::vector<LinkChiralCentre> mChiralCentres;
std::vector<LinkPlane> mPlanes; std::vector<LinkPlane> mPlanes;
}; };
......
...@@ -199,20 +199,6 @@ BondMap::BondMap(const Structure& p) ...@@ -199,20 +199,6 @@ BondMap::BondMap(const Structure& p)
} }
} }
//bool BondMap::operator()(const Atom& a, const Atom& b) const
//{
// size_t ixa = index.at(a.id());
// size_t ixb = index.at(b.id());
//
// if (ixb < ixa)
// swap(ixa, ixb);
//
// size_t ix = ixb + ixa * dim - ixa * (ixa + 1) / 2;
//
// assert(ix < bond.size());
// return bond[ix];
//}
bool BondMap::isBonded(size_t ixa, size_t ixb) const bool BondMap::isBonded(size_t ixa, size_t ixb) const
{ {
if (ixa == ixb) if (ixa == ixb)
......
...@@ -356,9 +356,7 @@ Compound::Compound(const fs::path& file, const std::string& id, ...@@ -356,9 +356,7 @@ Compound::Compound(const fs::path& file, const std::string& id,
} }
sort(mBonds.begin(), mBonds.end(), CompoundBondLess()); sort(mBonds.begin(), mBonds.end(), CompoundBondLess());
auto& compAngles = db["chem_comp_angle"]; for (auto row: db["chem_comp_angle"])
for (auto row: compAngles)
{ {
CompoundAngle a; CompoundAngle a;
...@@ -368,9 +366,17 @@ Compound::Compound(const fs::path& file, const std::string& id, ...@@ -368,9 +366,17 @@ Compound::Compound(const fs::path& file, const std::string& id,
mAngles.push_back(a); mAngles.push_back(a);
} }
auto& compChir = db["chem_comp_chir"]; for (auto row: db["chem_comp_tor"])
{
for (auto row: compChir) CompoundTorsion a;
cif::tie(a.atomID[0], a.atomID[1], a.atomID[2], a.atomID[3], a.angle, a.esd, a.period) =
row.get("atom_id_1", "atom_id_2", "atom_id_3", "atom_id_4", "value_angle", "value_angle_esd", "period");
mTorsions.push_back(a);
}
for (auto row: db["chem_comp_chir"])
{ {
CompoundChiralCentre cc; CompoundChiralCentre cc;
string volumeSign; string volumeSign;
...@@ -839,6 +845,20 @@ Link::Link(cif::Datablock& db) ...@@ -839,6 +845,20 @@ Link::Link(cif::Datablock& db)
mAngles.push_back(a); mAngles.push_back(a);
} }
for (auto row: db["chem_link_tor"])
{
LinkTorsion a;
cif::tie(a.atom[0].compID, a.atom[0].atomID, a.atom[1].compID, a.atom[1].atomID,
a.atom[2].compID, a.atom[2].atomID, a.atom[3].compID, a.atom[3].atomID,
a.angle, a.esd, a.period) =
row.get("atom_1_comp_id", "atom_id_1", "atom_2_comp_id", "atom_id_2",
"atom_3_comp_id", "atom_id_3", "atom_4_comp_id", "atom_id_4",
"value_angle", "value_angle_esd", "period");
mTorsions.push_back(a);
}
auto& linkChir = db["chem_link_chir"]; auto& linkChir = db["chem_link_chir"];
for (auto row: linkChir) for (auto row: linkChir)
{ {
......
...@@ -51,6 +51,17 @@ vector<clipper::RTop_orth> AlternativeSites(const clipper::Spacegroup& spacegrou ...@@ -51,6 +51,17 @@ vector<clipper::RTop_orth> AlternativeSites(const clipper::Spacegroup& spacegrou
// -------------------------------------------------------------------- // --------------------------------------------------------------------
inline clipper::Coord_orth toCell(clipper::Coord_orth p, const clipper::Cell& cell)
{
while (p[0] < 0) p[0] += cell.a();
while (p[0] > cell.a()) p[0] -= cell.a();
while (p[1] < 0) p[1] += cell.b();
while (p[1] > cell.a()) p[1] -= cell.b();
while (p[2] < 0) p[2] += cell.c();
while (p[2] > cell.a()) p[2] -= cell.c();
return p;
}
DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegroup, const clipper::Cell& cell) DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegroup, const clipper::Cell& cell)
: dim(0) : dim(0)
{ {
...@@ -114,10 +125,7 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro ...@@ -114,10 +125,7 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro
if (i >= locations.size()) if (i >= locations.size())
break; break;
clipper::Coord_orth pi = locations[i]; clipper::Coord_orth pi = toCell(locations[i], cell);
pi[0] = fmod(pi[0], cell.a());
pi[1] = fmod(pi[1], cell.b());
pi[2] = fmod(pi[2], cell.c());
for (size_t j = i + 1; j < locations.size(); ++j) for (size_t j = i + 1; j < locations.size(); ++j)
{ {
...@@ -129,11 +137,7 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro ...@@ -129,11 +137,7 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro
for (auto rt: rtOrth) for (auto rt: rtOrth)
{ {
auto pj = locations[j]; auto pj = toCell(locations[j], cell);
pj[0] = fmod(pj[0], cell.a());
pj[1] = fmod(pj[1], cell.b());
pj[2] = fmod(pj[2], cell.c());
pj = pj.transform(rt); pj = pj.transform(rt);
double r2 = (pi - pj).lengthsq(); double r2 = (pi - pj).lengthsq();
......
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