Skip to content

Commit 0d49ba0

Browse files
committed
Merge branch 'develop' of https://github.com/deepmodeling/abacus-develop into refactor
2 parents 6c0b2b2 + d73b1d2 commit 0d49ba0

37 files changed

+1244
-2078
lines changed

source/Makefile.Objects

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,11 @@ OBJS_DEEPKS=LCAO_deepks.o\
201201
deepks_hmat.o\
202202
LCAO_deepks_interface.o\
203203
orbital_precalc.o\
204-
orbital_precalc_k.o\
205204
cal_gdmx.o\
206-
cal_gdmx_k.o\
207205
cal_gedm.o\
208206
cal_gvx.o\
209207
cal_descriptor.o\
210208
v_delta_precalc.o\
211-
v_delta_precalc_k.o\
212209

213210

214211
OBJS_ELECSTAT=elecstate.o\

source/module_cell/atom_spec.cpp

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -102,51 +102,54 @@ void Atom::bcast_atom(void)
102102
Parallel_Common::bcast_bool(this->flag_empty_element);
103103
Parallel_Common::bcast_double(mass);
104104

105-
if (GlobalV::MY_RANK != 0)
105+
if (na > 0)
106106
{
107-
assert(na != 0);
108-
this->tau.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
109-
this->dis.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
110-
this->taud.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
111-
this->vel.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
112-
this->mag.resize(na, 0);
113-
this->angle1.resize(na, 0);
114-
this->angle2.resize(na, 0);
115-
this->m_loc_.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
116-
this->mbl.resize(na, ModuleBase::Vector3<int>(0, 0, 0));
117-
this->lambda.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
118-
this->constrain.resize(na, ModuleBase::Vector3<int>(0, 0, 0));
119-
}
107+
if (GlobalV::MY_RANK != 0)
108+
{
109+
assert(na != 0);
110+
this->tau.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
111+
this->dis.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
112+
this->taud.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
113+
this->vel.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
114+
this->mag.resize(na, 0);
115+
this->angle1.resize(na, 0);
116+
this->angle2.resize(na, 0);
117+
this->m_loc_.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
118+
this->mbl.resize(na, ModuleBase::Vector3<int>(0, 0, 0));
119+
this->lambda.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
120+
this->constrain.resize(na, ModuleBase::Vector3<int>(0, 0, 0));
121+
}
120122

