Skip to content

Commit 6866397

Browse files
committed
modify back atom_tau
1 parent 0dc4eaf commit 6866397

File tree

9 files changed

+35
-18
lines changed

9 files changed

+35
-18
lines changed

source/module_cell/atom_spec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void Atom::bcast_atom()
146146
return;
147147
}
148148

149-
void Atom::bcast_atom2()
149+
void Atom::bcast_atom_()
150150
{
151151
this->ncpp.bcast_atom_pseudo();
152152
}

source/module_cell/bcast_cell.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#endif
88
namespace unitcell
99
{
10-
void bcast_atoms(Atom* atoms,
10+
void bcast_atoms_tau(Atom* atoms,
1111
const int ntype)
1212
{
1313
#ifdef __MPI
@@ -17,6 +17,17 @@ namespace unitcell
1717
}
1818
#endif
1919
}
20+
21+
void bcast_atoms_ncpp_pesudo(Atom* atoms,
22+
const int ntype)
23+
{
24+
#ifndef __MPI
25+
for (int i = 0; i < ntype; i++)
26+
{
27+
atoms[i].bcast_atom2();
28+
}
29+
#endif
30+
}
2031

2132
void bcast_Lattice(Lattice& lat)
2233
{
@@ -86,10 +97,10 @@ namespace unitcell
8697
#ifdef __MPI
8798
const int ntype = ucell.ntype;
8899
Parallel_Common::bcast_int(ucell.nat);
89-
100+
90101
bcast_Lattice(ucell.lat);
91102
bcast_magnetism(ucell.magnet,ntype);
92-
bcast_atoms(ucell.atoms,ntype);
103+
bcast_atoms_tau(ucell.atoms,ntype);
93104

94105
if(ucell.orbital_fn == nullptr)
95106
{

source/module_cell/bcast_cell.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@ namespace unitcell
1010
* @param atoms: the atoms to be broadcasted [in/out]
1111
* @param ntype: the number of types of the atoms [in]
1212
*/
13-
void bcast_atoms(Atom* atoms,
14-
const int ntype);
13+
void bcast_atoms_tau(Atom* atoms,
14+
const int ntype);
15+
/**
16+
* @brief broadcast the pseduo of the atoms
17+
*
18+
* @param atoms: the atoms to be broadcasted [in/out]
19+
* @param ntype: the number of types of the atoms [in]
20+
*/
21+
void bcast_atoms_pseduo(Atom* atoms,
22+
const int ntype);
1523
/**
1624
* @brief broadcast the lattice
1725
*
@@ -34,6 +42,8 @@ namespace unitcell
3442
* @param ucell: the unitcell to be broadcasted [in/out]
3543
*/
3644
void bcast_unitcell(UnitCell& ucell);
45+
46+
3747
}
3848

3949
#endif // BCAST_CELL_H

source/module_cell/test/support/mock_unitcell.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ bool UnitCell::read_atom_positions(std::ifstream& ifpos,
3636
void UnitCell::update_pos_taud(double* posd_in) {}
3737
void UnitCell::update_pos_taud(const ModuleBase::Vector3<double>* posd_in) {}
3838
void UnitCell::update_vel(const ModuleBase::Vector3<double>* vel_in) {}
39-
void UnitCell::bcast_atoms() {}
39+
void UnitCell::bcast_atoms_tau() {}
4040
bool UnitCell::judge_big_cell() const { return true; }
4141
void UnitCell::update_stress(ModuleBase::matrix& scs) {}
4242
void UnitCell::update_force(ModuleBase::matrix& fcs) {}

source/module_cell/test/unitcell_test_para.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Magnetism::~Magnetism()
4747
* - UpdatePosTaud
4848
* - update_pos_tau(double* pos)
4949
* - update_pos_taud(const double* pos)
50-
* - bcast_atoms() is also called in the above function, which calls Atom::bcast_atom with many
50+
* - bcast_atoms_tau() is also called in the above function, which calls Atom::bcast_atom with many
5151
* atomic info in addition to tau
5252
* - BcastUnitcell
5353
* - bcast basic info of unitcell and basic info of atoms

source/module_cell/unitcell.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
#ifdef USE_PAW
2424
#include "module_cell/module_paw/paw_cell.h"
2525
#endif
26-
#ifdef __EXX
27-
#include "module_hamilt_pw/hamilt_pwdft/global.h"
28-
#include "module_ri/serialization_cereal.h"
29-
#endif
3026

3127

3228
#include "update_cell.h"
@@ -232,7 +228,7 @@ void UnitCell::update_pos_taud(double* posd_in) {
232228
}
233229
assert(iat == this->nat);
234230
unitcell::periodic_boundary_adjustment(this->atoms,this->latvec, this->ntype);
235-
this->bcast_atoms();
231+
this->bcast_atoms_tau();
236232
}
237233

238234
// posd_in is atomic displacements here liuyu 2023-03-22
@@ -250,7 +246,7 @@ void UnitCell::update_pos_taud(const ModuleBase::Vector3<double>* posd_in) {
250246
}
251247
assert(iat == this->nat);
252248
unitcell::periodic_boundary_adjustment(this->atoms,this->latvec, this->ntype);
253-
this->bcast_atoms();
249+
this->bcast_atoms_tau();
254250
}
255251

256252
void UnitCell::update_vel(const ModuleBase::Vector3<double>* vel_in) {
@@ -266,7 +262,7 @@ void UnitCell::update_vel(const ModuleBase::Vector3<double>* vel_in) {
266262
}
267263

268264

269-
void UnitCell::bcast_atoms() {
265+
void UnitCell::bcast_atoms_tau() {
270266
#ifdef __MPI
271267
MPI_Barrier(MPI_COMM_WORLD);
272268
for (int i = 0; i < ntype; i++) {

source/module_cell/unitcell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class UnitCell {
202202
void update_pos_taud(const ModuleBase::Vector3<double>* posd_in);
203203
void update_pos_taud(double* posd_in);
204204
void update_vel(const ModuleBase::Vector3<double>* vel_in);
205-
void bcast_atoms();
205+
void bcast_atoms_tau();
206206
bool judge_big_cell() const;
207207

208208
void update_stress(ModuleBase::matrix& scs); // updates stress

source/module_cell/update_cell.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ void update_pos_tau(const Lattice& lat,
371371
}
372372
assert(iat == nat);
373373
periodic_boundary_adjustment(atoms,lat.latvec,ntype);
374-
bcast_atoms(atoms, ntype);
374+
bcast_atoms_tau(atoms, ntype);
375375
}
376376

377377
void periodic_boundary_adjustment(Atom* atoms,

source/module_elecstate/read_pseudo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void read_pseudo(std::ofstream& ofs, UnitCell& ucell) {
136136
}
137137

138138
#ifdef __MPI
139-
unitcell::bcast_atoms(ucell.atoms,ucell.ntype);
139+
unitcell::bcast_atoms_tau(ucell.atoms,ucell.ntype);
140140
#endif
141141

142142
for (int it = 0; it < ucell.ntype; it++) {

0 commit comments

Comments
 (0)