Skip to content

Commit

Permalink
fix paramter name and function name
Browse files Browse the repository at this point in the history
  • Loading branch information
A-006 committed May 26, 2024
1 parent c9ad0ee commit 8929180
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 42 deletions.
2 changes: 2 additions & 0 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,8 @@ These variables are used to control the numerical atomic orbitals related parame
enough when the number is bigger then 2.
- **Default** : "4"

[back to top](#full-list-of-input-keywords)

## Electronic structure

These variables are used to control the electronic structure and geometry relaxation
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_gint/gint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void Gint::cal_gint(Gint_inout* inout)
if (isforce || isstress){
std::vector<double> force(nat * 3, 0.0);
std::vector<double> stress(6, 0.0);
GintKernel::gint_gamma_force_gpu(this->DMRGint[inout->ispin],
GintKernel::gint_fvl_gamma_gpu(this->DMRGint[inout->ispin],
ucell.omega
/ this->ncxyz,
inout->vl,
Expand Down
40 changes: 20 additions & 20 deletions source/module_hamilt_lcao/module_gint/gint_force.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ typedef struct
double** matrix_A_device;
double** matrix_B_device;
double** matrix_C_device;
} SGridParameter;
} grid_para;

typedef struct
{
Expand All @@ -55,14 +55,14 @@ typedef struct
int* iat_device;
int* iat_host;

} ForceStressIat;
} frc_strs_iat;

typedef struct
{
double* stress_global;
double* force_global;
int* iat_global;
} ForceStressIatGlobal;
} frc_strs_iat_gbl;

