SIRIUS 7.5.0
Electronic structure library and applications
force.hpp
Go to the documentation of this file.
1// Copyright (c) 2013-2019 Anton Kozhevnikov, Ilia Sivkov, Thomas Schulthess
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without modification, are permitted provided that
5// the following conditions are met:
6//
7// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
8// following disclaimer.
9// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
10// and the following disclaimer in the documentation and/or other materials provided with the distribution.
11//
12// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
13// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
15// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
17// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
18// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19
20/** \file force.hpp
21 *
22 * \brief Contains definition of sirius::Force class.
23 */
24
25#ifndef __FORCE_HPP__
26#define __FORCE_HPP__
27
30
31namespace sirius {
32/* forward declaration */
33class Simulation_context;
34class Density;
35class Potential;
36template <typename T>
37class K_point;
38class K_point_set;
39template <typename T>
40class Hamiltonian_k;
41
42/// Compute atomic forces.
43class Force
44{
45 private:
47
48 const Density& density_;
49
50 Potential& potential_;
51
52 K_point_set& kset_;
53
54 sddk::mdarray<double, 2> forces_vloc_;
55
56 sddk::mdarray<double, 2> forces_us_;
57
58 sddk::mdarray<double, 2> forces_nonloc_;
59
60 sddk::mdarray<double, 2> forces_usnl_;
61
62 sddk::mdarray<double, 2> forces_core_;
63
64 sddk::mdarray<double, 2> forces_ewald_;
65
66 sddk::mdarray<double, 2> forces_scf_corr_;
67
68 sddk::mdarray<double, 2> forces_hubbard_;
69
70 sddk::mdarray<double, 2> forces_hf_;
71
72 sddk::mdarray<double, 2> forces_rho_;
73
74 sddk::mdarray<double, 2> forces_ibs_;
75
76 sddk::mdarray<double, 2> forces_total_;
77
78 template <typename T, typename F>
79 void add_k_point_contribution(K_point<T>& kp__, sddk::mdarray<double, 2>& forces__) const;
80
81 /** In the second-variational approach we need to compute the following expression for the k-dependent
82 * contribution to the forces:
83 * \f[
84 * {\bf F}_{\rm IBS}^{\alpha}=\sum_{\bf k}w_{\bf k}\sum_{l\sigma}n_{l{\bf k}}
85 * \sum_{ij}c_{\sigma i}^{l{\bf k}*}c_{\sigma j}^{l{\bf k}}
86 * {\bf F}_{ij}^{\alpha{\bf k}}
87 * \f]
88 * This function sums over band and spin indices to get the "density matrix":
89 * \f[
90 * q_{ij} = \sum_{l\sigma}n_{l{\bf k}} c_{\sigma i}^{l{\bf k}*}c_{\sigma j}^{l{\bf k}}
91 * \f]
92 */
93 void compute_dmat(K_point<double>* kp__, la::dmatrix<std::complex<double>>& dm__) const;
94
95 /** Compute the forces for the simplex LDA+U method not the fully rotationally invariant one.
96 * It can not be used for LDA+U+SO either.
97 *
98 * It is based on this reference : PRB 84, 161102(R) (2011)
99 */
101
102 void add_ibs_force(K_point<double>* kp__, Hamiltonian_k<double>& Hk__, sddk::mdarray<double, 2>& ffac__, sddk::mdarray<double, 2>& forcek__) const;
103
104 public:
105 Force(Simulation_context& ctx__, Density& density__, Potential& potential__, K_point_set& kset__);
106
107 sddk::mdarray<double, 2> const& calc_forces_vloc();
108
109 inline sddk::mdarray<double, 2> const& forces_vloc() const
110 {
111 return forces_vloc_;
112 }
113
114 template <typename T>
115 void calc_forces_nonloc_aux();
116
117 sddk::mdarray<double, 2> const& calc_forces_nonloc();
118
119 inline sddk::mdarray<double, 2> const& forces_nonloc() const
120 {
121 return forces_nonloc_;
122 }
123
124 sddk::mdarray<double, 2> const& calc_forces_core();
125
126 inline sddk::mdarray<double, 2> const& forces_core() const
127 {
128 return forces_core_;
129 }
130
131 /// Calculate SCF correction to the forces.
132 /** Based on the following paper: PhysRevB.47.4771 */
134
135 inline sddk::mdarray<double, 2> const& forces_scf_corr() const
136 {
137 return forces_scf_corr_;
138 }
139
140 sddk::mdarray<double, 2> const& calc_forces_us();
141
142 inline sddk::mdarray<double, 2> const& forces_us() const
143 {
144 return forces_us_;
145 }
146
147 sddk::mdarray<double, 2> const& calc_forces_ewald();
148
149 sddk::mdarray<double, 2> const& forces_ewald() const
150 {
151 return forces_ewald_;
152 }
153
154 sddk::mdarray<double, 2> const& calc_forces_hubbard();
155
156 inline sddk::mdarray<double, 2> const& forces_hubbard() const
157 {
158 return forces_hubbard_;
159 }
160
161 sddk::mdarray<double, 2> const& calc_forces_usnl();
162
163 sddk::mdarray<double, 2> const& calc_forces_hf();
164
165 inline sddk::mdarray<double, 2> const& forces_hf() const
166 {
167 return forces_hf_;
168 }
169
170 sddk::mdarray<double, 2> const& calc_forces_rho();
171
172 inline sddk::mdarray<double, 2> const& forces_rho() const
173 {
174 return forces_rho_;
175 }
176
177 sddk::mdarray<double, 2> const& calc_forces_ibs();
178
179 inline sddk::mdarray<double, 2> const& forces_ibs() const
180 {
181 return forces_ibs_;
182 }
183
184 sddk::mdarray<double, 2> const& calc_forces_total();
185
186 inline sddk::mdarray<double, 2> const& forces_total() const
187 {
188 return forces_total_;
189 }
190
191 void print_info(std::ostream& out__, int verbosity__);
192};
193
194} // namespace sirius
195
196#endif // __FORCE_HPP__
Contains declaration and implementation of sirius::Beta_projectors_base class.
Generate charge density and magnetization from occupied spinor wave-functions.
Definition: density.hpp:214
Compute atomic forces.
Definition: force.hpp:44
void hubbard_force_add_k_contribution_collinear(K_point< double > &kp__, Q_operator< double > &q_op__, sddk::mdarray< double, 2 > &forceh_)
Definition: force.cpp:586
void compute_dmat(K_point< double > *kp__, la::dmatrix< std::complex< double > > &dm__) const
Definition: force.cpp:111
sddk::mdarray< double, 2 > const & calc_forces_scf_corr()
Calculate SCF correction to the forces.
Definition: force.cpp:470
Set of k-points.
Definition: k_point_set.hpp:41
K-point related variables and methods.
Definition: k_point.hpp:44
Generate effective potential from charge density and magnetization.
Definition: potential.hpp:46
Simulation context is a set of parameters and objects describing a single simulation.
Distributed matrix.
Definition: dmatrix.hpp:56
Contains declaration and definition of sirius::Hamiltonian class.
Namespace of the SIRIUS library.
Definition: sirius.f90:5