atomes 1.1.16
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
rings_ogl.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
21INTEGER FUNCTION rings_to_ogl (STEP, IDSEARCH, NRI, RSAVED, OSAVED)
22
23USE parameters
24
25INTEGER, INTENT(IN) :: step, idsearch
26INTEGER, DIMENSION(TAILLR, NS), INTENT(IN) :: nri
27INTEGER, DIMENSION(TAILLR,NUMA,TAILLR), INTENT(IN) :: rsaved, osaved
28INTEGER, DIMENSION(NUMA) :: ring_list
29INTEGER, DIMENSION(:), ALLOCATABLE :: ring_id
30INTEGER :: raa, rab, rac, rad, rae
31
32rab=0
33do raa=3, taillr
34 if (nri(raa,step) > 0) then
35 rab=rab+1
36 call allocate_all_rings (idsearch, step-1, raa, nri(raa,step))
37 endif
38enddo
39
40do raa=1, na
41 do rab=3, taillr
42 rac = 0
43 do rad=1, numa
44 ring_list(rad) = 0
45 enddo
46 do rad=1, nri(rab,step)
47 do rae=1, rab
48 if (rsaved(rab,rad,rae) .eq. raa) then
49 rac=rac+1
50 ring_list(rac) = rad
51 goto 001
52 endif
53 enddo
54 001 continue
55 enddo
56 if (allocated(ring_id)) deallocate(ring_id)
57 allocate(ring_id(rac), stat=err)
58 if (err .ne. 0) then
59 call show_error ("Impossible to allocate memory"//char(0), &
60 "Function: RINGS_TO_OGL"//char(0), "Table: RING_ID (1)"//char(0))
61 rings_to_ogl = 0
62 goto 002
63 endif
64 do rad=1, rac
65 ring_id(rad) = ring_list(rad)
66 enddo
67 !write (6, '("Sending atom/rings data:: step= ",i1,", at= ",i4," ring= ",i2,", size= ",i2,", num= ",i4)') STEP-1, RAA-1, IDSEARCH, RAB, RAC
68 if (rac > 0) call send_atom_rings_id_opengl (step-1, raa-1, idsearch, rab-1, rac, ring_id)
69 enddo
70enddo
71
72do raa=3, taillr
73 if (allocated(ring_id)) deallocate(ring_id)
74 allocate(ring_id(raa), stat=err)
75 if (err .ne. 0) then
76 call show_error ("Impossible to allocate memory"//char(0), &
77 "Function: RINGS_TO_OGL"//char(0), "Table: RING_ID (2)"//char(0))
78 rings_to_ogl = 0
79 goto 002
80 endif
81 do rab=1, nri(raa,step)
82 do rac=1, raa
83 ring_id(rac) = osaved(raa,rab,rac)
84 enddo
85 call send_rings_opengl (idsearch, step-1, raa-1, rab-1, ring_id)
86 enddo
87enddo
88
90
91if (allocated(ring_id)) deallocate(ring_id)
92
93002 continue
94
95END FUNCTION
96
97INTEGER FUNCTION rings_to_ogl_bis (STEP, IDSEARCH, NRI, RSAVED, OSAVED)
98
99USE parameters
100
101INTEGER, INTENT(IN) :: step, idsearch
102INTEGER, DIMENSION(TAILLR), INTENT(IN) :: nri
103INTEGER, DIMENSION(TAILLR,NUMA,TAILLR), INTENT(IN) :: rsaved, osaved
104INTEGER, DIMENSION(NUMA) :: ring_list
105INTEGER, DIMENSION(:), ALLOCATABLE :: ring_id
106INTEGER :: raa, rab, rac, rad, rae
107
108do raa=3, taillr
109 if (nri(raa) > 0) call allocate_all_rings (idsearch, step-1, raa, nri(raa))
110enddo
111
112do raa=1, na
113 do rab=3, taillr
114 rac = 0
115 do rad=1, numa
116 ring_list(rad) = 0
117 enddo
118 do rad=1, nri(rab)
119 do rae=1, rab
120 if (rsaved(rab,rad,rae) .eq. raa) then
121 rac=rac+1
122 ring_list(rac) = rad
123 goto 001
124 endif
125 enddo
126 001 continue
127 enddo
128 if (allocated(ring_id)) deallocate(ring_id)
129 allocate(ring_id(rac), stat=err)
130 if (err .ne. 0) then
131 call show_error ("Impossible to allocate memory"//char(0), &
132 "Function: RINGS_TO_OGL_BIS"//char(0), "Table: RING_ID (1)"//char(0))
134 goto 002
135 endif
136 do rad=1, rac
137 ring_id(rad) = ring_list(rad)
138 enddo
139 !write (6, '("Sending atom/rings data:: step= ",i1,", at= ",i4," ring= ",i2,", size= ",i2,", num= ",i4)') STEP-1, RAA-1, IDSEARCH, RAB, RAC
140 if (rac > 0) call send_atom_rings_id_opengl (step-1, raa-1, idsearch, rab, rac, ring_id)
141 enddo
142enddo
143
144do raa=3, taillr
145 if (allocated(ring_id)) deallocate(ring_id)
146 allocate(ring_id(raa), stat=err)
147 if (err .ne. 0) then
148 call show_error ("Impossible to allocate memory"//char(0), &
149 "Function: RINGS_TO_OGL_BIS"//char(0), "Table: RING_ID (2)"//char(0))
151 goto 002
152 endif
153 do rab=1, nri(raa)
154 do rac=1, raa
155 ring_id(rac) = osaved(raa,rab,rac)
156 enddo
157 call send_rings_opengl (idsearch, step-1, raa, rab-1, ring_id)
158 enddo
159enddo
160
162
163if (allocated(ring_id)) deallocate(ring_id)
164
165002 continue
166
167END FUNCTION
168
169INTEGER FUNCTION rings_to_ogl_menu (IDSEARCH, NRI)
170
171USE parameters
172
173INTEGER, INTENT(IN) :: idsearch
174INTEGER, DIMENSION(TAILLR, NS), INTENT(IN) :: nri
175INTEGER, DIMENSION(:), ALLOCATABLE :: ring_id, ring_jd
176
177if (allocated(ring_id)) deallocate(ring_id)
178allocate(ring_id(taillr), stat=err)
179if (err .ne. 0) then
180 call show_error ("Impossible to allocate memory"//char(0), &
181 "Function: RINGS_TO_OGL_MENU"//char(0), "Table: RING_ID "//char(0))
183 goto 001
184endif
185
186k = 0
187do i=1, taillr
188 ring_id(i) = 0
189 do j=1, ns
190 ring_id(i) = ring_id(i) + nri(i,j)
191 enddo
192 if (ring_id(i) > 0) then
193 k = k + 1
194 endif
195enddo
196
197if (allocated(ring_jd)) deallocate(ring_jd)
198allocate(ring_jd(k), stat=err)
199if (err .ne. 0) then
200 call show_error ("Impossible to allocate memory"//char(0), &
201 "Function: RINGS_TO_OGL_MENU"//char(0), "Table: RING_JD "//char(0))
203 goto 001
204endif
205
206k = 0
207do i=1, taillr
208 if (ring_id(i) > 0) then
209 k = k + 1
210 ring_jd(k) = i
211 endif
212enddo
213
214call send_coord_opengl (4+idsearch, 1, 0, 0, k, k)
215call init_menurings (4+idsearch, idsearch, k, ring_jd, 1)
216
217if (allocated(ring_id)) deallocate(ring_id)
218if (allocated(ring_jd)) deallocate(ring_jd)
219
221
222001 continue
223
224END FUNCTION
225
226INTEGER FUNCTION rings_to_ogl_m (IDSEARCH)
227
228USE parameters
229
230INTEGER, INTENT(IN) :: idsearch
231INTEGER, DIMENSION(:), ALLOCATABLE :: ring_id, ring_jd
232
233if (allocated(ring_id)) deallocate(ring_id)
234allocate(ring_id(taillr), stat=err)
235if (err .ne. 0) then
236 call show_error ("Impossible to allocate memory"//char(0), &
237 "Function: RINGS_TO_OGL_MENU"//char(0), "Table: RING_ID "//char(0))
239 goto 001
240endif
241
242k = 0
243do i=1, taillr
244 ring_id(i) = 0
245 do j=1, ns
246 ring_id(i) = ring_id(i) + nring(i,j)
247 enddo
248 if (ring_id(i) > 0) then
249 k = k + 1
250 endif
251enddo
252
253write (6, *) "k= ",k
254
255if (allocated(ring_jd)) deallocate(ring_jd)
256allocate(ring_jd(k), stat=err)
257if (err .ne. 0) then
258 call show_error ("Impossible to allocate memory"//char(0), &
259 "Function: RINGS_TO_OGL_MENU"//char(0), "Table: RING_JD "//char(0))
261 goto 001
262endif
263
264k = 0
265do i=1, taillr
266 if (ring_id(i) > 0) then
267 k = k + 1
268 ring_jd(k) = i
269 endif
270enddo
271
272call send_coord_opengl (4+idsearch, 1, 0, 0, k, k)
273call init_menurings (4+idsearch, idsearch, k, ring_jd, 1)
274
275if (allocated(ring_id)) deallocate(ring_id)
276if (allocated(ring_jd)) deallocate(ring_jd)
277
279
280001 continue
281
282END FUNCTION
void show_error(char *error, int val, GtkWidget *win)
show error message
Definition interface.c:293
integer taillr
integer numa
integer err
integer, dimension(:,:), allocatable, target nring
integer function rings_to_ogl(step, idsearch, nri, rsaved, osaved)
Definition rings_ogl.F90:22
integer function rings_to_ogl_menu(idsearch, nri)
integer function rings_to_ogl_m(idsearch)
integer function rings_to_ogl_bis(step, idsearch, nri, rsaved, osaved)
Definition rings_ogl.F90:98