votca 2024.1-dev
Loading...
Searching...
No Matches
ppm.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team
3 * (http://www.votca.org)
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License")
6 *
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20// Standard includes
21#include <iostream>
22
23// Local VOTCA includes
24#include "votca/xtp/ppm.h"
25
26namespace votca {
27namespace xtp {
28
30
31 // Solve Eigensystem
32 Eigen::SelfAdjointEigenSolver<Eigen::MatrixXd> es(
34 ppm_phi_ = es.eigenvectors();
35
36 // store PPM weights from eigenvalues
37 ppm_weight_ = 1 - es.eigenvalues().array().inverse();
38
39 // a) phi^t * epsilon(1) * phi e.g. transform epsilon(1) to the same space as
40 // epsilon(0)
41 Eigen::MatrixXd ortho =
43 Eigen::MatrixXd epsilon_1_inv = ortho.inverse();
44 // determine PPM frequencies
45 ppm_freq_.resize(es.eigenvalues().size());
46#pragma omp parallel for
47 for (Index i = 0; i < es.eigenvalues().size(); i++) {
48 if (ppm_weight_(i) < 1.e-5) {
49 ppm_weight_(i) = 0.0;
50 ppm_freq_(i) = 0.5; // Hartree
51 continue;
52 } else {
53 double nom = epsilon_1_inv(i, i) - 1.0;
54 double frac =
55 -1.0 * nom / (nom + ppm_weight_(i)) * screening_i * screening_i;
56 ppm_freq_(i) = std::sqrt(std::abs(frac));
57 }
58 }
59 return;
60}
61
62} // namespace xtp
63} // namespace votca
Eigen::VectorXd ppm_freq_
Definition ppm.h:53
Eigen::VectorXd ppm_weight_
Definition ppm.h:54
void PPM_construct_parameters(const RPA &rpa)
Definition ppm.cc:29
Eigen::MatrixXd ppm_phi_
Definition ppm.h:52
double screening_i
Definition ppm.h:49
double screening_r
Definition ppm.h:48
Eigen::MatrixXd calculate_epsilon_i(double frequency) const
Definition rpa.h:47
Eigen::MatrixXd calculate_epsilon_r(double frequency) const
Definition rpa.h:51
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26