1 subroutine contfunc(cscore,itypi,itypj)
3 C This subroutine calculates the contact function based on
4 C the Gay-Berne potential of interaction.
6 implicit real*8 (a-h,o-z)
8 include 'COMMON.CONTPAR'
12 sig0ij=sig_comp(itypi,itypj)
13 chi1=chi_comp(itypi,itypj)
14 chi2=chi_comp(itypj,itypi)
16 chip1=chip_comp(itypi,itypj)
17 chip2=chip_comp(itypj,itypi)
19 rrij=1.0D0/(xj*xj+yj*yj+zj*zj)
21 C Calculate angle-dependent terms of the contact function
25 om1=dxi*erij(1)+dyi*erij(2)+dzi*erij(3)
26 om2=dxj*erij(1)+dyj*erij(2)+dzj*erij(3)
27 om12=dxi*dxj+dyi*dyj+dzi*dzj
29 c print *,'egb',itypi,itypj,chi1,chi2,chip1,chip2,
31 c & rij,rrij,om1,om2,om12
32 C Calculate eps1(om12)
33 faceps1=1.0D0-om12*chiom12
34 faceps1_inv=1.0D0/faceps1
35 eps1=dsqrt(faceps1_inv)
36 C Following variable is eps1*deps1/dom12
37 eps1_om12=faceps1_inv*chiom12
38 C Calculate sigma(om1,om2,om12)
42 facsig=om1*chiom1+om2*chiom2-2.0D0*om1om2*chiom12
43 sigsq=1.0D0-facsig*faceps1_inv
44 C Calculate eps2 and its derivatives in om1, om2, and om12.
48 facp=1.0D0-om12*chipom12
50 facp1=om1*chipom1+om2*chipom2-2.0D0*om1om2*chipom12
51 C Following variable is the square root of eps2
52 eps2rt=1.0D0-facp1*facp_inv
54 sig=sig0ij*dsqrt(sigsq)
55 rij_shift=1.0D0/rij-sig+sig0ij
56 if (rij_shift.le.0.0D0) then
58 cscore = -dlog(evdw+1.0d-6)
61 rij_shift=1.0D0/rij_shift
62 e2=(rij_shift*sig0ij)**expon
63 evdw=dabs(eps1*eps2rt**2*e2)
64 if (evdw.gt.1.0d1) evdw = 1.0d1
65 cscore = -dlog(evdw+1.0d-6)
68 c------------------------------------------------------------------------------
69 subroutine scdist(cscore,itypi,itypj)
71 C This subroutine calculates the contact distance
73 implicit real*8 (a-h,o-z)
75 include 'COMMON.CONTPAR'
78 chi1=chi_comp(itypi,itypj)
79 chi2=chi_comp(itypj,itypi)
81 rrij=xj*xj+yj*yj+zj*zj
83 C Calculate angle-dependent terms of the contact function
87 om1=dxi*erij(1)+dyi*erij(2)+dzi*erij(3)
88 om2=dxj*erij(1)+dyj*erij(2)+dzj*erij(3)
89 om12=dxi*dxj+dyi*dyj+dzi*dzj
94 cscore=dsqrt(rrij+chi1**2+chi2**2+2*rij*(chiom2-chiom1)-2*chiom12)