Skip to content

Commit 3170cbe

Browse files
authored
Update DOS codes and related changes with respect to 'magnetzation' variable and default results of 204_NO_KP_NC example, reconstruct esolver by adding a new file pw_setup.cpp in esolver (#6145)
* fix two typos in manual * update output information * fix auto tests * fix typos and unittests * delete dos_nao, use write_dos_lcao directly * update dos codes * add warning_quit in pw basis for PDOS calculations, add doscs for ploting Fermi surface in LCAO basis, add Fermi surface plot function in PW basis when out_dos=3 * add fermi surface plot in pw dos * fix unittest of write_dos_pw * change magnetiation (a name that is too long) to mag * update header files * update md tests * update cmake, remove -Wno-tautological-constant-compare, which seems useless * update mag, it influences a lot of codes... * update mag * update mpi.h * update 204_NO_KP_NC, change scf_thr to 1.0e-7 * output format refactor * update output format * update esolver_ks_pw * fix magnetization esolver * update some formats * found a pw_setup file in esolver * add rho_mix, this belongs to esolver_ks * fix magnetization in DeePKS * update rho_restart.cpp * update rho_restart.cpp * fix json * fix define MPI in ri benchmark * update MPI in ri_benchmark_test.cpp
1 parent 74cbb38 commit 3170cbe

File tree

85 files changed

+1089
-828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1089
-828
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,13 @@ You can install Git first and reinstall abacus.")
114114
endif()
115115
endif()
116116

117+
# Serial version of ABACUS will not use ELPA
117118
if(NOT ENABLE_MPI)
118119
set(USE_ELPA OFF)
119120
set(ENABLE_DEEPKS OFF)
120121
endif()
121122

123+
# Different exe files of ABACUS
122124
if(ENABLE_LCAO AND ENABLE_MPI)
123125
set(ABACUS_BIN_NAME abacus)
124126
elseif(NOT ENABLE_LCAO AND ENABLE_MPI)
@@ -129,6 +131,7 @@ elseif(ENABLE_LCAO AND NOT ENABLE_MPI)
129131
set(ABACUS_BIN_NAME abacus_serial)
130132
endif()
131133

134+
# Use DSP hardware
132135
if (USE_DSP)
133136
set(USE_ELPA OFF)
134137
set(ENABLE_LCAO OFF)
@@ -212,7 +215,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES Intel)
212215
add_compile_options(-fp-model=strict)
213216
set(USE_ABACUS_LIBM OFF) # Force turn off USE_ABACUS_LIBM on Intel Compiler
214217
set(CMAKE_CXX_FLAGS
215-
"${CMAKE_CXX_FLAGS} -Wno-write-strings -Wno-tautological-constant-compare"
218+
"${CMAKE_CXX_FLAGS} -Wno-write-strings "
216219
)
217220
endif()
218221

docs/advanced/input_files/input-main.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,8 @@ These variables are used to control the output of properties.
17051705
- **Description**: Whether to output the density of states (DOS). For more information, refer to the [dos.md](../elec_properties/dos.md).
17061706
- 0: no output
17071707
- 1: output the density of states (DOS)
1708-
- 2: (lcao-only) output the density of states (DOS) and the projected density of states (PDOS)
1708+
- 2: (LCAO) output the density of states (DOS) and the projected density of states (PDOS)
1709+
- 3: output the Fermi surface file (fermi.bxsf) in BXSF format that can be visualized by XCrySDen
17091710
- **Default**: 0
17101711

17111712
### out_ldos

source/Makefile.Objects

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ OBJS_ESOLVER=esolver.o\
259259
esolver_of_tool.o\
260260
esolver_of_interface.o\
261261
pw_others.o\
262+
pw_setup.o\
262263

263264
OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
264265
esolver_ks_lcao_tddft.o\
@@ -495,13 +496,13 @@ OBJS_IO=input_conv.o\
495496
bessel_basis.o\
496497
cal_test.o\
497498
write_dos_pw.o\
499+
nscf_fermi_surf.o\
498500
nscf_band.o\
499501
cal_dos.o\
500502
cal_pdos_gamma.o\
501503
cal_pdos_multik.o\
502504
cal_ldos.o\
503505
cif_io.o\
504-
dos_nao.o\
505506
numerical_descriptor.o\
506507
numerical_basis.o\
507508
numerical_basis_jyjy.o\
@@ -564,7 +565,6 @@ OBJS_IO_LCAO=cal_r_overlap_R.o\
564565
write_dos_lcao.o\
565566
write_proj_band_lcao.o\
566567
write_istate_info.o\
567-
nscf_fermi_surf.o\
568568
get_pchg_lcao.o\
569569
get_wf_lcao.o\
570570
io_dmk.o\

