diff --git a/docs/advanced/elec_properties/hs_matrix.md b/docs/advanced/elec_properties/hs_matrix.md index 9fa0f5c936..c95b50cf55 100644 --- a/docs/advanced/elec_properties/hs_matrix.md +++ b/docs/advanced/elec_properties/hs_matrix.md @@ -61,6 +61,11 @@ We also offer the option of only calculating the overlap matrix without running A file named `SR.csr` will be generated in the working directory, which contains the overlap matrix. +> When `nspin` is set to 1 or 2, the dimension of the overlap matrix is nlocal $\times$ nlocal, where nlocal is the total number of numerical atomic orbitals. +These numerical atomic orbitals are ordered from outer to inner loop as atom, angular quantum number $l$, zeta (multiple radial orbitals corresponding to each $l$), and magnetic quantum number $m$. +When `nspin` is set to 4, the dimension of the overlap matrix is (2 $\times$ nlocal) $\times$ (2 $\times$ nlocal). In this case, the numerical atomic orbitals are ordered from outer to inner loop as atom, angular quantum number $l$, zeta (multiple radial orbitals corresponding to each $l$), magnetic quantum number $m$, and npol (index of spin, ranges from 0 to 1). + + ## examples We provide [examples](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/matrix_hs) of outputting the matrices. There are four examples: diff --git a/docs/advanced/elec_properties/position_matrix.md b/docs/advanced/elec_properties/position_matrix.md index 562843dc34..ea4f5ebecf 100644 --- a/docs/advanced/elec_properties/position_matrix.md +++ b/docs/advanced/elec_properties/position_matrix.md @@ -18,4 +18,7 @@ Each file or each section of the appended file starts with "STEP: " followed by Each block here contains the matrix for the corresponding cell. There are three columns in each block, giving the matrix elements in x, y, z directions, respectively. There are altogether nbasis * nbasis lines in each block, which emulates the matrix elements. -In molecular dynamics (MD) calculations, if [out_app_flag](../input_files/input-main.md#out_app_flag) is set to true, then `data-rR-tr` is written in an append manner. Otherwise, output files will be put in a separate directory, `matrix`, and named as `$x`_data-rR-tr, where `$x` is the number of MD step. In addition, The output frequency is controlled by [out_interval](../input_files/input-main.md#out_interval). For example, if we are running a 10-step MD with out_interval = 3, then `$x` will be 0, 3, 6, and 9. \ No newline at end of file +In molecular dynamics (MD) calculations, if [out_app_flag](../input_files/input-main.md#out_app_flag) is set to true, then `data-rR-tr` is written in an append manner. Otherwise, output files will be put in a separate directory, `matrix`, and named as `$x`_data-rR-tr, where `$x` is the number of MD step. In addition, the output frequency is controlled by [out_interval](../input_files/input-main.md#out_interval). For example, if we are running a 10-step MD with out_interval = 3, then `$x` will be 0, 3, 6, and 9. + +## get_S +We also offer the option of only calculating the position matrix without running SCF. For that purpose, in `INPUT` file we need to set the keyword [calculation](../input_files/input-main.md#calculation) to `get_S`, and [out_mat_r](../input_files/input-main.md#out_mat_r) to `true`. \ No newline at end of file diff --git a/docs/advanced/input_files/input-main.md b/docs/advanced/input_files/input-main.md index 4fdb15c232..ced6c56c54 100644 --- a/docs/advanced/input_files/input-main.md +++ b/docs/advanced/input_files/input-main.md @@ -1720,7 +1720,7 @@ These variables are used to control the output of properties. - **Type**: Boolean - **Availability**: Numerical atomic orbital basis (not gamma-only algorithm) -- **Description**: Whether to print the matrix representation of the position matrix (in Bohr) into a file named `data-rR-tr` in the directory `OUT.${suffix}`. For more information, please refer to [position_matrix.md](../elec_properties/position_matrix.md#extracting-position-matrices). +- **Description**: Whether to print the matrix representation of the position matrix (in Bohr) into a file named `data-rR-tr` in the directory `OUT.${suffix}`. If [calculation](#calculation) is set to `get_S`, the position matrix can be obtained without scf iterations. For more information, please refer to [position_matrix.md](../elec_properties/position_matrix.md#extracting-position-matrices). - **Default**: False ### out_mat_hs2 diff --git a/source/module_esolver/esolver_gets.cpp b/source/module_esolver/esolver_gets.cpp index 75b702b24c..d9b5b91d84 100644 --- a/source/module_esolver/esolver_gets.cpp +++ b/source/module_esolver/esolver_gets.cpp @@ -52,8 +52,8 @@ void ESolver_GetS::before_all_runners(UnitCell& ucell, const Input_para& inp) this->pelec = new elecstate::ElecStateLCAO>(&(this->chr), // use which parameter? &(this->kv), this->kv.get_nks(), - &(this->GG), // mohan add 2024-04-01 - &(this->GK), // mohan add 2024-04-01 + nullptr, // mohan add 2024-04-01 + nullptr, // mohan add 2024-04-01 this->pw_rho, this->pw_big); } @@ -100,7 +100,8 @@ void ESolver_GetS::runner(UnitCell& ucell, const int istep) search_radius, PARAM.inp.test_atom_input); - this->RA.for_2d(this->pv, PARAM.globalv.gamma_only_local, orb_.cutoffs()); + Record_adj RA; + RA.for_2d(this->pv, PARAM.globalv.gamma_only_local, orb_.cutoffs()); if (this->p_hamilt == nullptr) { diff --git a/source/module_esolver/esolver_gets.h b/source/module_esolver/esolver_gets.h index 8185f7b061..7ebbf84e56 100644 --- a/source/module_esolver/esolver_gets.h +++ b/source/module_esolver/esolver_gets.h @@ -4,8 +4,6 @@ #include "module_basis/module_nao/two_center_bundle.h" #include "module_cell/unitcell.h" #include "module_esolver/esolver_ks.h" -#include "module_hamilt_lcao/module_gint/gint_gamma.h" -#include "module_hamilt_lcao/module_gint/gint_k.h" #include @@ -34,18 +32,9 @@ class ESolver_GetS : public ESolver_KS> void cal_stress(UnitCell& ucell, ModuleBase::matrix& stress) {}; protected: - // we will get rid of this class soon, don't use it, mohan 2024-03-28 - Record_adj RA; - // 2d block - cyclic distribution info Parallel_Orbitals pv; - // used for k-dependent grid integration. - Gint_k GK; - - // used for gamma only algorithms. - Gint_Gamma GG; - TwoCenterBundle two_center_bundle_; // temporary introduced during removing GlobalC::ORB