-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdsl.hpp
111 lines (76 loc) · 3.49 KB
/
dsl.hpp
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
Copyright (c) 2013 Tobias Brink
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DSL_HPP
#define DSL_HPP
#include <vector>
#include <map>
#include <string>
#include <memory>
#include "core.hpp"
namespace mytest {
/** Tokenize, splitting at spaces. */
std::vector<std::string> tokenize(const std::string& input);
/** Parse and execute a line of a simple command language.
The language simply consist of a statement per line. The first
word is always the subroutine to be executed followed by space
separated arguments.
Commands:
box <name> <lattice> <lattice constant> <cubic?>
<repeat_a> <repeat_b> <repeat_c>
<periodic_a?> <periodic_b?> <periodic_c?>
<neighbor_mode>
<type1> [<type2> [<type3> [...]]]
Initialize a Box object.
model <name> <box> <modelname>
Initialize a Compute object.
compute <model_name>
Calculates and prints energy and stress (from virial) if
supported.
optimize_box <model_name> [<isotropic?>]
Optimize box vector lengths and print new lattice vectors, as
well as energy and stress. Default for isotropic is false.
optimize_positions <model_name>
Optimize atomic positions and print energy and stress.
bulk_modulus_energy <model_name> <max_strain>
[<c_to_a?> [<b_to_a?> [<positions>
[<angle_ab?> [<angle_ac?> [<angle_bc>]]]]]]
Calculate bulk modulus using energy-volume curves. Print E0,
V0, B0, B0'.
bulk_modulus_pressure <model_name> <max_strain>
[<c_to_a?> [<b_to_a?> [<positions?>
[<angle_ab?> [<angle_ac?> [<angle_bc?>]]]]]]
Calculate bulk modulus using pressure-volume curves. Print
V0, B0, B0'.
stiffness_tensor <model_name> <max_strain> <positions?>
Calculate and print all elastic constants c_ij.
switch_boxes <model1_name> <model2_name>
Switch boxes of both Compute objects.
change_box <model_name> <box_name>
Change box in computer to a new box.
scale <model_name> <factor_a> [<factor_b> <factor_c>]
Scale box by given factor(s).
Arguments with a question mark are booleans, denoted using
"true"/"false".
*/
void parse(std::string command,
std::map< std::string,std::unique_ptr<Box> >& boxes,
std::map<std::string,Compute>& computes);
}
#endif /* DSL_HPP */