mirror of
https://gitlab.rlp.net/mobitar/ReCo.jl.git
synced 2024-09-19 19:01:17 +00:00
Removed minimum_image
This commit is contained in:
parent
acebf489b7
commit
01e989c6bb
6 changed files with 15 additions and 34 deletions
|
@ -22,8 +22,6 @@ ReCo.gen_cell_list_box(::Float64, ::Float64) = nothing
|
||||||
ReCo.restrict_coordinate(value::Float64, ::Float64) = value
|
ReCo.restrict_coordinate(value::Float64, ::Float64) = value
|
||||||
ReCo.restrict_coordinates(v::SVector{2,Float64}, ::Float64) = v
|
ReCo.restrict_coordinates(v::SVector{2,Float64}, ::Float64) = v
|
||||||
ReCo.restrict_coordinates!(::ReCo.Particle, ::Float64) = nothing
|
ReCo.restrict_coordinates!(::ReCo.Particle, ::Float64) = nothing
|
||||||
ReCo.minimum_image_coordinate(value::Float64, ::Float64) = value
|
|
||||||
ReCo.minimum_image(v::SVector{2,Float64}, ::Float64) = v
|
|
||||||
|
|
||||||
const δt = 1e-4
|
const δt = 1e-4
|
||||||
const Dₜ = ReCo.DEFAULT_Dₜ
|
const Dₜ = ReCo.DEFAULT_Dₜ
|
||||||
|
|
|
@ -111,7 +111,7 @@ function radial_distribution(;
|
||||||
c2 = cs[p2_ind, snapshot_ind]
|
c2 = cs[p2_ind, snapshot_ind]
|
||||||
|
|
||||||
r⃗₁₂ = c2 - c1
|
r⃗₁₂ = c2 - c1
|
||||||
r⃗₁₂ = ReCo.minimum_image(r⃗₁₂, sim_consts.half_box_len)
|
r⃗₁₂ = ReCo.restrict_coordinates(r⃗₁₂, sim_consts.half_box_len)
|
||||||
|
|
||||||
distance = ReCo.norm2d(r⃗₁₂)
|
distance = ReCo.norm2d(r⃗₁₂)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ function gen_COM_graphics()
|
||||||
|
|
||||||
A = -0.9 * L
|
A = -0.9 * L
|
||||||
B = 0.65 * L
|
B = 0.65 * L
|
||||||
pr = 0.03 * L
|
particel_radius = 0.04 * L
|
||||||
|
|
||||||
Ap_vec = Vector(ReCo.Shape.project_to_unit_circle(A, L))
|
Ap_vec = Vector(ReCo.Shape.project_to_unit_circle(A, L))
|
||||||
Bp_vec = Vector(ReCo.Shape.project_to_unit_circle(B, L))
|
Bp_vec = Vector(ReCo.Shape.project_to_unit_circle(B, L))
|
||||||
|
@ -62,11 +62,11 @@ function gen_COM_graphics()
|
||||||
|
|
||||||
setcolor("blue")
|
setcolor("blue")
|
||||||
for p in (A, B)
|
for p in (A, B)
|
||||||
circle(Point(p, 0), pr, :fill)
|
circle(Point(p, 0), particel_radius, :fill)
|
||||||
end
|
end
|
||||||
|
|
||||||
setcolor("brown")
|
setcolor("brown")
|
||||||
circle(Point(COM, 0), pr, :fill)
|
circle(Point(COM, 0), particel_radius, :fill)
|
||||||
|
|
||||||
setcolor("black")
|
setcolor("black")
|
||||||
fontsize(5)
|
fontsize(5)
|
||||||
|
@ -106,7 +106,7 @@ function gen_COM_graphics()
|
||||||
|
|
||||||
setcolor("blue")
|
setcolor("blue")
|
||||||
for pp in (Ap, Bp)
|
for pp in (Ap, Bp)
|
||||||
circle(R * pp, pr, :fill)
|
circle(R * pp, particel_radius, :fill)
|
||||||
end
|
end
|
||||||
|
|
||||||
setcolor("black")
|
setcolor("black")
|
||||||
|
@ -115,10 +115,10 @@ function gen_COM_graphics()
|
||||||
line(Point(0, 0), COMp, :stroke)
|
line(Point(0, 0), COMp, :stroke)
|
||||||
|
|
||||||
setcolor("purple1")
|
setcolor("purple1")
|
||||||
circle(M, pr, :fill)
|
circle(M, particel_radius, :fill)
|
||||||
|
|
||||||
setcolor("brown")
|
setcolor("brown")
|
||||||
circle(COMp, pr, :fill)
|
circle(COMp, particel_radius, :fill)
|
||||||
|
|
||||||
finish()
|
finish()
|
||||||
|
|
||||||
|
|
|
@ -77,15 +77,15 @@ function gen_periodic_boundary_conditions_graphics()
|
||||||
|
|
||||||
setcolor("black")
|
setcolor("black")
|
||||||
setline(1.0)
|
setline(1.0)
|
||||||
for sign in (1, -1)
|
for line_factor in (-3, -1, 1, 3)
|
||||||
line(
|
line(
|
||||||
Point(sign * drwaing_box_length / 6, drwaing_box_length / 2),
|
Point(line_factor * drwaing_box_length / 6, drwaing_box_length / 2),
|
||||||
Point(sign * drwaing_box_length / 6, -drwaing_box_length / 2),
|
Point(line_factor * drwaing_box_length / 6, -drwaing_box_length / 2),
|
||||||
:stroke,
|
:stroke,
|
||||||
)
|
)
|
||||||
line(
|
line(
|
||||||
Point(drwaing_box_length / 2, sign * drwaing_box_length / 6),
|
Point(drwaing_box_length / 2, line_factor * drwaing_box_length / 6),
|
||||||
Point(-drwaing_box_length / 2, sign * drwaing_box_length / 6),
|
Point(-drwaing_box_length / 2, line_factor * drwaing_box_length / 6),
|
||||||
:stroke,
|
:stroke,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -96,7 +96,7 @@ function gen_periodic_boundary_conditions_graphics()
|
||||||
p1_c = particles[p1_ind].c
|
p1_c = particles[p1_ind].c
|
||||||
p2_c = particles[p2_ind].c
|
p2_c = particles[p2_ind].c
|
||||||
normal_vec_form_p1_to_p2 = p2_c - p1_c
|
normal_vec_form_p1_to_p2 = p2_c - p1_c
|
||||||
min_image_vec = ReCo.minimum_image(normal_vec_form_p1_to_p2, half_box_len)
|
min_image_vec = ReCo.restrict_coordinates(normal_vec_form_p1_to_p2, half_box_len)
|
||||||
min_image_vec_from_p1 = p1_c + min_image_vec
|
min_image_vec_from_p1 = p1_c + min_image_vec
|
||||||
|
|
||||||
setcolor("black")
|
setcolor("black")
|
||||||
|
|
|
@ -37,23 +37,6 @@ function restrict_coordinates!(p::Particle, half_box_len::Float64)
|
||||||
return nothing
|
return nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
function minimum_image_coordinate(value::Float64, half_box_len::Float64)
|
|
||||||
if value <= -half_box_len
|
|
||||||
value += 2 * half_box_len
|
|
||||||
elseif value > half_box_len
|
|
||||||
value -= 2 * half_box_len
|
|
||||||
end
|
|
||||||
|
|
||||||
return value
|
|
||||||
end
|
|
||||||
|
|
||||||
function minimum_image(v::SVector{2,Float64}, half_box_len::Float64)
|
|
||||||
return SVector(
|
|
||||||
minimum_image_coordinate(v[1], half_box_len),
|
|
||||||
minimum_image_coordinate(v[2], half_box_len),
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
function are_overlapping(
|
function are_overlapping(
|
||||||
c1::SVector{2,Float64},
|
c1::SVector{2,Float64},
|
||||||
c2::SVector{2,Float64},
|
c2::SVector{2,Float64},
|
||||||
|
@ -62,7 +45,7 @@ function are_overlapping(
|
||||||
)
|
)
|
||||||
r⃗₁₂ = c2 - c1 # 1 -> 2
|
r⃗₁₂ = c2 - c1 # 1 -> 2
|
||||||
|
|
||||||
r⃗₁₂ = minimum_image(r⃗₁₂, half_box_len)
|
r⃗₁₂ = restrict_coordinates(r⃗₁₂, half_box_len)
|
||||||
|
|
||||||
distance² = sq_norm2d(r⃗₁₂)
|
distance² = sq_norm2d(r⃗₁₂)
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ function elliptical_distance(
|
||||||
elliptical_a_b_ratio::R,
|
elliptical_a_b_ratio::R,
|
||||||
half_box_len::R,
|
half_box_len::R,
|
||||||
) where {R<:Real}
|
) where {R<:Real}
|
||||||
v′ = ReCo.minimum_image(v - COM, half_box_len)
|
v′ = ReCo.restrict_coordinates(v - COM, half_box_len)
|
||||||
|
|
||||||
x = LA.dot(v′, gyration_tensor_eigvec_to_bigger_eigval)
|
x = LA.dot(v′, gyration_tensor_eigvec_to_bigger_eigval)
|
||||||
y = LA.dot(v′, gyration_tensor_eigvec_to_smaller_eigval)
|
y = LA.dot(v′, gyration_tensor_eigvec_to_smaller_eigval)
|
||||||
|
|
Loading…
Reference in a new issue