mirror of
https://gitlab.rlp.net/mobitar/ReCo.jl.git
synced 2024-11-08 22:21:08 +00:00
Potential graphic
This commit is contained in:
parent
383a77e2bf
commit
1edea1cd1d
1 changed files with 51 additions and 0 deletions
51
graphics/pontential.jl
Normal file
51
graphics/pontential.jl
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
using CairoMakie
|
||||||
|
using LaTeXStrings: @L_str
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
text_width_in_pt = 405
|
||||||
|
|
||||||
|
fig = Figure(;
|
||||||
|
resolution=(text_width_in_pt, 0.55 * text_width_in_pt), fontsize=10, figure_padding=1
|
||||||
|
)
|
||||||
|
|
||||||
|
max_x = 2.5
|
||||||
|
|
||||||
|
max_y = 1.05
|
||||||
|
min_y = -max_y
|
||||||
|
|
||||||
|
ax = Axis(fig[1, 1]; xlabel=L"r/σ", ylabel=L"U/ϵ", limits=(0.88, max_x, min_y, max_y))
|
||||||
|
|
||||||
|
r_σ_ratio = LinRange(0.95, max_x, 1000)
|
||||||
|
|
||||||
|
LJ = lines!(ax, r_σ_ratio, U_LJ_ϵ_ratio.(r_σ_ratio))
|
||||||
|
|
||||||
|
WCA = lines!(ax, r_σ_ratio, U_WCA_ϵ_ratio.(r_σ_ratio))
|
||||||
|
|
||||||
|
minimum_r_σ_ratio_line = lines!(
|
||||||
|
ax, [minimum_r_σ_ratio, minimum_r_σ_ratio], [min_y, max_y]; linestyle=:dash, linewidth=1
|
||||||
|
)
|
||||||
|
|
||||||
|
Legend(
|
||||||
|
fig[1, 2],
|
||||||
|
[LJ, WCA, minimum_r_σ_ratio_line],
|
||||||
|
[L"U_{LJ}", L"U_{WCA}", L"\frac{r}{σ} = 2^{1/6}"],
|
||||||
|
)
|
||||||
|
|
||||||
|
colgap!(fig.layout, 5)
|
||||||
|
rowgap!(fig.layout, 5)
|
||||||
|
|
||||||
|
save("exports/graphics/potential.pdf", fig; pt_per_unit=1)
|
Loading…
Reference in a new issue