Skip to content

Commit

Permalink
Hide bare constructors and remove copy(::Langevin)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbarros committed Nov 15, 2023
1 parent c79bd51 commit 930a0d7
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/Integrators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ mutable struct Langevin
Δt :: Float64
λ :: Float64
kT :: Float64
end

function Langevin(Δt; λ, kT)
Δt <= 0 && error("Select positive Δt")
return Langevin(Δt, λ, kT)
function Langevin(Δt; λ, kT)
Δt <= 0 && error("Select positive Δt")
return new(Δt, λ, kT)
end
end

Base.copy(dyn::Langevin) = Langevin(dyn.Δt, dyn.λ, dyn.kT)

"""
ImplicitMidpoint(Δt::Float64; atol=1e-12) where N
Expand All @@ -42,15 +40,14 @@ periods of simulation time.
mutable struct ImplicitMidpoint
Δt :: Float64
atol :: Float64
end

function ImplicitMidpoint(Δt; atol=1e-12)
Δt <= 0 && error("Select positive Δt")
return ImplicitMidpoint(Δt, atol)
function ImplicitMidpoint(Δt; atol=1e-12)
Δt <= 0 && error("Select positive Δt")
return new(Δt, atol)
end
end



################################################################################
# Dipole integration
################################################################################
Expand Down

0 comments on commit 930a0d7

Please sign in to comment.