git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15248 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2016-07-01 23:27:26 +00:00
parent 8366b35459
commit 9656958169
245 changed files with 4890 additions and 4832 deletions

View File

@ -9,7 +9,7 @@
This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
__________________________________________________________________________
begin :
begin :
email : brownw@ornl.gov
***************************************************************************/
@ -24,7 +24,7 @@ AnswerT::Answer() : _allocated(false),_eflag(false),_vflag(false),
}
template <class numtyp, class acctyp>
int AnswerT::bytes_per_atom() const {
int AnswerT::bytes_per_atom() const {
int bytes=11*sizeof(acctyp);
if (_rot)
bytes+=4*sizeof(acctyp);
@ -38,19 +38,19 @@ bool AnswerT::alloc(const int inum) {
_max_local=static_cast<int>(static_cast<double>(inum)*1.10);
bool success=true;
_ans_fields=4;
if (_rot)
_ans_fields+=4;
// --------------------------- Device allocations
success=success && (engv.alloc(_ev_fields*_max_local,*dev,UCL_READ_ONLY,
UCL_READ_WRITE)==UCL_SUCCESS);
success=success && (force.alloc(_ans_fields*_max_local,*dev,UCL_READ_ONLY,
UCL_READ_WRITE)==UCL_SUCCESS);
_gpu_bytes=engv.device.row_bytes()+force.device.row_bytes();
_allocated=true;
_allocated=true;
return success;
}
@ -69,21 +69,21 @@ bool AnswerT::init(const int inum, const bool charge, const bool rot,
if (_charge)
_e_fields++;
_ev_fields=6+_e_fields;
// Initialize atom and nbor data
int ef_inum=inum;
if (ef_inum==0)
ef_inum=1000;
// Initialize timers for the selected device
time_answer.init(*dev);
time_answer.zero();
_time_cast=0.0;
_time_cpu_idle=0.0;
return success && alloc(ef_inum);
}
template <class numtyp, class acctyp>
bool AnswerT::add_fields(const bool charge, const bool rot) {
bool realloc=false;
@ -127,15 +127,15 @@ void AnswerT::clear() {
template <class numtyp, class acctyp>
double AnswerT::host_memory_usage() const {
int atom_bytes=4;
if (_charge)
if (_charge)
atom_bytes+=1;
if (_rot)
if (_rot)
atom_bytes+=4;
int ans_bytes=atom_bytes+_ev_fields;
return ans_bytes*(_max_local)*sizeof(acctyp)+
sizeof(Answer<numtyp,acctyp>);
}
template <class numtyp, class acctyp>
void AnswerT::copy_answers(const bool eflag, const bool vflag,
const bool ef_atom, const bool vf_atom) {
@ -144,8 +144,8 @@ void AnswerT::copy_answers(const bool eflag, const bool vflag,
_vflag=vflag;
_ef_atom=ef_atom;
_vf_atom=vf_atom;
int csize=_ev_fields;
int csize=_ev_fields;
if (!eflag)
csize-=_e_fields;
if (!vflag)
@ -180,7 +180,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom,
for (int i=0; i<_inum; i++)
evdwl+=engv[i];
if (_ef_atom)
if (_ilist==NULL)
if (_ilist==NULL)
for (int i=0; i<_inum; i++)
eatom[i]+=engv[i];
else
@ -196,18 +196,18 @@ double AnswerT::energy_virial(double *eatom, double **vatom,
if (_vf_atom)
if (_ilist==NULL) {
int ii=0;
for (int i=vstart; i<iend; i++)
for (int i=vstart; i<iend; i++)
vatom[ii++][j]+=engv[i];
} else {
int ii=0;
for (int i=vstart; i<iend; i++)
for (int i=vstart; i<iend; i++)
vatom[_ilist[ii++]][j]+=engv[i];
}
vstart+=_inum;
iend+=_inum;
}
}
return evdwl;
}
@ -242,8 +242,8 @@ double AnswerT::energy_virial(double *eatom, double **vatom,
}
vstart=iend;
iend+=_inum;
}
if (_vflag) {
}
if (_vflag) {
for (int j=0; j<6; j++) {
for (int i=vstart; i<iend; i++)
virial[j]+=engv[i];
@ -254,12 +254,12 @@ double AnswerT::energy_virial(double *eatom, double **vatom,
} else {
for (int i=vstart, ii=0; i<iend; i++)
vatom[_ilist[ii++]][j]+=engv[i];
}
}
vstart+=_inum;
iend+=_inum;
}
}
return evdwl;
}