Ticket #84: CHEN.FOR

File CHEN.FOR, 3.1 KB (added by jhjcho, 12 years ago)
Line 
1        subroutine chen
2
3*       See Chen, Rouch & Tartaglia, Croat. Chem. Acta, 65(2), (1992), 353-366
4
5        include 'frills_sources:function.inc'
6
7        integer*4       lolim
8        real*8          scale,r0,s,tau,df,bkgd
9        real*8          pi
10        real*8          rg,h,eta,twominustau,threeminustau,gamma2mt,gamma3mt
11        real*8          i0,q,qeta,u,incogau,f1,f2,g1,g2,incogaxh,vol
12
13        external incog,gammafunc
14
15        scale=p(1)
16        r0=p(2)
17        s=p(3)
18        tau=p(4)
19        df=p(5)
20        bkgd=p(6)
21
22        pi=3.141592654
23
24        lolim=1
25
26*       For some reason the P O F or P O C extrapolation is introducing
27*       some negative x-values at the start of the extrapolated data.  These
28*       cause a %MTH-F-UNDEXP, undefined exponentiation error in the
29*       calculation of u1.
30        do j=1,nv
31           if (x(j).lt.0.) then
32              lolim=j
33           end if
34        end do
35
3610      format(' Low Q points being ignored : ',i3)
37        write(6,10)lolim
38
39        if (df.le.0.) then
40           write(6,*)' '
41           write(6,*)'The fractal dimension must be >0!'
42           write(6,*)'Will set to 0.1'
43           df=0.1
44        end if
45
46        if (df.gt.6.) then
47           write(6,*)' '
48           write(6,*)'The fractal dimension must be <=6!'
49           write(6,*)'Will set to 6.'
50           df=6.0
51        end if
52
53        if (s.lt.1.) then
54           write(6,*)' '
55           write(6,*)'The aggregation number must be >=1!'
56           write(6,*)'Will set to 1.'
57           s=1.0
58        end if
59
60        if (tau.lt.1.) then
61           write(6,*)' '
62           write(6,*)'The polydispersity of the cluster must be >=1!'
63           write(6,*)'A smaller number means GREATER polydispersity.'
64           write(6,*)'Will set to 1.'
65           tau=1.0
66        end if
67
68        if (tau.eq.2.) then
69           write(6,*)'Adjusting polydispersity of the cluster to'
70           write(6,*)'avoid a high performance arithmetic trap in the'
71           write(6,*)'calculation of the incomplete Gamma function.'
72           write(6,*)'Was 2.00, will set to 2.01'
73           tau=2.01
74        end if
75
76        if (tau.eq.3.) then
77           write(6,*)'Adjusting polydispersity of the cluster to'
78           write(6,*)'avoid a high performance arithmetic trap in the'
79           write(6,*)'calculation of the incomplete Gamma function.'
80           write(6,*)'Was 3.00, will set to 3.01'
81           tau=3.01
82        end if
83
84        if (r0.le.0.) then
85           write(6,*)'The primary particle radius must be >=0!'
86           write(6,*)'Will set to 5.00'
87           r0=5.
88        end if
89
90*       Convert primary particle radius to equivalent Rg [Ang]
91        rg=sqrt((3./5.)*r0*r0)
92
93*       Volume of primary particle (in cm^3 !!!)
94        vol=(4./3.)*pi*(r0*r0*r0)*1.e-24
95
96        h=sqrt((df*(df+1.))/6.)
97
98*       Cluster correlation length
99        eta=h*rg*(s**(1./df))
100
10120      format(' Equivalent Cluster Rg [Ang]: ',e12.5)
102        write(6,20)rg
10330      format(' Cluster corr. length [Ang] : ',e12.5)
104        write(6,30)eta
105
106        twominustau=2.-tau
107        call gammafunc(twominustau,gamma2mt)
108
109        threeminustau=3.-tau
110        call gammafunc(threeminustau,gamma3mt)
111
112        i0=s*gamma3mt/gamma2mt
113
11440      format(' s * Gam(3-tau)/Gam(2-tau)  : ',e12.5)
115        write(6,40)i0
116
117*       do j=1,nv
118        do j=lolim+1,nv
119           q=x(j)
120           qeta=q*eta
121           u=(h*h*(1.+(qeta*qeta))/(qeta*qeta))**(df/2.)
122           call incog(threeminustau,u,incogau)
123           f1=gamma3mt-incogau
124           f2=(1.+(qeta*qeta))**((-1.*df*threeminustau)/2.)
125           g2=(qeta/h)**(-1.*df)
126           call incog(twominustau,g2,incogaxh)
127           g1=sin((df-1.)*pi/2.)*incogaxh/(df-1.)
128
129           ycal(j)=(scale*vol*s/gamma2mt)*((f1*f2)+(g1*g2))+bkgd
130        end do
131
132        return
133        end