30 #include "./base/base_uses.f90"
38 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'virial_methods'
51 TYPE(virial_type),
INTENT(INOUT) :: virial
52 TYPE(cp_subsys_type),
POINTER :: subsys
53 TYPE(mp_para_env_type),
POINTER :: para_env
55 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
56 TYPE(distribution_1d_type),
POINTER :: local_particles
57 TYPE(particle_list_type),
POINTER :: particles
59 CALL cp_subsys_get(subsys, local_particles=local_particles, atomic_kinds=atomic_kinds, &
62 CALL virial_evaluate(atomic_kinds%els, particles%els, local_particles, &
81 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
82 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
83 TYPE(distribution_1d_type),
POINTER :: local_particles
84 TYPE(virial_type),
INTENT(INOUT) :: virial
86 CLASS(mp_comm_type),
INTENT(IN) :: igroup
88 CHARACTER(LEN=*),
PARAMETER :: routinen =
'virial_evaluate'
90 INTEGER :: handle, i, iparticle, iparticle_kind, &
91 iparticle_local, j, nparticle_kind, &
94 TYPE(atomic_kind_type),
POINTER :: atomic_kind
96 IF (virial%pv_availability)
THEN
97 CALL timeset(routinen, handle)
99 nparticle_kind =
SIZE(atomic_kind_set)
100 virial%pv_kinetic = 0.0_dp
103 DO iparticle_kind = 1, nparticle_kind
104 atomic_kind => atomic_kind_set(iparticle_kind)
106 nparticle_local = local_particles%n_el(iparticle_kind)
107 DO iparticle_local = 1, nparticle_local
108 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
109 virial%pv_kinetic(i, j) = virial%pv_kinetic(i, j) + &
110 mass*particle_set(iparticle)%v(i)*particle_set(iparticle)%v(j)
113 virial%pv_kinetic(j, i) = virial%pv_kinetic(i, j)
117 CALL igroup%sum(virial%pv_kinetic)
120 virial%pv_total = virial%pv_virial + virial%pv_kinetic + virial%pv_constraint
122 CALL timestop(handle)
139 REAL(kind=
dp),
DIMENSION(3, 3),
INTENT(INOUT) :: pv_virial
140 REAL(kind=
dp),
INTENT(IN) :: f0
141 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: force, rab
147 pv_virial(i, j) = pv_virial(i, j) + f0*force(i)*rab(j)
163 TYPE(virial_type),
INTENT(IN) :: virial
164 INTEGER,
INTENT(IN) :: iw
165 TYPE(cell_type),
POINTER :: cell
167 CHARACTER(LEN=*),
PARAMETER :: fmt =
'(T2,A,T41,2(1X,ES19.11))'
169 REAL(kind=
dp) :: fconv
170 REAL(kind=
dp),
DIMENSION(3, 3) :: pv
173 cpassert(
ASSOCIATED(cell))
175 fconv = 1.0e-9_dp*
pascal/cell%deth
176 WRITE (unit=iw, fmt=
'(/,T2,A)') &
177 'STRESS| Stress tensor components (GPW/GAPW) [GPa]'
178 WRITE (unit=iw, fmt=
'(T2,A,T52,A,T70,A)') &
179 'STRESS|',
'1/3 Trace',
'Determinant'
180 pv = fconv*virial%pv_overlap
181 WRITE (unit=iw, fmt=fmt) &
183 pv = fconv*virial%pv_ekinetic
184 WRITE (unit=iw, fmt=fmt) &
186 pv = fconv*virial%pv_ppl
187 WRITE (unit=iw, fmt=fmt) &
189 pv = fconv*virial%pv_ppnl
190 WRITE (unit=iw, fmt=fmt) &
192 pv = fconv*virial%pv_ecore_overlap
193 WRITE (unit=iw, fmt=fmt) &
195 pv = fconv*virial%pv_ehartree
196 WRITE (unit=iw, fmt=fmt) &
198 pv = fconv*virial%pv_exc
199 WRITE (unit=iw, fmt=fmt) &
201 pv = fconv*virial%pv_exx
202 WRITE (unit=iw, fmt=fmt) &
204 pv = fconv*virial%pv_vdw
205 WRITE (unit=iw, fmt=fmt) &
207 pv = fconv*virial%pv_mp2
208 WRITE (unit=iw, fmt=fmt) &
210 pv = fconv*virial%pv_nlcc
211 WRITE (unit=iw, fmt=fmt) &
213 pv = fconv*virial%pv_gapw
214 WRITE (unit=iw, fmt=fmt) &
216 pv = fconv*virial%pv_lrigpw
217 WRITE (unit=iw, fmt=fmt) &
219 pv = fconv*(virial%pv_overlap + virial%pv_ekinetic + virial%pv_ppl + virial%pv_ppnl + &
220 virial%pv_ecore_overlap + virial%pv_ehartree + virial%pv_exc + &
221 virial%pv_exx + virial%pv_vdw + virial%pv_mp2 + virial%pv_nlcc + &
222 virial%pv_gapw + virial%pv_lrigpw)
223 WRITE (unit=iw, fmt=fmt) &
225 pv = fconv*virial%pv_virial
226 WRITE (unit=iw, fmt=fmt) &
238 REAL(kind=
dp),
DIMENSION(3, 3),
INTENT(IN) :: a
241 p = (a(1, 1) + a(2, 2) + a(3, 3))/3.0_dp
255 REAL(kind=
dp),
DIMENSION(3, 3),
INTENT(IN) :: pv_virial
256 INTEGER,
INTENT(IN) :: iw
257 TYPE(cell_type),
POINTER :: cell
258 LOGICAL,
INTENT(IN) :: numerical
260 REAL(kind=
dp),
DIMENSION(3) :: eigval
261 REAL(kind=
dp),
DIMENSION(3, 3) :: eigvec, stress_tensor
264 cpassert(
ASSOCIATED(cell))
265 stress_tensor(:, :) = pv_virial(:, :)/cell%deth*
pascal*1.0e-9_dp
267 WRITE (unit=iw, fmt=
'(/,T2,A)') &
268 'STRESS| Numerical stress tensor [GPa]'
270 WRITE (unit=iw, fmt=
'(/,T2,A)') &
271 'STRESS| Analytical stress tensor [GPa]'
273 WRITE (unit=iw, fmt=
'(T2,A,T14,3(19X,A1))') &
274 'STRESS|',
'x',
'y',
'z'
275 WRITE (unit=iw, fmt=
'(T2,A,T21,3(1X,ES19.11))') &
276 'STRESS| x', stress_tensor(1, 1:3)
277 WRITE (unit=iw, fmt=
'(T2,A,T21,3(1X,ES19.11))') &
278 'STRESS| y', stress_tensor(2, 1:3)
279 WRITE (unit=iw, fmt=
'(T2,A,T21,3(1X,ES19.11))') &
280 'STRESS| z', stress_tensor(3, 1:3)
281 WRITE (unit=iw, fmt=
'(T2,A,T61,ES20.11)') &
282 'STRESS| 1/3 Trace', (stress_tensor(1, 1) + &
283 stress_tensor(2, 2) + &
284 stress_tensor(3, 3))/3.0_dp
285 WRITE (unit=iw, fmt=
'(T2,A,T61,ES20.11)') &
286 'STRESS| Determinant',
det_3x3(stress_tensor(1:3, 1), &
287 stress_tensor(1:3, 2), &
288 stress_tensor(1:3, 3))
290 eigvec(:, :) = 0.0_dp
291 CALL jacobi(stress_tensor, eigval, eigvec)
293 WRITE (unit=iw, fmt=
'(/,T2,A)') &
294 'STRESS| Eigenvectors and eigenvalues of the numerical stress tensor [GPa]'
296 WRITE (unit=iw, fmt=
'(/,T2,A)') &
297 'STRESS| Eigenvectors and eigenvalues of the analytical stress tensor [GPa]'
299 WRITE (unit=iw, fmt=
'(T2,A,T14,3(1X,I19))') &
301 WRITE (unit=iw, fmt=
'(T2,A,T21,3(1X,ES19.11))') &
302 'STRESS| Eigenvalues', eigval(1:3)
303 WRITE (unit=iw, fmt=
'(T2,A,T21,3(1X,F19.12))') &
304 'STRESS| x', eigvec(1, 1:3)
305 WRITE (unit=iw, fmt=
'(T2,A,T21,3(1X,F19.12))') &
306 'STRESS| y', eigvec(2, 1:3)
307 WRITE (unit=iw, fmt=
'(T2,A,T21,3(1X,F19.12))') &
308 'STRESS| z', eigvec(3, 1:3)
real(kind=dp) function det_3x3(a)
...
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
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
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.
Definition of physical constants:
real(kind=dp), parameter, public pascal
subroutine, public write_stress_tensor_components(virial, iw, cell)
...
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, 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)
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.