Commit 64e2793c by maarten

fixed symmetry issue

git-svn-id: svn+ssh://gitlab/srv/svn-repos/pdb-redo/trunk@346 a1961a4f-ab94-4bcc-80e8-33b5a54de466
parent 51b6c7eb
...@@ -164,8 +164,11 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro ...@@ -164,8 +164,11 @@ DistanceMap::DistanceMap(const Structure& p, const clipper::Spacegroup& spacegro
clipper::Coord_orth pi = locations[i]; clipper::Coord_orth pi = locations[i];
for (size_t j = i + 1; j < locations.size(); ++j) for (size_t j = 0; j < locations.size(); ++j)
{ {
if (j == i)
continue;
// find nearest location based on spacegroup/cell // find nearest location based on spacegroup/cell
double minR2 = numeric_limits<double>::max(); double minR2 = numeric_limits<double>::max();
...@@ -325,8 +328,8 @@ float DistanceMap::operator()(const Atom& a, const Atom& b) const ...@@ -325,8 +328,8 @@ float DistanceMap::operator()(const Atom& a, const Atom& b) const
throw runtime_error("atom " + b.id() + " not found in distance map"); throw runtime_error("atom " + b.id() + " not found in distance map");
} }
if (ixb < ixa) // if (ixb < ixa)
std::swap(ixa, ixb); // std::swap(ixa, ixb);
size_t L = mIA[ixa]; size_t L = mIA[ixa];
size_t R = mIA[ixa + 1] - 1; size_t R = mIA[ixa + 1] - 1;
...@@ -359,44 +362,19 @@ vector<Atom> DistanceMap::near(const Atom& a, float maxDistance) const ...@@ -359,44 +362,19 @@ vector<Atom> DistanceMap::near(const Atom& a, float maxDistance) const
throw runtime_error("atom " + a.id() + " not found in distance map"); throw runtime_error("atom " + a.id() + " not found in distance map");
} }
set<tuple<size_t,size_t>> bix; vector<Atom> result;
for (size_t bi = mIA[ixa]; bi < mIA[ixa + 1]; ++bi) for (size_t bi = mIA[ixa]; bi < mIA[ixa + 1]; ++bi)
{ {
float d; float d;
size_t rti; size_t rti;
tie(d, rti) = mA[bi]; tie(d, rti) = mA[bi];
if (d <= maxDistance)
bix.insert(make_tuple(mJA[bi], rti));
}
for (size_t i = 0; i + 1 < dim; ++i)
{
for (size_t j = mIA[i]; j < mIA[i + 1]; ++j)
{
if (mJA[j] != ixa)
continue;
float d;
size_t rti;
tie(d, rti) = mA[j];
if (d > maxDistance) if (d > maxDistance)
continue; continue;
bix.insert(make_tuple(i, rti)); Atom a = structure.getAtomById(rIndex.at(mJA[bi]));
} result.emplace_back(a.symmetryCopy(mD, mRtOrth.at(rti)));
}
vector<Atom> result;
result.reserve(bix.size());
for (auto& i: bix)
{
size_t ix, rti;
tie(ix, rti) = i;
Atom a = structure.getAtomById(rIndex.at(ix));
result.push_back(a.symmetryCopy(mD, mRtOrth.at(rti)));
} }
return result; return result;
......
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