mirror of
https://igit.ific.uv.es/alramos/latticegpu.jl.git
synced 2025-05-14 19:23:42 +02:00
Added Base.show for integrators and omf2
This commit is contained in:
parent
0654f15564
commit
e96925e011
1 changed files with 32 additions and 9 deletions
41
src/MD/MD.jl
41
src/MD/MD.jl
|
@ -12,13 +12,17 @@
|
|||
module MD
|
||||
|
||||
# Dalla Brida / Luscher coefficients of
|
||||
# fourth order integrator
|
||||
const r1 = 0.08398315262876693
|
||||
const r2 = 0.25397851084105950
|
||||
const r3 = 0.68223653357190910
|
||||
const r4 = -0.03230286765269967
|
||||
const r5 = 0.5-r1-r3
|
||||
const r6 = 1.0-2.0*(r2+r4)
|
||||
# OMF integrator
|
||||
const r1omf4 = 0.08398315262876693
|
||||
const r2omf4 = 0.25397851084105950
|
||||
const r3omf4 = 0.68223653357190910
|
||||
const r4omf4 = -0.03230286765269967
|
||||
const r5omf4 = 0.5-r1omf4-r3omf4
|
||||
const r6omf4 = 1.0-2.0*(r2omf4+r4omf4)
|
||||
|
||||
const r1omf2 = 0.1931833275037836
|
||||
const r2omf2 = 0.5
|
||||
const r3omf2 = 1 - 2*r1omf2
|
||||
|
||||
struct IntrScheme{N, T}
|
||||
r::NTuple{N, T}
|
||||
|
@ -26,10 +30,29 @@ struct IntrScheme{N, T}
|
|||
ns::Int64
|
||||
end
|
||||
|
||||
omf4(::Type{T}, eps, ns) where T = IntrScheme{6,T}((r1,r2,r3,r4,r5,r6), eps, ns)
|
||||
|
||||
omf2(::Type{T}, eps, ns) where T = IntrScheme{3,T}((r1omf2,r2omf2,r3omf2), eps, ns)
|
||||
omf4(::Type{T}, eps, ns) where T = IntrScheme{6,T}((r1omf4,r2omf4,r3omf4,r4omf4,r5omf4,r6omf4), eps, ns)
|
||||
leapfrog(::Type{T}, eps, ns) where T = IntrScheme{2,T}((0.5,1.0,0.5), eps, ns)
|
||||
|
||||
export IntrScheme, omf4, leapfrog
|
||||
|
||||
import Base.show
|
||||
function Base.show(io::IO, int::IntrScheme{N,T}) where {N,T}
|
||||
|
||||
if N == 2
|
||||
println(io, "LEAPFROG integration scheme")
|
||||
elseif N == 3
|
||||
println(io, "OMF2 integration scheme")
|
||||
elseif N == 6
|
||||
println(io, "OMF4 integration scheme")
|
||||
end
|
||||
println(io, " - eps: ", int.eps)
|
||||
println(io, " - ns: ", int.ns)
|
||||
|
||||
return nothing
|
||||
end
|
||||
|
||||
export IntrScheme, omf4, leapfrog, omf2
|
||||
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue