Repository navigation
Expand file tree
/
Copy pathread_input_item_model.cpp
More file actions
375 lines (371 loc) · 13 KB
/
Copy pathread_input_item_model.cpp
File metadata and controls
375 lines (371 loc) · 13 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
#include "source_base/global_function.h"
#include "source_base/tool_quit.h"
#include "read_input.h"
#include "read_input_tool.h"
namespace ModuleIO
{
void ReadInput::item_model()
{
// Electric field and dipole correction
{
Input_Item item("efield_flag");
item.annotation = "add electric field";
read_sync_bool(input.efield_flag);
this->add_item(item);
}
{
Input_Item item("dip_cor_flag");
item.annotation = "dipole correction";
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.dip_cor_flag && !para.input.efield_flag)
{
ModuleBase::WARNING_QUIT("ReadInput", "dipole correction is not active if efield_flag=false !");
}
};
read_sync_bool(input.dip_cor_flag);
this->add_item(item);
}
{
Input_Item item("efield_dir");
item.annotation = "the direction of the electric field or dipole correction";
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.gate_flag && para.input.efield_flag && !para.input.dip_cor_flag)
{
ModuleBase::WARNING_QUIT("ReadInput",
"gate field cannot be used with "
"efield if dip_cor_flag=false !");
}
};
read_sync_int(input.efield_dir);
this->add_item(item);
}
{
Input_Item item("efield_pos_max");
item.annotation = "position of the maximum of the saw-like potential "
"along crystal axis efield_dir";
read_sync_double(input.efield_pos_max);
this->add_item(item);
}
{
Input_Item item("efield_pos_dec");
item.annotation = "zone in the unit cell where the saw-like potential decreases";
read_sync_double(input.efield_pos_dec);
this->add_item(item);
}
{
Input_Item item("efield_amp");
item.annotation = "amplitude of the electric field";
read_sync_double(input.efield_amp);
this->add_item(item);
}
// Gate field
{
Input_Item item("gate_flag");
item.annotation = "compensating charge or not";
read_sync_bool(input.gate_flag);
this->add_item(item);
}
{
Input_Item item("zgate");
item.annotation = "position of charged plate";
read_sync_double(input.zgate);
this->add_item(item);
}
{
Input_Item item("block");
item.annotation = "add a block potential or not";
read_sync_bool(input.block);
this->add_item(item);
}
{
Input_Item item("block_down");
item.annotation = "low bound of the block";
read_sync_double(input.block_down);
this->add_item(item);
}
{
Input_Item item("block_up");
item.annotation = "high bound of the block";
read_sync_double(input.block_up);
this->add_item(item);
}
{
Input_Item item("block_height");
item.annotation = "height of the block";
read_sync_double(input.block_height);
this->add_item(item);
}
// imlicit_solvation
{
Input_Item item("imp_sol");
item.annotation = "calculate implicit solvation correction or not";
read_sync_bool(input.imp_sol);
this->add_item(item);
}
{
Input_Item item("eb_k");
item.annotation = "the relative permittivity of the bulk solvent";
read_sync_double(input.eb_k);
this->add_item(item);
}
{
Input_Item item("tau");
item.annotation = "the effective surface tension parameter";
read_sync_double(input.tau);
this->add_item(item);
}
{
Input_Item item("sigma_k");
item.annotation = "the width of the diffuse cavity";
read_sync_double(input.sigma_k);
this->add_item(item);
}
{
Input_Item item("nc_k");
item.annotation = "the cut-off charge density";
read_sync_double(input.nc_k);
this->add_item(item);
}
// vdW Correction
{
Input_Item item("vdw_method");
item.annotation = "the method of calculating vdw (none ; d2 ; d3_0 ; d3_bj";
read_sync_string(input.vdw_method);
this->add_item(item);
}
{
Input_Item item("vdw_s6");
item.annotation = "scale parameter of d2/d3_0/d3_bj";
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.vdw_s6 == "default")
{
if (para.input.vdw_method == "d2")
{
para.input.vdw_s6 = "0.75";
}
// else if (para.input.vdw_method == "d3_0" || para.input.vdw_method == "d3_bj")
// {
// para.input.vdw_s6 = "1.0";
// }
}
};
read_sync_string(input.vdw_s6);
this->add_item(item);
}
{
Input_Item item("vdw_s8");
item.annotation = "scale parameter of d3_0/d3_bj";
item.reset_value = [](const Input_Item& item, Parameter& para) {
// if (para.input.vdw_s8 == "default")
// {
// if (para.input.vdw_method == "d3_0")
// {
// para.input.vdw_s8 = "0.722";
// }
// else if (para.input.vdw_method == "d3_bj")
// {
// para.input.vdw_s8 = "0.7875";
// }
// }
};
read_sync_string(input.vdw_s8);
this->add_item(item);
}
{
Input_Item item("vdw_a1");
item.annotation = "damping parameter of d3_0/d3_bj";
item.reset_value = [](const Input_Item& item, Parameter& para) {
// if (para.input.vdw_a1 == "default")
// {
// if (para.input.vdw_method == "d3_0")
// {
// para.input.vdw_a1 = "1.217";
// }
// else if (para.input.vdw_method == "d3_bj")
// {
// para.input.vdw_a1 = "0.4289";
// }
// }
};
read_sync_string(input.vdw_a1);
this->add_item(item);
}
{
Input_Item item("vdw_a2");
item.annotation = "damping parameter of d3_bj";
item.reset_value = [](const Input_Item& item, Parameter& para) {
// if (para.input.vdw_a2 == "default")
// {
// if (para.input.vdw_method == "d3_0")
// {
// para.input.vdw_a2 = "1.0";
// }
// else if (para.input.vdw_method == "d3_bj")
// {
// para.input.vdw_a2 = "4.4407";
// }
// }
};
read_sync_string(input.vdw_a2);
this->add_item(item);
}
{
Input_Item item("vdw_d");
item.annotation = "damping parameter of d2";
read_sync_double(input.vdw_d);
this->add_item(item);
}
{
Input_Item item("vdw_abc");
item.annotation = "third-order term?";
read_sync_bool(input.vdw_abc);
this->add_item(item);
}
{
Input_Item item("vdw_c6_file");
item.annotation = "filename of C6";
read_sync_string(input.vdw_C6_file);
this->add_item(item);
}
{
Input_Item item("vdw_c6_unit");
item.annotation = "unit of C6, Jnm6/mol or eVA6";
read_sync_string(input.vdw_C6_unit);
item.check_value = [](const Input_Item& item, const Parameter& para) {
if ((para.input.vdw_C6_unit != "Jnm6/mol") && (para.input.vdw_C6_unit != "eVA6"))
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_C6_unit must be Jnm6/mol or eVA6");
}
};
this->add_item(item);
}
{
Input_Item item("vdw_r0_file");
item.annotation = "filename of R0";
read_sync_string(input.vdw_R0_file);
this->add_item(item);
}
{
Input_Item item("vdw_r0_unit");
item.annotation = "unit of R0, A or Bohr";
read_sync_string(input.vdw_R0_unit);
item.check_value = [](const Input_Item& item, const Parameter& para) {
if ((para.input.vdw_R0_unit != "A") && (para.input.vdw_R0_unit != "Bohr"))
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_R0_unit must be A or Bohr");
}
};
this->add_item(item);
}
{
Input_Item item("vdw_cutoff_type");
item.annotation = "expression model of periodic structure, radius or period";
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.vdw_cutoff_type != "radius" && para.input.vdw_cutoff_type != "period")
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_cutoff_type must be radius or period");
}
};
read_sync_string(input.vdw_cutoff_type);
this->add_item(item);
}
{
Input_Item item("vdw_cutoff_radius");
item.annotation = "radius cutoff for periodic structure";
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.vdw_cutoff_radius == "default")
{
if (para.input.vdw_method == "d2")
{
para.input.vdw_cutoff_radius = "56.6918";
}
else if (para.input.vdw_method == "d3_0" || para.input.vdw_method == "d3_bj")
{
para.input.vdw_cutoff_radius = "95";
}
else
{
para.input.vdw_cutoff_radius = "0";
}
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (std::stod(para.input.vdw_cutoff_radius) <= 0 && para.input.vdw_method != "none")
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_cutoff_radius <= 0 is not allowd");
}
};
read_sync_string(input.vdw_cutoff_radius);
this->add_item(item);
}
{
Input_Item item("vdw_radius_unit");
item.annotation = "unit of radius cutoff for periodic structure";
read_sync_string(input.vdw_radius_unit);
item.check_value = [](const Input_Item& item, const Parameter& para) {
if ((para.input.vdw_radius_unit != "A") && (para.input.vdw_radius_unit != "Bohr"))
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_radius_unit must be A or Bohr");
}
};
this->add_item(item);
}
{
Input_Item item("vdw_cn_thr");
item.annotation = "radius cutoff for cn";
read_sync_double(input.vdw_cn_thr);
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.vdw_cn_thr <= 0)
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_cn_thr <= 0 is not allowd");
}
};
this->add_item(item);
}
{
Input_Item item("vdw_cn_thr_unit");
item.annotation = "unit of cn_thr, Bohr or Angstrom";
read_sync_string(input.vdw_cn_thr_unit);
item.check_value = [](const Input_Item& item, const Parameter& para) {
if ((para.input.vdw_cn_thr_unit != "A") && (para.input.vdw_cn_thr_unit != "Bohr"))
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_cn_thr_unit must be A or Bohr");
}
};
this->add_item(item);
}
{
Input_Item item("vdw_cutoff_period");
item.annotation = "periods of periodic structure";
item.read_value = [](const Input_Item& item, Parameter& para) {
size_t count = item.get_size();
if (count == 3)
{
para.input.vdw_cutoff_period[0] = std::stoi(item.str_values[0]);
para.input.vdw_cutoff_period[1] = std::stoi(item.str_values[1]);
para.input.vdw_cutoff_period[2] = std::stoi(item.str_values[2]);
}
else
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_cutoff_period should have 3 values");
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.vdw_cutoff_period[0] <= 0 || para.input.vdw_cutoff_period[1] <= 0
|| para.input.vdw_cutoff_period[2] <= 0)
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_cutoff_period should be positive");
}
};
item.get_final_value = [](Input_Item& item, const Parameter& para) {
item.final_value << para.input.vdw_cutoff_period[0] << " " << para.input.vdw_cutoff_period[1] << " "
<< para.input.vdw_cutoff_period[2];
};
#ifdef __MPI
bcastfuncs.push_back(
[](Parameter& para) { Parallel_Common::bcast_int((int*)¶.input.vdw_cutoff_period, 3); });
#endif
this->add_item(item);
}
}
} // namespace ModuleIO