|
7 | 7 | #include "module_elecstate/elecstate.h" |
8 | 8 | #include "module_elecstate/module_charge/charge_extra.h" |
9 | 9 | #include "module_hamilt_general/module_surchem/surchem.h" |
| 10 | +#include "module_hamilt_pw/hamilt_pwdft/VL_in_pw.h" |
10 | 11 | #include "module_hamilt_pw/hamilt_pwdft/structure_factor.h" |
11 | 12 |
|
12 | 13 | #include <fstream> |
13 | 14 |
|
14 | 15 | //! The First-Principles (FP) Energy Solver Class |
15 | 16 | /** |
16 | | - * This class represents components that needed in |
| 17 | + * This class represents components that needed in |
17 | 18 | * first-principles energy solver, such as the plane |
18 | 19 | * wave basis, the structure factors, and the k points. |
19 | 20 | * |
20 | | -*/ |
| 21 | + */ |
21 | 22 |
|
22 | 23 | namespace ModuleESolver |
23 | 24 | { |
24 | | - class ESolver_FP : public ESolver |
25 | | - { |
26 | | - public: |
27 | | - //! Constructor |
28 | | - ESolver_FP(); |
| 25 | +class ESolver_FP : public ESolver |
| 26 | +{ |
| 27 | + public: |
| 28 | + //! Constructor |
| 29 | + ESolver_FP(); |
| 30 | + |
| 31 | + //! Deconstructor |
| 32 | + virtual ~ESolver_FP(); |
29 | 33 |
|
30 | | - //! Deconstructor |
31 | | - virtual ~ESolver_FP(); |
| 34 | + //! Initialize of the first-principels energy solver |
| 35 | + virtual void before_all_runners(UnitCell& ucell, const Input_para& inp) override; |
32 | 36 |
|
33 | | - //! Initialize of the first-principels energy solver |
34 | | - virtual void before_all_runners(UnitCell& ucell, const Input_para& inp) override; |
| 37 | + protected: |
| 38 | + //! Something to do before SCF iterations. |
| 39 | + virtual void before_scf(UnitCell& ucell, const int istep); |
35 | 40 |
|
36 | | - protected: |
37 | | - //! Something to do before SCF iterations. |
38 | | - virtual void before_scf(UnitCell& ucell, const int istep); |
| 41 | + //! Something to do after SCF iterations when SCF is converged or comes to the max iter step. |
| 42 | + virtual void after_scf(UnitCell& ucell, const int istep); |
39 | 43 |
|
40 | | - //! Something to do after SCF iterations when SCF is converged or comes to the max iter step. |
41 | | - virtual void after_scf(UnitCell& ucell, const int istep); |
| 44 | + //! ------------------------------------------------------------------------------ |
| 45 | + //! These pointers will be deleted in the free_pointers() function every ion step. |
| 46 | + //! ------------------------------------------------------------------------------ |
| 47 | + elecstate::ElecState* pelec = nullptr; ///< Electronic states |
42 | 48 |
|
43 | | - //! Electronic states |
44 | | - elecstate::ElecState* pelec = nullptr; |
| 49 | + //! ------------------------------------------------------------------------------ |
45 | 50 |
|
46 | | - //! Electorn charge density |
47 | | - Charge chr; |
| 51 | + //! Electorn charge density |
| 52 | + Charge chr; |
48 | 53 |
|
49 | | - //! Structure factors that used with plane-wave basis set |
50 | | - Structure_Factor sf; |
| 54 | + //! Structure factors that used with plane-wave basis set |
| 55 | + Structure_Factor sf; |
51 | 56 |
|
52 | | - //! K points in Brillouin zone |
53 | | - K_Vectors kv; |
| 57 | + //! K points in Brillouin zone |
| 58 | + K_Vectors kv; |
54 | 59 |
|
55 | | - //! Plane-wave basis set for charge density |
56 | | - ModulePW::PW_Basis* pw_rho; |
| 60 | + //! Plane-wave basis set for charge density |
| 61 | + ModulePW::PW_Basis* pw_rho; |
57 | 62 |
|
58 | | - //! parallel for rho grid |
59 | | - Parallel_Grid Pgrid; |
| 63 | + //! parallel for rho grid |
| 64 | + Parallel_Grid Pgrid; |
60 | 65 |
|
61 | | - //! pointer to pseudopotential |
62 | | - pseudopot_cell_vl* p_locpp = nullptr; |
| 66 | + //! pointer to local pseudopotential |
| 67 | + pseudopot_cell_vl locpp; |
63 | 68 |
|
64 | | - /** |
65 | | - * @brief same as pw_rho for ncpp. Here 'd' stands for 'dense' |
66 | | - * dense grid for for uspp, used for ultrasoft augmented charge density. |
67 | | - * charge density and potential are defined on dense grids, |
68 | | - * but effective potential needs to be interpolated on smooth grids in order to compute Veff|psi> |
69 | | - */ |
70 | | - ModulePW::PW_Basis* pw_rhod; |
71 | | - ModulePW::PW_Basis_Big* pw_big; ///< [temp] pw_basis_big class |
| 69 | + /** |
| 70 | + * @brief same as pw_rho for ncpp. Here 'd' stands for 'dense' |
| 71 | + * dense grid for for uspp, used for ultrasoft augmented charge density. |
| 72 | + * charge density and potential are defined on dense grids, |
| 73 | + * but effective potential needs to be interpolated on smooth grids in order to compute Veff|psi> |
| 74 | + */ |
| 75 | + ModulePW::PW_Basis* pw_rhod; |
| 76 | + ModulePW::PW_Basis_Big* pw_big; ///< [temp] pw_basis_big class |
72 | 77 |
|
73 | | - //! Charge extrapolation |
74 | | - Charge_Extra CE; |
| 78 | + //! Charge extrapolation |
| 79 | + Charge_Extra CE; |
75 | 80 |
|
76 | | - // solvent model |
77 | | - surchem solvent; |
78 | | - }; |
79 | | -} |
| 81 | + // solvent model |
| 82 | + surchem solvent; |
| 83 | +}; |
| 84 | +} // namespace ModuleESolver |
80 | 85 |
|
81 | 86 | #endif |
0 commit comments