The Elk Code
findmtpt.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2025 J. K. Dewhurst and S. Sharma.
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 findmtpt(vrl,ias,ir,v,r)
7 use modmain
8 implicit none
9 ! arguments
10 real(8), intent(in) :: vrl(3)
11 integer, intent(out) :: ias,ir
12 real(8), intent(out) :: v(3),r
13 ! local variables
14 integer is,ia,nr,i1,i2,i3
15 real(8) rmn,rmt2,r2,t1
16 real(8) v1(3),v2(3),v3(3),v4(3)
17 v2(1:3)=vrl(1:3)
18 call r3frac(epslat,v2)
19 ! convert point to Cartesian coordinates
20 v1(1:3)=v2(1)*avec(1:3,1)+v2(2)*avec(1:3,2)+v2(3)*avec(1:3,3)
21 ! check if point is in a muffin-tin
22 do is=1,nspecies
23  nr=nrmt(is)
24  rmn=rminsp(is)
25  rmt2=rmt(is)**2
26  t1=dble(nr-1)/log(rmt(is)/rmn)
27  do ia=1,natoms(is)
28  ias=idxas(ia,is)
29  v2(1:3)=v1(1:3)-atposc(1:3,ia,is)
30  do i1=-1,1
31  v3(1:3)=v2(1:3)+dble(i1)*avec(1:3,1)
32  do i2=-1,1
33  v4(1:3)=v3(1:3)+dble(i2)*avec(1:3,2)
34  do i3=-1,1
35  v(1:3)=v4(1:3)+dble(i3)*avec(1:3,3)
36  r2=v(1)**2+v(2)**2+v(3)**2
37  if (r2 < rmt2) then
38  r=sqrt(r2)
39  if (r > rmn) then
40  ir=nint(t1*log(r/rmn))+1
41  if (ir > nr) ir=nr
42  else
43  ir=1
44  end if
45  return
46  end if
47  end do
48  end do
49  end do
50  end do
51 end do
52 ir=0
53 end subroutine
54 
subroutine findmtpt(vrl, ias, ir, v, r)
Definition: findmtpt.f90:7
integer, dimension(maxatoms, maxspecies) idxas
Definition: modmain.f90:42
real(8), dimension(3, 3) avec
Definition: modmain.f90:12
pure subroutine r3frac(eps, v)
Definition: r3frac.f90:10
real(8), dimension(maxspecies) rmt
Definition: modmain.f90:162
integer, dimension(maxspecies) natoms
Definition: modmain.f90:36
real(8) epslat
Definition: modmain.f90:24
real(8), dimension(maxspecies) rminsp
Definition: modmain.f90:103
integer nspecies
Definition: modmain.f90:34
real(8), dimension(3, maxatoms, maxspecies) atposc
Definition: modmain.f90:54
integer, dimension(maxspecies) nrmt
Definition: modmain.f90:150