source/module_base/parallel_comm.h

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,33 @@ extern MPI_Comm DIAG_WORLD; // mohan add 2012-01-13
1313

1414
class MPICommGroup
1515
{
16-
public:
17-
MPICommGroup(MPI_Comm parent_comm);
18-
~MPICommGroup();
19-
void divide_group_comm(const int& ngroup, const bool assert_even = true);
20-
public:
21-
bool is_even = false; ///< whether the group is even
22-
23-
MPI_Comm parent_comm = MPI_COMM_NULL; ///< parent communicator
24-
int gsize = 0; ///< size of parent communicator
25-
int grank = 0; ///< rank of parent communicator
26-
27-
MPI_Comm group_comm = MPI_COMM_NULL; ///< group communicator
28-
int ngroups = 0; ///< number of groups
29-
int nprocs_in_group = 0; ///< number of processes in the group
30-
int my_group = 0; ///< the group index
31-
int rank_in_group = 0; ///< the rank in the group
32-
33-
MPI_Comm inter_comm = MPI_COMM_NULL; ///< inter communicator
34-
bool has_inter_comm = false; ///< whether has inter communicator
35-
int& nprocs_in_inter = ngroups; ///< number of processes in the inter communicator
36-
int& my_inter = rank_in_group; ///< the rank in the inter communicator
37-
int& rank_in_inter = my_group; ///< the inter group index
16+
17+
public:
18+
19+
MPICommGroup(MPI_Comm parent_comm);
20+
~MPICommGroup();
21+
22+
void divide_group_comm(const int& ngroup, const bool assert_even = true);
23+
24+
bool is_even = false; ///< whether the group is even
25+
26+
MPI_Comm parent_comm = MPI_COMM_NULL; ///< parent communicator
27+
int gsize = 0; ///< size of parent communicator
28+
int grank = 0; ///< rank of parent communicator
29+
30+
MPI_Comm group_comm = MPI_COMM_NULL; ///< group communicator
31+
int ngroups = 0; ///< number of groups
32+
int nprocs_in_group = 0; ///< number of processes in the group
33+
int my_group = 0; ///< the group index
34+
int rank_in_group = 0; ///< the rank in the group
35+
36+
MPI_Comm inter_comm = MPI_COMM_NULL; ///< inter communicator
37+
bool has_inter_comm = false; ///< whether has inter communicator
38+
int& nprocs_in_inter = ngroups; ///< number of processes in the inter communicator
39+
int& my_inter = rank_in_group; ///< the rank in the inter communicator
40+
int& rank_in_inter = my_group; ///< the inter group index
3841
};
3942

4043
#endif
4144

42-
#endif // PARALLEL_COMM_H
45+
#endif // PARALLEL_COMM_H

source/module_cell/bcast_cell.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ namespace unitcell
8585
{
8686
#ifdef __MPI
8787
MPI_Barrier(MPI_COMM_WORLD);
88-
Parallel_Common::bcast_double(magnet.start_magnetization, ntype);
88+
Parallel_Common::bcast_double(magnet.start_mag, ntype);
8989
if (PARAM.inp.nspin == 4)
9090
{
9191
Parallel_Common::bcast_double(magnet.ux_[0]);
@@ -118,4 +118,4 @@ namespace unitcell
118118
return;
119119
#endif
120120
}
121-
}
121+
}

