Skip to content

Commit 0c0c5be

Browse files
committed
feat: shifting LJ potentials is now optional
1 parent cd4e65e commit 0c0c5be

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/models.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,14 @@ struct LennardJones{T<:AbstractFloat} <: DiscreteModel
107107
shift::T
108108
end
109109

110-
function LennardJones(ϵ, σ; rcut=2.5*σ, name="LennardJones")
110+
function LennardJones(ϵ, σ; rcut=2.5*σ, name="LennardJones", shift_potential=true)
111111
σ2 = σ ^ 2
112112
rcut2 = rcut ^ 2
113-
shift = lennard_jones(rcut2, 4ϵ, σ2)
113+
if shift_potential
114+
shift = lennard_jones(rcut2, 4ϵ, σ2)
115+
else
116+
shift = 0.0
117+
end
114118
return LennardJones(name, ϵ, 4ϵ, σ, σ2, rcut, rcut2, shift)
115119
end
116120

@@ -237,4 +241,4 @@ function Trimer()
237241
KG_33 = GeneralKG(ϵ[3,3], σ[3,3], k[3,3], r0[3,3])
238242
return SMatrix{3, 3, typeof(KG_11), 9}([KG_11 KG_12 KG_13; KG_12 KG_22 KG_23; KG_13 KG_23 KG_33])
239243
end
240-
###############################################################################
244+
###############################################################################

0 commit comments

Comments
 (0)