25 double precision,
allocatable :: epsilon(:,:)
26 double precision,
allocatable :: sigma(:,:)
27 double precision,
allocatable :: sigma_sq(:,:)
28 double precision,
allocatable :: cut(:,:)
29 double precision,
allocatable :: cut_sq(:,:)
30 double precision,
allocatable :: cut_energy(:,:)
31 double precision,
allocatable :: shift(:)
40 double precision,
intent(in) :: epsilon(:,:)
41 double precision,
intent(in) :: sigma(:,:)
42 double precision,
intent(in) :: cut(:,:)
43 double precision,
intent(in),
optional :: shift(:)
47 if (
size(epsilon, 1) /=
size(sigma, 1) .or. &
48 size(epsilon, 1) /=
size(cut, 1) .or. &
49 size(epsilon, 2) /=
size(sigma, 2) .or. &
50 size(epsilon, 2) /=
size(cut, 2) )
then 51 error stop
'unequal sizes for arguments to lj_params_init' 59 allocate(this% epsilon(n1, n2))
60 allocate(this% sigma(n1, n2))
61 allocate(this% sigma_sq(n1, n2))
62 allocate(this% cut(n1, n2))
63 allocate(this% cut_sq(n1, n2))
64 allocate(this% cut_energy(n1, n2))
65 allocate(this% shift(n1))
67 this% epsilon = epsilon
69 this% sigma_sq = sigma**2
72 if (
present(shift))
then 78 this% cut_energy =
lj_energy(this%cut_sq, this%epsilon, this%sigma, this%sigma*0)
83 pure function lj_force(d, r_sq, epsilon, sigma)
result(f)
84 double precision,
intent(in) :: d(3)
85 double precision,
intent(in) :: r_sq, epsilon, sigma
86 double precision :: f(3)
88 double precision :: sig6_o_r6, force_over_r
90 sig6_o_r6 = sigma**6/r_sq**3
92 force_over_r = 24.d0*epsilon* sig6_o_r6/r_sq * (2.d0*sig6_o_r6 - 1.d0)
99 pure function lj_force_9_6(d, r_sq, epsilon, sigma)
result(f)
100 double precision,
intent(in) :: d(3)
101 double precision,
intent(in) :: r_sq, epsilon, sigma
102 double precision :: f(3)
104 double precision :: sig6_o_r6, sig3_o_r3, force_o_r
105 sig6_o_r6 = sigma**6/r_sq**3
106 sig3_o_r3 = sigma**3/r_sq**(3.d0/2.d0)
108 force_o_r = 6.75d0*3.d0*epsilon*sig6_o_r6/r_sq*(3.d0*sig3_o_r3-2.d0)
114 pure function lj_force_9_3(z, z_sq, epsilon, sigma)
result(e)
115 double precision,
intent(in) ::z, z_sq, epsilon, sigma
116 double precision :: e
118 double precision :: sig3_o_r3, force_o_z
120 sig3_o_r3 = sigma**3/z_sq**(3.d0/2.d0)
122 force_o_z = 9*sqrt(3.d0)/2*epsilon/z_sq* (3.d0*sig3_o_r3**3 - sig3_o_r3)
126 pure elemental function lj_energy(r_sq, epsilon, sigma, cut_energy)
result(e)
127 double precision,
intent(in) :: r_sq, epsilon, sigma, cut_energy
128 double precision :: e
130 double precision :: sig6_o_r6
132 sig6_o_r6 = sigma**6/r_sq**3
134 e = 4.d0*epsilon * (sig6_o_r6**2 - sig6_o_r6) - cut_energy
139 double precision,
intent(in) :: r_sq, epsilon, sigma
140 double precision :: e
142 double precision :: sig6_o_r6, sig3_o_r3
144 sig6_o_r6 = sigma**6/r_sq**3
145 sig3_o_r3 = sigma**3/r_sq**(3.d0/2.d0)
147 e = 6.75d0*epsilon * (sig6_o_r6*(sig3_o_r3 - 1.d0) + 4.d0/27.d0)
152 double precision,
intent(in) :: z_sq, epsilon, sigma
153 double precision :: e
155 double precision :: sig3_o_r3
157 sig3_o_r3 = sigma**3/z_sq**(3.d0/2.d0)
159 e = 3*sqrt(3.d0)/2*epsilon*(sig3_o_r3**3 - sig3_o_r3) + epsilon
pure elemental double precision function, public lj_energy(r_sq, epsilon, sigma, cut_energy)
subroutine lj_params_init(this, epsilon, sigma, cut, shift)
pure double precision function, dimension(3), public lj_force_9_6(d, r_sq, epsilon, sigma)
pure double precision function, public lj_energy_9_3(z_sq, epsilon, sigma)
pure double precision function, public lj_energy_9_6(r_sq, epsilon, sigma)
pure double precision function, dimension(3), public lj_force(d, r_sq, epsilon, sigma)
pure double precision function, public lj_force_9_3(z, z_sq, epsilon, sigma)
Lennard-Jones potential definition.