Commit e5bd42b4 by maarten

fix voor symmetrie

git-svn-id: svn+ssh://gitlab/srv/svn-repos/pdb-redo/trunk@348 a1961a4f-ab94-4bcc-80e8-33b5a54de466
parent 602c770a
...@@ -132,6 +132,8 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro ...@@ -132,6 +132,8 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro
mD.mY = calculateD(my, cell.b()); mD.mY = calculateD(my, cell.b());
mD.mZ = calculateD(mz, cell.c()); mD.mZ = calculateD(mz, cell.c());
clipper::Coord_orth D = mD;
if (mD.mX != 0 or mD.mY != 0 or mD.mZ != 0) if (mD.mX != 0 or mD.mY != 0 or mD.mZ != 0)
{ {
if (VERBOSE) if (VERBOSE)
...@@ -182,8 +184,6 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro ...@@ -182,8 +184,6 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro
auto d = Distance(centerI, centerJ) - radiusI - radiusJ; auto d = Distance(centerI, centerJ) - radiusI - radiusJ;
if (d < mMaxDistance) if (d < mMaxDistance)
{ {
// cout << ri.labelID() << " en " << rj.labelID() << " liggen dicht bij elkaar: " << (d - radiusI - radiusJ) << endl;
AddDistancesForAtoms(ri, rj, dist, 0); AddDistancesForAtoms(ri, rj, dist, 0);
continue; continue;
} }
...@@ -200,7 +200,7 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro ...@@ -200,7 +200,7 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro
{ {
auto& rt = mRtOrth[k]; auto& rt = mRtOrth[k];
auto pJ = cJ.transform(rt); auto pJ = (cJ + D).transform(rt) - D;
double r2 = sqrt((cI - pJ).lengthsq()) - radiusI - radiusJ; double r2 = sqrt((cI - pJ).lengthsq()) - radiusI - radiusJ;
if (minR2 > r2) if (minR2 > r2)
...@@ -483,28 +483,51 @@ vector<Atom> DistanceMap::near(const Atom& a, float maxDistance) const ...@@ -483,28 +483,51 @@ vector<Atom> DistanceMap::near(const Atom& a, float maxDistance) const
size_t ixb = mJA[i]; size_t ixb = mJA[i];
Atom b = structure.getAtomById(rIndex.at(ixb)); Atom b = structure.getAtomById(rIndex.at(ixb));
clipper::RTop_orth rt = clipper::RTop_orth::identity();
if (rti > 0) if (rti > 0)
result.emplace_back(b.symmetryCopy(mD, mRtOrth.at(rti))); {
rt = mRtOrth.at(rti);
result.emplace_back(b.symmetryCopy(mD, rt));
}
else if (rti < 0) else if (rti < 0)
result.emplace_back(b.symmetryCopy(mD, mRtOrth.at(-rti).inverse())); {
rt = mRtOrth.at(-rti).inverse();
result.emplace_back(b.symmetryCopy(mD, rt));
}
else else
result.emplace_back(b); result.emplace_back(b);
#if 0 //DEBUG #if 1 //DEBUG
if (rti != 0) // if (rti != 0)
cerr << "symmetrie contact " << a.labelID() << " en " << result.back().labelID() // cerr << "symmetrie contact " << a.labelID() << " en " << result.back().labelID()
<< " d: " << d // << " d: " << d
<< " rti: " << rti // << " rti: " << rti
<< endl; // << endl;
auto d2 = Distance(a, result.back()); auto d2 = Distance(a, result.back());
if (abs(d2 - d) > 0.01) if (abs(d2 - d) > 0.01)
{
cerr << "Voor a: " << a.location() << " en b: " << b.location() << " => " << result.back().location() << endl;
cerr << "Afstand " << a.labelID() << " en " << result.back().labelID() cerr << "Afstand " << a.labelID() << " en " << result.back().labelID()
<< " is niet gelijk aan verwachtte waarde:" << " is niet gelijk aan verwachtte waarde:"
<< "d: " << d << "d: " << d
<< " d2: " << d2 << " d2: " << d2
<< " rti: " << rti << " rti: " << rti
<< endl; << endl;
rt = rt.inverse();
result.back() = b.symmetryCopy(mD, rt);
d2 = Distance(a, result.back());
cerr << "inverse b: " << result.back().location() << endl;
if (abs(d2 - d) < 0.01)
cerr << "==> But the inverse is correct" << endl;
}
#endif #endif
} }
......
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