votca 2024.2-dev
Loading...
Searching...
No Matches
crosscorrelate.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18// Local VOTCA includes
20
21namespace votca {
22namespace tools {
23
25 Index N = data[0].size();
26 Eigen::Map<Eigen::VectorXd> input(data[0].data(), N);
27 Eigen::FFT<double> fft;
28 Eigen::VectorXcd frequency = fft.fwd(input);
29 Eigen::VectorXcd magnitude = frequency.cwiseAbs2();
30
31 corrfunc_.resize(N);
32 Eigen::Map<Eigen::VectorXd> corr_map(corrfunc_.data(), N);
33 corr_map = fft.inv(magnitude);
34 double d = corr_map(0);
35 corr_map.array() /= d;
36}
37
38} // namespace tools
39} // namespace votca
std::vector< double > corrfunc_
void AutoCorrelate(DataCollection< double >::selection &data)
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26