atomes 1.1.15
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
initchains.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 (KIND=c_int) FUNCTION initchains (VTLT, VAAA, VACA, VHOMO, V121, VTAILLC, VNUMA) bind (C,NAME='initchains_')
22
23!
24! Initialization of the chain statistics
25! The key variable is NUMA see in the following lines
26!
27
28USE parameters
29
30IMPLICIT NONE
31
32INTEGER (KIND=c_int), INTENT(IN) :: vtlt, vaaa, vaca, vhomo, v121, vtaillc, vnuma
33
34INTERFACE
35 INTEGER FUNCTION chains()
36 END FUNCTION
37END INTERFACE
38
39 if (vtlt .eq. 0) then
40 tlt=nsp+1
41 else
42 tlt=vtlt
43 endif
44 numa=vnuma
46 taillc=vtaillc
47
48 aaaa=.false.
49 acac=.false.
50 no_homo=.false.
51 if (nsp.gt. 1) then
52 if (vaaa == 1) aaaa=.true.
53 if (vaca == 1) acac=.true.
54 if (vhomo == 1) no_homo=.true.
55 endif
56 isolated=.false.
57 if (v121 == 1) isolated=.true.
58#ifdef DEBUG
59 write (6, '("CHAINS:: AAAA= ",l1,", ACAC= ",l1,", NO_HOMO= ",l1,", ISOLATED= ",l1)') aaaa, acac, no_homo, isolated
60#endif
61 tbr=.false.
62 alc=.false.
63
65
66END FUNCTION
67
68INTEGER FUNCTION rechains()
69
70USE parameters
71
72IMPLICIT NONE
73
74DOUBLE PRECISION :: tamp, etamp
75DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: ctab
76
77allocate(ctab(taillc), stat=err)
78if (err .ne. 0) then
79 call show_error ("Impossible to allocate memory"//char(0), &
80 "Function: RECHAINS"//char(0), "Table: CTAB"//char(0))
81 rechains=0
82 goto 001
83endif
84if (allocated(red)) deallocate(red)
85allocate(red(ns), stat=err)
86if (err .ne. 0) then
87 call show_error ("Impossible to allocate memory"//char(0), &
88 "Function: RECHAINS"//char(0), "Table: RED"//char(0))
89 rechains=0
90 goto 001
91endif
92if (allocated(moyred)) deallocate(moyred)
93allocate(moyred(taillc), stat=err)
94if (err .ne. 0) then
95 call show_error ("Impossible to allocate memory"//char(0), &
96 "Function: RECHAINS"//char(0), "Table: MOYRED"//char(0))
97 rechains=0
98 goto 001
99endif
100if (allocated(ectype)) deallocate(ectype)
101allocate(ectype(taillc), stat=err)
102if (err .ne. 0) then
103 call show_error ("Impossible to allocate memory"//char(0), &
104 "Function: RECHAINS"//char(0), "Table: ECTYPE"//char(0))
105 rechains=0
106 goto 001
107endif
108
109red(:)=0.0d0
110
111do l=1, taillc
112 do i=1, ns
113 red(i)=dble(nring(l,i))/ntlt
114 enddo
115 if (ns .gt. 1) then
116 moyred(l)=0.0d0
117 ectype(l)=0.0d0
118 call moyenne(red, ns, moyred(l))
119 call ect_type(moyred(l), red, ns, ectype(l))
120 else
121 moyred(l)=red(1)
122 endif
123enddo
124
125tamp=0.0
126do i=1, taillc
127 ctab(i)=moyred(i)
128 tamp = tamp + ctab(i)
129enddo
130
131if (tamp .eq. 0.0) then
132 rechains=1
133 goto 001
134endif
135
136l=0
137if (tlt .ne. nsp+1) l = l + tlt
138
139call save_curve (taillc, ctab, l, idch)
140
141if (allocated(totpstep)) deallocate(totpstep)
142allocate(totpstep(ns), stat=err)
143if (err .ne. 0) then
144 call show_error ("Impossible to allocate memory"//char(0), &
145 "Function: RECHAINS"//char(0), "Table: TOTPSTEP"//char(0))
146 rechains=0
147 goto 001
148endif
149
150do i=1, ns
151 totpstep(i)=0
152 do j=1, taillc
153 totpstep(i)=totpstep(i)+dble(nring(j,i))
154 enddo
155enddo
156
157tamp=0.0d0
158etamp=0.0d0
159call moyenne(totpstep, ns, tamp)
160call ect_type(tamp, totpstep, ns, etamp)
161call save_chains_data (taillc, ectype, tamp, etamp)
162
163rechains=1
164
165001 continue
166
167if (allocated(totpstep)) deallocate(totpstep)
168if (allocated(moyred)) deallocate(moyred)
169if (allocated(red)) deallocate(red)
170if (allocated(ctab)) deallocate(ctab)
171
172END FUNCTION
integer function chains()
Definition chains.F90:54
integer function rechains()
integer(kind=c_int) function initchains(vtlt, vaaa, vaca, vhomo, v121, vtaillc, vnuma)
void show_error(char *error, int val, GtkWidget *win)
show error message
Definition interface.c:293
integer ntlt
double precision, dimension(:), allocatable moyred
logical isolated
integer taillc
logical acac
double precision, dimension(:), allocatable totpstep
logical tbr
integer, dimension(:), allocatable nbspbs
double precision, dimension(:), allocatable red
double precision, dimension(:), allocatable ectype
integer numa
integer err
logical alc
logical aaaa
integer idch
integer tlt
integer, dimension(:,:), allocatable, target nring
integer nsp
logical no_homo
subroutine moyenne(tableau, longtm, moytab)
Definition utils.F90:526
subroutine ect_type(moyenne, tableau, longte, ec_type)
Definition utils.F90:552