ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Grid Class Reference

#include <sltk_grid.h>

Inheritance diagram for Grid:
Collaboration diagram for Grid:

Public Member Functions

 Grid ()
 Default constructor.
 Grid (const int &test_grid_in)
 Constructor with test flag.
virtual ~Grid ()
 Destructor.
Grid & operator= (Grid &&)=default
void init (std::ofstream &ofs, const UnitCell &ucell, const double radius_in, const bool boundary=true)
 Initialize the grid.
void getBox (int &bx, int &by, int &bz, const double &x, const double &y, const double &z)
 Get box indices for given coordinates.
void clear_atoms ()
 Clear all atoms and adjacent information.
void clear_adj_info ()
 Clear adjacent information only.
int getGlayerX () const
int getGlayerY () const
int getGlayerZ () const
int getGlayerX_minus () const
int getGlayerY_minus () const
int getGlayerZ_minus () const

Public Attributes

bool pbc =false
 Data.
double sradius2 =0.0
 searching radius squared (unit:lat0)
double sradius =0.0
 searching radius (unit:lat0)
double x_min =0.0
 coordinate range of the input atom (unit:lat0)
double y_min =0.0
double z_min =0.0
double x_max =0.0
double y_max =0.0
double z_max =0.0
double box_edge_length =0.0
 box edge length (equal to sradius)
int box_nx =0
 number of boxes in x direction
int box_ny =0
 number of boxes in y direction
int box_nz =0
 number of boxes in z direction
std::vector< std::vector< std::vector< AtomMap > > > atoms_in_box
 Stores the atoms after box partitioning.
std::vector< std::vector< std::vector< FAtom * > > > all_adj_info
 Stores the adjacent information of atoms. [ntype][natom][adj list].

Private Member Functions

void setMemberVariables (std::ofstream &ofs_in, const UnitCell &ucell)
 Set member variables.
void Construct_Adjacent (const UnitCell &ucell)
 Construct adjacent atom information.
void Construct_Adjacent_near_box (const FAtom &fatom)
 Construct adjacent atom information for nearby boxes.
void Construct_Adjacent_final (const FAtom &fatom1, FAtom *fatom2)
 Finalize adjacent atom information for a pair of atoms.
void Check_Expand_Condition (const UnitCell &ucell)
 Check expansion condition for periodic images.

Private Attributes

int test_grid
 test flag
int glayerX =0
 number of periodic images in positive x direction
int glayerX_minus =0
 number of periodic images in negative x direction
int glayerY =0
 number of periodic images in positive y direction
int glayerY_minus =0
 number of periodic images in negative y direction
int glayerZ =0
 number of periodic images in positive z direction
int glayerZ_minus =0
 number of periodic images in negative z direction

Friends

class SltkGridTest
 the unit test drives the private setMemberVariables() directly

Constructor & Destructor Documentation

◆ Grid() [1/2]

Grid::Grid ( )
inline

Default constructor.

Grid is Global class, so init it with constant number.

Here is the caller graph for this function:

◆ Grid() [2/2]

Grid::Grid ( const int & test_grid_in)

Constructor with test flag.

Parameters
test_grid_intest flag
Here is the call graph for this function:

◆ ~Grid()

Grid::~Grid ( )
virtual

Destructor.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ Check_Expand_Condition()

void Grid::Check_Expand_Condition ( const UnitCell & ucell)
private

Check expansion condition for periodic images.

Parameters
ucellunit cell
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_adj_info()

void Grid::clear_adj_info ( )
inline

Clear adjacent information only.

Here we don't need to free the memory because the pointers point to the memory in vector atoms_in_box.

◆ clear_atoms()

void Grid::clear_atoms ( )
inline

Clear all atoms and adjacent information.

We have to clear the all_adj_info because the pointers point to the memory in vector atoms_in_box.

Here is the caller graph for this function:

◆ Construct_Adjacent()

void Grid::Construct_Adjacent ( const UnitCell & ucell)
private

Construct adjacent atom information.

Parameters
ucellunit cell
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Construct_Adjacent_final()

void Grid::Construct_Adjacent_final ( const FAtom & fatom1,
FAtom * fatom2 )
private

