The Elk Code
writestress.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2013 J. K. Dewhurst, S. Sharma and E. K. U. Gross.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
5 
6 subroutine writestress
7 use modmain
8 use modmpi
9 use modtest
10 implicit none
11 ! local variables
12 integer i,j,k
13 ! initialise universal variables
14 call init0
15 ! start from the atomic densities
16 trdstate=.false.
17 ! generate the stress tensors
18 call genstress
19 ! write the stress tensors to file
20 if (mp_mpi) then
21  open(50,file='STRESS.OUT',form='FORMATTED',action='WRITE')
22  write(50,*)
23  write(50,'("Lattice vector matrix, A, changed by")')
24  write(50,*)
25  write(50,'(" A → A + eā‚– dt,")')
26  write(50,*)
27  write(50,'("where dt is an infinitesimal scalar and eā‚– is a strain tensor")')
28  write(50,*)
29  write(50,'("Stress is given by the derivative of the total energy dE/dt")')
30  do k=1,nstrain
31  write(50,*)
32  write(50,'("Strain tensor k : ",I1)') k
33  do j=1,3
34  write(50,'(3G18.10)') (strain(i,j,k),i=1,3)
35  end do
36  write(50,'("Stress : ",G18.10)') stress(k)
37  end do
38  close(50)
39  write(*,*)
40  write(*,'("Info(writestress):")')
41  write(*,'(" Stress tensor components written to STRESS.OUT")')
42 end if
43 ! write test file if required
44 call writetest(440,'Stress tensor components',nv=nstrain,tol=5.d-2,rva=stress)
45 end subroutine
46 
integer nstrain
Definition: modmain.f90:1015
subroutine writetest(id, descr, nv, iv, iva, tol, rv, rva, zv, zva)
Definition: modtest.f90:16
logical mp_mpi
Definition: modmpi.f90:17
subroutine genstress
Definition: genstress.f90:7
real(8), dimension(9) stress
Definition: modmain.f90:1024
Definition: modmpi.f90:6
logical trdstate
Definition: modmain.f90:682
subroutine init0
Definition: init0.f90:10
subroutine writestress
Definition: writestress.f90:7
real(8), dimension(3, 3, 9) strain
Definition: modmain.f90:1019