Skip to content

Commit

Permalink
@kwdef for Atom
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreener64 committed Nov 7, 2024
1 parent d7cb3aa commit 339e7a3
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,23 +236,13 @@ The types used should be bits types if the GPU is going to be used.
potential is zero.
- `ϵ::E=0.0u"kJ * mol^-1"`: the Lennard-Jones depth of the potential well.
"""
struct Atom{T, M, C, S, E}
index::Int
atom_type::T
mass::M
charge::C
σ::S
ϵ::E
end

function Atom(;
index=1,
atom_type=1,
mass=1.0u"g/mol",
charge=0.0,
σ=0.0u"nm",
ϵ=0.0u"kJ * mol^-1")
return Atom(index, atom_type, mass, charge, σ, ϵ)
@kwdef struct Atom{T, M, C, S, E}
index::Int = 1
atom_type::T = 1
mass::M = 1.0u"g/mol"
charge::C = 0.0
σ::S = 0.0u"nm"
ϵ::E = 0.0u"kJ * mol^-1"
end

function Base.zero(::Atom{T, M, C, S, E}) where {T, M, C, S, E}
Expand Down

0 comments on commit 339e7a3

Please sign in to comment.