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

Fix Gadget2 read and units #8

Merged
merged 11 commits into from
Oct 29, 2021
12 changes: 6 additions & 6 deletions src/Gadget.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,18 @@ function read_gadget2_particle(f::Union{IOStream,Stream{format"Gadget2"}}, heade
# Read Gas Internal Energy Block
NumGas = header.npart[1]
if NumGas > 0 && header.flag_entropy_instead_u > 0 && !eof(f)
d = data["gases"]
d = data[data.Collection .== GAS]
elehcim marked this conversation as resolved.
Show resolved Hide resolved

if !eof(f)
read_Entropy!(f, data, NumGas, getuEntropy(units))
read_Entropy!(f, d, NumGas, getuEntropy(units))
elehcim marked this conversation as resolved.
Show resolved Hide resolved
end

if !eof(f)
read_Density!(f, data, NumGas, getuDensity(units))
read_Density!(f, d, NumGas, getuDensity(units))
elehcim marked this conversation as resolved.
Show resolved Hide resolved
end

if !eof(f)
read_HSML!(f, data, NumGas, getuLength(units))
read_HSML!(f, d, NumGas, getuLength(units))
elehcim marked this conversation as resolved.
Show resolved Hide resolved
end
end

Expand Down Expand Up @@ -333,9 +333,9 @@ function read_gadget2_particle_format2(f::Union{IOStream,Stream{format"Gadget2"}
elseif name == "MASS"
read_MASS!(f, data, header, getuMass(units))
elseif name == "RHO "
read_Density!(f, data["gases"], NumGas, getuDensity(units))
read_Density!(f, data[data.Collection.==GAS], NumGas, getuDensity(units))
elehcim marked this conversation as resolved.
Show resolved Hide resolved
elseif name == "HSML"
read_HSML!(f, data["gases"], NumGas, getuLength(units))
read_HSML!(f, data[data.Collection.==GAS], NumGas, getuLength(units))
elehcim marked this conversation as resolved.
Show resolved Hide resolved
elseif name == "POT "
read_POT!(f, data, getuEnergy(units))
elseif name == "ACCE"
Expand Down