The Elk Code
moment.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2002-2005 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
5 
6 !BOP
7 ! !ROUTINE: moment
8 ! !INTERFACE:
9 subroutine moment
10 ! !USES:
11 use modmain
12 use modtest
13 ! !DESCRIPTION:
14 ! Computes the muffin-tin, interstitial and total moments by integrating the
15 ! magnetisation.
16 !
17 ! !REVISION HISTORY:
18 ! Created January 2005 (JKD)
19 !EOP
20 !BOC
21 implicit none
22 ! local variables
23 integer idm,is,ias
24 ! external functions
25 real(8), external :: rfmtint
26 ! find the muffin-tin moments
27 mommttot(:)=0.d0
28 do idm=1,ndmag
29  do ias=1,natmtot
30  is=idxis(ias)
31  mommt(idm,ias)=rfmtint(nrmt(is),nrmti(is),wr2mt(:,is),magmt(:,ias,idm))
32  mommttot(idm)=mommttot(idm)+mommt(idm,ias)
33  end do
34 end do
35 ! find the interstitial and total moments
36 do idm=1,ndmag
37  momir(idm)=(omega/ngtot)*dot_product(magir(1:ngtot,idm),cfunir(1:ngtot))
38  momtot(idm)=mommttot(idm)+momir(idm)
39 end do
40 ! total moment magnitude
41 momtotm=merge(norm2(momtot(1:3)),abs(momtot(1)),ncmag)
42 ! write total moment magnitude to test file
43 call writetest(450,'total moment magnitude',tol=1.d-3,rv=momtotm)
44 end subroutine
45 !EOC
46 
subroutine writetest(id, descr, nv, iv, iva, tol, rv, rva, zv, zva)
Definition: modtest.f90:16
real(8), dimension(:,:), allocatable mommt
Definition: modmain.f90:747
real(8), dimension(3) momtot
Definition: modmain.f90:741
integer ngtot
Definition: modmain.f90:393
integer ndmag
Definition: modmain.f90:240
real(8) momtotm
Definition: modmain.f90:743
real(8), dimension(3) mommttot
Definition: modmain.f90:749
real(8) omega
Definition: modmain.f90:20
real(8), dimension(:,:,:), pointer, contiguous magmt
Definition: modmain.f90:619
subroutine moment
Definition: moment.f90:10
real(8), dimension(:), allocatable cfunir
Definition: modmain.f90:439
real(8), dimension(3) momir
Definition: modmain.f90:745
integer, dimension(maxatoms *maxspecies) idxis
Definition: modmain.f90:44
real(8), dimension(:,:), pointer, contiguous magir
Definition: modmain.f90:619
integer natmtot
Definition: modmain.f90:40
logical ncmag
Definition: modmain.f90:242
integer, dimension(maxspecies) nrmti
Definition: modmain.f90:213
real(8), dimension(:,:), allocatable wr2mt
Definition: modmain.f90:185
integer, dimension(maxspecies) nrmt
Definition: modmain.f90:150