atomes 1.1.16
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
initrings.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 allocrings()
22
23!
24! Memory allocation for ring statistics
25!
26
27USE parameters
28
29IMPLICIT NONE
30
31if(allocated(nring)) deallocate(nring)
32allocate(nring(taillr,ns), stat=err)
33if (err .ne. 0) then
34 call show_error ("Impossible to allocate memory"//char(0), &
35 "Function: ALLOCRINGS"//char(0), "Table: NRING"//char(0))
36 allocrings=.false.
37 goto 001
38endif
39if (allocated(pna)) deallocate(pna)
40allocate(pna(taillr,taillr,ns), stat=err)
41if (err .ne. 0) then
42 call show_error ("Impossible to allocate memory"//char(0), &
43 "Function: ALLOCRINGS"//char(0), "Table: PNA"//char(0))
44 allocrings=.false.
45 goto 001
46endif
47if (allocated(maxpna)) deallocate(maxpna)
48allocate(maxpna(taillr,ns), stat=err)
49if (err .ne. 0) then
50 call show_error ("Impossible to allocate memory"//char(0), &
51 "Function: ALLOCRINGS"//char(0), "Table: MAXPNA"//char(0))
52 allocrings=.false.
53 goto 001
54endif
55if (allocated(minpna)) deallocate(minpna)
56allocate(minpna(taillr,ns), stat=err)
57if (err .ne. 0) then
58 call show_error ("Impossible to allocate memory"//char(0), &
59 "Function: ALLOCRINGS"//char(0), "Table: MINPNA"//char(0))
60 allocrings=.false.
61 goto 001
62endif
63
64!if (FACTATRING) then
65! if (allocated(ATRING)) deallocate(ATRING)
66! allocate(ATRING(TAILLD,NTLT,NS), STAT=ERR)
67! if (ERR .ne. 0) then
68!
69! endif
70! ATRING(:,:,:)=0
71!endif
72
73if (doampat) then
74 if (allocated(ampat)) deallocate(ampat)
75 allocate(ampat(ntlt,ns), stat=err)
76 if (err .ne. 0) then
77 call show_error ("Impossible to allocate memory"//char(0), &
78 "Function: ALLOCRINGS"//char(0), "Table: AMPAT"//char(0))
79 allocrings=.false.
80 goto 001
81 endif
82 ampat(:,:)=0
83endif
84
85!if (FACTATPNA) then
86! if (allocated(ATPNA)) deallocate(ATPNA)
87! allocate(ATPNA(TAILLD,NTLT,NS), STAT=ERR)
88! if (ERR .ne. 0) then
89! call show_error ("Impossible to allocate memory"//CHAR(0), &
90! "Function: ALLOCRINGS"//CHAR(0), "Table: ATPNA"//CHAR(0))
91! ALLOCRINGS=.false.
92! goto 001
93! endif
94! ATPNA(:,:,:)=0
95!endif
96
97! End of allocation / Initialisation
98
99maxpna(:,:)=0
100minpna(:,:)=0
101pna(:,:,:)=0
102nring(:,:)=0
103
104allocrings=.true.
105
106001 continue
107
108END FUNCTION
109
110INTEGER (KIND=c_int) FUNCTION initrings (VRINGS, VTAILLD, VTLT, VNUMA, VABAB, VHOMO) bind (C,NAME='initrings_')
111
112!
113! Initialization of the ring statistics
114! The key variable is NUMA see in the following lines
115!
116
117USE parameters
118
119IMPLICIT NONE
120
121INTEGER (KIND=c_int), INTENT(IN) :: vrings, vtailld, vtlt, vnuma, vabab, vhomo
122INTERFACE
123 LOGICAL FUNCTION allocrings()
124 END FUNCTION
125 INTEGER FUNCTION king_rings()
126 END FUNCTION
127 INTEGER FUNCTION guttman_rings()
128 END FUNCTION
129 INTEGER FUNCTION primitive_rings()
130 END FUNCTION
131END INTERFACE
132
133if (vtlt .eq. 0) then
134 tlt=nsp+1
135else
136 tlt=vtlt
137endif
138numa=vnuma
140taillr=vtailld
141tailld=vtailld+1
142
143abab=.false.
144no_homo=.false.
145if (nsp .gt. 1) then
146 if (vabab .eq. 1) abab=.true.
147 if (vhomo .eq. 1) no_homo=.true.
148endif
149
150#ifdef DEBUG
151 write (6, '("RINGS:: ABAB= ",l1,", NO_HOMO= ",l1,", NUMA= ",i5,", TAILLR= ",i2)') abab, no_homo, numa, taillr
152#endif
153
154tbr=.false.
155alc=.false.
156allrings=.false.
157calc_strings=.false.
158
159! In the following lines the NUMA variable
160! gives the 'average' number of rings per size and per step
161! this variable depends on the type of rings, of the system studied as well
162! as of the search depth.
163! NUMA is used as a reference to allocate almost all tabs during rings
164! search and analysis. NUMA is a key variable - tweak with caution !
165
166if (vrings.eq.1 .or. vrings.eq.2) then
167 doampat=.true.
168else
169 doampat=.false.
170endif
171
172if (.not.allocrings()) then
173 initrings=0
174 goto 001
175endif
176
177if (vrings .eq. 0) allrings=.true.
178
179if (vrings .le. 1) then
181endif
182
183if (vrings .eq. 2) then
185endif
186
187if (vrings > 2) then
188 calc_prings=.true.
189 if (.not.pbc) then
190 nna=na
191 nnp=0
192 else
193 nnp=na*(nbx**3 - 1)/2
194 endif
195 if (vrings .eq. 4) calc_strings=.true.
197endif
198
199001 continue
200
201END FUNCTION
integer(kind=c_int) function initrings(vrings, vtailld, vtlt, vnuma, vabab, vhomo)
logical function allocrings()
Definition initrings.F90:22
void show_error(char *error, int val, GtkWidget *win)
show error message
Definition interface.c:293
logical allrings
integer ntlt
logical abab
integer tailld
logical calc_prings
integer nna
logical tbr
integer, dimension(:,:), allocatable ampat
integer nbx
integer nnp
integer, dimension(:), allocatable nbspbs
integer, dimension(:,:), allocatable maxpna
integer, dimension(:,:), allocatable minpna
integer taillr
integer numa
integer err
logical alc
integer, dimension(:,:,:), allocatable pna
logical doampat
logical calc_strings
integer tlt
logical pbc
integer, dimension(:,:), allocatable, target nring
integer nsp
logical no_homo
integer function guttman_rings()
integer function king_rings()
integer function primitive_rings()