121-
for (int i = 0; i < na; i++)
122-
{
123-
Parallel_Common::bcast_double(tau[i].x);
124-
Parallel_Common::bcast_double(tau[i].y);
125-
Parallel_Common::bcast_double(tau[i].z);
126-
Parallel_Common::bcast_double(taud[i].x);
127-
Parallel_Common::bcast_double(taud[i].y);
128-
Parallel_Common::bcast_double(taud[i].z);
129-
Parallel_Common::bcast_double(dis[i].x);
130-
Parallel_Common::bcast_double(dis[i].y);
131-
Parallel_Common::bcast_double(dis[i].z);
132-
Parallel_Common::bcast_double(vel[i].x);
133-
Parallel_Common::bcast_double(vel[i].y);
134-
Parallel_Common::bcast_double(vel[i].z);
135-
Parallel_Common::bcast_double(mag[i]);
136-
Parallel_Common::bcast_double(angle1[i]);
137-
Parallel_Common::bcast_double(angle2[i]);
138-
Parallel_Common::bcast_double(m_loc_[i].x);
139-
Parallel_Common::bcast_double(m_loc_[i].y);
140-
Parallel_Common::bcast_double(m_loc_[i].z);
141-
Parallel_Common::bcast_int(mbl[i].x);
142-
Parallel_Common::bcast_int(mbl[i].y);
143-
Parallel_Common::bcast_int(mbl[i].z);
144-
Parallel_Common::bcast_double(lambda[i].x);
145-
Parallel_Common::bcast_double(lambda[i].y);
146-
Parallel_Common::bcast_double(lambda[i].z);
147-
Parallel_Common::bcast_int(constrain[i].x);
148-
Parallel_Common::bcast_int(constrain[i].y);
149-
Parallel_Common::bcast_int(constrain[i].z);
123+
for (int i = 0; i < na; i++)
124+
{
125+
Parallel_Common::bcast_double(tau[i].x);
126+
Parallel_Common::bcast_double(tau[i].y);
127+
Parallel_Common::bcast_double(tau[i].z);
128+
Parallel_Common::bcast_double(taud[i].x);
129+
Parallel_Common::bcast_double(taud[i].y);
130+
Parallel_Common::bcast_double(taud[i].z);
131+
Parallel_Common::bcast_double(dis[i].x);
132+
Parallel_Common::bcast_double(dis[i].y);
133+
Parallel_Common::bcast_double(dis[i].z);
134+
Parallel_Common::bcast_double(vel[i].x);
135+
Parallel_Common::bcast_double(vel[i].y);
136+
Parallel_Common::bcast_double(vel[i].z);
137+
Parallel_Common::bcast_double(mag[i]);
138+
Parallel_Common::bcast_double(angle1[i]);
139+
Parallel_Common::bcast_double(angle2[i]);
140+
Parallel_Common::bcast_double(m_loc_[i].x);
141+
Parallel_Common::bcast_double(m_loc_[i].y);
142+
Parallel_Common::bcast_double(m_loc_[i].z);
143+
Parallel_Common::bcast_int(mbl[i].x);
144+
Parallel_Common::bcast_int(mbl[i].y);
145+
Parallel_Common::bcast_int(mbl[i].z);
146+
Parallel_Common::bcast_double(lambda[i].x);
147+
Parallel_Common::bcast_double(lambda[i].y);
148+
Parallel_Common::bcast_double(lambda[i].z);
149+
Parallel_Common::bcast_int(constrain[i].x);
150+
Parallel_Common::bcast_int(constrain[i].y);
151+
Parallel_Common::bcast_int(constrain[i].z);
152+
}
150153
}
151154

152155
return;

source/module_cell/read_atoms.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,18 @@ bool UnitCell::read_atom_positions(std::ifstream &ifpos, std::ofstream &ofs_runn
504504
ModuleBase::WARNING("read_atom_positions", " atom number < 0.");
505505
return false;
506506
}
507-
if (na > 0)
507+
else if (na == 0)
508+
{
509+
std::cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;
510+
std::cout << " Warning: atom number is 0 for atom type: " << atoms[it].label << std::endl;
511+
std::cout << " If you are confident that this is not a mistake, please ignore this warning." << std::endl;
512+
std::cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;
513+
ofs_running << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;
514+
ofs_running << " Warning: atom number is 0 for atom type: " << atoms[it].label << std::endl;
515+
ofs_running << " If you are confident that this is not a mistake, please ignore this warning." << std::endl;
516+
ofs_running << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;
517+
}
518+
else if (na > 0)
508519
{
509520
atoms[it].tau.resize(na, ModuleBase::Vector3<double>(0,0,0));
510521
atoms[it].dis.resize(na, ModuleBase::Vector3<double>(0,0,0));
@@ -891,6 +902,12 @@ bool UnitCell::read_atom_positions(std::ifstream &ifpos, std::ofstream &ofs_runn
891902
ofs_running << std::endl;
892903
ModuleBase::GlobalFunc::OUT(ofs_running,"TOTAL ATOM NUMBER",nat);
893904

905+
if (nat == 0)
906+
{
907+
ModuleBase::WARNING("read_atom_positions","no atom in the system!");
908+
return false;
909+
}
910+
894911
// mohan add 2010-06-30
895912
//xiaohui modify 2015-03-15, cancel outputfile "STRU_READIN.xyz"
896913
//this->print_cell_xyz("STRU_READIN.xyz");

0 commit comments

Comments
 (0)