JuliaMolSim / Molly.jl

Molecular simulation in Julia
Other
390 stars 53 forks source link

Units in Nose Hoover temperature #157

Closed nwalet closed 10 months ago

nwalet commented 10 months ago

Can I suggest a small change, in case one is using Nose Hoover without units, (keep in mind I don't know the coding conventions in molly) in line 594 in simulators.jl from T_half = uconvert(u"K", 2 * KE_half / (df * sys.k)) to

        if unit(sim.temperature) != NoUnits
           T_half = uconvert(unit(sim.temperature), 2 * KE_half / (df * sys.k))
    else
            T_half =  2 * KE_half / (df * sys.k)
    end

Niels

jgreener64 commented 10 months ago

Thanks for this, added it in https://github.com/JuliaMolSim/Molly.jl/commit/130f18d8ba72fa666781867ce46373a72d38dd28.