-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParseSimulationInputParameters.m
45 lines (38 loc) · 1.45 KB
/
ParseSimulationInputParameters.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function [SAVEDIR, NAME, MODEL, INTEGRATOR, THERMOSTAT, TRACKERS, dt, CONDITION, MODE, NAMINGCONVENTION, useGpu] = ParseSimulationInputParameters(varargin)
Globals.includeSubfolders();
In = Utility.InputParser()...
.addLogical("GPU", false) ...
.parse(varargin{:});
useGpu = In.GPU;
Globals.VerbosityLevel('debug');
Options.usingGpuComputation(In.GPU);
rng('shuffle', 'twister');
In = Utility.InputParser()...
.addString("SAVEDIR") ...
.addString("NAME") ...
.addObject("MODEL", "IModel") ...
.addObject("INTEGRATOR", "IIntegrator") ...
.addObject("THERMOSTAT", "IThermostat") ...
.addObject("POTENTIAL", "IPotential", []) ...
.addString("TRACKERS") ...
.addFloat("DT") ...
.addObject("UNTIL", "ISimulationCondition") ...
.addString("NAMINGCONVENTION") ...
.addString("MODE", "run") ...
.parse(varargin{:});
dt = In.DT;
NAME = In.NAME;
MODEL = In.MODEL;
INTEGRATOR = In.INTEGRATOR;
THERMOSTAT = In.THERMOSTAT;
SAVEDIR = In.SAVEDIR;
CONDITION = In.UNTIL;
NAMINGCONVENTION = In.NAMINGCONVENTION;
% There are 3 Modes: "new run", "equillibrate", "test run", "continue run"
MODE = In.MODE;
if ~isempty(In.POTENTIAL)
MODEL.Potential = In.POTENTIAL;
end
if ~isfolder(SAVEDIR); mkdir(SAVEDIR); end
TRACKERS = eval(sprintf("{%s}", In.TRACKERS));
end