File: positions.f90

package info (click to toggle)
abinit 9.10.4-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 518,712 kB
  • sloc: xml: 877,568; f90: 577,240; python: 80,760; perl: 7,019; ansic: 4,585; sh: 1,925; javascript: 601; fortran: 557; cpp: 454; objc: 323; makefile: 77; csh: 42; pascal: 31
file content (142 lines) | stat: -rw-r--r-- 3,666 bytes parent folder | download | duplicates (5)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
!---------------------------------!
!-----Atomic Position Symetry-----!
!---------------------------------!

subroutine atom_sym(nbtime,position,a,b,c,indexAtom1,Pos1,Pos2,Pos3,size1,size2,nba1)

  !input 
  integer :: size1,size2,nba1
  integer, intent(in) :: nbtime
  !f2py  optional  ,  depend(position)    ::  size1=len(position[:,1,1])
  !f2py  optional  ,  depend(position)    ::  size2=len(position[1,:,1])
  !f2py  optional  ,  depend(indexAtom1)  ::  nba1=len(indexAtom1)
  real, intent(in)  ::  position(size1,size2,3)
  integer, intent(in)  ::  indexAtom1(nba1)
  real, intent(in) :: a(size1),b(size1),c(size1)
  !output
  real(8),intent(out)  ::  Pos1(nbtime*nba1),Pos2(nbtime*nba1),Pos3(nbtime*nba1)
  !local variable
  real(8) :: x,y,z
  integer :: i,j,k

  k = 1

  do  i=1,nbtime
     do j=1,nba1
 
       x = position(i,indexAtom1(j),1)
       y = position(i,indexAtom1(j),2)
       z = position(i,indexAtom1(j),3)

       if (x >= 0) then  !replace atoms in a box [0:1]
         
         Pos1(k) = x - a(i)*int(x/a(i))
         
       else
         
         Pos1(k) = x - a(i)*int(x/a(i)-1)
         
       endif
       
       if (y >= 0) then  !replace atoms in a box [0:1]
         
         Pos2(k) = y - b(i)*int(y/b(i))
         
       else
         
         Pos2(k) = y - b(i)*int(y/b(i)-1)
         
       endif
       
       if (z >= 0) then  !replace atoms in a box [0:1]
         
         Pos3(k) = z - c(i)*int(z/c(i))
         
       else
         
         Pos3(k) = z - c(i)*int(z/c(i)-1)
         
       endif
        
        k = k+1
        
      enddo
    enddo

end subroutine atom_sym


!---------------------------------!
!-----Atomic Position Average-----!
!---------------------------------!

subroutine atom_ave(nbtime,position,indexAtom1,pos1,pos2,pos3,size1,size2,nba1)

  !input 
  integer :: size1,size2,nba1
  integer, intent(in) :: nbtime
  !f2py  optional  ,  depend(position)    ::  size1=len(position[:,1,1])
  !f2py  optional  ,  depend(position)    ::  size2=len(position[1,:,1])
  !f2py  optional  ,  depend(indexAtom1)  ::  nba1=len(indexAtom1)
  real, intent(in)  ::  position(size1,size2,3)
  integer, intent(in)  ::  indexAtom1(nba1)
  !output
  real(8),intent(out)  ::  pos1(nba1),pos2(nba1),pos3(nba1)
  !local variable
  real :: x,y,z,xred,yred,zred
  integer :: i,j

  do  i=1,nbtime
     do j=1,nba1

        x = position(i,indexAtom1(j),1)
        y = position(i,indexAtom1(j),2)
        z = position(i,indexAtom1(j),3)

        pos1(j) = pos1(j) + x/nbtime
        pos2(j) = pos2(j) + y/nbtime
        pos3(j) = pos3(j) + z/nbtime

     enddo
  enddo

end subroutine atom_ave

!---------------------------------!
!-----Atomic Position Standard----!
!---------------------------------!

subroutine atom_std(nbtime,position,indexAtom1,pos1,pos2,pos3,size1,size2,nba1)

  !input 
  integer :: size1,size2,nba1
  integer, intent(in) :: nbtime
  !f2py  optional  ,  depend(position)    ::  size1=len(position[:,1,1])
  !f2py  optional  ,  depend(position)    ::  size2=len(position[1,:,1])
  !f2py  optional  ,  depend(indexAtom1)  ::  nba1=len(indexAtom1)
  real, intent(in)  ::  position(size1,size2,3)
  integer, intent(in)  ::  indexAtom1(nba1)
  !output
  real(8),intent(out)  ::  pos1(nbtime*nba1),pos2(nbtime*nba1),pos3(nbtime*nba1)
  !local variable
  real :: x,y,z,xred,yred,zred
  integer :: i,j,k

  k = 1
  do  i=1,nbtime
     do j=1,nba1

        x = position(i,indexAtom1(j),1)
        y = position(i,indexAtom1(j),2)
        z = position(i,indexAtom1(j),3)

        pos1(k) = x
        pos2(k) = y
        pos3(k) = z

        k=k+1
     enddo
  enddo

end subroutine atom_std