Skip to content

Commit 68d3aaa

Browse files
authored
Merge pull request #991 from YuLiu98/develop
fix : bcast unitcell in MSST
2 parents d9bc4e8 + 25e36ab commit 68d3aaa

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

source/module_cell/atom_spec.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Atom::Atom()
1515
taud = new ModuleBase::Vector3<double>[1];
1616
vel = new ModuleBase::Vector3<double>[1];
1717
mag = new double[1];
18+
angle1 = new double[1];
19+
angle2 = new double[1];
20+
m_loc_ = new ModuleBase::Vector3<double>[1];
1821
l_nchi = new int[1];
1922
iw2l = new int[1];
2023
iw2n = new int[1];
@@ -29,6 +32,9 @@ Atom::~Atom()
2932
delete[] taud;
3033
delete[] vel;
3134
delete[] mag;
35+
delete[] angle1;
36+
delete[] angle2;
37+
delete[] m_loc_;
3238
delete[] l_nchi;
3339
delete[] iw2l;
3440
delete[] iw2n;
@@ -137,6 +143,9 @@ void Atom::bcast_atom(void)
137143
delete[] taud;
138144
delete[] vel;
139145
delete[] mag;
146+
delete[] angle1;
147+
delete[] angle2;
148+
delete[] m_loc_;
140149
tau = new ModuleBase::Vector3<double>[na];
141150
taud = new ModuleBase::Vector3<double>[na];
142151
vel = new ModuleBase::Vector3<double>[na];

source/module_cell/read_atoms.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,9 @@ bool UnitCell_pseudo::read_atom_positions(std::ifstream &ifpos, std::ofstream &o
570570
delete[] atoms[it].vel;
571571
delete[] atoms[it].mbl;
572572
delete[] atoms[it].mag;
573+
delete[] atoms[it].angle1;
574+
delete[] atoms[it].angle2;
575+
delete[] atoms[it].m_loc_;
573576
atoms[it].tau = new ModuleBase::Vector3<double>[na];
574577
atoms[it].taud = new ModuleBase::Vector3<double>[na];
575578
atoms[it].vel = new ModuleBase::Vector3<double>[na];

source/module_cell/unitcell_pseudo.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -695,24 +695,11 @@ void UnitCell_pseudo::setup_cell_after_vc(std::ofstream &log)
695695
for(int ia =0;ia< atom->na;ia++)
696696
{
697697
atom->tau[ia] = atom->taud[ia] * latvec;
698-
/*
699-
#ifdef __MPI
700-
Parallel_Common::bcast_double( atom->tau[ia].x );
701-
Parallel_Common::bcast_double( atom->tau[ia].y );
702-
Parallel_Common::bcast_double( atom->tau[ia].z );
703-
Parallel_Common::bcast_double( atom->taud[ia].x );
704-
Parallel_Common::bcast_double( atom->taud[ia].y );
705-
Parallel_Common::bcast_double( atom->taud[ia].z );
706-
#endif
707-
*/
708698
}
709699
}
700+
710701
#ifdef __MPI
711-
MPI_Barrier(MPI_COMM_WORLD);
712-
for (int i=0;i<ntype;i++)
713-
{
714-
atoms[i].bcast_atom(); // bcast tau array
715-
}
702+
this->bcast_unitcell();
716703
#endif
717704

718705
log << std::endl;

source/module_md/MSST.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ void MSST::rescale(double volume)
240240
ucell.latvec.e11 *= dilation[0];
241241
ucell.latvec.e22 *= dilation[1];
242242
ucell.latvec.e33 *= dilation[2];
243+
ucell.a1 *= dilation[0];
244+
ucell.a2 *= dilation[1];
245+
ucell.a3 *= dilation[2];
243246

244247
ucell.setup_cell_after_vc(GlobalV::ofs_running);
245248
MD_func::InitPos(ucell, pos);

0 commit comments

Comments
 (0)