source/module_cell/module_neighbor/sltk_atom_arrange.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ double atom_arrange::set_sr_NL(std::ofstream& ofs_in,
3737

3838
if (output_level != "m") // xiaohui add 'output_level', 2015-09-16
3939
{
40-
ofs_in << "\n\n\n\n";
40+
ofs_in << "\n\n";
4141
ofs_in << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl;
4242
ofs_in << " | |" << std::endl;
4343
ofs_in << " | Search adjacent atoms: |" << std::endl;
@@ -47,7 +47,7 @@ double atom_arrange::set_sr_NL(std::ofstream& ofs_in,
4747
ofs_in << " | for each atom. |" << std::endl;
4848
ofs_in << " | |" << std::endl;
4949
ofs_in << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl;
50-
ofs_in << "\n\n\n\n";
50+
ofs_in << "\n\n";
5151

5252
ofs_in << "\n SETUP SEARCHING RADIUS FOR PROGRAM TO SEARCH ADJACENT ATOMS" << std::endl;
5353
ofs_in << std::setprecision(3);

source/module_cell/module_neighbor/test/prepare_unitcell.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ class UcellTestPrepare
7777
this->init_vel,
7878
this->fixed_axes);
7979

80-
delete[] ucell->magnet.start_magnetization; //mag set here
80+
delete[] ucell->magnet.start_mag; //mag set here
8181
ucell->atom_label.resize(ucell->ntype);
8282
ucell->atom_mass.resize(ucell->ntype);
8383
ucell->pseudo_fn.resize(ucell->ntype);
8484
ucell->pseudo_type.resize(ucell->ntype);
8585
ucell->orbital_fn.resize(ucell->ntype);
86-
ucell->magnet.start_magnetization = new double[ucell->ntype]; //mag set here
86+
ucell->magnet.start_mag = new double[ucell->ntype]; //mag set here
8787
ucell->magnet.ux_[0] = 0.0; // ux_ set here
8888
ucell->magnet.ux_[1] = 0.0;
8989
ucell->magnet.ux_[2] = 0.0;
@@ -94,7 +94,7 @@ class UcellTestPrepare
9494
ucell->pseudo_fn[it] = this->pp_files[it];
9595
ucell->pseudo_type[it] = this->pp_types[it];
9696
ucell->orbital_fn[it] = this->orb_files[it];
97-
ucell->magnet.start_magnetization[it] = 0.0; //mag set here
97+
ucell->magnet.start_mag[it] = 0.0; //mag set here
9898
}
9999
//lattice info
100100
ucell->lat0 = this->lat0;

source/module_cell/module_neighbor/test/sltk_atom_arrange_test.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ LCAO_Orbitals::~LCAO_Orbitals()
2626
#endif
2727
Magnetism::Magnetism()
2828
{
29-
this->tot_magnetization = 0.0;
30-
this->abs_magnetization = 0.0;
31-
this->start_magnetization = nullptr;
29+
this->tot_mag = 0.0;
30+
this->abs_mag = 0.0;
31+
this->start_mag = nullptr;
3232
}
3333
Magnetism::~Magnetism()
3434
{
35-
delete[] this->start_magnetization;
35+
delete[] this->start_mag;
3636
}
3737

3838
/************************************************
@@ -152,4 +152,4 @@ TEST_F(SltkAtomArrangeTest, Filteradjs)
152152
is_adjs[0] = true;
153153
filter_adjs(is_adjs, adjs);
154154
EXPECT_EQ(adjs.adj_num, 0);
155-
}
155+
}

source/module_cell/module_neighbor/test/sltk_grid_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ LCAO_Orbitals::~LCAO_Orbitals()
2323
#endif
2424
Magnetism::Magnetism()
2525
{
26-
this->tot_magnetization = 0.0;
27-
this->abs_magnetization = 0.0;
28-
this->start_magnetization = nullptr;
26+
this->tot_mag = 0.0;
27+
this->abs_mag = 0.0;
28+
this->start_mag = nullptr;
2929
}
3030
Magnetism::~Magnetism()
3131
{
32-
delete[] this->start_magnetization;
32+
delete[] this->start_mag;
3333
}
3434

3535
/************************************************

source/module_cell/print_cell.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ namespace unitcell
104104
for(int it = 0; it < ucell.ntype; it++)
105105
{
106106
str += "\n" + ucell.atoms[it].label + " #label\n";
107-
str += FmtCore::format("%-8.4f #magnetism\n", ucell.magnet.start_magnetization[it]);
107+
str += FmtCore::format("%-8.4f #magnetism\n", ucell.magnet.start_mag[it]);
108108
str += FmtCore::format("%d #number of atoms\n", atoms[it].na);
109109
for(int ia = 0; ia < atoms[it].na; ia++)
110110
{

0 commit comments

Comments
 (0)