Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into refactor
  • Loading branch information
YuLiu98 committed Nov 21, 2024
2 parents 44159e4 + c650aa8 commit 01cd5f8
Show file tree
Hide file tree
Showing 155 changed files with 896 additions and 1,339 deletions.
10 changes: 10 additions & 0 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@
- [pexsi\_zero\_thr](#pexsi_zero_thr)
- [Linear Response TDDFT](#linear-response-tddft)
- [xc\_kernel](#xc_kernel)
- [lr\_init\_xc\_kernel](#lr_init_xc_kernel)
- [lr\_solver](#lr_solver)
- [lr\_thr](#lr_thr)
- [nocc](#nocc)
Expand Down Expand Up @@ -3943,6 +3944,15 @@ These parameters are used to solve the excited states using. e.g. LR-TDDFT.
Currently supported: `RPA`, `LDA`, `PBE`, `HSE`, `HF`.
- **Default**: LDA

### lr_init_xc_kernel

- **Type**: String
- **Description**: The method to initalize the xc kernel.
- "default": Calculate xc kerenel ($f_\text{xc}$) from the ground-state charge density.
- "file": Read the xc kernel $f_\text{xc}$ on grid from the provided files. The following words should be the paths of ".cube" files, where the first 1 (*[nspin](#nspin)==1*) or 3 (*[nspin](#nspin)==2*, namely spin-aa, spin-ab and spin-bb) will be read in. The parameter [xc_kernel](#xc_kernel) will be invalid. Now only LDA-type kernel is supproted as the potential will be calculated by directly multiplying the transition density.
- "from_charge_file": Calculate fxc from the charge density read from the provided files. The following words should be the paths of ".cube" files, where the first [nspin]($nspin) files will be read in.
- **Default**: "default"

### lr_solver

- **Type**: String
Expand Down
10 changes: 5 additions & 5 deletions examples/bsse/water/result.ref
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-13.31798074740440
E_H2O: -466.1225988776397
E_O: -427.6271689751553
E_H1: -12.58872469295076
E_H2: -12.58872446212924
-13.49968292248493
E_H2O: -466.1225988772539
E_O: -427.5222287307378
E_H1: -12.55034372743879
E_H2: -12.55034349659238
1 change: 0 additions & 1 deletion examples/scf/lcao_Cu/INPUT
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ orbital_dir ../../../tests/PP_ORB
nbands 10

calculation scf
ecutwfc 100
ecutwfc 100 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1]
scf_thr 1.0e-8
scf_nmax 100
Expand Down
2 changes: 1 addition & 1 deletion source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ OBJS_TENSOR=tensor.o\
dmr_complex.o\
operator_lr_hxc.o\
operator_lr_exx.o\
kernel_xc.o\
xc_kernel.o\
pot_hxc_lrtd.o\
lr_spectrum.o\
hamilt_casida.o\
Expand Down
10 changes: 6 additions & 4 deletions source/module_base/module_mixing/mixing_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Base_Mixing
{

Mixing_Data::Mixing_Data(const int& ndim, const int& length, const size_t& type_size)
Mixing_Data::Mixing_Data(const int& ndim, const std::size_t& length, const size_t& type_size)
{
this->ndim_tot = ndim;
this->length = length;
Expand All @@ -15,16 +15,18 @@ Mixing_Data::Mixing_Data(const int& ndim, const int& length, const size_t& type_

Mixing_Data::~Mixing_Data()
{
if (this->data != nullptr)
if (this->data != nullptr) {
free(this->data);
}
}

void Mixing_Data::resize(const int& ndim, const int& length, const size_t& type_size)
void Mixing_Data::resize(const int& ndim, const std::size_t& length, const size_t& type_size)
{
this->ndim_tot = ndim;
this->length = length;
if (this->data != nullptr)
if (this->data != nullptr) {
free(this->data);
}
if (ndim * length > 0)
{
this->data = malloc(ndim * length * type_size);
Expand Down
8 changes: 4 additions & 4 deletions source/module_base/module_mixing/mixing_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Mixing_Data
* @param type_size size of type
*
*/
Mixing_Data(const int& ndim, const int& length, const size_t& type_size);
Mixing_Data(const int& ndim, const std::size_t& length, const size_t& type_size);

/**
* @brief Destroy the Mixing_Data object
Expand All @@ -38,7 +38,7 @@ class Mixing_Data
* @param type_size size of type
*
*/
void resize(const int& ndim, const int& length, const size_t& type_size);
void resize(const int& ndim, const std::size_t& length, const size_t& type_size);

/**
* @brief push data to the tensor
Expand All @@ -54,7 +54,7 @@ class Mixing_Data
#ifdef _OPENMP
#pragma omp parallel for schedule(static, 4096/sizeof(FPTYPE))
#endif
for (int i = 0; i < length; ++i)
for (std::size_t i = 0; i < length; ++i)
{
FP_startdata[i] = data_in[i];
}
Expand Down Expand Up @@ -86,7 +86,7 @@ class Mixing_Data
// the number of vectors for mixing
int ndim_tot = 0;
// the length of each vector
int length = 0;
std::size_t length = 0;
// the start index for vector: start = this->index_move(0)
int start = -1;
// the number of used vectors for mixing
Expand Down
10 changes: 5 additions & 5 deletions source/module_base/module_mixing/pulay_mixing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ void Pulay_Mixing::tem_push_data(Mixing_Data& mdata,
std::function<void(FPTYPE*, const FPTYPE*, const FPTYPE*)> mix,
const bool& need_calcoef)
{
const size_t length = mdata.length;
const std::size_t length = mdata.length;
std::vector<FPTYPE> F_tmp(length);

#ifdef _OPENMP
#pragma omp parallel for schedule(static, 4096 / sizeof(FPTYPE))
#endif
for (int i = 0; i < length; ++i)
for (std::size_t i = 0; i < length; ++i)
{
F_tmp[i] = data_out[i] - data_in[i];
}
Expand Down Expand Up @@ -69,7 +69,7 @@ void Pulay_Mixing::tem_push_data(Mixing_Data& mdata,
#ifdef _OPENMP
#pragma omp parallel for schedule(static, 4096 / sizeof(FPTYPE))
#endif
for (int i = 0; i < length; ++i)
for (std::size_t i = 0; i < length; ++i)
{
FP_F[i] = F_tmp[i];
}
Expand All @@ -81,7 +81,7 @@ void Pulay_Mixing::tem_push_data(Mixing_Data& mdata,
#ifdef _OPENMP
#pragma omp parallel for schedule(static, 4096 / sizeof(FPTYPE))
#endif
for (int i = 0; i < length; ++i)
for (std::size_t i = 0; i < length; ++i)
{
FP_startF[i] = F_tmp[i];
}
Expand All @@ -103,7 +103,7 @@ void Pulay_Mixing::tem_cal_coef(const Mixing_Data& mdata, std::function<double(F
ModuleBase::WARNING_QUIT(
"Pulay_mixing",
"One Pulay_Mixing object can only bind one Mixing_Data object to calculate coefficients");
const int length = mdata.length;
const std::size_t length = mdata.length;
FPTYPE* FP_F = static_cast<FPTYPE*>(F);

if (mdata.ndim_use > 1)
Expand Down
33 changes: 21 additions & 12 deletions source/module_cell/module_neighbor/sltk_atom.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,31 @@ class FAtom
int type;
int natom;

int cell_x;
int cell_y;
int cell_z;
public:
//==========================================================
// Default Constructor and deconstructor
//==========================================================

FAtom();
FAtom(const double& x_in, const double& y_in, const double& z_in,
const int& type_in, const int& natom_in,
const int& cell_x_in, const int& cell_y_in, const int& cell_z_in)
{
d_x = x_in;
d_y = y_in;
d_z = z_in;
type = type_in;
natom = natom_in;
cell_x = cell_x_in;
cell_y = cell_y_in;
cell_z = cell_z_in;
}
~FAtom();
//2015-05-07
void delete_vector(void);
void delete_vector();

// static int count1;
// static int count2;
Expand All @@ -47,7 +63,7 @@ class FAtom
std::shared_ptr<AdjacentSet> getAdjacentSet() const
{ return this->as; }

void allocate_AdjacentSet(void)
void allocate_AdjacentSet()
{ this->as = std::make_shared<AdjacentSet>(); }

//==========================================================
Expand All @@ -59,16 +75,9 @@ class FAtom
const double& z() const { return d_z; }
const int& getType() const { return type;}
const int& getNatom() const { return natom;}

//==========================================================
// MEMBER FUNCTION :
// EXPLAIN : set value
//==========================================================
void setX(const double& r) { d_x = r; }
void setY(const double& r) { d_y = r; }
void setZ(const double& r) { d_z = r; }
void setType(const int ntype) {type = ntype;}
void setNatom(const int atom) {natom = atom;}
const int& getCellX() const { return cell_x; }
const int& getCellY() const { return cell_y; }
const int& getCellZ() const { return cell_z; }
};

#endif
Loading

0 comments on commit 01cd5f8

Please sign in to comment.