Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [System variables](#system-variables)
- [suffix](#suffix)
- [ntype](#ntype)
- [replicate](#replicate)
- [calculation](#calculation)
- [esolver\_type](#esolver_type)
- [symmetry](#symmetry)
Expand Down Expand Up @@ -580,6 +581,12 @@
- **Description**: Number of different atom species in the calculation.
- **Default**: 0

### replicate

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest changing 'replicate' to 'cell_replica'


- **Type**: Three Integers
- **Description**: Replicate the input STRU by Na, Nb, and Nc along its lattice vectors for distributed MDCell workflows. The default is 1 1 1, which preserves the input structure.
- **Default**: 1 1 1

### calculation

- **Type**: String
Expand Down
8 changes: 8 additions & 0 deletions docs/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ parameters:
default_value: "0"
unit: ""
availability: ""
- name: replicate
category: System variables
type: Three Integers
description: |
Replicate the input STRU by Na, Nb, and Nc along its lattice vectors for distributed MDCell workflows. The default is 1 1 1, which preserves the input structure.
default_value: 1 1 1
unit: ""
availability: ""
- name: calculation
category: System variables
type: String
Expand Down
1 change: 1 addition & 0 deletions source/source_base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ add_library(
tool_title.cpp
ylm.cpp
parallel_common.cpp
communication_domain.cpp

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest changing the name to parallel_cell.cpp

parallel_global.cpp
parallel_comm.cpp
parallel_reduce.cpp
Expand Down
43 changes: 43 additions & 0 deletions source/source_base/communication_domain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "source_base/communication_domain.h"

namespace ModuleBase
{
CommunicationDomain::CommunicationDomain()
{
}

#ifdef __MPI
CommunicationDomain::CommunicationDomain(MPI_Comm communicator) : communicator_(communicator)
{
if (communicator_ != MPI_COMM_NULL)
{
MPI_Comm_rank(communicator_, &rank_);
MPI_Comm_size(communicator_, &size_);
}
}

MPI_Comm CommunicationDomain::communicator() const
{
return communicator_;
}
#endif

int CommunicationDomain::rank() const
{
return rank_;
}

int CommunicationDomain::size() const
{
return size_;
}

CommunicationDomain world_communication_domain()
{
#ifdef __MPI
return CommunicationDomain(MPI_COMM_WORLD);
#else
return CommunicationDomain();
#endif
}
} // namespace ModuleBase
39 changes: 39 additions & 0 deletions source/source_base/communication_domain.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef COMMUNICATION_DOMAIN_H
#define COMMUNICATION_DOMAIN_H

#ifdef __MPI
#include <mpi.h>
#endif

namespace ModuleBase
{
/**
* @brief A non-owning MPI communication domain supplied to a subsystem.
*
* The creator remains responsible for the lifetime of the MPI communicator.
*/
class CommunicationDomain
{
public:
CommunicationDomain();

#ifdef __MPI
explicit CommunicationDomain(MPI_Comm communicator);
MPI_Comm communicator() const;
#endif

int rank() const;
int size() const;

private:
#ifdef __MPI
MPI_Comm communicator_ = MPI_COMM_NULL;
#endif
int rank_ = 0;
int size_ = 1;
};

CommunicationDomain world_communication_domain();
} // namespace ModuleBase

#endif
5 changes: 3 additions & 2 deletions source/source_base/parallel_comm.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "parallel_comm.h"

#if defined __MPI

#include "mpi.h"
#include "parallel_global.h"

MPI_Comm POOL_WORLD; //groups for different plane waves. In this group, only plane waves are different. K-points and bands are the same.
Expand Down Expand Up @@ -52,4 +53,4 @@ void MPICommGroup::divide_group_comm(const int& ngroup, const bool assert_even)
}
}

#endif
#endif
2 changes: 1 addition & 1 deletion source/source_base/parallel_comm.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ class MPICommGroup

#endif

#endif // PARALLEL_COMM_H
#endif // PARALLEL_COMM_H
2 changes: 2 additions & 0 deletions source/source_cell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ add_library(
read_pp_upf201.cpp
read_pp_blps.cpp
read_pp_vwr.cpp
distributed_mdcell_reader.cpp
md_cell.cpp
unitcell.cpp
read_atoms.cpp
read_atoms_helper.cpp
Expand Down
6 changes: 4 additions & 2 deletions source/source_cell/base_cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "source_base/matrix3.h"

#include <cstdint>

class BaseCell
{
public:
Expand All @@ -19,7 +21,7 @@ class BaseCell
return get_kind();
}

int nat() const
std::int64_t nat() const
{
return get_nat();
}
Expand Down Expand Up @@ -48,7 +50,7 @@ class BaseCell

private:
virtual Kind get_kind() const = 0;
virtual int get_nat() const = 0;
virtual std::int64_t get_nat() const = 0;
virtual double get_lat0() const = 0;
virtual double get_omega() const = 0;
virtual const ModuleBase::Matrix3& get_latvec() const = 0;
Expand Down
Loading