37INTEGER,
INTENT(IN) :: Num
39CHARACTER (LEN=16) :: Pseudo
41CHARACTER (LEN=15),
INTENT(INOUT) :: Word
47do while (word(1:lc) .eq.
' ')
56write (word, *) pseudo(lc:len_trim(pseudo))
66TYPE (RING),
INTENT(INOUT) :: RING_INIT
67INTEGER,
INTENT(IN) :: ELEM_CR
70ring_init%ATOM = elem_cr
71nullify(ring_init%PAST)
72nullify(ring_init%NEXT)
82TYPE (RING),
POINTER,
INTENT(INOUT) :: THE_RING
84INTEGER,
INTENT(IN) :: ELEM_DO
85TYPE (RING),
POINTER :: NEW
86allocate(new, stat=
err)
88 call show_error (
"Impossible to allocate memory"//char(0), &
89 "Subroutine: DO_RING"//char(0),
"Pointer: NEW"//char(0))
98new%SPEC = the_ring%SPEC+1
114SUBROUTINE calcrij(AT1, AT2, STEP_1, STEP_2, SID)
120INTEGER,
INTENT(IN) :: AT1, AT2, STEP_1, STEP_2, SID
122DOUBLE PRECISION,
DIMENSION(3) :: COORDA, COORDB
123DOUBLE PRECISION,
DIMENSION(3) :: Aij, Bij, Nij
125if (step_1 .eq. -2)
then
128 coorda(r1) =
nfullpos(at1,r1,step_2)
129 coordb(r1) =
nfullpos(at2,r1,step_2)
132elseif (step_1 .eq. -1)
then
136 coorda(r1) =
pob(at2,r1)
137 coordb(r1) =
poa(at1,r1)
143 coorda(r1) =
fullpos(at1,r1,step_1)
144 coordb(r1) =
fullpos(at2,r1,step_2)
150 rij(r1) = coorda(r1) - coordb(r1)
153if (.not.
pbc)
goto 001
165 aij = matmul(coorda,
the_box(sid)%carttofrac)
166 bij = matmul(coordb,
the_box(sid)%carttofrac)
168 nij(r1) = aij(r1) - bij(r1)
169 nij(r1) = nij(r1) - anint(nij(r1))
184DOUBLE PRECISION FUNCTION calcdij(R12, AT1, AT2, STEP_1, STEP_2, SID)
190DOUBLE PRECISION,
DIMENSION(3),
INTENT(INOUT) :: r12
191INTEGER,
INTENT(IN) :: at1, at2, step_1, step_2, sid
193DOUBLE PRECISION,
DIMENSION(3) :: coorda, coordb
194DOUBLE PRECISION,
DIMENSION(3) :: aij, bij, nij
196if (step_1 .eq. -2)
then
199 coorda(r1) =
nfullpos(at1,r1,step_2)
200 coordb(r1) =
nfullpos(at2,r1,step_2)
203elseif (step_1 .eq. -1)
then
207 coorda(r1) =
pob(at2,r1)
208 coordb(r1) =
poa(at1,r1)
214 coorda(r1) =
fullpos(at1,r1,step_1)
215 coordb(r1) =
fullpos(at2,r1,step_2)
221 r12(r1) = coorda(r1) - coordb(r1)
224if (.not.
pbc)
goto 001
231 r12(r1)=r12(r1) - anint(r12(r1)/(
the_box(sid)%modv(r1)))*(
the_box(sid)%modv(r1))
236 aij = matmul(coorda,
the_box(sid)%carttofrac)
237 bij = matmul(coordb,
the_box(sid)%carttofrac)
239 nij(r1) = aij(r1) - bij(r1)
240 nij(r1) = nij(r1) - anint(nij(r1))
242 r12 = matmul(nij,
the_box(sid)%fractocart)
260DOUBLE PRECISION FUNCTION sacos (ANG)
264DOUBLE PRECISION,
INTENT(IN) :: ang
265DOUBLE PRECISION :: scos
267if (ang .lt. -1.0d0)
then
269else if (ang .gt. 1.0d0)
then
284DOUBLE PRECISION FUNCTION angijk(ATG1, ATG2, ATG3, ASTEP)
290INTEGER,
INTENT(IN) :: atg1, atg2, atg3, astep
292DOUBLE PRECISION :: daa, dbb, vang
293DOUBLE PRECISION,
DIMENSION(3) :: raa, rbb
296 DOUBLE PRECISION FUNCTION calcdij(R12, AT1, AT2, STEP_1, STEP_2, SID)
297 DOUBLE PRECISION,
DIMENSION(3),
INTENT(INOUT) :: r12
298 INTEGER,
INTENT(IN) :: at1, at2, step_1, step_2, sid
300 DOUBLE PRECISION FUNCTION sacos (ANG)
301 DOUBLE PRECISION,
INTENT(IN) :: ang
311daa =
calcdij(raa, atg2,atg1,astep,astep,ag2)
313dbb =
calcdij(rbb, atg2,atg3,astep,astep,ag2)
316 vang=vang+raa(ag1)*rbb(ag1)
330DOUBLE PRECISION FUNCTION diedre(DG1, DG2, DG3, DG4, DSTEP)
336INTEGER,
INTENT(IN) :: dg1, dg2, dg3, dg4, dstep
338DOUBLE PRECISION :: dh1, dh2, dh3, vdi
339DOUBLE PRECISION,
DIMENSION(3) :: d12, d23, d34
340DOUBLE PRECISION,
DIMENSION(3) :: vh1, vh2
343 DOUBLE PRECISION FUNCTION calcdij(R12, AT1, AT2, STEP_1, STEP_2, SID)
344 DOUBLE PRECISION,
DIMENSION(3),
INTENT(INOUT) :: r12
345 INTEGER,
INTENT(IN) :: at1, at2, step_1, step_2, sid
347 DOUBLE PRECISION FUNCTION sacos (ANG)
348 DOUBLE PRECISION,
INTENT(IN) :: ang
358dh1 =
calcdij(d12,dg1,dg2,dstep,dstep,ah)
359dh2 =
calcdij(d23,dg2,dg3,dstep,dstep,ah)
360dh3 =
calcdij(d34,dg3,dg4,dstep,dstep,ah)
362vh1(1) = d12(2)*d23(3) - d12(3)*d23(2)
363vh1(2) = d12(3)*d23(1) - d12(1)*d23(3)
364vh1(3) = d12(1)*d23(2) - d12(2)*d23(1)
366vh2(1) = d23(2)*d34(3) - d23(3)*d34(2)
367vh2(2) = d23(3)*d34(1) - d23(1)*d34(3)
368vh2(3) = d23(1)*d34(2) - d23(2)*d34(1)
373 dh1 = dh1 + vh1(ag)*vh1(ag)
374 dh2 = dh2 + vh2(ag)*vh2(ag)
378if (dh1.eq.0.0d0 .or. dh2.eq.0.0d0)
then
383 vdi=vdi+vh1(ag)*vh2(ag)
396INTEGER,
INTENT(IN) :: LONGTE, LREPRES
398DOUBLE PRECISION,
INTENT(IN) :: MOYENNE
399DOUBLE PRECISION,
INTENT(IN),
DIMENSION(LONGTE) :: TABLEAU
400DOUBLE PRECISION,
INTENT(INOUT) :: EC_TYPE
406 if (tableau(pose) .ne. 0.0) ec_type= ec_type + (tableau(pose) - moyenne)**2
410ec_type=sqrt(ec_type/dble(lrepres-1))
420DOUBLE PRECISION FUNCTION ran3 (idnum)
422INTEGER,
INTENT(IN) :: idnum
424INTEGER :: mbig,mseed,mz
425INTEGER :: iii,iff,ii,inext,inextp,k
426INTEGER :: mj,mk,ma(55)
428DOUBLE PRECISION :: fac
430parameter(mbig=1000000000,mseed=161803398,mz=0,fac=1./mbig)
431SAVE iff,inext,inextp,ma
435if(idum.lt.0 .or. iff.eq.0)
then
447 if(mk.lt.mz)mk=mk+mbig
456 ma(iii)=ma(iii)-ma(1+mod(iii+30,55))
457 if(ma(iii).lt.mz)ma(iii)=ma(iii)+mbig
469if(inext.eq.56)inext=1
471if(inextp.eq.56)inextp=1
472mj=ma(inext)-ma(inextp)
473if(mj.lt.mz)mj=mj+mbig
479REAL (KIND=c_double) FUNCTION random3(seed) bind (C,NAME='random3_')
481use,
INTRINSIC :: iso_c_binding
483INTEGER (KIND=c_int),
INTENT(IN) :: seed
486 DOUBLE PRECISION FUNCTION ran3 (idnum)
487 INTEGER,
INTENT(IN) :: idnum
501SUBROUTINE somme(TABS, LONGTS, SOMTAB)
504INTEGER,
INTENT(IN) :: LONGTS
506DOUBLE PRECISION,
INTENT(INOUT) :: SOMTAB
507DOUBLE PRECISION,
INTENT(IN),
DIMENSION(LONGTS) :: TABS
513somtab=somtab+tabs(posm)
528INTEGER,
INTENT(IN) :: LONGTM
530DOUBLE PRECISION,
INTENT(INOUT) :: MOYTAB
531DOUBLE PRECISION,
INTENT(IN),
DIMENSION(LONGTM) :: TABLEAU
537moytab=moytab+tableau(posm)
541moytab=moytab/dble(longtm)
551SUBROUTINE ect_type(MOYENNE, TABLEAU, LONGTE, EC_TYPE)
554INTEGER,
INTENT(IN) :: LONGTE
556DOUBLE PRECISION,
INTENT(IN) :: MOYENNE
557DOUBLE PRECISION,
INTENT(IN),
DIMENSION(LONGTE) :: TABLEAU
558DOUBLE PRECISION,
INTENT(INOUT) :: EC_TYPE
564ec_type= ec_type + (tableau(pose) - moyenne)**2
568ec_type=sqrt(ec_type/dble(longte-1))
580SUBROUTINE tri(TAB, DIMTAB)
584INTEGER,
INTENT(IN) :: DIMTAB
585INTEGER,
DIMENSION(DIMTAB),
INTENT(INOUT) :: TAB
586INTEGER :: SORTX, SORTY, VALUE
592 do sorty=sortx-1, 1, -1
594 if (tab(sorty) .le.
VALUE)
exit
596 tab(sorty+1)=tab(sorty)
611LOGICAL FUNCTION smooth (TABTOLISS, GTOLISS, DIMTOLISS, SIGMALISS)
618INTEGER,
INTENT(IN) :: dimtoliss
619DOUBLE PRECISION,
INTENT(IN) :: sigmaliss
620DOUBLE PRECISION,
INTENT(IN),
DIMENSION(DIMTOLISS) :: gtoliss
621DOUBLE PRECISION,
INTENT(INOUT),
DIMENSION(DIMTOLISS) :: tabtoliss
623INTEGER :: inda, indb, err
624DOUBLE PRECISION,
PARAMETER :: pi=acos(-1.0)
625DOUBLE PRECISION :: dq, dq2
626DOUBLE PRECISION :: factliss
628DOUBLE PRECISION,
DIMENSION(:),
ALLOCATABLE :: newtab
630allocate(newtab(dimtoliss), stat=err)
632 call show_error (
"Impossible to allocate memory"//char(0), &
633 "Function: SMOOTH"//char(0),
"Table: NEWTAB"//char(0))
642factliss=1.0d0/(sigmaliss*sqrt(2.0d0*pi))
648 dq= gtoliss(2)-gtoliss(1)
649 elseif (indb .eq. dimtoliss)
then
650 dq = gtoliss(dimtoliss)- gtoliss(dimtoliss-1)
652 dq = (gtoliss(indb+1)- gtoliss(indb-1))*0.5
655 dq2=(gtoliss(inda)-gtoliss(indb))*(gtoliss(inda)-gtoliss(indb))
656 newtab(inda) = newtab(inda) + exp(-dq2/(2.0d0*sigmaliss*sigmaliss))*tabtoliss(indb)*dq
659 newtab(inda)=factliss*newtab(inda)
663 tabtoliss(inda)=newtab(inda)
670if (
allocated(newtab))
deallocate(newtab)
682INTEGER,
INTENT(IN) :: ndum
683INTEGER,
DIMENSION(ndum) :: index
685INTEGER,
DIMENSION(ndum),
INTENT(INOUT) :: arr
696 INTEGER,
PARAMETER :: NPAR_ARTH=16,npar2_arth=8
697 INTEGER,
DIMENSION(n),
INTENT(INOUT) :: index
698 INTEGER,
PARAMETER :: NN=15, nstack=50
699 INTEGER,
INTENT(IN) :: n
700 INTEGER :: k,i,j,indext,jstack,l,r
701 INTEGER,
DIMENSION(NSTACK) :: istack
703 INTEGER,
DIMENSION(n),
INTENT(IN) :: arr
705 call arth(1,1,n,index)
715 if (arr(index(i)) <= a)
exit
720 if (jstack .eq. 0)
RETURN
726 call swap(index(k),index(l+1))
727 call icomp_xchg(index(l),index(r))
728 call icomp_xchg(index(l+1),index(r))
729 call icomp_xchg(index(l),index(l+1))
737 if (arr(index(i)) >= a)
exit
741 if (arr(index(j)) <= a)
exit
744 call swap(index(i),index(j))
749 if (jstack > nstack)
write (6, *)
'Sort3 error: indexx: NSTACK too small'
750 if (r-i+1 >= j-l)
then
763 SUBROUTINE icomp_xchg(i, j)
764 INTEGER,
INTENT(INOUT) :: i,j
766 if (arr(j) < arr(i))
then
771 END SUBROUTINE icomp_xchg
773 SUBROUTINE arth(first, increment, m, arth_i)
774 INTEGER,
INTENT(IN) :: first,increment,m
775 INTEGER,
DIMENSION(m) :: arth_i
778 if (m > 0) arth_i(1)=first
779 if (m <= npar_arth)
then
781 arth_i(k)=arth_i(k-1)+increment
785 arth_i(k)=arth_i(k-1)+increment
787 temp=increment*npar2_arth
792 arth_i(k+1:
min(k2,m))=temp+arth_i(1:
min(k,m-k))
800 INTEGER,
INTENT(INOUT) :: a,b
818INTEGER,
INTENT(IN) :: ndum
819INTEGER,
DIMENSION(ndum) :: index
821DOUBLE PRECISION,
DIMENSION(ndum),
INTENT(INOUT) :: arr
832 INTEGER,
PARAMETER :: NPAR_ARTH=16,npar2_arth=8
833 INTEGER,
DIMENSION(n),
INTENT(INOUT) :: index
834 INTEGER,
PARAMETER :: NN=15, nstack=50
835 INTEGER,
INTENT(IN) :: n
836 INTEGER :: k,i,j,indext,jstack,l,r
837 INTEGER,
DIMENSION(NSTACK) :: istack
838 DOUBLE PRECISION :: a
839 DOUBLE PRECISION,
DIMENSION(n),
INTENT(IN) :: arr
841 call arth(1,1,n,index)
851 if (arr(index(i)) <= a)
exit
856 if (jstack .eq. 0)
RETURN
862 call swap(index(k),index(l+1))
863 call icomp_xchg(index(l),index(r))
864 call icomp_xchg(index(l+1),index(r))
865 call icomp_xchg(index(l),index(l+1))
873 if (arr(index(i)) >= a)
exit
877 if (arr(index(j)) <= a)
exit
880 call swap(index(i),index(j))
885 if (jstack > nstack)
write (6, *)
'Sort3 error: indexx: NSTACK too small'
886 if (r-i+1 >= j-l)
then
899 SUBROUTINE icomp_xchg(i, j)
900 INTEGER,
INTENT(INOUT) :: i,j
902 if (arr(j) < arr(i))
then
907 END SUBROUTINE icomp_xchg
909 SUBROUTINE arth(first, increment, m, arth_i)
910 INTEGER,
INTENT(IN) :: first,increment,m
911 INTEGER,
DIMENSION(m) :: arth_i
914 if (m > 0) arth_i(1)=first
915 if (m <= npar_arth)
then
917 arth_i(k)=arth_i(k-1)+increment
921 arth_i(k)=arth_i(k-1)+increment
923 temp=increment*npar2_arth
928 arth_i(k+1:
min(k2,m))=temp+arth_i(1:
min(k,m-k))
936 INTEGER,
INTENT(INOUT) :: a,b
void show_error(char *error, int val, GtkWidget *win)
show error message
double precision, dimension(:,:,:), allocatable fullpos
double precision, dimension(:,:,:), allocatable nfullpos
double precision, dimension(:,:), allocatable pob
double precision, dimension(:,:), allocatable poa
double precision, dimension(3) rij
type(lattice), dimension(:), allocatable, target the_box
double precision, parameter pi
real(kind=c_double) function random3(seed)
subroutine moyenne(tableau, longtm, moytab)
subroutine somme(tabs, longts, somtab)
subroutine sort3(arr, ndum)
subroutine do_ring(the_ring, elem_do)
subroutine sort3_dp(arr, ndum)
double precision function sacos(ang)
logical function smooth(tabtoliss, gtoliss, dimtoliss, sigmaliss)
subroutine creat_ring(ring_init, elem_cr)
subroutine ect_type(moyenne, tableau, longte, ec_type)
subroutine ect_type_rings(moyenne, tableau, longte, lrepres, ec_type)
subroutine tri(tab, dimtab)
subroutine indexx_i(arr, index, n)
subroutine charint(word, num)
double precision function calcdij(r12, at1, at2, step_1, step_2, sid)
double precision function angijk(atg1, atg2, atg3, astep)
subroutine calcrij(at1, at2, step_1, step_2, sid)
double precision function ran3(idnum)
double precision function diedre(dg1, dg2, dg3, dg4, dstep)
subroutine indexx_dp(arr, index, n)