Skip to content

Commit cea80b8

Browse files
author
Fei Yang
committed
fix: restore distributed MDCell build integration
1 parent d87c618 commit cea80b8

6 files changed

Lines changed: 6 additions & 31 deletions

File tree

source/source_cell/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ add_library(
2424
klist.cpp
2525
parallel_kpoints.cpp
2626
cell_index.cpp
27+
cell_tools.cpp
2728
check_atomic_stru.cpp
2829
update_cell.cpp
2930
magnetism.cpp
@@ -39,6 +40,7 @@ add_library(
3940
cal_nelec_nband.cpp
4041
read_pseudo.cpp
4142
cal_wfc.cpp
43+
cal_ux.cpp
4244
)
4345

4446
if(ENABLE_COVERAGE)

source/source_cell/distributed_mdcell_reader.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,5 @@ MDCell DistributedMDCellReader::read_stru(const std::string& stru_file,
366366
cutoff,
367367
skin);
368368
mdcell.set_stru_metadata(metadata.stru_metadata);
369-
mdcell.set_uses_replicated_stru(replicate[0] != 1 || replicate[1] != 1 || replicate[2] != 1);
370369
return mdcell;
371370
}

source/source_cell/md_cell.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -442,13 +442,6 @@ std::vector<LocalAtom>& MDCell::mutable_ghost_atoms()
442442
return ghost_atoms_;
443443
}
444444

445-
void MDCell::replace_owned_atoms_for_restart(const std::vector<LocalAtom>& owned_atoms)
446-
{
447-
owned_atoms_ = owned_atoms;
448-
clear_forces_(owned_atoms_);
449-
exchange_ghost_atoms();
450-
}
451-
452445
int MDCell::nlocal() const
453446
{
454447
return static_cast<int>(owned_atoms_.size());
@@ -484,16 +477,6 @@ bool MDCell::has_backing_unitcell() const
484477
return backing_unitcell_ != nullptr;
485478
}
486479

487-
bool MDCell::uses_replicated_stru() const
488-
{
489-
return uses_replicated_stru_;
490-
}
491-
492-
void MDCell::set_uses_replicated_stru(const bool uses_replicated_stru)
493-
{
494-
uses_replicated_stru_ = uses_replicated_stru;
495-
}
496-
497480
UnitCell& MDCell::backing_unitcell()
498481
{
499482
assert(backing_unitcell_ != nullptr);

source/source_cell/md_cell.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ class MDCell : public BaseCell
8181
void set_stru_metadata(const MdStruMetadata& metadata);
8282
std::vector<LocalAtom>& mutable_owned_atoms();
8383
std::vector<LocalAtom>& mutable_ghost_atoms();
84-
void replace_owned_atoms_for_restart(const std::vector<LocalAtom>& owned_atoms);
8584

8685
int nlocal() const;
8786
int nghost() const;
@@ -90,8 +89,6 @@ class MDCell : public BaseCell
9089
double cutoff() const;
9190
double skin() const;
9291
bool has_backing_unitcell() const;
93-
bool uses_replicated_stru() const;
94-
void set_uses_replicated_stru(bool uses_replicated_stru);
9592
UnitCell& backing_unitcell();
9693
const UnitCell& backing_unitcell() const;
9794
void sync_backing_unitcell();
@@ -132,7 +129,6 @@ class MDCell : public BaseCell
132129
double cutoff_ = 0.0;
133130
double skin_ = 0.0;
134131
UnitCell* backing_unitcell_ = nullptr;
135-
bool uses_replicated_stru_ = false;
136132

137133
#ifdef __MPI
138134
MPI_Comm comm_ = MPI_COMM_NULL;

source/source_cell/module_neighlist/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if(ENABLE_MPI)
4343
)
4444
target_link_libraries(MODULE_CELL_NEIGHBOR_mdcell_migrate_mpi
4545
PRIVATE
46-
parameter base device GTest::gtest_main GTest::gmock_main abacus::linalg_libs
46+
parameter base device MPI::MPI_CXX GTest::gtest_main GTest::gmock_main abacus::linalg_libs
4747
)
4848
install(TARGETS MODULE_CELL_NEIGHBOR_mdcell_migrate_mpi DESTINATION ${CMAKE_BINARY_DIR}/tests)
4949
add_test(NAME MODULE_CELL_NEIGHBOR_mdcell_migrate_mpi

source/source_esolver/esolver_lj.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#include "source_io/module_output/output_log.h"
66
#include "source_cell/module_neighlist/neighbor_types.h"
77
#include "source_cell/module_neighlist/neighbor_search.h"
8+
#include "source_cell/md_cell.h"
89
#include "source_base/global_variable.h"
910
#include "source_base/timer.h"
1011
#ifdef __MPI
11-
#include "source_cell/module_neighlist/domain_decomposition.h"
1212
#include "source_base/parallel_reduce.h"
1313
#endif
1414

@@ -58,13 +58,8 @@ void ESolver_LJ::runner(BaseCell& cell, const int istep)
5858
{
5959
ModuleBase::timer::start("ESolverLJ", "mpi_total");
6060
ModuleBase::timer::start("ESolverLJ", "neigh_init");
61-
DomainDecomposition decomp;
62-
decomp.init(MPI_COMM_WORLD, ucell.latvec, ucell.lat0, search_radius, 0.0);
63-
std::vector<LocalAtom> owned_atoms;
64-
std::vector<LocalAtom> ghost_atoms;
65-
decomp.split_owned_atoms_from_ucell(ucell, owned_atoms);
66-
decomp.exchange_ghost_atoms(owned_atoms, ghost_atoms);
67-
neighbor_search.init_distributed(owned_atoms, ghost_atoms, search_radius, ucell.lat0);
61+
MDCell mdcell(ucell, MPI_COMM_WORLD, search_radius, 0.0);
62+
neighbor_search.init(mdcell, search_radius);
6863
ModuleBase::timer::end("ESolverLJ", "neigh_init");
6964
ModuleBase::timer::start("ESolverLJ", "neigh_bld");
7065
neighbor_search.build_neighbors();

0 commit comments

Comments
 (0)