typedef struct
{
Expand All @@ -84,7 +84,7 @@ typedef struct
* @param ylmcoef_now Coefficients for spherical harmonics.
* @param gridt Reference to Grid_Technique object.
*/
void gint_gamma_force_gpu(hamilt::HContainer<double>* dm,
void gint_fvl_gamma_gpu(hamilt::HContainer<double>* dm,
const double vfactor,
const double* vlocal,
std::vector<double>& force,
Expand Down Expand Up @@ -138,15 +138,15 @@ void gpu_task_generator_force(const Grid_Technique& gridt,
int& max_m,
int& max_n,
int& atom_pair_num,
SGridParameter& para);
grid_para& para);
/**
* @brief Density Matrix,force Stress Iat Init
*
* Using structure to init the parameter
*
* @param denstiy_mat DensityMat,contained the density_mat_dice and
* destiyMatHost
* @param f_s_iat_dev ForceStressIatGlobal,contined the Force Stress and
* @param f_s_iat_dev frc_strs_iat_gbl,contined the Force Stress and
* Iat Number
* @param dm hamilt::HContainer,denstiy stored in the Hcontainer
* @param gridt Grid_Technique,stored the major method in the the gint.
Expand All @@ -156,7 +156,7 @@ void gpu_task_generator_force(const Grid_Technique& gridt,
* @param atom_num_grid in force calculate,used for Block nums
*/
void calculateInit(DensityMat& denstiy_mat,
ForceStressIatGlobal& f_s_iat_dev,
frc_strs_iat_gbl& f_s_iat_dev,
hamilt::HContainer<double>* dm,
const Grid_Technique& gridt,
const UnitCell& ucell,
Expand Down Expand Up @@ -189,28 +189,28 @@ void allocateDm(double* matrix_host,
* @param nbz int,stand for the number of Z-axis
* @param gridt Grid_Technique,stored the major method in the the gint.
*/
void para_init(SGridParameter& para,
void para_init(grid_para& para,
const int iter_num,
const int nbz,
const Grid_Technique& gridt);
/**
* @brief ForceStressIat on host and device Init
* @brief frc_strs_iat on host and device Init
*
* GridParameter init
*
* @param ForceStressIat ForceStressIat,contains the Force Stree Iat on Host
* @param frc_strs_iat frc_strs_iat,contains the Force Stree Iat on Host
* @param stream_num int , record the stream in GPU
* @param cuda_block in stress compute,used for Block nums
* @param atom_num_grid in force calculate,used for Block nums
* @param max_size Maximum size of atoms on a grid.
* @param ForceStressIatGlobal ForceStressIatGlobal,contains the Force Stree Iat on Host
* @param frc_strs_iat_gbl frc_strs_iat_gbl,contains the Force Stree Iat on Host
*/
void cal_init(ForceStressIat& f_s_iat,
void cal_init(frc_strs_iat& f_s_iat,
const int stream_num,
const int cuda_block,
const int atom_num_grid,
const int max_size,
ForceStressIatGlobal& f_s_iatg);
frc_strs_iat_gbl& f_s_iatg);
/**
* @brief GridParameter memCpy,from Host to Device
*
Expand All @@ -221,45 +221,45 @@ void cal_init(ForceStressIat& f_s_iat,
* @param nbz int,stand for the number of Z-axis
* @param atom_num_grid in force calculate,used for Block nums
*/
void para_mem_copy(SGridParameter& para,
void para_mem_copy(grid_para& para,
const Grid_Technique& gridt,
const int nbz,
const int atom_num_grid);
/**
* @brief Force Stress Force Iat memCpy,from Host to Device
*
* @param ForceStressIat ForceStressIat,contains the Force Stree Iat on Device
* @param frc_strs_iat frc_strs_iat,contains the Force Stree Iat on Device
* and Host
* @param gridt Grid_Technique,stored the major method in the the gint.
* @param atom_num_grid in force calculate,used for Block nums
* @param cuda_block in stress compute,used for Block nums
* @param stream_num int , record the stream in GPU
*/
void cal_mem_cpy(ForceStressIat& f_s_iat,
void cal_mem_cpy(frc_strs_iat& f_s_iat,
const Grid_Technique& gridt,
const int atom_num_grid,
const int cuda_block,
const int stream_num);
/**
* @brief Force Calculate on Host
*
* @param ForceStressIat ForceStressIat,contains the Force Stree Iat on Device
* @param frc_strs_iat frc_strs_iat,contains the Force Stree Iat on Device
* and Host
* @param force stored the force for each atom on each directions
* @param atom_num_grid in force calculate,used for Block nums
*/
void cal_force_add(ForceStressIat& f_s_iat,
void cal_force_add(frc_strs_iat& f_s_iat,
std::vector<double>& force,
const int atom_num_grid);
/**
* @brief Stress Calculate on Host
*
* @param ForceStressIat ForceStressIat,contains the Force Stree Iat on Device
* @param frc_strs_iat frc_strs_iat,contains the Force Stree Iat on Device
* and Host
* @param stress stored the stress for each directions
* @param cuda_block in stress compute,used for Block nums
*/
void cal_stress_add(ForceStressIat& f_s_iat,
void cal_stress_add(frc_strs_iat& f_s_iat,
std::vector<double>& stress,
const int cuda_block);
} // namespace GintKernel
Expand Down
12 changes: 6 additions & 6 deletions source/module_hamilt_lcao/module_gint/gint_force_gpu.cu
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace GintKernel

// Function to calculate forces using GPU-accelerated gamma point Gint
/**
* @brief Calculate forces and stresses for the `gint_gamma_force_gpu` function.
* @brief Calculate forces and stresses for the `gint_fvl_gamma_gpu` function.
*
* This function calculates forces and stresses based on given parameters.
*
Expand All @@ -30,7 +30,7 @@ namespace GintKernel
*/
/**
* Function to calculate forces using GPU-accelerated gamma point Gint
* @brief Calculate forces and stresses for the `gint_gamma_force_gpu` function.
* @brief Calculate forces and stresses for the `gint_fvl_gamma_gpu` function.
*
* This function calculates forces and stresses based on given parameters.
*
Expand All @@ -55,7 +55,7 @@ namespace GintKernel
* 6. force dot on the GPU.
* 7. Copy the results back to the host.
*/
void gint_gamma_force_gpu(hamilt::HContainer<double>* dm,
void gint_fvl_gamma_gpu(hamilt::HContainer<double>* dm,
const double vfactor,
const double* vlocal,
std::vector<double>& force,
Expand All @@ -79,9 +79,9 @@ void gint_gamma_force_gpu(hamilt::HContainer<double>* dm,
= std::min(64, (gridt.psir_size + cuda_threads - 1) / cuda_threads);
int iter_num = 0;
DensityMat denstiy_mat;
ForceStressIatGlobal f_s_iat_dev;
SGridParameter para;
ForceStressIat f_s_iat;
frc_strs_iat_gbl f_s_iat_dev;
grid_para para;
frc_strs_iat f_s_iat;

calculateInit(denstiy_mat,
f_s_iat_dev,
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_gint/gtask_force.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void gpu_task_generator_force(const Grid_Technique& gridt,
int& max_m,
int& max_n,
int& atom_pair_num,
SGridParameter& para)
grid_para& para)
{
const int grid_index_ij = i * gridt.nby * gridt.nbzp + j * gridt.nbzp;
const int nwmax = ucell.nwmax;
Expand Down
28 changes: 14 additions & 14 deletions source/module_hamilt_lcao/module_gint/kernels/cuda/gint_force.cu
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ __global__ void dot_product_force(double* psir_lx,
}
}
void calculateInit(DensityMat& denstiy_mat,
ForceStressIatGlobal& f_s_iat_dev,
frc_strs_iat_gbl& f_s_iat_dev,
hamilt::HContainer<double>* dm,
const Grid_Technique& gridt,
const UnitCell& ucell,
Expand Down Expand Up @@ -300,7 +300,7 @@ void calculateInit(DensityMat& denstiy_mat,
* @param nbz int,stand for the number of Z-axis
* @param gridt Grid_Technique,stored the major method in the the gint.
*/
void para_init(SGridParameter& para,
void para_init(grid_para& para,
int iter_num,
int nbz,
const Grid_Technique& gridt)
Expand Down Expand Up @@ -377,23 +377,23 @@ void para_init(SGridParameter& para,
= &gridt.ap_output_gbl_g[gridt.atom_pair_nbz * para.stream_num];
}
/**
* @brief ForceStressIat on host and device Init
* @brief frc_strs_iat on host and device Init
*
* GridParameter init
*
* @param ForceStressIat ForceStressIat,contains the Force Stree Iat on Host
* @param frc_strs_iat frc_strs_iat,contains the Force Stree Iat on Host
* @param stream_num int , record the stream in GPU
* @param cuda_block in stress compute,used for Block nums
* @param atom_num_grid in force calculate,used for Block nums
* @param max_size Maximum size of atoms on a grid.
* @param ForceStressIatGlobal ForceStressIatGlobal,contains the Force Stree Iat on Host
* @param frc_strs_iat_gbl frc_strs_iat_gbl,contains the Force Stree Iat on Host
*/
void cal_init(ForceStressIat& f_s_iat,
void cal_init(frc_strs_iat& f_s_iat,
const int stream_num,
const int cuda_block,
const int atom_num_grid,
const int max_size,
ForceStressIatGlobal& f_s_iat_dev)
frc_strs_iat_gbl& f_s_iat_dev)
{
const int iat_min = -max_size - 1;
f_s_iat.stress_host = new double[6 * cuda_block];
Expand Down Expand Up @@ -423,7 +423,7 @@ void cal_init(ForceStressIat& f_s_iat,
* @param nbz int,stand for the number of Z-axis
* @param atom_num_grid in force calculate,used for Block nums
*/
void para_mem_copy(SGridParameter& para,
void para_mem_copy(grid_para& para,
const Grid_Technique& gridt,
const int nbz,
const int atom_num_grid)
Expand Down Expand Up @@ -536,14 +536,14 @@ void para_mem_copy(SGridParameter& para,
/**
* @brief Force Stress Force Iat memCpy,from Host to Device
*
* @param ForceStressIat ForceStressIat,contains the Force Stree Iat on Device
* @param frc_strs_iat frc_strs_iat,contains the Force Stree Iat on Device
* and Host
* @param gridt Grid_Technique,stored the major method in the the gint.
* @param atom_num_grid in force calculate,used for Block nums
* @param cuda_block in stress compute,used for Block nums
* @param stream_num int , record the stream in GPU
*/
void cal_mem_cpy(ForceStressIat& f_s_iat,
void cal_mem_cpy(frc_strs_iat& f_s_iat,
const Grid_Technique& gridt,
const int atom_num_grid,
const int cuda_block,
Expand All @@ -566,12 +566,12 @@ void cal_mem_cpy(ForceStressIat& f_s_iat,
/*
* @brief Force Calculate on Host
*
* @param ForceStressIat ForceStressIat,contains the Force Stree Iat on Device
* @param frc_strs_iat frc_strs_iat,contains the Force Stree Iat on Device
* and Host
* @param force stored the force for each atom on each directions
* @param atom_num_grid in force calculate,used for Block nums
*/
void cal_force_add(ForceStressIat& f_s_iat,
void cal_force_add(frc_strs_iat& f_s_iat,
std::vector<double>& force,
const int atom_num_grid)
{
Expand All @@ -595,12 +595,12 @@ void cal_force_add(ForceStressIat& f_s_iat,
/**
* @brief Stress Calculate on Host
*
* @param ForceStressIat ForceStressIat,contains the Force Stree Iat on Device
* @param frc_strs_iat frc_strs_iat,contains the Force Stree Iat on Device
* and Host
* @param stress stored the stress for each directions
* @param cuda_block in stress compute,used for Block nums
*/
void cal_stress_add(ForceStressIat& f_s_iat,
void cal_stress_add(frc_strs_iat& f_s_iat,
std::vector<double>& stress,
const int cuda_block)
{
Expand Down

0 comments on commit 8929180

Please sign in to comment.