Debian Codegraph @

coot-utils/peak-search-from-list.cc

raw symbols SCIP
1 /* coot-utils/peak-search.cc
2 *
3 * Copyright 2009 by Kevin Keating
4 * Copyright 2009 by the University of Oxford
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or (at
9 * your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301, USA
20 */
21
22 #include "peak-search.hh"cxx . . $ `<file>/coot-utils/peak-search.hh`/
23
24 stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#>
25 cootcxx . . $ coot/::peak_searchcxx . . $ coot/peak_search#::get_peaks_from_listcxx . . $ coot/peak_search#get_peaks_from_list(1bf68d94f8f4adfe).(const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap,
26 const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &center,
27 float radius,
28 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> &peaks) {
29
30 stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> rcxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
31
32 //move the search center near the origin
33 stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> sampled_protein_coordscxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
34 sampled_protein_coords.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(center);
35 stdcxx . . $ std/::vectorcxx . . $ std/vector#<int> iprotein_trans = find_protein_to_origin_translationscxx . . $ coot/peak_search#find_protein_to_origin_translations(a22493903dcc2868).(sampled_protein_coords, xmap);
36 clippercxx . . $ clipper/::Mat33cxx . . $ clipper/Mat33#<double> m_identitycxx . . $ clipper/Mat33#Mat33(ca294aebd03ed32e).(1, 0, 0, 0, 1, 0, 0, 0, 1);
37 clippercxx . . $ clipper/::Coord_fraccxx . . $ clipper/Coord_frac# cell_shiftcxx . . $ clipper/Coord_frac#Coord_frac(3374d1a184fcc02e).(iprotein_trans[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0], iprotein_trans[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).1], iprotein_trans[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).2]);
38 clippercxx . . $ clipper/::RTop_fraccxx . . $ clipper/RTop_frac# rtfcxx . . $ clipper/RTop_frac#RTop_frac(cd0dec0763f9cd6f).(m_identity, cell_shift);
39 clippercxx . . $ clipper/::Coord_fraccxx . . $ clipper/Coord_frac# cell_shift_revcxx . . $ clipper/Coord_frac#Coord_frac(3374d1a184fcc02e).(-iprotein_trans[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0], -iprotein_trans[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).1], -iprotein_trans[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).2]);
40 clippercxx . . $ clipper/::RTop_fraccxx . . $ clipper/RTop_frac# rtf_revcxx . . $ clipper/RTop_frac#RTop_frac(cd0dec0763f9cd6f).(m_identity, cell_shift_rev);
41
42 clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth# orthop = rtf.rtop_orthcxx . . $ clipper/RTop_frac#rtop_orth(16975ddec59bbaa3).(xmap.cellcxx . . $ clipper/Xmap_base#cell(43f43fac4da8b803).());
43 clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# translated_center = center.transformcxx . . $ clipper/Coord_orth#transform(82925a12407e9823).(orthop);
44
45
46 //prepare the transformation operation to move points back to the original center location
47 clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth# orthop_rev = rtf_rev.rtop_orthcxx . . $ clipper/RTop_frac#rtop_orth(16975ddec59bbaa3).(xmap.cellcxx . . $ clipper/Xmap_base#cell(43f43fac4da8b803).());
48
49 //go through each peak and find any translations or rotations of it that are near the translated center
50 for (unsigned int i=0; i<peaks.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
51 clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# pt = peaks[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i];
52 stdcxx . . $ std/::paircxx . . $ std/pair#<bool, clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> pair = sym_shift_testcxx . . $ coot/peak_search#sym_shift_test(8fa2d7d589379df0).(pt, xmap.spacegroupcxx . . $ clipper/Xmap_base#spacegroup(f2c81a655761ef05).(), xmap.cellcxx . . $ clipper/Xmap_base#cell(43f43fac4da8b803).(),
53 center, radius, iprotein_trans,
54 translated_center, orthop_rev);
55 if (pair.firstcxx . . $ std/pair#first.)
56 r.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(pair.secondcxx . . $ std/pair#second.);
57 }
58 return rcxx . . $ std/vector#vector(6f559d22b039ccdb).;
59 }
60
61
62 stdcxx . . $ std/::paircxx . . $ std/pair#<bool, clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#>
63 cootcxx . . $ coot/::peak_searchcxx . . $ coot/peak_search#::sym_shift_testcxx . . $ coot/peak_search#sym_shift_test(8fa2d7d589379df0).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt,
64 clippercxx . . $ clipper/::Spacegroupcxx . . $ clipper/Spacegroup# spacegroup,
65 clippercxx . . $ clipper/::Cellcxx . . $ clipper/Cell# cell,
66 const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &center,
67 float radius,
68 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<int> &iprotein_trans,
69 const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &translated_center,
70 const clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth# &orthop_rev) const {
71
72 clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# rcxx . . $ clipper/Coord_orth#Coord_orth(49f6e7a06ebc5aa8).;
73 bool done = 0;
74
75 int shift_range = 2;
76 int nsyms = spacegroup.num_symopscxx . . $ clipper/Spacegroup#num_symops(ec45a031f4e09d1e).();
77
78 clippercxx . . $ clipper/::Coord_fraccxx . . $ clipper/Coord_frac# cell_shift_ptcxx . . $ clipper/Coord_frac#Coord_frac(49f6e7a06ebc5aa8).;
79 for (int isym=0; isym<nsyms; isym++) {
80 for (int x_shift = -shift_range; x_shift<=shift_range; x_shift++) {
81 for (int y_shift = -shift_range; y_shift<=shift_range; y_shift++) {
82 for (int z_shift = -shift_range; z_shift<=shift_range; z_shift++) {
83 cell_shift_pt =cxx . . $ clipper/Coord_frac#`operator=`(f924ebf5fae4bff). clippercxx . . $ clipper/Coord_frac#Coord_frac(3374d1a184fcc02e).::Coord_fraccxx . . $ clipper/Coord_frac#(x_shift, y_shift, z_shift);
84 clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth# orthop =
85 clippercxx . . $ clipper/RTop_frac#RTop_frac(cd0dec0763f9cd6f).::RTop_fraccxx . . $ clipper/RTop_frac#(spacegroup.symopcxx . . $ clipper/Spacegroup#symop(c260ee1521318708).(isym).rotcxx . . $ clipper/RTop#rot(ba7fec5062424102).(),
86 spacegroup.symopcxx . . $ clipper/Spacegroup#symop(c260ee1521318708).(isym).trncxx . . $ clipper/RTop#trn(e52ad8594b15af75).() +cxx . . $ clipper/operator+(46588243a4d00b95).
87 cell_shift_pt).rtop_orthcxx . . $ clipper/RTop_frac#rtop_orth(16975ddec59bbaa3).(cell);
88 clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# t_point = pt.transformcxx . . $ clipper/Coord_orth#transform(82925a12407e9823).(orthop);
89 double t_dist = clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#::lengthcxx . . $ clipper/Coord_orth#length(7745d27be8580732).(t_point, translated_center);
90 if (t_dist < radius) {
91 //if this translation and rotation of the point is within the radius, then add it to r
92 r =cxx . . $ clipper/Coord_orth#`operator=`(c3f604fd3327b93d). t_point.transformcxx . . $ clipper/Coord_orth#transform(82925a12407e9823).(orthop_rev);
93 done = 1;
94 }
95 }
96 }
97 }
98 }
99 return stdcxx . . $ std/pair#pair(62e1774a2dc03c82).::paircxx . . $ std/pair#<bool, clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> (done, r);
100 }
101
102
103