forked from deepmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread_inp_model.cpp
More file actions
697 lines (686 loc) · 31.2 KB
/
Copy pathread_inp_model.cpp
File metadata and controls
697 lines (686 loc) · 31.2 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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
#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()
{
// NOTE: The order of add_item() calls below determines the parameter order
// in the generated documentation (docs/advanced/input_files/input-main.md).
// Please preserve this ordering when adding new parameters.
// Electric field and dipole correction
{
Input_Item item("efield_flag");
item.annotation = "add electric field";
item.category = "Electric field and dipole correction";
item.type = "Boolean";
item.description = R"(Added the electric field.
* True: A saw-like potential simulating an electric field is added to the bare ionic potential.
* False: Not added the electric field.)";
item.default_value = "False";
item.unit = "";
read_sync_bool(input.efield_flag);
this->add_item(item);
}
{
Input_Item item("dip_cor_flag");
item.annotation = "dipole correction";
item.category = "Electric field and dipole correction";
item.type = "Boolean";
item.description = R"(Added a dipole correction to the bare ionic potential.
* True: A dipole correction is also added to the bare ionic potential.
* False: A dipole correction is not added to the bare ionic potential.
[NOTE] Note: If you do not want any electric field, the parameter efield_amp should be set to zero. This should ONLY be used in a slab geometry for surface calculations, with the discontinuity FALLING IN THE EMPTY SPACE.)";
item.default_value = "False";
item.unit = "";
item.set_availability("efield_flag==true");
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.category = "Electric field and dipole correction";
item.type = "Integer";
item.description = R"(The direction of the electric field or dipole correction is parallel to the reciprocal lattice vector, so the potential is constant in planes defined by FFT grid points, efield_dir can set to 0, 1 or 2.
* 0: parallel to the first reciprocal lattice vector
* 1: parallel to the second reciprocal lattice vector
* 2: parallel to the third reciprocal lattice vector)";
item.default_value = "2";
item.unit = "";
item.set_availability("efield_flag==true");
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";
item.category = "Electric field and dipole correction";
item.type = "Real";
item.description = "Position of the maximum of the saw-like potential along crystal axis efield_dir, within the unit cell, 0 <= efield_pos_max < 1.";
item.default_value = "Autoset to center of vacuum - width of vacuum / 20";
item.unit = "";
item.set_availability("efield_flag==true");
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";
item.category = "Electric field and dipole correction";
item.type = "Real";
item.description = "Zone in the unit cell where the saw-like potential decreases, 0 < efield_pos_dec < 1.";
item.default_value = "Autoset to width of vacuum / 10";
item.unit = "";
item.set_availability("efield_flag==true");
read_sync_double(input.efield_pos_dec);
this->add_item(item);
}
{
Input_Item item("efield_amp");
item.annotation = "amplitude of the electric field";
item.category = "Electric field and dipole correction";
item.type = "Real";
item.description = R"(Amplitude of the electric field. The saw-like potential increases with slope efield_amp in the region from efield_pos_max+efield_pos_dec-1) to (efield_pos_max), then decreases until (efield_pos_max+efield_pos_dec), in units of the crystal vector efield_dir.
[NOTE] Note: The change of slope of this potential must be located in the empty region, or else unphysical forces will result.)";
item.default_value = "0.0";
item.unit = "a.u., 1 a.u. = 51.4220632*10^10 V/m.";
item.set_availability("efield_flag==true");
read_sync_double(input.efield_amp);
this->add_item(item);
}
// Gate field
{
Input_Item item("gate_flag");
item.annotation = "compensating charge or not";
item.category = "Gate field (compensating charge)";
item.type = "Boolean";
item.description = R"(Controls the addition of compensating charge by a charged plate for charged cells.
* true: A charged plate is placed at the zgate position to add compensating charge. The direction is determined by efield_dir.
* false: No compensating charge is added.)";
item.default_value = "false";
item.unit = "";
read_sync_bool(input.gate_flag);
this->add_item(item);
}
{
Input_Item item("zgate");
item.annotation = "position of charged plate";
item.category = "Gate field (compensating charge)";
item.type = "Real";
item.description = "Position of the charged plate in the unit cell";
item.default_value = "0.5";
item.unit = "Unit cell size";
read_sync_double(input.zgate);
this->add_item(item);
}
{
Input_Item item("block");
item.annotation = "add a block potential or not";
item.category = "Gate field (compensating charge)";
item.type = "Boolean";
item.description = R"(Controls the addition of a potential barrier to prevent electron spillover.
* true: A potential barrier is added from block_down to block_up with a height of block_height. If dip_cor_flag is set to true, efield_pos_dec is used to smoothly increase and decrease the potential barrier.
* false: No potential barrier is added.)";
item.default_value = "false";
item.unit = "";
read_sync_bool(input.block);
this->add_item(item);
}
{
Input_Item item("block_down");
item.annotation = "low bound of the block";
item.category = "Gate field (compensating charge)";
item.type = "Real";
item.description = "Lower beginning of the potential barrier";
item.default_value = "0.45";
item.unit = "Unit cell size";
read_sync_double(input.block_down);
this->add_item(item);
}
{
Input_Item item("block_up");
item.annotation = "high bound of the block";
item.category = "Gate field (compensating charge)";
item.type = "Real";
item.description = "Upper beginning of the potential barrier";
item.default_value = "0.55";
item.unit = "Unit cell size";
read_sync_double(input.block_up);
this->add_item(item);
}
{
Input_Item item("block_height");
item.annotation = "height of the block";
item.category = "Gate field (compensating charge)";
item.type = "Real";
item.description = "Height of the potential barrier";
item.default_value = "0.1";
item.unit = "Rydberg";
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";
item.category = "Implicit solvation model";
item.type = "Boolean";
item.description = "Calculate implicit solvation correction";
item.default_value = "False";
item.unit = "";
read_sync_bool(input.imp_sol);
this->add_item(item);
}
{
Input_Item item("eb_k");
item.annotation = "the relative permittivity of the bulk solvent";
item.category = "Implicit solvation model";
item.type = "Real";
item.description = "The relative permittivity of the bulk solvent, 80 for water";
item.default_value = "80";
item.unit = "";
item.set_availability("imp_sol==true");
read_sync_double(input.eb_k);
this->add_item(item);
}
{
Input_Item item("tau");
item.annotation = "the effective surface tension parameter";
item.category = "Implicit solvation model";
item.type = "Real";
item.description = "The effective surface tension parameter that describes the cavitation, the dispersion, and the repulsion interaction between the solute and the solvent which are not captured by the electrostatic terms";
item.default_value = "1.0798e-05";
item.unit = "";
read_sync_double(input.tau);
this->add_item(item);
}
{
Input_Item item("sigma_k");
item.annotation = "the width of the diffuse cavity";
item.category = "Implicit solvation model";
item.type = "Real";
item.description = "The width of the diffuse cavity that is implicitly determined by the electronic structure of the solute";
item.default_value = "0.6";
item.unit = "";
read_sync_double(input.sigma_k);
this->add_item(item);
}
{
Input_Item item("nc_k");
item.annotation = "the cut-off charge density";
item.category = "Implicit solvation model";
item.type = "Real";
item.description = "The value of the electron density at which the dielectric cavity forms";
item.default_value = "0.00037";
item.unit = "";
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 ; d4)";
item.category = "vdW correction";
item.type = "String";
item.description = R"(Specifies the method used for Van der Waals (VdW) correction. Available options are:
* d2: Grimme's D2 dispersion correction method
* d3_0: Grimme's DFT-D3(0) dispersion correction method (zero-damping)
* d3_bj: Grimme's DFTD3(BJ) dispersion correction method (BJ-damping)
* d4: Grimme's DFT-D4 dispersion correction method using the external DFT-D4 library
* none: no vdW correction
[NOTE] ABACUS supports automatic setting of DFT-D3 parameters for common functionals. To benefit from this feature, please specify the parameter dft_functional explicitly, otherwise the autoset procedure will crash. If not satisfied with the built-in parameters, any manual setting on vdw_s6, vdw_s8, vdw_a1 and vdw_a2 will overwrite the automatic values.)";
item.default_value = "none";
item.unit = "";
read_sync_string(input.vdw_method);
this->add_item(item);
}
{
Input_Item item("vdw_d4_xc");
item.annotation = "functional name passed to DFT-D4";
item.category = "vdW correction";
item.type = "String";
item.description = R"(Functional name used to load DFT-D4 damping parameters from the DFT-D4 library.
If set to default, ABACUS infers the functional name from dft_functional or pseudopotential metadata.)";
item.default_value = "default";
item.unit = "";
item.set_availability("vdw_method==d4");
read_sync_string(input.vdw_d4_xc);
this->add_item(item);
}
{
Input_Item item("vdw_d4_model");
item.annotation = "DFT-D4 dispersion model";
item.category = "vdW correction";
item.type = "String";
item.description = R"(DFT-D4 dispersion model used by the external DFT-D4 library.
Available options are:
* d4: standard D4 model
* d4s: smooth D4S model)";
item.default_value = "d4";
item.unit = "";
item.set_availability("vdw_method==d4");
read_sync_string(input.vdw_d4_model);
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.vdw_d4_model != "d4" && para.input.vdw_d4_model != "d4s"
&& para.input.vdw_d4_model != "D4" && para.input.vdw_d4_model != "D4S")
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_d4_model must be d4 or d4s");
}
};
this->add_item(item);
}
{
Input_Item item("vdw_s6");
item.annotation = "scale parameter of d2/d3_0/d3_bj";
item.category = "vdW correction";
item.type = "String";
item.description = "This scale factor is used to optimize the interaction energy deviations in van der Waals (vdW) corrected calculations. The recommended values of this parameter are dependent on the chosen vdW correction method and the DFT functional being used. For DFT-D2, the recommended values are 0.75 (PBE), 1.2 (BLYP), 1.05 (B-P86), 1.0 (TPSS), and 1.05 (B3LYP). If not set, will use values of PBE functional. For DFT-D3, recommended values with different DFT functionals can be found on the here. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value.";
item.default_value = "";
item.unit = "";
item.set_availability("vdw_method in [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.category = "vdW correction";
item.type = "String";
item.description = "This scale factor is relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value.";
item.default_value = "";
item.unit = "";
item.set_availability("vdw_method in [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.category = "vdW correction";
item.type = "String";
item.description = "This damping function parameter is relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value.";
item.default_value = "";
item.unit = "";
item.set_availability("vdw_method in [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.category = "vdW correction";
item.type = "String";
item.description = "This damping function parameter is only relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value.";
item.default_value = "";
item.unit = "";
item.set_availability("vdw_method in [d3_0, 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";
item.category = "vdW correction";
item.type = "Real";
item.description = "Controls the damping rate of the damping function in the DFT-D2 method.";
item.default_value = "20";
item.unit = "";
item.set_availability("vdw_method==d2");
read_sync_double(input.vdw_d);
this->add_item(item);
}
{
Input_Item item("vdw_abc");
item.annotation = "third-order term?";
item.category = "vdW correction";
item.type = "Boolean";
item.description = R"(Determines whether three-body terms are calculated for DFT-D3 methods.
* True: ABACUS will calculate the three-body term.
* False: The three-body term is not included.)";
item.default_value = "False";
item.unit = "";
item.set_availability("vdw_method in [d3_0, d3_bj]");
read_sync_bool(input.vdw_abc);
this->add_item(item);
}
{
Input_Item item("vdw_c6_file");
item.annotation = "filename of C6";
item.category = "vdW correction";
item.type = "String";
item.description = R"(Specifies the name of the file containing parameters for each element when using the D2 method. If not set, ABACUS uses the default parameters (Jnm6/mol) stored in the program. To manually set the parameters, provide a file containing the parameters. An example is given by:
H 0.1 Si 9.0
Namely, each line contains the element name and the corresponding parameter.)";
item.default_value = "default";
item.unit = "";
item.set_availability("vdw_method==d2");
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";
item.category = "vdW correction";
item.type = "String";
item.description = R"(Specifies the unit of the provided parameters in the D2 method. Available options are:
* Jnm6/mol (J nm^6/mol)
* eVA (eV Angstrom))";
item.default_value = "Jnm6/mol";
item.unit = "";
item.set_availability("vdw_method==d2 and vdw_c6_file!=default");
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";
item.category = "vdW correction";
item.type = "String";
item.description = R"(Specifies the name of the file containing parameters for each element when using the D2 method. If not set, ABACUS uses the default parameters (Angstrom) stored in the program. To manually set the parameters, provide a file containing the parameters. An example is given by:
Li 1.0 Cl 2.0
Namely, each line contains the element name and the corresponding parameter.)";
item.default_value = "default";
item.unit = "";
item.set_availability("vdw_method==d2");
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";
item.category = "vdW correction";
item.type = "String";
item.description = R"(Specifies the unit for the parameters in the D2 method when manually set by the user. Available options are:
* A (Angstrom)
* Bohr)";
item.default_value = "A";
item.unit = "";
item.set_availability("vdw_method==d2 and vdw_r0_file!=default");
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.category = "vdW correction";
item.type = "String";
item.description = R"(Determines the method used for specifying the cutoff radius in periodic systems when applying Van der Waals correction. Available options are:
* radius: The supercell is selected within a sphere centered at the origin with a radius defined by vdw_cutoff_radius.
* period: The extent of the supercell is explicitly specified using the vdw_cutoff_period keyword.)";
item.default_value = "radius";
item.unit = "";
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.category = "vdW correction";
item.type = "String";
item.description = "Defines the radius of the cutoff sphere when vdw_cutoff_type is set to radius. The default values depend on the chosen vdw_method.";
item.default_value = "";
item.unit = "defined by vdw_radius_unit (default Bohr)";
item.set_availability("vdw_cutoff_type==radius");
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 if (para.input.vdw_method == "d4")
{
// DFT-D4 uses separate real-space cutoffs internally.
// This input controls the two-body cutoff; the wrapper keeps
// the three-body cutoff at min(40 Bohr, vdw_cutoff_radius).
para.input.vdw_cutoff_radius = "60";
}
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";
item.category = "vdW correction";
item.type = "String";
item.description = R"(Specify the unit of vdw_cutoff_radius. Available options are:
* A(Angstrom)
* Bohr)";
item.default_value = "Bohr";
item.unit = "";
item.set_availability("vdw_cutoff_type==radius");
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_cutoff_width2");
item.annotation = "smooth cutoff width for two-body dispersion";
item.category = "vdW correction";
item.type = "Real";
item.description = R"(Width of the smooth switching region for the two-body pairwise dispersion real-space cutoff.
A value of zero disables smoothing for the two-body contribution.)";
item.default_value = "0.05";
item.unit = "Bohr";
item.set_availability("vdw_method==d4");
read_sync_double(input.vdw_cutoff_width2);
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.vdw_cutoff_width2 < 0.0)
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_cutoff_width2 must be non-negative");
}
};
this->add_item(item);
}
{
Input_Item item("vdw_cutoff_width3");
item.annotation = "smooth cutoff width for three-body dispersion";
item.category = "vdW correction";
item.type = "Real";
item.description = R"(Width of the smooth switching region for the three-body Axilrod-Teller-Muto (ATM) dispersion real-space cutoff.
A value of zero disables smoothing for the three-body contribution.)";
item.default_value = "0.05";
item.unit = "Bohr";
item.set_availability("vdw_method==d4");
read_sync_double(input.vdw_cutoff_width3);
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.vdw_cutoff_width3 < 0.0)
{
ModuleBase::WARNING_QUIT("ReadInput", "vdw_cutoff_width3 must be non-negative");
}
};
this->add_item(item);
}
{
Input_Item item("vdw_cutoff_period");
item.annotation = "periods of periodic structure";
item.category = "vdW correction";
item.type = "Integer Integer Integer";
item.description = "The three integers supplied here explicitly specify the extent of the supercell in the directions of the three basis lattice vectors.";
item.default_value = "3 3 3";
item.unit = "";
item.set_availability("vdw_cutoff_type==period");
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);
}
{
Input_Item item("vdw_cn_thr");
item.annotation = "radius cutoff for cn";
item.category = "vdW correction";
item.type = "Real";
item.description = "The cutoff radius when calculating coordination numbers.";
item.default_value = "40";
item.unit = "defined by vdw_cn_thr_unit (default: Bohr)";
item.set_availability("vdw_method in [d3_0, d3_bj, d4]");
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (!item.is_read() && para.input.vdw_method == "d4")
{
// DFT-D4 library default for coordination numbers.
para.input.vdw_cn_thr = 30.0;
}
};
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";
item.category = "vdW correction";
item.type = "String";
item.description = R"(Unit of the coordination number cutoff (vdw_cn_thr). Available options are:
* A(Angstrom)
* Bohr)";
item.default_value = "Bohr";
item.unit = "";
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);
}
}
} // namespace ModuleIO