forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 245
Expand file tree
/
Copy pathread_inp_out.cpp
More file actions
1743 lines (1716 loc) · 99.7 KB
/
Copy pathread_inp_out.cpp
File metadata and controls
1743 lines (1716 loc) · 99.7 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
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "source_base/formatter.h"
#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_output()
{
// 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.
{
Input_Item item("out_freq_ion");
item.annotation = "print information every few ionic steps";
item.category = "Output information";
item.type = "Integer";
item.description = "Controls the output interval in ionic steps. When set to a positive integer, information such as charge density, local potential, electrostatic potential, Hamiltonian matrix, overlap matrix, density matrix, Mulliken population analysis, and structure files (STRU{istep} or STRU{istep}.cif, when out_stru is 1 or 2) is printed every n ionic steps."
"\n\n[NOTE] In RT-TDDFT calculations, this parameter is inactive; output frequency is instead controlled by out_freq_td.";
item.default_value = "0";
item.unit = "";
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.out_freq_ion <= 0)
{
para.input.out_freq_ion = 0; // 0 means no output of info
}
};
read_sync_int(input.out_freq_ion);
this->add_item(item);
}
{
Input_Item item("out_freq_td");
item.annotation = "print information every few completed electronic iterations in RT-TDDFT";
item.category = "Output information";
item.type = "Integer";
item.description = "Controls the output interval in completed electronic evolution steps during RT-TDDFT calculations. When set to a positive integer n, detailed information (see out_freq_ion) is printed every n electron time-evolution steps (i.e., every STEP OF ELECTRON EVOLVE). For example, if you wish to output information once per ionic step, you should set out_freq_td equal to estep_per_md, since one ionic step corresponds to estep_per_md electronic evolution steps."
"\n\n[NOTE] This parameter is only active in RT-TDDFT mode (esolver_type = tddft). It has no effect in ground-state calculations.";
item.default_value = "0";
item.unit = "";
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.out_freq_td <= 0)
{
para.input.out_freq_td = 0; // 0 means no output of info
}
};
read_sync_int(input.out_freq_td);
this->add_item(item);
}
{
Input_Item item("out_freq_elec");
item.annotation = "print information every few electronic steps";
item.category = "Output information";
item.type = "Integer";
item.description = "Output the charge density (only binary format, controlled by out_chg), wavefunction (controlled by out_wfc_pw) per out_freq_elec electronic iterations. Note that they are always output when converged or reach the maximum iterations scf_nmax.";
item.default_value = "scf_nmax";
item.unit = "";
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.out_freq_elec <= 0)
{
para.input.out_freq_elec = para.input.scf_nmax;
}
};
read_sync_int(input.out_freq_elec);
this->add_item(item);
}
{
Input_Item item("out_chg");
item.annotation = "> 0 output charge density for selected electron steps"
", second parameter controls the precision, default is 3.";
item.category = "Output information";
item.type = R"(Integer \[Integer\](optional))";
item.description = R"(The first integer controls whether to output the charge density on real space grids:
- 1: Output the charge density (in Bohr^-3) on real space grids into the density files in the folder `OUT.${suffix}`. The files are named as:
- nspin = 1: `chg.cube`;
- nspin = 2: `chgs1.cube`, and `chgs2.cube`;
- nspin = 4: `chgs1.cube`, `chgs2.cube`, `chgs3.cube`, and `chgs4.cube`;
- When using the Meta-GGA functional, additional files containing the kinetic energy density are also output:
- nspin = 1: `tau.cube`;
- nspin = 2: `taus1.cube`, and `taus2.cube`;
- nspin = 4: `taus1.cube`, `taus2.cube`, `taus3.cube`, and `taus4.cube`;
- 2: On top of 1, also output the initial charge density files. The files are named as:
- out_freq_ion = 0:
- nspin = 1: `chg_ini.cube`;
- nspin = 2: `chgs1_ini.cube` and `chgs2_ini.cube`;
- nspin = 4: `chgs1_ini.cube`, `chgs2_ini.cube`, `chgs3_ini.cube`, and `chgs4_ini.cube`;
- output at every step (overwrite same file)
- out_freq_ion > 0:
- nspin = 1: `chgg{geom_step}_ini.cube` (e.g., `chgg1_ini.cube`);
- nspin = 2: `chgs1g{geom_step}_ini.cube` and `chgs2g{geom_step}_ini.cube`;
- nspin = 4: `chgs1g{geom_step}_ini.cube`, `chgs2g{geom_step}_ini.cube`, `chgs3g{geom_step}_ini.cube`, and `chgs4g{geom_step}_ini.cube`.
- output every out_freq_ion steps
Here, {geom_step} denotes the geometry step index, starting from 1 (geom_step = istep + 1).
- -1: Disable the charge density auto-back-up file `{suffix}-CHARGE-DENSITY.restart`, useful for large systems.
The second integer controls the precision of the charge density output. If not given, `3` is used as default. For restarting from this file and other high-precision calculations, `10` is recommended.
In molecular dynamics simulations, the output frequency is controlled by out_freq_ion.
[NOTE] In the 3.10-LTS version, the file names are SPIN1_CHG.cube and SPIN1_CHG_INI.cube, etc.)";
item.default_value = "0 3";
item.unit = "";
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_chg needs at least 1 value");
para.input.out_chg[0] = std::stoi(item.str_values[0]);
para.input.out_chg[1] = 3;
if (count >= 2) try { para.input.out_chg[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) { /* do nothing */ }
catch (const std::out_of_range&) {/* do nothing */}
};
// reset value in some special case
item.reset_value = [](const Input_Item& item, Parameter& para) {
para.input.out_chg[0] = (para.input.calculation == "get_wf" || para.input.calculation == "get_pchg")
? 1
: para.input.out_chg[0];
};
sync_intvec(input.out_chg, 2, 0);
this->add_item(item);
}
{
Input_Item item("out_pot");
item.annotation = "output real space potential (with precision 8)";
item.category = "Output information";
item.type = R"(Integer \[Integer\](optional))";
item.description = R"(* 1: Output the total local potential (i.e., local pseudopotential + Hartree potential + XC potential + external electric field (if exists) + dipole correction potential (if exists) + ...) on real space grids (in Ry) into files in the folder OUT.{suffix}. The files are named as:
* nspin = 1: pots1.cube;
* nspin = 2: pots1.cube and pots2.cube;
* nspin = 4: pots1.cube, pots2.cube, pots3.cube, and pots4.cube
* 2: Output the electrostatic potential on real space grids into OUT.{suffix}/pot_es.cube. The Python script named tools/02_postprocessing/average_pot/aveElecStatPot.py can be used to calculate the average electrostatic potential along the z-axis and outputs it into ElecStaticPot_AVE. Please note that the total local potential refers to the local component of the self-consistent potential, excluding the non-local pseudopotential. The distinction between the local potential and the electrostatic potential is as follows: local potential = electrostatic potential + XC potential.
* 3: Apart from 1, also output the total local potential of the initial charge density. The files are named as:
* out_freq_ion = 0:
* nspin = 1: `pot_ini.cube`;
* nspin = 2: `pots1_ini.cube` and `pots2_ini.cube`;
* nspin = 4: `pots1_ini.cube`, `pots2_ini.cube`, `pots3_ini.cube`, and `pots4_ini.cube`;
* output at every step (overwrite same file)
* out_freq_ion > 0:
* nspin = 1: `potg{geom_step}_ini.cube` (e.g., `potg1_ini.cube`);
* nspin = 2: `pots1g{geom_step}_ini.cube` and `pots2g{geom_step}_ini.cube`;
* nspin = 4: `pots1g{geom_step}_ini.cube`, `pots2g{geom_step}_ini.cube`, `pots3g{geom_step}_ini.cube`, and `pots4g{geom_step}_ini.cube`.
* output every out_freq_ion steps
Here, {geom_step} denotes the geometry step index, starting from 1 (geom_step = istep + 1).
The optional second integer controls the output precision. If not provided, the default precision is 8.
In molecular dynamics calculations, the output frequency is controlled by out_freq_ion.
[NOTE] In the 3.10-LTS version, the file names are SPIN1_POT.cube and SPIN1_POT_INI.cube, etc.)";
item.default_value = "0";
item.unit = "";
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_pot needs at least 1 value");
para.input.out_pot[0] = std::stoi(item.str_values[0]);
para.input.out_pot[1] = 8;
if (count >= 2) try { para.input.out_pot[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) { /* do nothing */ }
catch (const std::out_of_range&) {/* do nothing */}
};
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.calculation == "get_wf" || para.input.calculation == "get_pchg")
{
para.input.out_pot[0] = 0;
}
};
sync_intvec(input.out_pot, 2, 0);
this->add_item(item);
}
{
Input_Item item("out_dmk");
item.annotation = ">0 output density matrix DM(k) for each k-point";
item.category = "Output information";
item.type = R"(Boolean \[Integer\](optional))";
item.description = R"(Whether to output the density matrix for each k-point into files in the folder OUT.${suffix}. For current develop versions, out_dmk writes *_nao.txt files and includes a g{istep} index in the file name:
* For gamma only case:
* nspin = 1 and 4: dmg1_nao.txt;
* nspin = 2: dms1g1_nao.txt and dms2g1_nao.txt for the two spin channels.
* For multi-k points case:
* nspin = 1 and 4: dmk1g1_nao.txt, dmk2g1_nao.txt, ...;
* nspin = 2: dmk1s1g1_nao.txt... and dmk1s2g1_nao.txt... for the two spin channels.
Here, g{istep} denotes the geometry/step index in the output file name.
[NOTE] Version difference (develop vs 3.10-LTS):
* In develop, out_dmk supports both gamma-only and multi-k-point density-matrix output.
* In 3.10-LTS, the corresponding keyword is out_dm, and the output files are SPIN1_DM and SPIN2_DM, etc.)";
item.default_value = "False";
item.unit = "";
item.set_availability("basis_type==lcao");
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_dmk needs at least 1 value");
para.input.out_dmk[0] = assume_as_boolean(item.str_values[0]);
para.input.out_dmk[1] = 8;
if (count >= 2) try { para.input.out_dmk[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) { /* do nothing */ }
catch (const std::out_of_range&) {/* do nothing */}
};
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.calculation == "get_wf" || para.input.calculation == "get_pchg")
{
para.input.out_dmk[0] = 0;
}
};
sync_intvec(input.out_dmk, 2, 0);
this->add_item(item);
}
{
Input_Item item("out_dmr");
item.annotation = "output density matrix DM(R) with respect to lattice vector R (with precision 8)";
item.category = "Output information";
item.type = R"(Boolean \[Integer\](optional))";
item.description = R"(Whether to output the density matrix with Bravias lattice vector R index into files in the folder OUT.${suffix}. The files are named as dmr{s}{spin index}{g}{geometry index}{_nao} + {".csr"}. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and the sparse matrix format 'csr' is mentioned in out_hsr. Finally, if out_app_flag is set to false, the file name contains the optional 'g' index for each ionic step that may have different geometries, and if out_app_flag is set to true, the density matrix with respect to Bravias lattice vector R accumulates during ionic steps:
* nspin = 1: dmrs1_nao.csr;
* nspin = 2: dmrs1_nao.csr and dmrs2_nao.csr for the two spin channels.
[NOTE] In the 3.10-LTS version, the parameter is named out_dm1, and the file names are data-DMR-sparse_SPIN0.csr and data-DMR-sparse_SPIN1.csr, etc.)";
item.default_value = "False";
item.unit = "";
item.set_availability("basis_type==lcao and gamma_only==0");
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_dmr needs at least 1 value");
para.input.out_dmr[0] = assume_as_boolean(item.str_values[0]);
para.input.out_dmr[1] = 8;
if (count >= 2) try { para.input.out_dmr[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) { /* do nothing */ }
catch (const std::out_of_range&) {/* do nothing */}
};
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.calculation == "get_wf" || para.input.calculation == "get_pchg")
{
para.input.out_dmr[0] = 0;
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.sys.gamma_only_local == true && para.input.out_dmr[0])
{
ModuleBase::WARNING_QUIT("ReadInput", "out_dmr is only valid for multi-k calculation");
}
};
sync_intvec(input.out_dmr, 2, 0);
this->add_item(item);
}
{
Input_Item item("out_wfc_pw");
item.annotation = "output wave functions";
item.category = "Output information";
item.type = "Integer";
item.description = R"(Whether to output the electronic wavefunction coefficients into files and store them in the folder OUT.${suffix}. The files are named as wf{k}{k-point index}{s}{spin index}{g}{geometry index}{e}{electronic iteration index}{_pw} + {".txt"/".dat"}. Here, the s index refers to spin but the label will not show up for non-spin-polarized calculations, where s1 means spin up channel while s2 means spin down channel, and s4 refers to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled. For scf or nscf calculations, g index will not appear, but the g index appears for geometry relaxation and molecular dynamics, where one can use the out_freq_ion command to control. To print out the electroinc wave functions every few SCF iterations, use the out_freq_elec command and the e index will appear in the file name.
* 0: no output
* 1: (txt format)
* non-gamma-only with nspin=1: wfk1_pw.txt, wfk2_pw.txt, ...;
* non-gamma-only with nspin=2: wfk1s1_pw.txt, wfk1s2_pw.txt, wfk2s1_pw.txt, wfk2s2_pw.txt, ...;
* non-gamma-only with nspin=4: wfk1s4_pw.txt, wfk2s4_pw.txt, ...;
* 2: (binary format)
* non-gamma-only with nspin=1: wfk1_pw.dat, wfk2_pw.dat, ...;
* non-gamma-only with nspin=2: wfk1s1_pw.dat, wfk1s2_pw.dat, wfk2s1_pw.dat, wfk2s2_pw.dat, ...;
* non-gamma-only with nspin=4: wfk1s4_pw.dat, wfk2s4_pw.dat, ...;
[NOTE] In the 3.10-LTS version, the file names are WAVEFUNC1.dat, WAVEFUNC2.dat, etc.)";
item.default_value = "0";
item.unit = "";
item.set_availability("basis_type==pw or (basis_type==lcao and calculation==get_wf)");
read_sync_int(input.out_wfc_pw);
this->add_item(item);
}
{
Input_Item item("out_wfc_lcao");
item.annotation = "ouput LCAO wave functions, 0, no output 1: text, 2: binary";
item.category = "Output information";
item.type = "Integer";
item.description = R"(Whether to output the electronic wavefunction coefficients into files and store them in the folder OUT.${suffix}. The files are named as wf{s}{spin index}{k(optional)}{k-point index}{g(optional)}{geometry index1}{_nao} + {".txt"/".dat"}. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and 's12' refer to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled. In addition, if 'gamma_only' is set to 0, then the optinoal k-point sampling index appears with the k-point index attached to the electronic wave function file names. Finally, if out_app_flag is set to false, the file name contains the optional 'g' index for each ionic step that may have different geometries, and if out_app_flag is set to true, the wave functions accumulate during ionic steps. If the out_app_flag is set to false, a new folder named WFC will be created, and the wave function files will be saved into it.
* 0: no output
* 1: (txt format)
* gamma-only: wfs1_nao.txt or wfs2_nao.txt, ...;
* non-gamma-only: wfs1k1_nao.txt or wfs1k2_nao.txt, ...;
* 2: (binary format)
* gamma-only: wfs1_nao.dat or wfs2_nao.dat, ...;
* non-gamma-only: wfs1k1_nao.dat or wfs1k2_nao.dat, ....
The corresponding sequence of the orbitals can be seen in Basis Set.
Also controled by out_freq_ion and out_app_flag.
[NOTE] In the 3.10-LTS version, the file names are WFC_NAO_GAMMA1_ION1.txt and WFC_NAO_K1_ION1.txt, etc.)";
item.default_value = "0";
item.unit = "";
item.set_availability("basis_type==lcao");
read_sync_int(input.out_wfc_lcao);
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.qo_switch)
{
para.input.out_wfc_lcao = 1;
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.out_wfc_lcao < 0 || para.input.out_wfc_lcao > 2)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_wfc_lcao should be 0, 1, or 2");
}
if (para.input.basis_type != "lcao" && para.input.out_wfc_lcao != 0)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_wfc_lcao is only available for basis_type = lcao");
}
};
this->add_item(item);
}
{
Input_Item item("out_dos");
item.annotation = "output energy and dos";
item.category = "Output information";
item.type = "Integer";
item.description = R"(Whether to output the density of states (DOS). For more information, refer to the dos.md.
* 0: no output
* 1: output the density of states (DOS)
* nspin=1 or 4: doss1g{geom}_{basis}.txt, where geom is the geometry index when cell changes or ions move while basis is either pw or nao.
* nspin=2: doss1g{geom}_{basis}.txt and doss2g{geom}_{basis}.txt for two spin channles.
* 2: (LCAO) output the density of states (DOS) and the projected density of states (PDOS)
* 3: output the Fermi surface file (fermi.bxsf) in BXSF format that can be visualized by XCrySDen)";
item.default_value = "0";
item.unit = "";
read_sync_int(input.out_dos);
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.calculation == "get_wf" || para.input.calculation == "get_pchg")
{
para.input.out_dos = 0;
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.out_dos == 3 && para.input.symmetry == "1")
{
ModuleBase::WARNING_QUIT("ReadInput",
"symmetry can't be used for out_dos==3(Fermi Surface "
"Plotting) by now.");
}
if (para.input.basis_type == "pw" && para.input.out_dos == 3)
{
ModuleBase::WARNING_QUIT("ReadInput",
"Fermi Surface Plotting not "
"implemented for plane wave now.");
}
};
this->add_item(item);
}
{
Input_Item item("out_ldos");
item.annotation = "output mode of local density of states, second parameter controls the precision";
item.category = "Output information";
item.type = R"(Integer \[Integer\](optional))";
item.description = R"(Whether to output the local density of states (LDOS), optionally output precision can be set by a second parameter, default is 3.
* 0: no output
* 1: output the partial charge density for given bias (controlled by stm_bias) in cube file format, which can be used to plot scanning tunneling spectroscopys to mimick STM images using the Python script plot.py.
* 2: output LDOS along a line in real space (controlled by ldos_line). Parameters used to control DOS output are also valid for LDOS.
* 3: output both two LDOS modes above.)";
item.default_value = "0";
item.unit = "";
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count != 1 && count != 2)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_ldos should have 1 or 2 values");
}
para.input.out_ldos[0] = std::stoi(item.str_values[0]);
para.input.out_ldos[1] = (count == 2) ? std::stoi(item.str_values[1]) : 3;
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.out_ldos[0] < 0 || para.input.out_ldos[0] > 3)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_ldos should be 0, 1, 2 or 3");
}
};
sync_intvec(input.out_ldos, 2, 0);
this->add_item(item);
}
{
Input_Item item("out_band");
item.annotation = "output energy and band structure (with precision 8)";
item.category = "Output information";
item.type = R"(Boolean \[Integer\](optional))";
item.description = R"(Whether to output the eigenvalues of the Hamiltonian matrix (in eV) into the running log during electronic iterations and into a file at the end of calculations. The former can be used with the 'out_freq_elec' parameter while the latter option allows the output precision to be set via a second parameter, with a default value of 8. The output file names are:
* nspin = 1 or 4: eig.txt;
* nspin = 2: eigs1.txt and eigs2.txt;
* For more information, refer to the band.md)";
item.default_value = "False";
item.unit = "";
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count != 1 && count != 2)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_band should have 1 or 2 values");
}
para.input.out_band[0] = assume_as_boolean(item.str_values[0]);
para.input.out_band[1] = (count == 2) ? std::stoi(item.str_values[1]) : 8;
};
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.calculation == "get_wf" || para.input.calculation == "get_pchg")
{
para.input.out_band[0] = 0;
}
};
sync_intvec(input.out_band, 2, 0);
this->add_item(item);
}
{
Input_Item item("out_proj_band");
item.annotation = "output projected band structure";
item.category = "Output information";
item.type = "Boolean";
item.description = "Whether to output the projected band structure. For more information, refer to the band.md";
item.default_value = "False";
item.unit = "";
read_sync_bool(input.out_proj_band);
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.calculation == "get_wf" || para.input.calculation == "get_pchg")
{
para.input.out_proj_band = false;
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.basis_type == "pw" && para.input.out_proj_band)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_proj_band is only for lcao");
}
};
this->add_item(item);
}
{
Input_Item item("out_stru");
item.annotation = "output the structure files per ion step";
item.category = "Output information";
item.type = "Integer";
item.description = "Controls the output of structure files per ionic step in geometry relaxation calculations. The files are written to the OUT.{suffix}/ directory. Each file corresponds to the structure at RELAX STEP ${istep}, i.e., the structure for which that step's energy was computed (before the relax move), and includes a header comment with the ABACUS version, timestamp, energy, and stress tensor. When out_freq_ion is positive, the numbered files STRU{istep} (or STRU{istep}.cif) are written every out_freq_ion steps; when out_freq_ion is 0, no numbered files are output.\n"
" - 0: No structure files are output.\n"
" - 1: ABACUS STRU format files are output. The latest structure is written to STRU_NOW (overwritten each step), the numbered file STRU{istep} (e.g., STRU1, STRU2) is written every out_freq_ion steps (when out_freq_ion is positive), and the final converged structure is written to STRU_FINAL. No CIF files are output.\n"
" - 2: CIF format files are output. The latest structure is written to STRU_NOW.cif (overwritten each step), the numbered file STRU{istep}.cif (e.g., STRU1.cif, STRU2.cif) is written every out_freq_ion steps (when out_freq_ion is positive), and the final converged structure is written to STRU_FINAL.cif. No non-CIF files are output.\n"
"[NOTE] For backward compatibility, true/false (case insensitive) are accepted and converted to 1/0.";
item.default_value = "1";
item.unit = "";
item.read_value = [](const Input_Item& item, Parameter& para) {
const std::string val = FmtCore::lower(item.str_values[0]);
if (val == "true" || val == "t" || val == "yes" || val == "y" || val == "on" || val == ".true.")
{
para.input.out_stru = 1;
}
else if (val == "false" || val == "f" || val == "no" || val == "n" || val == "off" || val == ".false.")
{
para.input.out_stru = 0;
}
else
{
try
{
size_t pos = 0;
const int parsed = std::stoi(item.str_values[0], &pos);
if (pos != item.str_values[0].size())
{
ModuleBase::WARNING_QUIT("ReadInput",
"out_stru must be one of 0, 1, 2. For backward compatibility, true/false are also accepted. Got: '" + item.str_values[0] + "'.");
}
para.input.out_stru = parsed;
}
catch (const std::invalid_argument&)
{
ModuleBase::WARNING_QUIT("ReadInput",
"out_stru must be one of 0, 1, 2. For backward compatibility, true/false are also accepted. Got: '" + item.str_values[0] + "'.");
}
catch (const std::out_of_range&)
{
ModuleBase::WARNING_QUIT("ReadInput",
"out_stru must be one of 0, 1, 2. For backward compatibility, true/false are also accepted. Got: '" + item.str_values[0] + "'.");
}
}
};
item.reset_value = [](const Input_Item& item, Parameter& para) {
const std::vector<std::string> offlist = {"nscf", "get_s", "get_pchg", "get_wf"};
if (std::find(offlist.begin(), offlist.end(), para.input.calculation) != offlist.end())
{
para.input.out_stru = 0;
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.out_stru < 0 || para.input.out_stru > 2)
{
ModuleBase::WARNING_QUIT("ReadInput",
"out_stru must be one of 0, 1, 2. For backward compatibility, true/false are also accepted.");
}
};
sync_int(input.out_stru);
this->add_item(item);
}
{
Input_Item item("out_level");
item.annotation = "ie(for electrons); i(for ions);";
item.category = "Output information";
item.type = "String";
item.description = R"(Control the output level of information in OUT.{calculation}.log.
* ie: electronic iteration level, which prints useful information for electronic iterations;
* i: geometry relaxation level, which prints some information for geometry relaxations additionally;
* m: molecular dynamics level, which does not print some information for simplicity.)";
item.default_value = "ie";
item.unit = "";
item.read_value = [](const Input_Item& item, Parameter& para) {
para.input.out_level = strvalue;
para.sys.out_md_control = true;
};
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (!para.sys.out_md_control && para.input.calculation == "md")
{
para.input.out_level = "m"; // zhengdy add 2019-04-07
}
};
sync_string(input.out_level);
add_bool_bcast(sys.out_md_control);
this->add_item(item);
}
{
Input_Item item("out_hsk");
item.annotation = "output H(k) and S(k) matrices in reciprocal space";
item.category = "Output information";
item.type = R"(Integer \[Integer\](optional))";
item.description = R"(Output the upper triangular part of the Hamiltonian and overlap matrices in reciprocal space for each k-point into files in the directory OUT.${suffix}. The first integer selects the format:
* 0: disabled;
* 1: text output; the optional second integer controls precision and defaults to 8;
* 2: binary output in the native ABACUS .dat format;
* 3: NPZ output, which is not implemented for H(k)/S(k).
The output is also controlled by out_freq_ion and out_app_flag. For more information, refer to hs_matrix.md.
* Gamma-only, nspin = 1: hk_nao.txt for the Hamiltonian matrix and sk_nao.txt for the overlap matrix.
* Gamma-only, nspin = 2: hks1_nao.txt and hks2_nao.txt for the two spin channels of the Hamiltonian matrix, and sk_nao.txt for the overlap matrix. Only one overlap matrix is written because it is identical for both spin channels.
* Gamma-only, nspin = 4: not available with the gamma-only algorithm.
* Multi-k, nspin = 1: hk1_nao.txt for the Hamiltonian matrix and sk1_nao.txt for the overlap matrix at the first k-point.
* Multi-k, nspin = 2: hk1s1_nao.txt and hk1s2_nao.txt for the two spin channels of the Hamiltonian matrix, and sk1_nao.txt for the overlap matrix at the first k-point. Only one overlap matrix is written because it is identical for both spin channels.
* Multi-k, nspin = 4: hk1s4_nao.txt for the spinor Hamiltonian matrix and sk1_nao.txt for the spinor overlap matrix at the first k-point.
For binary output, the same names use the .dat suffix. Each native binary record contains the matrix dimension as an int followed by the row-major upper triangle. Gamma-only elements are doubles; multi-k and spinor elements are pairs of doubles containing the real and imaginary parts. Native integer representation and byte order are used.
When out_app_flag is true, the first ionic step truncates the file and later steps append complete records.
When out_app_flag is false, g followed by the one-based ionic-step index is inserted before _nao, for example hk1s1g1_nao.txt.
[NOTE] In the 3.10-LTS version, the file names are data-0-H and data-0-S, etc.)";
item.default_value = "0 8";
item.unit = "Ry";
item.set_availability("basis_type==lcao");
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1 || count > 2)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_hsk expects a format and optional precision");
}
try
{
para.input.out_hsk[0] = std::stoi(item.str_values[0]);
para.input.out_hsk[1] = count == 2 ? std::stoi(item.str_values[1]) : 8;
}
catch (const std::exception&)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_hsk format and precision must be integers");
}
if (count == 2 && para.input.out_hsk[0] != 1)
{
ModuleBase::WARNING("ReadInput", "out_hsk precision is ignored unless format is 1");
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
const int format = para.input.out_hsk[0];
if (format < 0 || format > 3)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_hsk format must be 0, 1, 2, or 3");
}
if (format == 3)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_hsk NPZ output is not implemented");
}
};
sync_intvec(input.out_hsk, 2, 0);
this->add_item(item);
}
{
Input_Item item("out_mat_hs");
item.annotation = "legacy alias for text H(k) and S(k) output in reciprocal space";
item.category = "Output information";
item.type = R"(Boolean \[Integer\](optional))";
item.description = "Legacy alias for out_hsk 1, which outputs Hamiltonian and overlap matrices in reciprocal space for each k-point. The optional second integer controls text precision. If both out_hsk and out_mat_hs are present, out_hsk takes precedence.";
item.default_value = "False 8";
item.unit = "Ry";
item.set_availability("basis_type==lcao");
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_hs needs at least 1 value");
para.input.out_mat_hs[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_hs[1] = 8;
if (count >= 2) try { para.input.out_mat_hs[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) { /* do nothing */ }
catch (const std::out_of_range&) {/* do nothing */}
};
this->add_item(item);
}
{
Input_Item item("out_hsr");
item.annotation = "output H(R) and S(R) matrices in real space";
item.category = "Output information";
item.type = R"(Integer \[Integer\](optional))";
item.description = R"(Output Hamiltonian and overlap matrices in real space, indexed by the Bravais lattice vector R, in the directory OUT.${suffix}. The first integer selects the format:
* 0: disabled;
* 1: text CSR output; the optional second integer controls precision and defaults to 8;
* 2: native binary CSR output using .dat files;
* 3: NPZ output using hrs1_nao.npz, hrs2_nao.npz when needed, and sr_nao.npz.
For multi-k calculations, the output contains the individual real-space blocks stored for the Bravais lattice vectors R. For gamma-only calculations, the internal real-space contributions are folded into a single R = (0, 0, 0) block. This folded result cannot recover the original R-resolved contributions or interpolate arbitrary k points. Terms added only while constructing H(k) are not guaranteed to be present.
For binary output, each file uses the same basename as text output with a .dat suffix. Every native record contains the zero-based ionic step, matrix dimension, and number of R blocks as ints. Each R block contains three int coordinates, an int nonzero count, native double values (real/imaginary double pairs for complex matrices), int column indices, and long long row pointers. Native integer representation and byte order are used. When out_app_flag is true, the first ionic step truncates the file and later steps append complete records.
[NOTE] In the 3.10-LTS version, the file names are data-HR-sparse_SPIN0.csr and data-SR-sparse_SPIN0.csr, etc.)";
item.default_value = "0 8";
item.unit = "Ry";
item.set_availability("basis_type==lcao");
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1 || count > 2)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_hsr expects a format and optional precision");
}
try
{
para.input.out_hsr[0] = std::stoi(item.str_values[0]);
para.input.out_hsr[1] = count == 2 ? std::stoi(item.str_values[1]) : 8;
}
catch (const std::exception&)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_hsr format and precision must be integers");
}
if (count == 2 && para.input.out_hsr[0] != 1)
{
ModuleBase::WARNING("ReadInput", "out_hsr precision is ignored unless format is 1");
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
const int format = para.input.out_hsr[0];
if (format < 0 || format > 3)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_hsr format must be 0, 1, 2, or 3");
}
if (format == 3)
{
#ifndef __CNPY
ModuleBase::WARNING_QUIT("ReadInput",
"to write in npz format, please "
"recompile with -DENABLE_CNPY=1");
#endif
}
};
sync_intvec(input.out_hsr, 2, 0);
add_bool_bcast(input.out_hsr_npz_compat);
this->add_item(item);
}
{
Input_Item item("out_mat_hs2");
item.annotation = "legacy alias for text H(R) and S(R) output in real space";
item.category = "Output information";
item.type = R"(Boolean \[Integer\](optional))";
item.description = "Legacy alias for out_hsr 1, which outputs Hamiltonian and overlap matrices in real space indexed by the Bravais lattice vector R. The optional second integer controls text precision. If both out_hsr and out_mat_hs2 are present, out_hsr takes precedence.";
item.default_value = "False 8";
item.unit = "Ry";
item.set_availability("basis_type==lcao");
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_hs2 needs at least 1 value");
para.input.out_mat_hs2[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_hs2[1] = 8;
if (count >= 2) try { para.input.out_mat_hs2[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) { /* do nothing */ }
catch (const std::out_of_range&) {/* do nothing */}
};
this->add_item(item);
}
{
Input_Item item("out_mat_tk");
item.annotation = "output kinetic matrix of electrons T(k)";
item.category = "Output information";
item.type = R"(Boolean \[Integer\](optional))";
item.description = "Whether to print the upper triangular part of the kinetic matrices for each k-point into OUT.${suffix}/tks1ki_nao.txt, where i is the index of k points. One may optionally provide a second parameter to specify the precision."
"\n\n[NOTE] In the 3.10-LTS version, the file names are data-TR-sparse_SPIN0.csr, etc.";
item.default_value = "False [8]";
item.unit = "Ry";
item.set_availability("basis_type==lcao");
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_tk needs at least 1 value");
para.input.out_mat_tk[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_tk[1] = 8;
if (count >= 2) try { para.input.out_mat_tk[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) { /* do nothing */ }
catch (const std::out_of_range&) {/* do nothing */}
};
sync_intvec(input.out_mat_tk, 2, 0);
this->add_item(item);
}
{
Input_Item item("out_mat_r");
item.annotation = "output r(R) matrix";
item.category = "Output information";
item.type = R"(Boolean \[Integer\](optional))";
item.description = "Whether to print the matrix representation of the position matrix into files named rxrs1_nao.csr, ryrs1_nao.csr, rzrs1_nao.csr in the directory OUT.${suffix}. The optional second parameter controls text output precision. If calculation is set to get_s, the position matrix can be obtained without scf iterations. For more information, please refer to position_matrix.md."
"\n\n[NOTE] In the 3.10-LTS version, the file name is data-rR-sparse.csr.";
item.default_value = "False 8";
item.unit = "Bohr";
item.set_availability("basis_type==lcao and gamma_only==0");
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_r needs at least 1 value");
try {
para.input.out_mat_r[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_r[1] = 8;
if (count >= 2) try { para.input.out_mat_r[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_r precision must be an integer, using default 8");
}
}
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_r enable flag must be 0/1, using default 0");
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if ((para.inp.out_mat_r[0] || para.inp.out_mat_t[0]
|| para.inp.out_hr_npz || para.inp.out_dm_npz || para.inp.dm_to_rho)
&& para.sys.gamma_only_local)
{
ModuleBase::WARNING_QUIT("ReadInput",
"output of r(R)/T(R), H(R)-only/DM(R) in NPZ format, "
"or conversion from DM(R) to rho is not "
"available for gamma only calculations");
}
};
sync_intvec(input.out_mat_r, 2, 0);
this->add_item(item);
}
{
Input_Item item("out_mat_t");
item.annotation = "output T(R) matrix";
item.category = "Output information";
item.type = R"(Boolean \[Integer\](optional))";
item.description = "Generate files containing the kinetic energy matrix. The optional second parameter controls text output precision. The format will be the same as the Hamiltonian matrix and overlap matrix as mentioned in out_hsr. The name of the files will be trs1_nao.csr and so on. Also controled by out_freq_ion and out_app_flag."
"\n\n[NOTE] In the 3.10-LTS version, the file name is data-TR-sparse_SPIN0.csr.";
item.default_value = "False 8";
item.unit = "Ry";
item.set_availability("basis_type==lcao and gamma_only==0");
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_t needs at least 1 value");
try {
para.input.out_mat_t[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_t[1] = 8;
if (count >= 2) try { para.input.out_mat_t[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_t precision must be an integer, using default 8");
}
}
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_t enable flag must be 0/1, using default 0");
}
};
sync_intvec(input.out_mat_t, 2, 0);
this->add_item(item);
}
{
Input_Item item("out_mat_dh");
item.annotation = "output Hamiltonian derivatives dH/dR matrices";
item.category = "Output information";
item.type = "Integer";
item.description = "Whether to print files containing the derivatives of the Hamiltonian matrix. The format will be the same as the Hamiltonian matrix and overlap matrix as mentioned in out_hsr. The name of the files will be dhrxs1_nao.csr, dhrys1_nao.csr, dhrzs1_nao.csr and so on. Also controled by out_freq_ion and out_app_flag."
"\n\nFormat: <enable> [precision] [iat1 iat2 ...]. The first value (0/1) enables/disables output. The second optional value sets the output precision (default: 8). Starting from the third value, 1-based atom indices can be listed to restrict output to derivatives with respect to those specific atoms only; if no atom indices are given, all atoms are written."
"\n\n[NOTE] In the 3.10-LTS version, the file name is data-dHRx-sparse_SPIN0.csr and so on.";
item.default_value = "0 8";
item.unit = "Ry/Bohr";
item.set_availability("basis_type==lcao and gamma_only==0");
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_dh needs at least 1 value");
try {
para.input.out_mat_dh[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_dh[1] = 8;
if (count >= 2) try { para.input.out_mat_dh[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_dh precision must be an integer, using default 8");
}
for (size_t i = 2; i < count; ++i)
try { para.input.out_mat_dh.push_back(std::stoi(item.str_values[i]) - 1); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh atom index must be an integer, skipping");
}
}
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_dh enable flag must be 0/1, using default 0");
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.out_mat_dh[0] && para.input.nspin == 4)
{
ModuleBase::WARNING_QUIT("ReadInput", "out_mat_dh is not available for nspin = 4");
}
};
sync_intvec(input.out_mat_dh, para.input.out_mat_dh.size(), 0);
this->add_item(item);
}
{
Input_Item item("out_mat_dh_t");
item.annotation = "output kinetic energy dH/dR (dT/dR) matrices";
item.category = "Output information";
item.type = "Integer";
item.description = "Whether to print files containing the derivatives of the kinetic energy matrix dT/dR."
"\n\nSee out_mat_dh for format details (enable, precision, atom indices).";
item.default_value = "0 8";
item.unit = "Ry/Bohr";
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
try {
para.input.out_mat_dh_t[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_dh_t[1] = 8;
if (count >= 2) try { para.input.out_mat_dh_t[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_t precision must be an integer, using default 8");
}
for (size_t i = 2; i < count; ++i)
try { para.input.out_mat_dh_t.push_back(std::stoi(item.str_values[i]) - 1); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_t atom index must be an integer, skipping");
}
}
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_dh_t enable flag must be 0/1, using default 0");
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.out_mat_dh_t[0] && para.input.nspin == 4)
ModuleBase::WARNING_QUIT("ReadInput", "out_mat_dh_t is not available for nspin = 4");
};
sync_intvec(input.out_mat_dh_t, para.input.out_mat_dh_t.size(), 0);
this->add_item(item);
}
{
Input_Item item("out_mat_dh_vl");
item.annotation = "output local pseudopotential dH/dR (dV^L/dR) matrices";
item.category = "Output information";
item.type = "Integer";
item.description = "Whether to print files containing the derivatives of the local pseudopotential matrix dV^L/dR."
"\n\nSee out_mat_dh for format details.";
item.default_value = "0 8";
item.unit = "Ry/Bohr";
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
try {
para.input.out_mat_dh_vl[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_dh_vl[1] = 8;
if (count >= 2) try { para.input.out_mat_dh_vl[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_vl precision must be an integer, using default 8");
}
for (size_t i = 2; i < count; ++i)
try { para.input.out_mat_dh_vl.push_back(std::stoi(item.str_values[i]) - 1); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_vl atom index must be an integer, skipping");
}
}
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_dh_vl enable flag must be 0/1, using default 0");
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.out_mat_dh_vl[0] && para.input.nspin == 4)
ModuleBase::WARNING_QUIT("ReadInput", "out_mat_dh_vl is not available for nspin = 4");
};
sync_intvec(input.out_mat_dh_vl, para.input.out_mat_dh_vl.size(), 0);
this->add_item(item);
}
{
Input_Item item("out_mat_dh_vnl");
item.annotation = "output nonlocal pseudopotential dH/dR (dV^NL/dR) matrices";
item.category = "Output information";
item.type = "Integer";
item.description = "Whether to print files containing the derivatives of the nonlocal pseudopotential matrix dV^NL/dR."
"\n\nSee out_mat_dh for format details.";
item.default_value = "0 8";
item.unit = "Ry/Bohr";
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
try {
para.input.out_mat_dh_vnl[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_dh_vnl[1] = 8;
if (count >= 2) try { para.input.out_mat_dh_vnl[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_vnl precision must be an integer, using default 8");
}
for (size_t i = 2; i < count; ++i)
try { para.input.out_mat_dh_vnl.push_back(std::stoi(item.str_values[i]) - 1); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_vnl atom index must be an integer, skipping");
}
}
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_dh_vnl enable flag must be 0/1, using default 0");
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.out_mat_dh_vnl[0] && para.input.nspin == 4)
ModuleBase::WARNING_QUIT("ReadInput", "out_mat_dh_vnl is not available for nspin = 4");
};
sync_intvec(input.out_mat_dh_vnl, para.input.out_mat_dh_vnl.size(), 0);
this->add_item(item);
}
{
Input_Item item("out_mat_dh_vh");
item.annotation = "output Hartree dH/dR (dV^H/dR) matrices";
item.category = "Output information";
item.type = "Integer";
item.description = "Whether to print files containing the derivatives of the Hartree matrix dV^H/dR."
"\n\nSee out_mat_dh for format details.";
item.default_value = "0 8";
item.unit = "Ry/Bohr";
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
try {
para.input.out_mat_dh_vh[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_dh_vh[1] = 8;
if (count >= 2) try { para.input.out_mat_dh_vh[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_vh precision must be an integer, using default 8");
}
for (size_t i = 2; i < count; ++i)
try { para.input.out_mat_dh_vh.push_back(std::stoi(item.str_values[i]) - 1); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_vh atom index must be an integer, skipping");
}
}
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_dh_vh enable flag must be 0/1, using default 0");
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.out_mat_dh_vh[0] && para.input.nspin == 4)
ModuleBase::WARNING_QUIT("ReadInput", "out_mat_dh_vh is not available for nspin = 4");
};
sync_intvec(input.out_mat_dh_vh, para.input.out_mat_dh_vh.size(), 0);
this->add_item(item);
}
{
Input_Item item("out_mat_dh_vxc");
item.annotation = "output exchange-correlation dH/dR (dV^XC/dR) matrices";
item.category = "Output information";
item.type = "Integer";
item.description = "Whether to print files containing the derivatives of the XC matrix dV^XC/dR."
"\n\nSee out_mat_dh for format details.";
item.default_value = "0 8";
item.unit = "Ry/Bohr";
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
try {
para.input.out_mat_dh_vxc[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_dh_vxc[1] = 8;
if (count >= 2) try { para.input.out_mat_dh_vxc[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_vxc precision must be an integer, using default 8");
}
for (size_t i = 2; i < count; ++i)
try { para.input.out_mat_dh_vxc.push_back(std::stoi(item.str_values[i]) - 1); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_vxc atom index must be an integer, skipping");
}
}
catch (const std::invalid_argument& e) {
ModuleBase::WARNING("Input", "out_mat_dh_vxc enable flag must be 0/1, using default 0");
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.out_mat_dh_vxc[0] && para.input.nspin == 4)
ModuleBase::WARNING_QUIT("ReadInput", "out_mat_dh_vxc is not available for nspin = 4");
};
sync_intvec(input.out_mat_dh_vxc, para.input.out_mat_dh_vxc.size(), 0);
this->add_item(item);
}
{
Input_Item item("out_mat_dh_exx");
item.annotation = "output exact-exchange dH/dR (dV^EXX/dR) matrices";
item.category = "Output information";
item.type = "Integer";
item.description = "Whether to print files containing the derivatives of the exact-exchange matrix dV^EXX/dR."
"\n\nSee out_mat_dh for format details.";
item.default_value = "0 8";
item.unit = "Ry/Bohr";
item.read_value = [](const Input_Item& item, Parameter& para) {
const size_t count = item.get_size();
try {
para.input.out_mat_dh_exx[0] = assume_as_boolean(item.str_values[0]);
para.input.out_mat_dh_exx[1] = 8;
if (count >= 2) try { para.input.out_mat_dh_exx[1] = std::stoi(item.str_values[1]); }
catch (const std::invalid_argument&) {
ModuleBase::WARNING("Input", "out_mat_dh_exx precision must be an integer, using default 8");
}
for (size_t i = 2; i < count; ++i)
try { para.input.out_mat_dh_exx.push_back(std::stoi(item.str_values[i]) - 1); }
catch (const std::invalid_argument&) {