Skip to content

Commit 3d82977

Browse files
authored
Moved general surface hopping functions to SurfaceHoppingMethods.jl (#356)
Moved two generally applicable surface hopping functions get_hopping_nonadiabatic_coupling() and get_hopping_velocity() to SurfaceHoppingMethods.jl and moved their duplicate RingPolymer definitions to the same file to bring these definitions more in line with the duplicate function definition philosophy in the rest of NQCD
1 parent 96081d1 commit 3d82977

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/DynamicsMethods/SurfaceHoppingMethods/SurfaceHoppingMethods.jl

+16
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,22 @@ function DynamicsUtils.get_hopping_eigenvalues(sim::RingPolymerSimulation, r::Ab
9393
return Calculators.get_centroid_eigen(sim.calculator, r).values
9494
end
9595

96+
function DynamicsUtils.get_hopping_nonadiabatic_coupling(sim::Simulation, r::AbstractMatrix)
97+
return Calculators.get_nonadiabatic_coupling(sim.calculator, r)
98+
end
99+
100+
function DynamicsUtils.get_hopping_nonadiabatic_coupling(sim::RingPolymerSimulation, r::AbstractArray{T,3}) where {T}
101+
return Calculators.get_centroid_nonadiabatic_coupling(sim.calculator, r)
102+
end
103+
104+
function DynamicsUtils.get_hopping_velocity(::Simulation, v::AbstractMatrix)
105+
return v
106+
end
107+
108+
function DynamicsUtils.get_hopping_velocity(::RingPolymerSimulation, v::AbstractArray{T,3}) where {T}
109+
return get_centroid(v)
110+
end
111+
96112
include("decoherence_corrections.jl")
97113
include("surface_hopping.jl")
98114
include("fssh.jl")

src/DynamicsMethods/SurfaceHoppingMethods/fssh.jl

-8
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,6 @@ function evaluate_hopping_probability!(sim::AbstractSimulation{<:FSSH}, u, dt)
7575
fewest_switches_probability!(sim.method.hopping_probability, v, σ, s, d, dt)
7676
end
7777

78-
function DynamicsUtils.get_hopping_nonadiabatic_coupling(sim::Simulation, r::AbstractMatrix)
79-
return Calculators.get_nonadiabatic_coupling(sim.calculator, r)
80-
end
81-
82-
function DynamicsUtils.get_hopping_velocity(::Simulation, v::AbstractMatrix)
83-
return v
84-
end
85-
8678
function fewest_switches_probability!(probability, v, σ, s, d, dt)
8779
probability .= 0 # Set all entries to 0
8880
for m in axes(σ, 1)

src/DynamicsMethods/SurfaceHoppingMethods/rpsh.jl

-8
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ function DynamicsMethods.motion!(du, u, sim::RingPolymerSimulation{<:SurfaceHopp
2727
DynamicsUtils.set_quantum_derivative!(dσ, u, sim)
2828
end
2929

30-
function DynamicsUtils.get_hopping_nonadiabatic_coupling(sim::RingPolymerSimulation, r::AbstractArray{T,3}) where {T}
31-
return Calculators.get_centroid_nonadiabatic_coupling(sim.calculator, r)
32-
end
33-
34-
function DynamicsUtils.get_hopping_velocity(::RingPolymerSimulation, v::AbstractArray{T,3}) where {T}
35-
return get_centroid(v)
36-
end
37-
3830
function perform_rescaling!(
3931
sim::RingPolymerSimulation{<:SurfaceHopping}, velocity, γ, d
4032
)

0 commit comments

Comments
 (0)