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: writeiad
8! !INTERFACE:
9subroutine writeiad(fnum)
10! !USES:
11use modmain
12! !INPUT/OUTPUT PARAMETERS:
13!   fnum : file number for writing output (in,integer)
14! !DESCRIPTION:
15!   Outputs the interatomic distances to file.
16!
17! !REVISION HISTORY:
18!   Created May 2005 (JKD)
19!EOP
20!BOC
21implicit none
22! arguments
23integer, intent(in) :: fnum
24! local variables
25integer is,js,ia,ja
26integer i1,i2,i3
27real(8) d,dmin,v(3)
28do is=1,nspecies
29  do ia=1,natoms(is)
30    write(fnum,*)
31    write(fnum,'("Distance between is = ",I4," (",A,"), ia = ",I4," and")') &
32     is,trim(spsymb(is)),ia
33    do js=1,nspecies
34      do ja=1,natoms(js)
35        dmin=1.d8
36        do i1=-1,1
37          do i2=-1,1
38            do i3=-1,1
39              v(:)=dble(i1)*avec(:,1) &
40                  +dble(i2)*avec(:,2) &
41                  +dble(i3)*avec(:,3)+atposc(:,ja,js)
42              v(:)=v(:)-atposc(:,ia,is)
43              d=sqrt(v(1)**2+v(2)**2+v(3)**2)
44              dmin=min(d,dmin)
45            end do
46          end do
47        end do
48        write(fnum,'(" is = ",I4," (",A,"), ia = ",I4," : ",G18.10)') js, &
49         trim(spsymb(js)),ja,dmin
50      end do
51    end do
52  end do
53end do
54end subroutine
55!EOC
56
57