File: torque.f90

package info (click to toggle)
elkcode 5.4.24-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 12,840 kB
  • sloc: f90: 48,415; fortran: 22,457; perl: 965; makefile: 384; sh: 369; python: 105; ansic: 67
file content (39 lines) | stat: -rw-r--r-- 984 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

! Copyright (C) 2017 J. K. Dewhurst, S. Sharma and E. K. U. Gross.
! This file is distributed under the terms of the GNU General Public License.
! See the file COPYING for license details.

subroutine torque
use modmain
implicit none
! local variables
integer idm
real(8) torq(3)
! allocatable arrays
real(8), allocatable :: rvfmt(:,:,:),rvfir(:,:)
! external functions
real(8) rfint
external rfint
! initialise universal variables
call init0
if (.not.ncmag) then
  torq(:)=0.d0
  goto 10
end if
! read magnetisation and exchange-correlation magnetic field from file
call readstate
! compute m(r) x B_xc(r)
allocate(rvfmt(npmtmax,natmtot,3),rvfir(ngtot,3))
call rvfcross(magmt,magir,bxcmt,bxcir,rvfmt,rvfir)
! integrate to find the total torque
do idm=1,ndmag
  torq(idm)=rfint(rvfmt(:,:,idm),rvfir(:,idm))
end do
10 continue
write(*,*)
write(*,'("Info(torque):")')
write(*,'(" Total torque exerted by B_xc on the magnetisation :")')
write(*,'(3G18.10)') torq
return
end subroutine