27INTEGER,
INTENT(IN) :: STR
28INTEGER,
DIMENSION(NA,NS),
INTENT(IN):: CONT
29INTEGER,
DIMENSION(MAXN,NA,NS),
INTENT(IN) :: VOIS
30INTEGER,
DIMENSION(NA),
INTENT(INOUT):: CPT
31INTEGER,
DIMENSION(NA,MAXN),
INTENT(INOUT) :: VPT
45 cpt(rab) = cont(rab,str)
46 do rac=1, cont(rab,str)
47 vpt(rab,rac) = vois(rac,rab,str)
75numth = omp_get_max_threads()
77if (
ns.ge.1 .and.
ns.lt.numth)
then
78 if (numth .ge. 2*(
ns-1))
then
85if (all_atoms) doatoms=.true.
88 if (
na.lt.numth) numth=
na
90 write (6, *)
"OpenMP on atoms, NUMTH= ",numth
92 call chains_search_atoms (numth)
95 write (6, *)
"OpenMP on MD steps, NUMTH= ",numth
108SUBROUTINE chains_search_atoms (NUMTH)
115INTEGER,
INTENT(IN) :: numth
116TYPE (
ring),
DIMENSION(:),
ALLOCATABLE :: the_chain
117INTEGER,
DIMENSION(:),
ALLOCATABLE :: tring, indte
118INTEGER,
DIMENSION(:,:,:),
ALLOCATABLE :: savring
119INTEGER,
DIMENSION(:,:,:),
ALLOCATABLE :: savr
120INTEGER :: lora, lorb, res, ch
123 INTEGER FUNCTION check_chain (THE_CHAIN, CHAINE, TAE, RSAVED, TRING, INDE, RESL)
125 TYPE (
ring),
DIMENSION(TAILLC),
INTENT(IN) :: the_chain
126 INTEGER,
INTENT(IN) :: chaine
127 INTEGER,
INTENT(INOUT) :: tae
128 INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: rsaved
129 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: tring
130 INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: inde
131 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: resl
133 RECURSIVE SUBROUTINE inside_chain (THE_CHAIN, CID, TAE, LRA, LRB, NRPAT, RSAVED, TRING, INDE, RESL, CPT, VPT)
135 TYPE (
ring),
DIMENSION(TAILLC),
INTENT(INOUT) :: the_chain
136 INTEGER,
INTENT(IN) :: cid, lra, lrb
137 INTEGER,
INTENT(INOUT) :: tae
138 INTEGER,
DIMENSION(NA),
INTENT(INOUT) :: nrpat
139 INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: rsaved
140 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: tring
141 INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: inde
142 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: resl
143 INTEGER,
DIMENSION(NA),
INTENT(IN):: cpt
144 INTEGER,
DIMENSION(NA,MAXN),
INTENT(IN) :: vpt
148 INTEGER,
INTENT(IN) :: step
149 INTEGER,
DIMENSION(TAILLC, NS),
INTENT(IN) :: nri
150 INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(IN) :: rsaved
154 INTEGER,
DIMENSION(TAILLC, NS),
INTENT(IN) :: nri
159if (
allocated(nring))
deallocate(nring)
160allocate(nring(taillc,ns), stat=err)
167if(
allocated(savring))
deallocate(savring)
168allocate(savring(taillc,numa,taillc), stat=err)
174if(
allocated(cpat))
deallocate(cpat)
175allocate(cpat(na), stat=err)
181 if(
allocated(vpat))
deallocate(vpat)
182allocate(vpat(na,maxn), stat=err)
201 if (
allocated(rpat))
deallocate(rpat)
202 allocate(rpat(na), stat=err)
208 if(
allocated(res_list))
deallocate(res_list)
209 allocate(res_list(taillc), stat=err)
215 if(
allocated(indte))
deallocate(indte)
216 allocate(indte(numa), stat=err)
221 if(
allocated(savr))
deallocate(savr)
222 allocate(savr(taillc,numa,taillc), stat=err)
228 if(
allocated(tring))
deallocate(tring)
229 allocate(tring(taillc), stat=err)
235 if(
allocated(the_chain))
deallocate(the_chain)
236 allocate(the_chain(taillc), stat=err)
248 if (tbr .or. alc)
goto 002
249 if (tlt .eq. nsp+1 .or. lot(j) .eq. tlt)
then
251 if ((isolated .and. cpat(j).eq.1) .or. (.not.isolated .and. (cpat(j).gt.0 .and. cpat(j).ne.2)))
then
258 if (lora .ne. lorb)
then
264 if (lora .ne. lorb)
then
269 else if (nohp .and. lora.eq.lorb)
then
283 the_chain(1)%SPEC=lora
284 the_chain(1)%NEIGHBOR=1
285 the_chain(2)%ATOM=vpat(j,l)
286 the_chain(2)%SPEC=lorb
287 the_chain(2)%NEIGHBOR=cpat(vpat(j,l))
291 res =
check_chain(the_chain, 2, taille, savr, tring, indte, res_list)
292 if (alc) alc_tab=
"CHECK_CHAIN"
293 if (tbr .or. alc)
goto 002
294 if (cpat(vpat(j,l)) .eq. 2)
then
295 call inside_chain (the_chain, 2, taille, lora, lorb, rpat, savr, tring, indte, res_list, cpat, vpat)
296 if (alc) alc_tab=
"INSIDE_CHAIN"
298 if (tbr .or. alc)
goto 002
308 if (tbr .or. alc)
goto 003
311 if (tring(k).gt.0)
then
312 if (nring(k,i).gt.0)
then
318 if (savring(k,m,n) .ne. savr(k,l,n))
then
326 if (savring(k,m,k-n+1) .ne. savr(k,l,n))
then
336 if (nring(k,i)+o .gt. numa)
then
341 savring(k,nring(k,i)+o,m) = savr(k,l,m)
345 nring(k,i)=nring(k,i)+o
349 savring(k,l,m) = savr(k,l,m)
352 nring(k,i) = tring(k)
362 if (
allocated(rpat))
deallocate (rpat)
363 if (
allocated(res_list))
deallocate (res_list)
364 if (
allocated(indte))
deallocate (indte)
365 if (
allocated(tring))
deallocate (tring)
366 if (
allocated(savr))
deallocate (savr)
367 if (
allocated(the_chain))
deallocate (the_chain)
369 if (alc .or. tbr)
goto 001
386 call show_error (
"Impossible to allocate memory"//char(0), &
387 "Subroutine: CHAINS_SEARCH_ATOMS"//char(0),
"Table: "//alc_tab(1:len_trim(alc_tab))//char(0))
390if (
allocated(cpat))
deallocate (cpat)
391if (
allocated(vpat))
deallocate (vpat)
392if (
allocated(savring))
deallocate (savring)
405INTEGER,
INTENT(IN) :: numth
412TYPE (RING),
DIMENSION(:),
ALLOCATABLE :: THE_CHAIN
413INTEGER,
DIMENSION(:),
ALLOCATABLE :: TRING, INDTE
414INTEGER,
DIMENSION(:,:,:),
ALLOCATABLE :: SAVRING
415INTEGER :: RES, LORA, LORB, ch
418 INTEGER FUNCTION check_chain (THE_CHAIN, CHAINE, TAE, RSAVED, TRING, INDE, RESL)
420 TYPE (RING),
DIMENSION(TAILLC),
INTENT(IN) :: THE_CHAIN
421 INTEGER,
INTENT(IN) :: CHAINE
422 INTEGER,
INTENT(INOUT) :: TAE
423 INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: RSAVED
424 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: TRING
425 INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: INDE
426 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: RESL
428 RECURSIVE SUBROUTINE inside_chain (THE_CHAIN, CID, TAE, LRA, LRB, NRPAT, RSAVED, TRING, INDE, RESL, CPT, VPT)
430 TYPE (RING),
DIMENSION(TAILLC),
INTENT(INOUT) :: THE_CHAIN
431 INTEGER,
INTENT(IN) :: CID, LRA, LRB
432 INTEGER,
INTENT(INOUT) :: TAE
433 INTEGER,
DIMENSION(NA),
INTENT(INOUT) :: NRPAT
434 INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: RSAVED
435 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: TRING
436 INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: INDE
437 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: RESL
438 INTEGER,
DIMENSION(NA),
INTENT(IN):: CPT
439 INTEGER,
DIMENSION(NA,MAXN),
INTENT(IN) :: VPT
443 INTEGER,
INTENT(IN) :: STEP
444 INTEGER,
DIMENSION(TAILLC, NS),
INTENT(IN) :: NRI
445 INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(IN) :: RSAVED
449 INTEGER,
DIMENSION(TAILLC, NS),
INTENT(IN) :: NRI
455if (
allocated(nring))
deallocate(nring)
456allocate(nring(taillc,ns), stat=err)
473if(
allocated(savring))
deallocate(savring)
474allocate(savring(taillc,numa,taillc), stat=err)
480if(
allocated(cpat))
deallocate(cpat)
481allocate(cpat(na), stat=err)
487 if(
allocated(vpat))
deallocate(vpat)
488allocate(vpat(na,maxn), stat=err)
494if (
allocated(rpat))
deallocate(rpat)
495allocate(rpat(na), stat=err)
501if(
allocated(res_list))
deallocate(res_list)
502allocate(res_list(taillc), stat=err)
508if(
allocated(indte))
deallocate(indte)
509allocate(indte(numa), stat=err)
514if(
allocated(tring))
deallocate(tring)
515allocate(tring(taillc), stat=err)
521if(
allocated(the_chain))
deallocate(the_chain)
522allocate(the_chain(taillc), stat=err)
534 if (tbr .or. alc)
goto 003
541 if (tlt .eq. nsp+1 .or. lot(j) .eq. tlt)
then
543 if ((isolated .and. cpat(j).eq.1) .or. (.not.isolated .and. (cpat(j).gt.0 .and. cpat(j).ne.2)))
then
550 if (lora .ne. lorb)
then
556 if (lora .ne. lorb)
then
561 else if (nohp .and. lora.eq.lorb)
then
575 the_chain(1)%SPEC=lora
576 the_chain(1)%NEIGHBOR=1
577 the_chain(2)%ATOM=vpat(j,l)
578 the_chain(2)%SPEC=lorb
579 the_chain(2)%NEIGHBOR=cpat(vpat(j,l))
583 res =
check_chain(the_chain, 2, taille, savring, tring, indte, res_list)
584 if (alc) alc_tab=
"CHECK_CHAIN"
585 if (tbr .or. alc)
goto 003
586 if (cpat(vpat(j,l)) .eq. 2)
then
587 call inside_chain (the_chain, 2, taille, lora, lorb, rpat, savring, tring, indte, res_list, cpat, vpat)
588 if (alc) alc_tab=
"INSIDE_CHAIN"
590 if (tbr .or. alc)
goto 003
600 nring(j,i) = tring(j)
628 call show_error (
"Impossible to allocate memory"//char(0), &
629 "Subroutine: CHAINS_SEARCH_STEPS"//char(0),
"Table: "//alc_tab(1:len_trim(alc_tab))//char(0))
632if (
allocated(tring))
deallocate (tring)
633if (
allocated(the_chain))
deallocate (the_chain)
634if (
allocated(savring))
deallocate (savring)
635if (
allocated(cpat))
deallocate (cpat)
636if (
allocated(vpat))
deallocate (vpat)
637if (
allocated(rpat))
deallocate (rpat)
638if (
allocated(res_list))
deallocate (res_list)
639if (
allocated(indte))
deallocate (indte)
651INTEGER FUNCTION check_chain (THE_CHAIN, CHAINE, TAE, RSAVED, TRING, INDE, RESL)
657TYPE (
ring),
DIMENSION(TAILLC),
INTENT(IN) :: the_chain
658INTEGER,
INTENT(IN) :: chaine
659INTEGER,
INTENT(INOUT) :: tae
660INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: rsaved
661INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: tring
662INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: inde
663INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: resl
665 SUBROUTINE save_this_chain (THE_CHAIN, TLES, RSAVED, TRING, INDT, RESL)
667 TYPE (
ring),
DIMENSION(TAILLC),
INTENT(IN) :: the_chain
668 INTEGER,
INTENT(IN) :: tles
669 INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: rsaved
670 INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: indt
671 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: resl, tring
675 INTEGER,
INTENT(IN) :: tled
676 INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: rsaved
677 INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: indt
678 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: resl, tring
683 if (chaine .ge. tae .and. chaine .le. taillc)
then
684 if (tae .gt. 0)
call del_this_chain (tae, rsaved, tring, resl, inde)
693 NRPAT, RSAVED, TRING, INDE, RESL, CPT, VPT)
698TYPE (
ring),
DIMENSION(TAILLC),
INTENT(INOUT) :: the_chain
699INTEGER,
INTENT(IN) :: cid, lra, lrb
700INTEGER,
INTENT(INOUT) :: tae
701INTEGER,
DIMENSION(NA),
INTENT(INOUT) :: nrpat
702INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: rsaved
703INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: tring
704INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: inde
705INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: resl
706INTEGER,
DIMENSION(NA),
INTENT(IN):: cpt
707INTEGER,
DIMENSION(NA,MAXN),
INTENT(IN) :: vpt
712 INTEGER FUNCTION check_chain (THE_CHAIN, CHAINE, TAE, RSAVED, TRING, INDE, RESL)
714 TYPE (
ring),
DIMENSION(TAILLC),
INTENT(IN) :: the_chain
715 INTEGER,
INTENT(IN) :: chaine
716 INTEGER,
INTENT(INOUT) :: tae
717 INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: rsaved
718 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: tring
719 INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: inde
720 INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: resl
724if (cid-1 .lt. taillc)
then
726 do while (the_chain(cid)%NEIGHBOR .ge. 1)
728 ind = vpt(the_chain(cid)%ATOM, the_chain(cid)%NEIGHBOR)
729 if (nrpat(ind).eq.0 .and. cpt(ind).ge.1)
then
732 if (the_chain(cid)%SPEC .eq. lot(ind))
then
738 if (mod(cid,2).ne.0 .and. lot(ind).eq.lrb)
then
740 else if (mod(cid,2).eq.0 .and. lot(ind).eq.lra)
then
745 else if (nohp .and. the_chain(cid)%SPEC.eq.lot(ind))
then
751 if (addsp .and. ((isolated .and. cpt(ind).le.2) .or. .not.isolated))
then
752 the_chain(cid+1)%ATOM = ind
753 the_chain(cid+1)%SPEC = lot(ind)
754 the_chain(cid+1)%NEIGHBOR = cpt(ind)
756 res =
check_chain(the_chain, cid+1, tae, rsaved, tring, inde, resl)
757 if (tbr .or. alc)
goto 001
758 if (res.eq.0 .and. cpt(ind).eq.2)
then
759 call inside_chain(the_chain, cid+1, tae, lra, lrb, nrpat, rsaved, tring, inde, resl, cpt, vpt)
760 if (tbr .or. alc)
goto 001
766 the_chain(cid)%NEIGHBOR = the_chain(cid)%NEIGHBOR - 1
782TYPE (RING),
DIMENSION(TAILLC),
INTENT(IN) :: THE_CHAIN
783INTEGER,
INTENT(IN) :: TLES
784INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: RSAVED
785INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: INDT
786INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: RESL, TRING
789INTEGER,
DIMENSION(TLES) :: TOSAV
797 tosav(idx)=the_chain(idx)%ATOM
801if (tring(tles) .ne. 0)
then
803 do idx=1, tring(tles)
809 if (tosav(idy) .ne. rsaved(tles,idx,idy))
then
818 if (tosav(tles-idy+1) .ne. rsaved(tles,idx,idy))
then
825 if (.not.newchain)
then
828 indt(idx)=indt(idx)+1
842 resl(tles)=resl(tles)+1
843 tring(tles)=tring(tles)+1
844 if (tring(tles) .gt.
numa)
then
848 indt(tring(tles))=indt(tring(tles))+1
850 rsaved(tles,tring(tles),idx)=tosav(idx)
864INTEGER,
INTENT(IN) :: TLED
865INTEGER,
DIMENSION(TAILLC,NUMA,TAILLC),
INTENT(INOUT) :: RSAVED
866INTEGER,
DIMENSION(NUMA),
INTENT(INOUT) :: INDT
867INTEGER,
DIMENSION(TAILLC),
INTENT(INOUT) :: RESL, TRING
872if (resl(tled) .ge. 1)
then
874 do xdel=0, resl(tled)-1
877 rsaved(tled,tring(tled)-xdel,did)=0
883 tring(tled)=tring(tled)-resl(tled)
integer function check_chain(the_chain, chaine, tae, rsaved, tring, inde, resl)
subroutine save_this_chain(the_chain, tles, rsaved, tring, indt, resl)
integer function chains()
subroutine del_this_chain(tled, rsaved, tring, resl, indt)
subroutine setup_cpat_vpat_chain(cont, vois, str, cpt, vpt)
recursive subroutine inside_chain(the_chain, cid, tae, lra, lrb, nrpat, rsaved, tring, inde, resl, cpt, vpt)
subroutine chains_search_steps()
integer function chains_to_ogl_menu(nri)
integer function chains_to_ogl(step, nri, rsaved)
integer function rechains()
void show_error(char *error, int val, GtkWidget *win)
show error message