Skip to content

Commit

Permalink
default vec of vecs by in xatomic and xgalactic
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Dec 24, 2021
1 parent cd210d8 commit c6c7751
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/testing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -433,21 +433,29 @@ end

# Create a set of random particles with an atomic density simiilar to that
# of water at room temperature and pressure.
function xatomic(n=100_000;cutoff=12.,lcell=1)
function xatomic(n=100_000;cutoff=12.,lcell=1,type=:vec)
atomic_density_of_water = 0.1 # atoms/ Angstrom^3
vol = n/atomic_density_of_water
l = vol^(1/3)
x = l*rand(3,n)
if type == :mat
x = l*rand(3,n)
elseif type == :vec
x = [ l*rand(SVector{3,Float64}) for _ in 1:n ]
end
box = Box([l,l,l],cutoff,lcell=lcell)
return x, box
end

# Create a set of random particles with the typical density of galaxies
function xgalactic(n=8_000_000;cutoff=5.,lcell=1)
function xgalactic(n=8_000_000;cutoff=5.,lcell=1,type=:vec)
galactic_density = 12 # galaxyes per cubic mega-parsecs (https://doi.org/10.1093/mnras/106.2.121)
vol = n/galactic_density
l = vol^(1/3) # mega-parsecs
x = l*rand(3,n)
if type == :mat
x = l*rand(3,n)
elseif type == :vec
x = [ l*rand(SVector{3,Float64}) for _ in 1:n ]
end
box = Box([l,l,l],cutoff,lcell=lcell)
return x, box
end
Expand Down

0 comments on commit c6c7751

Please sign in to comment.