atomes 1.1.16
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
fzbt.F90
Go to the documentation of this file.
1! This file is part of the 'atomes' software.
2!
3! 'atomes' is free software: you can redistribute it and/or modify it under the terms
4! of the GNU Affero General Public License as published by the Free Software Foundation,
5! either version 3 of the License, or (at your option) any later version.
6!
7! 'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8! without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9! See the GNU General Public License for more details.
10!
11! You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12! If not, see <https://www.gnu.org/licenses/>
13!
14! Copyright (C) 2022-2024 by CNRS and University of Strasbourg
15!
20
21LOGICAL FUNCTION fzbt (NDQ)
22
23!
24! Compute Faber-Ziman and Bathia-Thornton S(q) from Ashcroft S(q)
25!
26
27USE parameters
28
29IMPLICIT NONE
30
31INTEGER, INTENT(IN) :: ndq
32DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: xr
33
34
35if (nsp .eq. 2) then
36 if (allocated(btij)) deallocate(btij)
37 allocate(btij(ndq,4), stat=err)
38 if (err .ne. 0) then
39 call show_error ("Impossible to allocate memory"//char(0), &
40 "Function: FZBT"//char(0), "Table: BTij"//char(0))
41 fzbt=.false.
42 goto 001
43 endif
44 btij(:,:)=0.0d0
45endif
46
47if (allocated(fzsij)) deallocate(fzsij)
48allocate(fzsij(ndq,nsp,nsp), stat=err)
49if (err .ne. 0) then
50 call show_error ("Impossible to allocate memory"//char(0), &
51 "Function: FZBT"//char(0), "Table: FZSij"//char(0))
52 fzbt=.false.
53 goto 001
54endif
55
56fzsij(:,:,:)=0.0d0
57
58if (allocated(xr)) deallocate(xr)
59allocate(xr(nsp), stat=err)
60if (err .ne. 0) then
61 call show_error ("Impossible to allocate memory"//char(0), &
62 "Function: FZBT"//char(0), "Table: Xr"//char(0))
63 fzbt=.false.
64 goto 001
65endif
66
67do o=1, nsp
68 xr(o)=xi(o)
69enddo
70
71do m=1, ndq
72 do n=1, nsp
73 do o=1, nsp
74 if (o .eq. n) then
75 fzsij(m,n,o) = 1 + (sij(m,n,o)-1)/xr(n)
76 if (nsp .eq. 2) then
77 btij(m,1) = btij(m,1) + xr(o)*xr(o)*fzsij(m,n,o)
78 btij(m,3) = btij(m,3) + fzsij(m,n,o)
79 endif
80 else
81 fzsij(m,n,o) = sij(m,n,o)/sqrt(xr(n)*xr(o)) + 1
82 if (nsp .eq. 2) then
83 btij(m,1) = btij(m,1) + xr(o)*xr(n)*fzsij(m,n,o)
84 btij(m,3) = btij(m,3) - fzsij(m,n,o)
85 endif
86 endif
87 enddo
88 enddo
89 if (nsp .eq. 2) then
90 if (nbspbs(1) .le. nbspbs(2)) then
91 o=1
92 n=2
93 else
94 o=2
95 n=1
96 endif
97 btij(m,2) = xr(o)*fzsij(m,o,o) - xr(n)*fzsij(m,n,n)
98 btij(m,2) = btij(m,2)+fzsij(m,o,n)*(xr(n)-xr(o))
99 btij(m,2) = btij(m,2)*xr(n)*xr(o)
100 btij(m,3) = (btij(m,3)*xr(1)*xr(2) +1)*xr(1)*xr(2)
101 btij(m,4) = btij(m,3)/(xr(1)*xr(2))
102 endif
103enddo
104
105if (allocated(xr)) deallocate(xr)
106
107fzbt=.true.
108
109001 continue
110
111END FUNCTION
112
113LOGICAL FUNCTION grbt(GrToBT, NDTR)
114
115!
116! Compute Bathia-Thornton g(r)
117!
118
119USE parameters
120
121INTEGER, INTENT(IN) :: ndtr
122DOUBLE PRECISION, DIMENSION(NDTR,NSP,NSP), INTENT(IN) :: grtobt
123
124if (allocated(btij)) deallocate(btij)
125allocate(btij(ndtr,3), stat=err)
126if (err .ne. 0) then
127 call show_error ("Impossible to allocate memory"//char(0), &
128 "Function: GRBT"//char(0), "Table: BTij"//char(0))
129 grbt=.false.
130 goto 001
131endif
132btij(:,:)=0.0d0
133
134do m=1, ndtr
135 do n=1, nsp
136 do o=1, nsp
137 if (o .eq. n) then
138 btij(m,1) = btij(m,1) + xi(o)*xi(o)*grtobt(m,n,o)
139 btij(m,3) = btij(m,3) + grtobt(m,n,o)
140 else
141 btij(m,1) = btij(m,1) + xi(o)*xi(n)*grtobt(m,n,o)
142 btij(m,3) = btij(m,3) - grtobt(m,n,o)
143 endif
144 enddo
145 enddo
146 if (nbspbs(1) .le. nbspbs(2)) then
147 o=1
148 n=2
149 else
150 o=2
151 n=1
152 endif
153 btij(m,2) = xi(o)*grtobt(m,o,o) - xi(n)*grtobt(m,n,n)
154 btij(m,2) = btij(m,2)+grtobt(m,o,n)*(xi(n)-xi(o))
155 btij(m,3) = btij(m,3)*xi(1)*xi(2)
156! BTij(m,4) = BTij(m,3)/(Xi(1)*Xi(2))
157! BTij(m,5) = BTij(m,2)/(Xi(n)/ )
158enddo
159
160grbt=.true.
161
162001 continue
163
164END FUNCTION
logical function grbt(grtobt, ndtr)
Definition fzbt.F90:114
logical function fzbt(ndq)
Definition fzbt.F90:22
void show_error(char *error, int val, GtkWidget *win)
show error message
Definition interface.c:293
double precision, dimension(:,:,:), allocatable fzsij
double precision, dimension(:), allocatable xi
integer, dimension(:), allocatable nbspbs
double precision, dimension(:,:), allocatable btij
integer err
integer nsp
double precision, dimension(:,:,:), allocatable sij