2022-01-21 01:56:33 +00:00
|
|
|
|
using CairoMakie
|
|
|
|
|
using LaTeXStrings: @L_str
|
|
|
|
|
|
2022-01-29 13:32:04 +00:00
|
|
|
|
includet("../src/Visualization/common_CairoMakie.jl")
|
2022-01-24 19:43:37 +00:00
|
|
|
|
|
2022-01-21 01:56:33 +00:00
|
|
|
|
const minimum_r_σ_ratio = 2^(1 / 6)
|
|
|
|
|
|
|
|
|
|
function U_LJ_ϵ_ratio(r_σ_ratio::Real)
|
|
|
|
|
σ_r_ratio⁶ = r_σ_ratio^(-6)
|
|
|
|
|
return 4 * (σ_r_ratio⁶^2 - σ_r_ratio⁶)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function U_WCA_ϵ_ratio(r_σ_ratio::Real)
|
|
|
|
|
if r_σ_ratio > minimum_r_σ_ratio
|
|
|
|
|
return zero(r_σ_ratio)
|
|
|
|
|
else
|
|
|
|
|
return U_LJ_ϵ_ratio(r_σ_ratio) + 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
function plot_potentials()
|
|
|
|
|
init_cairomakie!()
|
|
|
|
|
|
|
|
|
|
fig = gen_figure()
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
max_x = 2.5
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
max_y = 1.05
|
|
|
|
|
min_y = -max_y
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
ax = Axis(fig[1, 1]; xlabel=L"r/σ", ylabel=L"U/ϵ", limits=(0.88, max_x, min_y, max_y))
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
r_σ_ratio = LinRange(0.95, max_x, 1000)
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
LJ = lines!(ax, r_σ_ratio, U_LJ_ϵ_ratio.(r_σ_ratio))
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
WCA = lines!(ax, r_σ_ratio, U_WCA_ϵ_ratio.(r_σ_ratio))
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
minimum_r_σ_ratio_line = lines!(
|
|
|
|
|
ax,
|
|
|
|
|
[minimum_r_σ_ratio, minimum_r_σ_ratio],
|
|
|
|
|
[min_y, max_y];
|
|
|
|
|
linestyle=:dash,
|
|
|
|
|
linewidth=1,
|
|
|
|
|
)
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
Legend(
|
|
|
|
|
fig[1, 2],
|
|
|
|
|
[LJ, WCA, minimum_r_σ_ratio_line],
|
|
|
|
|
[L"U_{LJ}", L"U_{WCA}", L"\frac{r}{σ} = 2^{1/6}"],
|
|
|
|
|
)
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
set_gaps!(fig)
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
save_fig("potential.pdf", fig)
|
2022-01-21 01:56:33 +00:00
|
|
|
|
|
2022-01-24 19:43:37 +00:00
|
|
|
|
return nothing
|
|
|
|
|
end
|