Develop and Download Open Source Software

Browse Subversion Repository

Contents of /Conograph/trunk/src/lattice_symmetry/gather_q_of_Ndim_lattice.hh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 33 - (show annotations) (download) (as text)
Wed Sep 7 04:38:51 2016 UTC (7 years, 6 months ago) by rtomiyasu
File MIME type: text/x-c++hdr
File size: 4033 byte(s)
The output format for base-centered monoclinic cells was corrected.
1 /*
2 * The MIT License
3
4 Conograph (powder auto-indexing program)
5
6 Copyright (c) <2012> <Ryoko Oishi-Tomiyasu, KEK>
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE.
25 *
26 */
27 #ifndef _gather_q_of_Ndim_lattice_HH_
28 #define _gather_q_of_Ndim_lattice_HH_
29 // set_additonal_Q.hh
30
31 #include "../lattice_symmetry/HKL_Q.hh"
32 #include "../utility_data_structure/SymMat.hh"
33
34 using namespace std;
35
36 void gatherQcal(const SymMat<Double>& S_super,
37 const Double& maxQ,
38 vector<HKL_Q>& hkl_q_tray
39 );
40
41 void gatherQcal(const SymMat<Double>& S_super,
42 const Double& maxQ,
43 const NRMat<Int4>& transform_hkl,
44 vector<HKL_Q>& hkl_q_tray
45 );
46
47 inline void gatherQcal(const SymMat<Double>& S_super,
48 const Double& maxQ,
49 vector<Double>& qcal_tray
50 )
51 {
52 qcal_tray.clear();
53
54 vector<HKL_Q> hkl_q_tray;
55 gatherQcal(S_super, maxQ, hkl_q_tray);
56 if( hkl_q_tray.empty() ) return;
57 qcal_tray.push_back(hkl_q_tray.begin()->Q());
58 for(vector<HKL_Q>::const_iterator it=hkl_q_tray.begin()+1; it!=hkl_q_tray.end(); it++)
59 {
60 if( *(qcal_tray.rbegin()) < it->Q() )
61 {
62 qcal_tray.push_back(it->Q());
63 }
64 }
65 }
66
67 // Assumes that the entries between it_begin and it_end are sorted.
68 inline vector<Double>::const_iterator closest_data(
69 const vector<Double>::const_iterator& it_begin,
70 const vector<Double>::const_iterator& it_end,
71 const Double& rhs)
72 {
73 const vector<Double>::const_iterator it = lower_bound( it_begin, it_end, rhs );
74 if( it == it_begin ) return it;
75 else if( it == it_end ) return it - 1;
76 else
77 {
78 const Double diff1 = rhs - *(it-1);
79 const Double diff2 = *it - rhs;
80 if( diff1 > diff2 ) return it;
81 else return it - 1;
82 }
83 }
84
85
86 inline vector<HKL_Q>::const_iterator closest_data(
87 const vector<HKL_Q>::const_iterator& it_begin,
88 const vector<HKL_Q>::const_iterator& it_end,
89 const Double& rhs)
90 {
91 const vector<HKL_Q>::const_iterator it = lower_bound( it_begin, it_end, HKL_Q(NRVec<Int4>(), rhs) );
92 if( it == it_begin ) return it;
93 else if( it == it_end ) return it - 1;
94 else
95 {
96 const Double diff1 = rhs - (it-1)->Q();
97 const Double diff2 = it->Q() - rhs;
98 if( diff1 > diff2 ) return it;
99 else return it - 1;
100 }
101 }
102
103
104 bool associateQcalWithQobs(const vector<HKL_Q>::const_iterator& it_begin,
105 const vector<HKL_Q>::const_iterator& it_end,
106 const Int4& scale_of_qcal,
107 const vector<Double>& qobs_tray,
108 const Double& resol);
109
110 void associateQobsWithQcal(const vector<Double>::const_iterator it_begin,
111 const vector<Double>::const_iterator it_end,
112 const vector<HKL_Q>& qcal_tray,
113 vector< vector<HKL_Q>::const_iterator >& closest_qcal_tray
114 );
115
116 vector<Double>::const_iterator associateQobsWithQcal(
117 const vector<Double>::const_iterator& it_begin,
118 const vector<Double>::const_iterator& it_end,
119 const vector<HKL_Q>& qcal_tray,
120 const Double& resol,
121 vector< vector<HKL_Q>::const_iterator >& closest_qcal_tray);
122
123
124 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26