Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving general surface hopping functions to SurfaceHoppingMethods.jl #357

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/DynamicsMethods/SurfaceHoppingMethods/SurfaceHoppingMethods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ using ComponentArrays: ComponentVector
using DiffEqBase: DiffEqBase
using LinearAlgebra: LinearAlgebra, lmul!
using OrdinaryDiffEq: OrdinaryDiffEq
using RingPolymerArrays: get_centroid

using NQCDynamics:
NQCDynamics,
Expand Down Expand Up @@ -93,6 +94,22 @@ function DynamicsUtils.get_hopping_eigenvalues(sim::RingPolymerSimulation, r::Ab
return Calculators.get_centroid_eigen(sim.calculator, r).values
end

function DynamicsUtils.get_hopping_nonadiabatic_coupling(sim::Simulation, r::AbstractMatrix)
return Calculators.get_nonadiabatic_coupling(sim.calculator, r)
end

function DynamicsUtils.get_hopping_nonadiabatic_coupling(sim::RingPolymerSimulation, r::AbstractArray{T,3}) where {T}
return Calculators.get_centroid_nonadiabatic_coupling(sim.calculator, r)
end

function DynamicsUtils.get_hopping_velocity(::Simulation, v::AbstractMatrix)
return v
end

function DynamicsUtils.get_hopping_velocity(::RingPolymerSimulation, v::AbstractArray{T,3}) where {T}
return get_centroid(v)
end

include("decoherence_corrections.jl")
include("surface_hopping.jl")
include("fssh.jl")
Expand Down
8 changes: 0 additions & 8 deletions src/DynamicsMethods/SurfaceHoppingMethods/fssh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ function evaluate_hopping_probability!(sim::AbstractSimulation{<:FSSH}, u, dt)
fewest_switches_probability!(sim.method.hopping_probability, v, σ, s, d, dt)
end

function DynamicsUtils.get_hopping_nonadiabatic_coupling(sim::Simulation, r::AbstractMatrix)
return Calculators.get_nonadiabatic_coupling(sim.calculator, r)
end

function DynamicsUtils.get_hopping_velocity(::Simulation, v::AbstractMatrix)
return v
end

function fewest_switches_probability!(probability, v, σ, s, d, dt)
probability .= 0 # Set all entries to 0
for m in axes(σ, 1)
Expand Down
8 changes: 0 additions & 8 deletions src/DynamicsMethods/SurfaceHoppingMethods/rpsh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ function DynamicsMethods.motion!(du, u, sim::RingPolymerSimulation{<:SurfaceHopp
DynamicsUtils.set_quantum_derivative!(dσ, u, sim)
end

function DynamicsUtils.get_hopping_nonadiabatic_coupling(sim::RingPolymerSimulation, r::AbstractArray{T,3}) where {T}
return Calculators.get_centroid_nonadiabatic_coupling(sim.calculator, r)
end

function DynamicsUtils.get_hopping_velocity(::RingPolymerSimulation, v::AbstractArray{T,3}) where {T}
return get_centroid(v)
end

function perform_rescaling!(
sim::RingPolymerSimulation{<:SurfaceHopping}, velocity, γ, d
)
Expand Down
Loading