Cleaned up and re-arranged the functions to reflect the order of calling in a time step
This commit is contained in:
@ -126,49 +126,6 @@ double AmoebaT::host_memory_usage() const {
|
||||
return this->host_memory_usage_atomic()+sizeof(Amoeba<numtyp,acctyp>);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Calculate the polar real-space term, returning tep
|
||||
// ---------------------------------------------------------------------------
|
||||
template <class numtyp, class acctyp>
|
||||
int AmoebaT::polar_real(const int eflag, const int vflag) {
|
||||
// Compute the block size and grid size to keep all cores busy
|
||||
const int BX=this->block_size();
|
||||
int GX=static_cast<int>(ceil(static_cast<double>(this->ans->inum())/
|
||||
(BX/this->_threads_per_atom)));
|
||||
|
||||
int _nall=this->atom->nall();
|
||||
int ainum=this->ans->inum();
|
||||
int nbor_pitch=this->nbor->nbor_pitch();
|
||||
this->time_pair.start();
|
||||
|
||||
// Build the short neighbor list if needed
|
||||
if (!this->short_nbor_avail) {
|
||||
this->k_short_nbor.set_size(GX,BX);
|
||||
this->k_short_nbor.run(&this->atom->x, &this->nbor->dev_nbor,
|
||||
&this->_nbor_data->begin(),
|
||||
&this->dev_short_nbor, &_off2, &ainum,
|
||||
&nbor_pitch, &this->_threads_per_atom);
|
||||
this->short_nbor_avail = true;
|
||||
}
|
||||
|
||||
this->k_polar.set_size(GX,BX);
|
||||
this->k_polar.run(&this->atom->x, &this->atom->extra, &damping, &sp_polar,
|
||||
&this->nbor->dev_nbor, &this->_nbor_data->begin(),
|
||||
&this->dev_short_nbor,
|
||||
&this->ans->force, &this->ans->engv, &this->_tep,
|
||||
&eflag, &vflag, &ainum, &_nall, &nbor_pitch,
|
||||
&this->_threads_per_atom,
|
||||
&_aewald, &_felec, &_off2, &_polar_dscale, &_polar_uscale);
|
||||
this->time_pair.stop();
|
||||
|
||||
// Signal that short nbor list is not avail for the next time step
|
||||
// do it here because polar_real() is the last kernel in a time step at this point
|
||||
|
||||
this->short_nbor_avail = false;
|
||||
|
||||
return GX;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Calculate the real-space permanent field, returning field and fieldp
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -182,13 +139,13 @@ int AmoebaT::udirect2b(const int eflag, const int vflag) {
|
||||
const int BX=this->block_size();
|
||||
int GX=static_cast<int>(ceil(static_cast<double>(this->ans->inum())/(BX/this->_threads_per_atom)));
|
||||
|
||||
// Build the short neighbor list if needed
|
||||
// Build the short neighbor list if not done yet
|
||||
if (!this->short_nbor_avail) {
|
||||
this->k_short_nbor.set_size(GX,BX);
|
||||
this->k_short_nbor.run(&this->atom->x, &this->nbor->dev_nbor,
|
||||
&this->_nbor_data->begin(),
|
||||
&this->dev_short_nbor, &_off2, &ainum,
|
||||
&nbor_pitch, &this->_threads_per_atom);
|
||||
&this->_nbor_data->begin(),
|
||||
&this->dev_short_nbor, &_off2, &ainum,
|
||||
&nbor_pitch, &this->_threads_per_atom);
|
||||
this->short_nbor_avail = true;
|
||||
}
|
||||
|
||||
@ -219,9 +176,20 @@ int AmoebaT::umutual2b(const int eflag, const int vflag) {
|
||||
int nbor_pitch=this->nbor->nbor_pitch();
|
||||
this->time_pair.start();
|
||||
|
||||
// Build the short neighbor list if not done yet
|
||||
if (!this->short_nbor_avail) {
|
||||
this->k_short_nbor.set_size(GX,BX);
|
||||
this->k_short_nbor.run(&this->atom->x, &this->nbor->dev_nbor,
|
||||
&this->_nbor_data->begin(),
|
||||
&this->dev_short_nbor, &_off2, &ainum,
|
||||
&nbor_pitch, &this->_threads_per_atom);
|
||||
this->short_nbor_avail = true;
|
||||
}
|
||||
|
||||
this->k_umutual2b.set_size(GX,BX);
|
||||
this->k_umutual2b.run(&this->atom->x, &this->atom->extra, &damping, &sp_polar,
|
||||
&this->nbor->dev_nbor, &this->_nbor_data->begin(),
|
||||
&this->dev_short_nbor,
|
||||
&this->_fieldp, &ainum, &_nall, &nbor_pitch,
|
||||
&this->_threads_per_atom, &_aewald, &_off2,
|
||||
&_polar_dscale, &_polar_uscale);
|
||||
@ -230,5 +198,48 @@ int AmoebaT::umutual2b(const int eflag, const int vflag) {
|
||||
return GX;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Calculate the polar real-space term, returning tep
|
||||
// ---------------------------------------------------------------------------
|
||||
template <class numtyp, class acctyp>
|
||||
int AmoebaT::polar_real(const int eflag, const int vflag) {
|
||||
// Compute the block size and grid size to keep all cores busy
|
||||
const int BX=this->block_size();
|
||||
int GX=static_cast<int>(ceil(static_cast<double>(this->ans->inum())/
|
||||
(BX/this->_threads_per_atom)));
|
||||
|
||||
int _nall=this->atom->nall();
|
||||
int ainum=this->ans->inum();
|
||||
int nbor_pitch=this->nbor->nbor_pitch();
|
||||
this->time_pair.start();
|
||||
|
||||
// Build the short neighbor list if not done yet
|
||||
if (!this->short_nbor_avail) {
|
||||
this->k_short_nbor.set_size(GX,BX);
|
||||
this->k_short_nbor.run(&this->atom->x, &this->nbor->dev_nbor,
|
||||
&this->_nbor_data->begin(),
|
||||
&this->dev_short_nbor, &_off2, &ainum,
|
||||
&nbor_pitch, &this->_threads_per_atom);
|
||||
this->short_nbor_avail = true;
|
||||
}
|
||||
|
||||
this->k_polar.set_size(GX,BX);
|
||||
this->k_polar.run(&this->atom->x, &this->atom->extra, &damping, &sp_polar,
|
||||
&this->nbor->dev_nbor, &this->_nbor_data->begin(),
|
||||
&this->dev_short_nbor,
|
||||
&this->ans->force, &this->ans->engv, &this->_tep,
|
||||
&eflag, &vflag, &ainum, &_nall, &nbor_pitch,
|
||||
&this->_threads_per_atom,
|
||||
&_aewald, &_felec, &_off2, &_polar_dscale, &_polar_uscale);
|
||||
this->time_pair.stop();
|
||||
|
||||
// Signal that short nbor list is not avail for the next time step
|
||||
// do it here because polar_real() is the last kernel in a time step at this point
|
||||
|
||||
this->short_nbor_avail = false;
|
||||
|
||||
return GX;
|
||||
}
|
||||
|
||||
template class Amoeba<PRECISION,ACC_PRECISION>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user