Skip to content

Commit

Permalink
Merge pull request #11 from NQCD/velocity-com
Browse files Browse the repository at this point in the history
VelocityBoltzmann with centre of mass shift
  • Loading branch information
reinimaurer1 authored Dec 13, 2023
2 parents baba97c + f729b7e commit dbeca25
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/nuclear/boltzmann.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@

"""
VelocityBoltzmann(temperature, masses::AbstractVector, dims::Dims{2})
VelocityBoltzmann(temperature, masses::AbstractVector, dims::Dims{2}; centre = nothing)
Generate a Boltzmann of velocities for each degree of freedom.
Generate a Boltzmann distribution of velocities for each degree of freedom.
# Arguments
* `temperature` - Atomic units or Unitful
* `masses` - Vector of masses for each atom
* `dims` - (ndofs, natoms). `natoms` must equal `length(masses)`
* `centre` - Vector of dimension ndofs that provides centre of mass velocity offset
"""
function VelocityBoltzmann(temperature, masses::AbstractVector, dims::Dims{2})
return UnivariateArray([VelocityBoltzmann(temperature, masses[I[2]]) for I in CartesianIndices(dims)])
function VelocityBoltzmann(temperature, masses::AbstractVector, dims::Dims{2}; centre = zeros(dims))
return UnivariateArray([VelocityBoltzmann(temperature, masses[I[2]]; centre = centre[I]) for I in CartesianIndices(dims)])
end
VelocityBoltzmann(temperature, mass) = Normal(0, sqrt(austrip(temperature)/mass))
VelocityBoltzmann(temperature, mass; centre = 0) = Normal(centre, sqrt(austrip(temperature)/mass))

0 comments on commit dbeca25

Please sign in to comment.