-
Notifications
You must be signed in to change notification settings - Fork 8
/
pot_so2.f90
133 lines (121 loc) · 3.14 KB
/
pot_so2.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
!
! This unit is for a user defined potential
!
module pot_user
use accuracy
use moltype
implicit none
public MLdipole,MLpoten,ML_MEP
private
integer(ik), parameter :: verbose = 4 ! Verbosity level
!
contains
!
!
function ML_MEP(dim,rho) result(f)
integer(ik),intent(in) :: dim
real(ark),intent(in) :: rho
real(ark) :: f(dim)
!
if (dim/=3) stop 'Illegal size of the function - must be 3'
!
f(:) = molec%local_eq(:)
f(molec%Ncoords) = rho
end function ML_MEP
recursive subroutine MLdipole(rank,ncoords,natoms,local,xyz,f)
!
integer(ik),intent(in) :: rank,ncoords,natoms
real(ark),intent(in) :: local(ncoords),xyz(natoms,3)
real(ark),intent(out) :: f(rank)
!
f = 0
!
end subroutine MLdipole
!
! Defining potential energy function (built for SO2)
function MLpoten(ncoords,natoms,local,xyz,force) result(f)
!
integer(ik),intent(in) :: ncoords,natoms
real(ark),intent(in) :: local(ncoords)
real(ark),intent(in) :: xyz(natoms,3)
real(ark),intent(in) :: force(:)
real(ark) :: f
!
f = MLpoten_so2_damp(ncoords,natoms,local,xyz,force)
!
end function MLpoten
!
!
function MLpoten_so2_damp(ncoords,natoms,local,xyz,force) result(f)
!
integer(ik),intent(in) :: ncoords,natoms
real(ark),intent(in) :: local(ncoords)
real(ark),intent(in) :: xyz(natoms,3)
real(ark),intent(in) :: force(:)
real(ark) :: f
!
integer(ik) :: iterm,k_ind(3),ifst
real(ark) :: y(3),xi(3),vshort,vlong,vdamp
real(ark) :: De,ae,re,beta,damp2,damp4,th1,vshort2,temp
!
re = molec%req(1)
ae = molec%alphaeq(1)
!
De = force(1)
beta = force(2)
damp2 = force(3)
damp4 = force(4)
!
ifst = 5
!
y(1) = local(1)-re
y(2) = local(2)-re
y(3) = local(3)-ae
!
vlong = De*(1.0_ark-exp(-beta*y(1)))**2 + De*(1.0_ark-exp(-beta*y(2)))**2
vdamp = exp( -damp2*( y(1)**2+y(2)**2)-damp4*( y(1)**4+y(2)**4 ) )
!
vshort2 = 0.0_ark
!
vshort = 0.0_ark
!
do iterm=ifst,size(force)
!
xi(1:3) = y(1:3)**molec%pot_ind(1:3,iterm)
!
temp = force(iterm)*product(xi(1:3))
!
if (molec%pot_ind(1,iterm)/=molec%pot_ind(2,iterm)) then
!
k_ind(1) = molec%pot_ind(2,iterm)
k_ind(2) = molec%pot_ind(1,iterm)
k_ind(3) = molec%pot_ind(3,iterm)
!
xi(1:3) = y(1:3)**k_ind(1:3)
!
temp = temp + force(iterm)*product(xi(1:3))
!
endif
!
if (sum(molec%pot_ind(1:3,iterm))>2) then
!
vshort = vshort + temp
!
else
!
vshort2 = vshort2 + temp
!
endif
!
enddo
!
temp = vshort2*vdamp+vlong
!
th1 = 0.5d0*( 1.0d0-tanh( 0.0001_ark*( temp-40000.0_ark ) ) )
!
f = temp + vshort*th1*vdamp
!
!f = vlong + vshort*vdamp
!
end function MLpoten_so2_damp
end module pot_user