Finalize adjacent atom information for a pair of atoms.

Parameters
fatom1first atom
fatom2second atom
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Construct_Adjacent_near_box()

void Grid::Construct_Adjacent_near_box ( const FAtom & fatom)
private

Construct adjacent atom information for nearby boxes.

Parameters
fatomatom for which to find neighbors
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBox()

void Grid::getBox ( int & bx,
int & by,
int & bz,
const double & x,
const double & y,
const double & z )
inline

Get box indices for given coordinates.

Parameters
bxbox index in x direction (output)
bybox index in y direction (output)
bzbox index in z direction (output)
xx coordinate
yy coordinate
zz coordinate
Here is the caller graph for this function:

◆ getGlayerX()

int Grid::getGlayerX ( ) const
inline
Here is the caller graph for this function:

◆ getGlayerX_minus()

int Grid::getGlayerX_minus ( ) const
inline
Here is the caller graph for this function:

◆ getGlayerY()

int Grid::getGlayerY ( ) const
inline
Here is the caller graph for this function:

◆ getGlayerY_minus()

int Grid::getGlayerY_minus ( ) const
inline
Here is the caller graph for this function:

◆ getGlayerZ()

int Grid::getGlayerZ ( ) const
inline
Here is the caller graph for this function:

◆ getGlayerZ_minus()

int Grid::getGlayerZ_minus ( ) const
inline
Here is the caller graph for this function:

◆ init()

void Grid::init ( std::ofstream & ofs,
const UnitCell & ucell,
const double radius_in,
const bool boundary = true )

Initialize the grid.

Parameters
ofsoutput file stream
ucellunit cell
radius_insearching radius
boundarywhether to apply boundary conditions
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

Grid & Grid::operator= ( Grid && )
default
Here is the call graph for this function:

◆ setMemberVariables()

void Grid::setMemberVariables ( std::ofstream & ofs_in,
const UnitCell & ucell )
private

Set member variables.

Parameters
ofs_inoutput file stream
ucellunit cell
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SltkGridTest

friend class SltkGridTest
friend

the unit test drives the private setMemberVariables() directly

Member Data Documentation

◆ all_adj_info

std::vector<std::vector< std::vector<FAtom *> > > Grid::all_adj_info

Stores the adjacent information of atoms. [ntype][natom][adj list].

◆ atoms_in_box

std::vector<std::vector<std::vector<AtomMap> > > Grid::atoms_in_box

Stores the atoms after box partitioning.

◆ box_edge_length

double Grid::box_edge_length =0.0

box edge length (equal to sradius)

◆ box_nx

int Grid::box_nx =0

number of boxes in x direction

◆ box_ny

int Grid::box_ny =0

number of boxes in y direction

◆ box_nz

int Grid::box_nz =0

number of boxes in z direction

◆ glayerX

int Grid::glayerX =0
private

number of periodic images in positive x direction

◆ glayerX_minus

int Grid::glayerX_minus =0
private

number of periodic images in negative x direction

◆ glayerY

int Grid::glayerY =0
private

number of periodic images in positive y direction

◆ glayerY_minus

int Grid::glayerY_minus =0
private

number of periodic images in negative y direction

◆ glayerZ

int Grid::glayerZ =0
private

number of periodic images in positive z direction

◆ glayerZ_minus

int Grid::glayerZ_minus =0
private

number of periodic images in negative z direction

◆ pbc

bool Grid::pbc =false

Data.

When pbc is set to false, periodic boundary conditions are explicitly ignored.

◆ sradius

double Grid::sradius =0.0

searching radius (unit:lat0)

◆ sradius2

double Grid::sradius2 =0.0

searching radius squared (unit:lat0)

◆ test_grid

int Grid::test_grid
private

test flag

◆ x_max

double Grid::x_max =0.0

◆ x_min

double Grid::x_min =0.0

coordinate range of the input atom (unit:lat0)

◆ y_max

double Grid::y_max =0.0

◆ y_min

double Grid::y_min =0.0

◆ z_max

double Grid::z_max =0.0

◆ z_min

double Grid::z_min =0.0

The documentation for this class was generated from the following files: