From 97742b36cd0415618fc1d1d20da5299f329cfec8 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Mon, 4 Nov 2024 18:09:25 +0100 Subject: [PATCH] add shell script --- CMakeLists.txt | 2 +- build.sh | 10 ++++++++++ config.txt | 18 +----------------- main.cpp | 8 +++----- test.py | 5 +++-- 5 files changed, 18 insertions(+), 25 deletions(-) create mode 100644 build.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index b556b3f..a8a2a72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.28) +cmake_minimum_required(VERSION 3.18) project(rwsim) set(CMAKE_CXX_STANDARD 17) diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..934ac2c --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +mkdir build +cd build + +cmake .. +cmake --build . + +cd .. + +python test.py + diff --git a/config.txt b/config.txt index 5136da4..1d278ce 100644 --- a/config.txt +++ b/config.txt @@ -1,5 +1,5 @@ # Simulation part -num_walker=20000 +num_walker=50000 # Motion model part delta=161e3 eta=0.0 @@ -19,19 +19,3 @@ tmix_start=1e-5 tmix_stop=1e1 tmix_steps=61 tau=0.001 -tau=0.001 -tau=0.001 -tau=0.001 -tau=0.001 -tau=0.001 -tau=0.01 -tau=0.0031622776601683794 -tau=0.001 -tau=0.00031622776601683794 -tau=0.0001 -tau=3.1622776601683795e-05 -tau=1e-05 -tau=3.162277660168379e-06 -tau=1e-06 -tau=3.162277660168379e-07 -tau=1e-07 diff --git a/main.cpp b/main.cpp index 20385b0..82629de 100644 --- a/main.cpp +++ b/main.cpp @@ -24,18 +24,16 @@ int main (const int argc, char *argv[]) { std::unordered_map parameter { read_parameter(args.parameter_file) }; - - std::random_device rd; std::mt19937_64 rng(rd()); // auto motion = BimodalAngle(1, 1, 2, 30, 0.98, rng); // auto motion = TetrahedralJump(rng); // auto motion = RandomJump(rng); - auto motion = SmallAngle(1, 1, 1, rng); + auto motion = SmallAngle(1, 1, 20, rng); - // auto dist = DeltaDistribution(rng); - auto dist = LogNormalDistribution(1, 2, rng); + auto dist = DeltaDistribution(rng); + // auto dist = LogNormalDistribution(1, 2, rng); if (args.spectrum) { diff --git a/test.py b/test.py index 4bfb0b0..aa4cd76 100644 --- a/test.py +++ b/test.py @@ -8,9 +8,10 @@ import matplotlib.pyplot as plt def run_sims(taus): for tau in taus: + print('tau') with pathlib.Path('./config.txt').open('a') as f: f.write(f'tau={tau}\n') - subprocess.run(['./cmake-build-debug/rwsim', '-ste', './config.txt']) + subprocess.run(['./build/rwsim', '-ste', './config.txt']) def dampening(x: np.ndarray, apod: float) -> np.ndarray: @@ -84,7 +85,7 @@ def post_process_ste(taus): if __name__ == '__main__': - tau_values = np.logspace(-3, -2, 1) + tau_values = np.logspace(-2, -6, 1) lb = 2e3 pulse_length = 2e-6