atom charge and dpd/slater cutoff passing

This commit is contained in:
Eddy Barraud
2024-06-04 19:13:56 +02:00
parent c69e905cd6
commit b187001f38
3 changed files with 33 additions and 10 deletions

View File

@ -46,7 +46,9 @@ template <class numtyp, class acctyp>
int DPDChargedT::init(const int ntypes,
double **host_cutsq, double **host_a0,
double **host_gamma, double **host_sigma,
double **host_cut, double *host_special_lj,
double **host_cut,
double **host_cut_dpd, **host_cut_slater,
double *host_special_lj,
const bool tstat_only,
const int nlocal, const int nall,
const int max_nbors, const int maxspecial,
@ -70,7 +72,7 @@ int DPDChargedT::init(const int ntypes,
int success;
success=this->init_atomic(nlocal,nall,max_nbors,maxspecial,cell_size,
gpu_split,_screen,dpd,"k_dpd",onetype);
gpu_split,_screen,dpd,"k_dpd_charged",onetype);
if (success!=0)
return success;
@ -99,6 +101,15 @@ int DPDChargedT::init(const int ntypes,
cutsq.alloc(lj_types*lj_types,*(this->ucl_device),UCL_READ_ONLY);
this->atom->type_pack1(ntypes,lj_types,cutsq,host_rsq,host_cutsq);
cut_dpd.alloc(lj_types*lj_types,*(this->ucl_device),UCL_READ_ONLY);
this->atom->type_pack1(ntypes,lj_types,cut_dpdsq,host_rsq,host_cut_dpd);
cutsq.alloc(lj_types*lj_types,*(this->ucl_device),UCL_READ_ONLY);
this->atom->type_pack1(ntypes,lj_types,cutsq,host_rsq,host_cutsq);
scale.alloc(lj_types*lj_types,*(this->ucl_device),UCL_READ_ONLY);
this->atom->type_pack1(ntypes,lj_types,scale,host_write,host_scale);
double special_sqrt[4];
special_sqrt[0] = sqrt(host_special_lj[0]);
special_sqrt[1] = sqrt(host_special_lj[1]);
@ -196,12 +207,12 @@ int DPDChargedT::loop(const int eflag, const int vflag) {
template <class numtyp, class acctyp>
void DPDChargedT::update_coeff(int ntypes, double **host_a0, double **host_gamma,
double **host_sigma, double **host_cut)
double **host_sigma, double **host_cut, double **host_cut_dpd, **host_cut_slater)
{
UCL_H_Vec<numtyp> host_write(_lj_types*_lj_types*32,*(this->ucl_device),
UCL_WRITE_ONLY);
this->atom->type_pack4(ntypes,_lj_types,coeff,host_write,host_a0,host_gamma,
host_sigma,host_cut);
host_sigma,host_cut,host_cut_dpd, host_cut_slater);
}
// ---------------------------------------------------------------------------

View File

@ -29,6 +29,7 @@ static DPDCharged<PRECISION,ACC_PRECISION> DPDCMF;
// ---------------------------------------------------------------------------
int dpd_charged_gpu_init(const int ntypes, double **cutsq, double **host_a0,
double **host_gamma, double **host_sigma, double **host_cut,
double **host_cut_dpd, double **host_cut_slater,
double *special_lj, const int inum,
const int nall, const int max_nbors, const int maxspecial,
const double cell_size, int &gpu_mode, FILE *screen) {
@ -55,7 +56,7 @@ int dpd_charged_gpu_init(const int ntypes, double **cutsq, double **host_a0,
int init_ok=0;
if (world_me==0)
init_ok=DPDCMF.init(ntypes, cutsq, host_a0, host_gamma, host_sigma,
host_cut, special_lj, false, inum, nall, max_nbors,
host_cut, host_cut_dpd, host_cut_slater, special_lj, false, inum, nall, max_nbors,
maxspecial, cell_size, gpu_split, screen);
DPDCMF.device->world_barrier();
@ -73,7 +74,7 @@ int dpd_charged_gpu_init(const int ntypes, double **cutsq, double **host_a0,
}
if (gpu_rank==i && world_me!=0)
init_ok=DPDCMF.init(ntypes, cutsq, host_a0, host_gamma, host_sigma,
host_cut, special_lj, false, inum, nall, max_nbors,
host_cut, host_cut_dpd, host_cut_slater, special_lj, false, inum, nall, max_nbors,
maxspecial, cell_size, gpu_split, screen);
DPDCMF.device->serialize_init();
@ -121,9 +122,13 @@ void dpd_charged_gpu_compute(const int ago, const int inum_full, const int nall,
}
void dpd_charged_gpu_update_coeff(int ntypes, double **host_a0, double **host_gamma,
double **host_sigma, double **host_cut)
double **host_sigma, double **host_cut, double **host_cut_dpd, **host_cut_slater)
{
DPDCMF.update_coeff(ntypes,host_a0,host_gamma,host_sigma,host_cut);
DPDCMF.update_coeff(ntypes,host_a0,host_gamma,host_sigma,host_cut, host_cut_dpd, host_cut_slater,);
}
void dpd_charged_gpu_get_extra_data(double *host_q) {
DPDCMF.get_extra_data(host_q);
}
double dpd_charged_gpu_bytes() {

View File

@ -39,7 +39,7 @@ using namespace EwaldConst;
// External functions from cuda library for atom decomposition
int dpd_charged_gpu_init(const int ntypes, double **cutsq, double **host_a0, double **host_gamma,
double **host_sigma, double **host_cut, double *special_lj, const int inum,
double **host_sigma, double **host_cut, double **host_cut_dpd, double **host_cut_slater, double *special_lj, const int inum,
const int nall, const int max_nbors, const int maxspecial, const double cell_size,
int &gpu_mode, FILE *screen);
void dpd_charged_gpu_clear();
@ -56,6 +56,9 @@ void dpd_charged_gpu_compute(const int ago, const int inum_full, const int nall,
const double cpu_time, bool &success, tagint *tag, double **host_v,
const double dtinvsqrt, const int seed, const int timestep, const int nlocal,
double *boxlo, double *prd);
void dpd_charged_gpu_get_extra_data(double *host_q);
double dpd_charged_gpu_bytes();
static constexpr double EPSILON = 1.0e-10;
@ -232,6 +235,10 @@ void PairDPDChargedGPU::compute(int eflag, int vflag)
bool success = true;
int *ilist, *numneigh, **firstneigh;
double *charge = atom->q;
dpd_charged_gpu_get_extra_data(charge);
if (gpu_mode != GPU_FORCE) {
double sublo[3], subhi[3];
if (domain->triclinic == 0) {
@ -305,7 +312,7 @@ void PairDPDChargedGPU::init_style()
if (atom->molecular != Atom::ATOMIC) maxspecial = atom->maxspecial;
int mnf = 5e-2 * neighbor->oneatom;
int success =
dpd_charged_gpu_init(atom->ntypes + 1, cutsq, a0, gamma, sigma, cut, force->special_lj, atom->nlocal,
dpd_charged_gpu_init(atom->ntypes + 1, cutsq, a0, gamma, sigma, cut, cut_dpd, cut_slater, force->special_lj, atom->nlocal,
atom->nlocal + atom->nghost, mnf, maxspecial, cell_size, gpu_mode, screen);
GPU_EXTRA::check_flag(success, error, world);