Skip to content

Commit

Permalink
script for randomly generated samples
Browse files Browse the repository at this point in the history
  • Loading branch information
grasingerm committed May 15, 2023
1 parent b2d0a79 commit 09ca935
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions run/phases-random_2023-05-15.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
println("Hello world!");

@everywhere using Printf;
@everywhere using Distributions;

@show workdir = if length(ARGS) > 0
ARGS[1];
else
".";
end

@everywhere fmt(x) = @sprintf("%07d", round(Int, 1e3*x));
@everywhere fmt_int(x) = @sprintf("%03d", x);

@everywhere function prefix(case)
"E0-$(fmt(case[:E0]))_K1-$(fmt(case[:K1]))_K2-$(fmt(case[:K2]))_kT-$(fmt(case[:kT]))_Fz-$(fmt(case[:Fz]))_Fx-$(fmt(case[:Fx]))_n-$(fmt(case[:n]))_b-$(fmt(case[:b]))_kappa-$(fmt(case[:kappa]))";
end

@everywhere Kdist = collect(zip([1.0; 0.0], [0.0; 1.0], [2.0; 1.0], [1.0; 2.0], [3.0; 2.0], [2.0; 3.0]));
@everywhere Edist = Normal(2.5, 1.0);
@everywhere ndist = Normal(35, 15);
@everywhere bdist = [1e-3; 1e-2; 1e-1; 0.5; 1.0; 2.0; 1e2];
@everywhere kTdist = [0.1; 1.0; 10.0]
@everywhere Fdist = Normal(2.0, 1.0);

mkpath(workdir);

@sync @distributed for i=1:1000000

case = Dict();
case[:kappa] = 0.0;
case[:E0] = max(0.05, rand(Edist));
Ks = rand(Kdist)
case[:K1], case[:K2] = Ks[1], Ks[2]
case[:n] = max(10, round(Int, rand(ndist)));
case[:b] = rand(bdist);
case[:kT] = rand(kTdist);
case[:Fx] = max(0.0, rand(Fdist));
case[:Fz] = max(0.0, rand(Fdist));

outfile = joinpath(workdir, "$(prefix(case)).out");
if !isfile(outfile)
println("Running case: $case.");
command = `julia -O 3 mcmc_clustering_eap_chain.jl --chain-type dielectric --energy-type interacting -b $(case[:b]) --bend-mod $(case[:kappa]) --E0 $(case[:E0]) --K1 $(case[:K1]) --K2 $(case[:K2]) --kT $(case[:kT]) --Fz $(case[:Fz]) --Fx $(case[:Fx]) -n $(case[:n]) --num-steps 2000000 --burn-in 200000 -v 2 --prefix $(joinpath(workdir, prefix(case)))`;
output = read(command, String);
write(outfile, output);
else
println("Case: $case has already been run.");
end

end

0 comments on commit 09ca935

Please sign in to comment.