31#include "./base/base_uses.f90"
39 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'virial_methods'
61 CALL cp_subsys_get(subsys, local_particles=local_particles, atomic_kinds=atomic_kinds, &
64 CALL virial_evaluate(atomic_kinds%els, particles%els, local_particles, &
91 CHARACTER(LEN=*),
PARAMETER :: routinen =
"virial_evaluate"
93 INTEGER :: handle, i, iparticle, iparticle_kind, &
94 iparticle_local, j, nparticle_kind, &
99 IF (virial%pv_availability)
THEN
100 CALL timeset(routinen, handle)
101 NULLIFY (atomic_kind)
102 nparticle_kind =
SIZE(atomic_kind_set)
103 virial%pv_kinetic = 0.0_dp
106 DO iparticle_kind = 1, nparticle_kind
107 atomic_kind => atomic_kind_set(iparticle_kind)
109 nparticle_local = local_particles%n_el(iparticle_kind)
110 DO iparticle_local = 1, nparticle_local
111 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
112 virial%pv_kinetic(i, j) = virial%pv_kinetic(i, j) + &
113 mass*particle_set(iparticle)%v(i)*particle_set(iparticle)%v(j)
116 virial%pv_kinetic(j, i) = virial%pv_kinetic(i, j)
120 CALL igroup%sum(virial%pv_kinetic)
123 virial%pv_total = virial%pv_virial + virial%pv_kinetic + virial%pv_constraint
125 CALL timestop(handle)
142 REAL(kind=
dp),
DIMENSION(3, 3),
INTENT(INOUT) :: pv_virial
143 REAL(kind=
dp),
INTENT(IN) :: f0
144 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: force, rab
150 pv_virial(i, j) = pv_virial(i, j) + f0*force(i)*rab(j)
169 INTEGER,
INTENT(IN) :: iw
171 CHARACTER(LEN=default_string_length),
INTENT(IN) :: unit_string
173 CHARACTER(LEN=*),
PARAMETER :: fmt =
"(T2,A,T41,2(1X,ES19.11))"
175 REAL(kind=
dp) :: fconv
176 REAL(kind=
dp),
DIMENSION(3, 3) :: pv
179 cpassert(
ASSOCIATED(cell))
182 WRITE (unit=iw, fmt=
"(/,T2,A)") &
183 "STRESS| Stress tensor components (GPW/GAPW) ["//trim(adjustl(unit_string))//
"]"
184 WRITE (unit=iw, fmt=
"(T2,A,T52,A,T70,A)") &
185 "STRESS|",
"1/3 Trace",
"Determinant"
186 pv = fconv*virial%pv_overlap
187 WRITE (unit=iw, fmt=fmt) &
189 pv = fconv*virial%pv_ekinetic
190 WRITE (unit=iw, fmt=fmt) &
192 pv = fconv*virial%pv_ppl
193 WRITE (unit=iw, fmt=fmt) &
195 pv = fconv*virial%pv_ppnl
196 WRITE (unit=iw, fmt=fmt) &
198 pv = fconv*virial%pv_ecore_overlap
199 WRITE (unit=iw, fmt=fmt) &
201 pv = fconv*virial%pv_ehartree
202 WRITE (unit=iw, fmt=fmt) &
204 pv = fconv*virial%pv_exc
205 WRITE (unit=iw, fmt=fmt) &
207 pv = fconv*virial%pv_exx
208 WRITE (unit=iw, fmt=fmt) &
210 pv = fconv*virial%pv_vdw
211 WRITE (unit=iw, fmt=fmt) &
213 pv = fconv*virial%pv_mp2
214 WRITE (unit=iw, fmt=fmt) &
216 pv = fconv*virial%pv_nlcc
217 WRITE (unit=iw, fmt=fmt) &
219 pv = fconv*virial%pv_gapw
220 WRITE (unit=iw, fmt=fmt) &
222 pv = fconv*virial%pv_lrigpw
223 WRITE (unit=iw, fmt=fmt) &
225 pv = fconv*(virial%pv_overlap + virial%pv_ekinetic + virial%pv_ppl + virial%pv_ppnl + &
226 virial%pv_ecore_overlap + virial%pv_ehartree + virial%pv_exc + &
227 virial%pv_exx + virial%pv_vdw + virial%pv_mp2 + virial%pv_nlcc + &
228 virial%pv_gapw + virial%pv_lrigpw)
229 WRITE (unit=iw, fmt=fmt) &
231 pv = fconv*virial%pv_virial
232 WRITE (unit=iw, fmt=fmt) &
244 REAL(kind=
dp),
DIMENSION(3, 3),
INTENT(IN) :: a
247 p = (a(1, 1) + a(2, 2) + a(3, 3))/3.0_dp
262 REAL(kind=
dp),
DIMENSION(3, 3),
INTENT(IN) :: pv_virial
263 INTEGER,
INTENT(IN) :: iw
265 CHARACTER(LEN=default_string_length),
INTENT(IN) :: unit_string
266 LOGICAL,
INTENT(IN) :: numerical
268 REAL(kind=
dp) :: fconv
269 REAL(kind=
dp),
DIMENSION(3) :: eigval
270 REAL(kind=
dp),
DIMENSION(3, 3) :: eigvec, stress_tensor
273 cpassert(
ASSOCIATED(cell))
276 stress_tensor(:, :) = fconv*pv_virial(:, :)
278 WRITE (unit=iw, fmt=
"(/,T2,A)") &
279 "STRESS| Numerical stress tensor ["//trim(adjustl(unit_string))//
"]"
281 WRITE (unit=iw, fmt=
"(/,T2,A)") &
282 "STRESS| Analytical stress tensor ["//trim(adjustl(unit_string))//
"]"
284 WRITE (unit=iw, fmt=
"(T2,A,T14,3(19X,A1))") &
285 "STRESS|",
"x",
"y",
"z"
286 WRITE (unit=iw, fmt=
"(T2,A,T21,3(1X,ES19.11))") &
287 "STRESS| x", stress_tensor(1, 1:3)
288 WRITE (unit=iw, fmt=
"(T2,A,T21,3(1X,ES19.11))") &
289 "STRESS| y", stress_tensor(2, 1:3)
290 WRITE (unit=iw, fmt=
"(T2,A,T21,3(1X,ES19.11))") &
291 "STRESS| z", stress_tensor(3, 1:3)
292 WRITE (unit=iw, fmt=
"(T2,A,T61,ES20.11)") &
293 "STRESS| 1/3 Trace", (stress_tensor(1, 1) + &
294 stress_tensor(2, 2) + &
295 stress_tensor(3, 3))/3.0_dp
296 WRITE (unit=iw, fmt=
"(T2,A,T61,ES20.11)") &
297 "STRESS| Determinant",
det_3x3(stress_tensor(1:3, 1), &
298 stress_tensor(1:3, 2), &
299 stress_tensor(1:3, 3))
301 eigvec(:, :) = 0.0_dp
302 CALL jacobi(stress_tensor, eigval, eigvec)
304 WRITE (unit=iw, fmt=
"(/,T2,A)") &
305 "STRESS| Eigenvectors and eigenvalues of the numerical stress tensor ["// &
306 trim(adjustl(unit_string))//
"]"
308 WRITE (unit=iw, fmt=
"(/,T2,A)") &
309 "STRESS| Eigenvectors and eigenvalues of the analytical stress tensor ["// &
310 trim(adjustl(unit_string))//
"]"
312 WRITE (unit=iw, fmt=
"(T2,A,T14,3(1X,I19))") &
314 WRITE (unit=iw, fmt=
"(T2,A,T21,3(1X,ES19.11))") &
315 "STRESS| Eigenvalues", eigval(1:3)
316 WRITE (unit=iw, fmt=
"(T2,A,T21,3(1X,F19.12))") &
317 "STRESS| x", eigvec(1, 1:3)
318 WRITE (unit=iw, fmt=
"(T2,A,T21,3(1X,F19.12))") &
319 "STRESS| y", eigvec(2, 1:3)
320 WRITE (unit=iw, fmt=
"(T2,A,T21,3(1X,F19.12))") &
321 "STRESS| z", eigvec(3, 1:3)
represent a simple array based list of the given type
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell)
returns information about various attributes of the given subsys
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Collection of simple mathematical functions and subroutines.
subroutine, public jacobi(a, d, v)
Jacobi matrix diagonalization. The eigenvalues are returned in vector d and the eigenvectors are retu...
Interface to the message passing library MPI.
represent a simple array based list of the given type
Define the data structure for the particle information.
pure subroutine, public virial_pair_force(pv_virial, f0, force, rab)
Computes the contribution to the stress tensor from two-body pair-wise forces.
subroutine, public write_stress_tensor(pv_virial, iw, cell, unit_string, numerical)
Print stress tensor to output file.
subroutine, public virial_evaluate(atomic_kind_set, particle_set, local_particles, virial, igroup)
Computes the kinetic part of the pressure tensor and updates the full VIRIAL (PV)
subroutine, public write_stress_tensor_components(virial, iw, cell, unit_string)
...
pure real(kind=dp) function, public one_third_sum_diag(a)
...
subroutine, public virial_update(virial, subsys, para_env)
Updates the virial given the virial and subsys.
represent a list of objects
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
represents a system: atoms, molecules, their pos,vel,...
structure to store local (to a processor) ordered lists of integers.
stores all the informations relevant to an mpi environment
represent a list of objects