forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 224
Expand file tree
/
Copy pathbcast_cell.cpp
More file actions
128 lines (116 loc) · 4.31 KB
/
bcast_cell.cpp
File metadata and controls
128 lines (116 loc) · 4.31 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
#include "unitcell.h"
#include "source_base/parallel_common.h"
#include "source_io/module_parameter/parameter.h"
#ifdef __EXX
#include "source_lcao/module_ri/serialization_cereal.h"
#endif
#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info
namespace unitcell
{
void bcast_atoms_tau(Atom* atoms,
const int ntype)
{
#ifdef __MPI
MPI_Barrier(MPI_COMM_WORLD);
for (int i = 0; i < ntype; i++) {
atoms[i].bcast_atom(); // bcast tau array
}
#endif
}
void bcast_atoms_pseudo(Atom* atoms,
const int ntype)
{
#ifdef __MPI
MPI_Barrier(MPI_COMM_WORLD);
for (int i = 0; i < ntype; i++)
{
atoms[i].bcast_atom2();
}
#endif
}
void bcast_Lattice(Lattice& lat)
{
#ifdef __MPI
MPI_Barrier(MPI_COMM_WORLD);
// distribute lattice parameters.
ModuleBase::Matrix3& latvec = lat.latvec;
ModuleBase::Matrix3& latvec_supercell = lat.latvec_supercell;
Parallel_Common::bcast_string(lat.Coordinate);
Parallel_Common::bcast_double(lat.lat0);
Parallel_Common::bcast_double(lat.lat0_angstrom);
Parallel_Common::bcast_double(lat.tpiba);
Parallel_Common::bcast_double(lat.tpiba2);
Parallel_Common::bcast_double(lat.omega);
Parallel_Common::bcast_string(lat.latName);
// distribute lattice vectors.
Parallel_Common::bcast_double(latvec.e11);
Parallel_Common::bcast_double(latvec.e12);
Parallel_Common::bcast_double(latvec.e13);
Parallel_Common::bcast_double(latvec.e21);
Parallel_Common::bcast_double(latvec.e22);
Parallel_Common::bcast_double(latvec.e23);
Parallel_Common::bcast_double(latvec.e31);
Parallel_Common::bcast_double(latvec.e32);
Parallel_Common::bcast_double(latvec.e33);
// distribute lattice vectors.
for (int i = 0; i < 3; i++)
{
Parallel_Common::bcast_double(lat.a1[i]);
Parallel_Common::bcast_double(lat.a2[i]);
Parallel_Common::bcast_double(lat.a3[i]);
Parallel_Common::bcast_double(lat.latcenter[i]);
Parallel_Common::bcast_int(lat.lc[i]);
}
// distribute superlattice vectors.
Parallel_Common::bcast_double(latvec_supercell.e11);
Parallel_Common::bcast_double(latvec_supercell.e12);
Parallel_Common::bcast_double(latvec_supercell.e13);
Parallel_Common::bcast_double(latvec_supercell.e21);
Parallel_Common::bcast_double(latvec_supercell.e22);
Parallel_Common::bcast_double(latvec_supercell.e23);
Parallel_Common::bcast_double(latvec_supercell.e31);
Parallel_Common::bcast_double(latvec_supercell.e32);
Parallel_Common::bcast_double(latvec_supercell.e33);
// distribute Change the lattice vectors or not
#endif
}
void bcast_magnetism(Magnetism& magnet, const int ntype)
{
#ifdef __MPI
MPI_Barrier(MPI_COMM_WORLD);
Parallel_Common::bcast_double(magnet.start_mag, ntype);
if (PARAM.inp.nspin == 4)
{
Parallel_Common::bcast_double(magnet.ux_[0]);
Parallel_Common::bcast_double(magnet.ux_[1]);
Parallel_Common::bcast_double(magnet.ux_[2]);
}
#endif
}
void bcast_unitcell(UnitCell& ucell)
{
#ifdef __MPI
const int ntype = ucell.ntype;
Parallel_Common::bcast_int(ucell.nat);
bcast_Lattice(ucell.lat);
bcast_magnetism(ucell.magnet,ntype);
bcast_atoms_tau(ucell.atoms,ntype);
for (int i = 0; i < ntype; i++)
{
Parallel_Common::bcast_string(ucell.orbital_fn[i]);
}
#ifdef __EXX
ModuleBase::bcast_data_cereal(GlobalC::exx_info.info_ri.files_abfs,
MPI_COMM_WORLD,
0);
ModuleBase::bcast_data_cereal(GlobalC::exx_info.info_opt_abfs.files_abfs,
MPI_COMM_WORLD,
0);
ModuleBase::bcast_data_cereal(GlobalC::exx_info.info_opt_abfs.files_jles,
MPI_COMM_WORLD,
0);
#endif
return;
#endif
}
}