git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8498 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -38,30 +38,30 @@ using namespace LAMMPS_NS;
|
||||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int eam_gpu_init(const int ntypes, double host_cutforcesq,
|
||||
int **host_type2rhor, int **host_type2z2r,
|
||||
int **host_type2rhor, int **host_type2z2r,
|
||||
int *host_type2frho, double ***host_rhor_spline,
|
||||
double ***host_z2r_spline, double ***host_frho_spline,
|
||||
double ***host_z2r_spline, double ***host_frho_spline,
|
||||
double rdr, double rdrho, int nrhor, int nrho, int nz2r,
|
||||
int nfrho, int nr, const int nlocal, const int nall,
|
||||
const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
int &fp_size);
|
||||
int nfrho, int nr, const int nlocal, const int nall,
|
||||
const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
int &fp_size);
|
||||
void eam_gpu_clear();
|
||||
int** eam_gpu_compute_n(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial, int **special,
|
||||
const bool eflag, const bool vflag, const bool eatom,
|
||||
const bool vatom, int &host_start, int **ilist,
|
||||
int **jnum, const double cpu_time, bool &success,
|
||||
int &inum, void **fp_ptr);
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial, int **special,
|
||||
const bool eflag, const bool vflag, const bool eatom,
|
||||
const bool vatom, int &host_start, int **ilist,
|
||||
int **jnum, const double cpu_time, bool &success,
|
||||
int &inum, void **fp_ptr);
|
||||
void eam_gpu_compute(const int ago, const int inum_full, const int nlocal,
|
||||
const int nall,double **host_x, int *host_type,
|
||||
int *ilist, int *numj, int **firstneigh,
|
||||
const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, void **fp_ptr);
|
||||
const int nall,double **host_x, int *host_type,
|
||||
int *ilist, int *numj, int **firstneigh,
|
||||
const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, void **fp_ptr);
|
||||
void eam_gpu_compute_force(int *ilist, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom);
|
||||
const bool eatom, const bool vatom);
|
||||
double eam_gpu_bytes();
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -114,19 +114,19 @@ void PairEAMGPU::compute(int eflag, int vflag)
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = eam_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, inum_dev, &fp_pinned);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, inum_dev, &fp_pinned);
|
||||
} else { // gpu_mode == GPU_FORCE
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
eam_gpu_compute(neighbor->ago, inum, nlocal, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, &fp_pinned);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, &fp_pinned);
|
||||
}
|
||||
|
||||
if (!success)
|
||||
@ -179,10 +179,10 @@ void PairEAMGPU::init_style()
|
||||
maxspecial=atom->maxspecial;
|
||||
int fp_size;
|
||||
int success = eam_gpu_init(atom->ntypes+1, cutforcesq, type2rhor, type2z2r,
|
||||
type2frho, rhor_spline, z2r_spline, frho_spline,
|
||||
rdr, rdrho, nrhor, nrho, nz2r, nfrho, nr,
|
||||
atom->nlocal, atom->nlocal+atom->nghost, 300,
|
||||
maxspecial, cell_size, gpu_mode, screen, fp_size);
|
||||
type2frho, rhor_spline, z2r_spline, frho_spline,
|
||||
rdr, rdrho, nrhor, nrho, nz2r, nfrho, nr,
|
||||
atom->nlocal, atom->nlocal+atom->nghost, 300,
|
||||
maxspecial, cell_size, gpu_mode, screen, fp_size);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
@ -200,8 +200,8 @@ void PairEAMGPU::init_style()
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairEAMGPU::single(int i, int j, int itype, int jtype,
|
||||
double rsq, double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
double rsq, double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
int m;
|
||||
double r,p,rhoip,rhojp,z2,z2p,recip,phi,phip,psip;
|
||||
@ -243,7 +243,7 @@ double PairEAMGPU::single(int i, int j, int itype, int jtype,
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int PairEAMGPU::pack_comm(int n, int *list, double *buf, int pbc_flag,
|
||||
int *pbc)
|
||||
int *pbc)
|
||||
{
|
||||
int i,j,m;
|
||||
|
||||
|
||||
@ -614,4 +614,3 @@ double PairLJCutCoulLongTIP4P::memory_usage()
|
||||
bytes += 2 * nmax * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
@ -64,12 +64,12 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||
if (strcmp(arg[iarg],"file") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/comb command");
|
||||
if (me == 0) {
|
||||
fp = fopen(arg[iarg+1],"w");
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
sprintf(str,"Cannot open fix qeq/comb file %s",arg[iarg+1]);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
fp = fopen(arg[iarg+1],"w");
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
sprintf(str,"Cannot open fix qeq/comb file %s",arg[iarg+1]);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
}
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix qeq/comb command");
|
||||
@ -187,7 +187,7 @@ void FixQEQComb::post_force(int vflag)
|
||||
|
||||
if (me == 0 && fp)
|
||||
fprintf(fp,"Charge equilibration on step " BIGINT_FORMAT "\n",
|
||||
update->ntimestep);
|
||||
update->ntimestep);
|
||||
|
||||
heatpq = 0.05;
|
||||
qmass = 0.016;
|
||||
@ -215,8 +215,8 @@ void FixQEQComb::post_force(int vflag)
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
if (mask[i] & groupbit) {
|
||||
q1[i] += qf[i]*dtq2 - heatpq*q1[i];
|
||||
q[i] += q1[i];
|
||||
q1[i] += qf[i]*dtq2 - heatpq*q1[i];
|
||||
q[i] += q1[i];
|
||||
}
|
||||
}
|
||||
comm->forward_comm_fix(this);
|
||||
@ -228,10 +228,10 @@ void FixQEQComb::post_force(int vflag)
|
||||
for (ii = 0; ii < inum ; ii++) {
|
||||
i = ilist[ii];
|
||||
if (mask[i] & groupbit) {
|
||||
q2[i] = enegtot-qf[i];
|
||||
enegmax = MAX(enegmax,fabs(q2[i]));
|
||||
enegchk += fabs(q2[i]);
|
||||
qf[i] = q2[i];
|
||||
q2[i] = enegtot-qf[i];
|
||||
enegmax = MAX(enegmax,fabs(q2[i]));
|
||||
enegchk += fabs(q2[i]);
|
||||
qf[i] = q2[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,13 +244,13 @@ void FixQEQComb::post_force(int vflag)
|
||||
|
||||
if (me == 0 && fp)
|
||||
fprintf(fp," iteration: %d, enegtot %.6g, "
|
||||
"enegmax %.6g, fq deviation: %.6g\n",
|
||||
iloop,enegtot,enegmax,enegchk);
|
||||
"enegmax %.6g, fq deviation: %.6g\n",
|
||||
iloop,enegtot,enegmax,enegchk);
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
if (mask[i] & groupbit)
|
||||
q1[i] += qf[i]*dtq2 - heatpq*q1[i];
|
||||
q1[i] += qf[i]*dtq2 - heatpq*q1[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ void FixQEQComb::post_force(int vflag)
|
||||
fprintf(fp,"Charges did not converge in %d iterations\n",iloop);
|
||||
else
|
||||
fprintf(fp,"Charges converged in %d iterations to %.10f tolerance\n",
|
||||
iloop,enegchk);
|
||||
iloop,enegchk);
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,4 +305,3 @@ void FixQEQComb::unpack_comm(int n, int first, double *buf)
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
@ -48,12 +48,12 @@ class PairBOP : public Pair {
|
||||
int maxbopn; // maximum size of bop neighbor list for allocation
|
||||
int maxnall; // maximum size of bop neighbor list for allocation
|
||||
int *map; // mapping from atom types to elements
|
||||
int nelements; // # of unique elments
|
||||
int nelements; // # of unique elments
|
||||
int nr; // increments for the BOP potential
|
||||
int nBOt; // second BO increments
|
||||
int bop_types; // number of elments in potential
|
||||
int npairs; // number of element pairs
|
||||
char **elements; // names of unique elements
|
||||
char **elements; // names of unique elements
|
||||
int ***elem2param;
|
||||
int nparams;
|
||||
int bop_step;
|
||||
@ -86,13 +86,13 @@ class PairBOP : public Pair {
|
||||
double beta3,rsmall,rbig,rcore;
|
||||
char **words;
|
||||
|
||||
double cutmax; //max cutoff for all elements
|
||||
int otfly; //Defines whether to do on the fly
|
||||
double cutmax; //max cutoff for all elements
|
||||
int otfly; //Defines whether to do on the fly
|
||||
//calculations of angles and distances
|
||||
//on the fly will slow down calculations
|
||||
//but requires less memory on = 1, off=0
|
||||
|
||||
int table; //determines the method for reading in
|
||||
int table; //determines the method for reading in
|
||||
//potential parameters a preset table
|
||||
//or generate the tables using a spline
|
||||
|
||||
|
||||
@ -1221,5 +1221,3 @@ int MolfileInterface::property(int propid, char **prop)
|
||||
|
||||
return _props;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -888,4 +888,3 @@ typedef struct {
|
||||
} molfile_plugin_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ void FixQEqReax::pertype_parameters(char *arg)
|
||||
gamma = (double *) pair->extract("gamma",tmp);
|
||||
if (chi == NULL || eta == NULL || gamma == NULL)
|
||||
error->all(FLERR,
|
||||
"Fix qeq/reax could not extract params from pair reax/c");
|
||||
"Fix qeq/reax could not extract params from pair reax/c");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ void FixQEqReax::pertype_parameters(char *arg)
|
||||
for (i = 1; i <= ntypes && !feof(pf); i++) {
|
||||
fscanf(pf,"%d %lg %lg %lg",&itype,&v1,&v2,&v3);
|
||||
if (itype < 1 || itype > ntypes)
|
||||
error->one(FLERR,"Fix qeq/reax invalid atom type in param file");
|
||||
error->one(FLERR,"Fix qeq/reax invalid atom type in param file");
|
||||
chi[itype] = v1;
|
||||
eta[itype] = v2;
|
||||
gamma[itype] = v3;
|
||||
@ -353,7 +353,7 @@ void FixQEqReax::init_taper()
|
||||
Tap[2] =-210.0 * (swa3*swb2 + swa2*swb3) / d7;
|
||||
Tap[1] = 140.0 * swa3 * swb3 / d7;
|
||||
Tap[0] = (-35.0*swa3*swb2*swb2 + 21.0*swa2*swb3*swb2 +
|
||||
7.0*swa*swb3*swb3 + swb3*swb3*swb ) / d7;
|
||||
7.0*swa*swb3*swb3 + swb3*swb3*swb ) / d7;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -416,7 +416,7 @@ void FixQEqReax::pre_force(int vflag)
|
||||
reallocate_matrix();
|
||||
|
||||
init_matvec();
|
||||
matvecs = CG(b_s, s); // CG on s - parallel
|
||||
matvecs = CG(b_s, s); // CG on s - parallel
|
||||
matvecs += CG(b_t, t); // CG on t - parallel
|
||||
calculate_Q();
|
||||
|
||||
@ -512,7 +512,7 @@ void FixQEqReax::compute_H()
|
||||
if (r_sqr <= SQR(swb)) {
|
||||
if (j < n) flag = 1;
|
||||
else if (tag[i] < tag[j]) flag = 1;
|
||||
else if (tag[i] == tag[j]) {
|
||||
else if (tag[i] == tag[j]) {
|
||||
if (dz > SMALL) flag = 1;
|
||||
else if (fabs(dz) < SMALL) {
|
||||
if (dy > SMALL) flag = 1;
|
||||
@ -523,9 +523,9 @@ void FixQEqReax::compute_H()
|
||||
}
|
||||
|
||||
if( flag ) {
|
||||
H.jlist[m_fill] = j;
|
||||
H.val[m_fill] = calculate_H( sqrt(r_sqr), shld[type[i]][type[j]] );
|
||||
m_fill++;
|
||||
H.jlist[m_fill] = j;
|
||||
H.val[m_fill] = calculate_H( sqrt(r_sqr), shld[type[i]][type[j]] );
|
||||
m_fill++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,7 +535,7 @@ void FixQEqReax::compute_H()
|
||||
if (m_fill >= H.m) {
|
||||
char str[128];
|
||||
sprintf(str,"H matrix size has been exceeded: m_fill=%d H.m=%d\n",
|
||||
m_fill, H.m );
|
||||
m_fill, H.m );
|
||||
error->warning(FLERR,str);
|
||||
error->all(FLERR,"Fix qeq/reax has insufficient QEq matrix size");
|
||||
}
|
||||
@ -662,7 +662,7 @@ void FixQEqReax::calculate_Q()
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int FixQEqReax::pack_comm(int n, int *list, double *buf,
|
||||
int pbc_flag, int *pbc)
|
||||
int pbc_flag, int *pbc)
|
||||
{
|
||||
int m;
|
||||
|
||||
@ -835,7 +835,7 @@ double FixQEqReax::norm( double* v1, int k )
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixQEqReax::vector_sum( double* dest, double c, double* v,
|
||||
double d, double* y, int k )
|
||||
double d, double* y, int k )
|
||||
{
|
||||
for( --k; k>=0; --k )
|
||||
dest[k] = c * v[k] + d * y[k];
|
||||
|
||||
@ -366,12 +366,12 @@ void PairReaxC::setup( )
|
||||
|
||||
int num_nbrs = estimate_reax_lists();
|
||||
if(!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR,
|
||||
lists+FAR_NBRS, world))
|
||||
lists+FAR_NBRS, world))
|
||||
error->all(FLERR,"Pair reax/c problem in far neighbor list");
|
||||
|
||||
write_reax_lists();
|
||||
Initialize( system, control, data, workspace, &lists, out_control,
|
||||
mpi_data, world );
|
||||
mpi_data, world );
|
||||
for( int k = 0; k < system->N; ++k ) {
|
||||
num_bonds[k] = system->my_atoms[k].num_bonds;
|
||||
num_hbonds[k] = system->my_atoms[k].num_hbonds;
|
||||
@ -424,7 +424,7 @@ void PairReaxC::compute(int eflag, int vflag)
|
||||
firstwarn = 0;
|
||||
if (comm->me == 0)
|
||||
error->warning(FLERR,"Pair reax/c cannot yet compute "
|
||||
"per-atom energy or stress");
|
||||
"per-atom energy or stress");
|
||||
} */
|
||||
|
||||
if (vflag_global) control->virial = 1;
|
||||
@ -518,10 +518,10 @@ void PairReaxC::compute(int eflag, int vflag)
|
||||
Output_Results( system, control, data, &lists, out_control, mpi_data );
|
||||
|
||||
if(fixbond_flag)
|
||||
fixbond( system, control, data, &lists, out_control, mpi_data );
|
||||
fixbond( system, control, data, &lists, out_control, mpi_data );
|
||||
|
||||
if(fixspecies_flag)
|
||||
fixspecies( system, control, data, &lists, out_control, mpi_data );
|
||||
fixspecies( system, control, data, &lists, out_control, mpi_data );
|
||||
|
||||
}
|
||||
|
||||
@ -557,7 +557,7 @@ void PairReaxC::get_distance( rvec xj, rvec xi, double *d_sqr, rvec *dvec )
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairReaxC::set_far_nbr( far_neighbor_data *fdest,
|
||||
int j, double d, rvec dvec )
|
||||
int j, double d, rvec dvec )
|
||||
{
|
||||
fdest->nbr = j;
|
||||
fdest->d = d;
|
||||
@ -609,7 +609,7 @@ int PairReaxC::estimate_reax_lists()
|
||||
get_distance( x[j], x[i], &d_sqr, &dvec );
|
||||
|
||||
if( d_sqr <= SQR(control->nonb_cut) )
|
||||
++num_nbrs;
|
||||
++num_nbrs;
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,8 +664,8 @@ int PairReaxC::write_reax_lists()
|
||||
|
||||
if( d_sqr <= (control->nonb_cut*control->nonb_cut) ){
|
||||
dist[j] = sqrt( d_sqr );
|
||||
set_far_nbr( &far_list[num_nbrs], j, dist[j], dvec );
|
||||
++num_nbrs;
|
||||
set_far_nbr( &far_list[num_nbrs], j, dist[j], dvec );
|
||||
++num_nbrs;
|
||||
}
|
||||
}
|
||||
Set_End_Index( i, num_nbrs, far_nbrs );
|
||||
|
||||
@ -327,10 +327,10 @@ void Tabulated_vdW_Coulomb_Energy( reax_system *system,control_params *control,
|
||||
//fprintf(stderr, "r: %f, i: %d, base: %f, dif: %f\n", r, i, base, dif);
|
||||
|
||||
e_vdW = ((t->vdW[r].d*dif + t->vdW[r].c)*dif + t->vdW[r].b)*dif +
|
||||
t->vdW[r].a;
|
||||
t->vdW[r].a;
|
||||
|
||||
e_ele = ((t->ele[r].d*dif + t->ele[r].c)*dif + t->ele[r].b)*dif +
|
||||
t->ele[r].a;
|
||||
t->ele[r].a;
|
||||
e_ele *= system->my_atoms[i].q * system->my_atoms[j].q;
|
||||
|
||||
data->my_en.e_vdW += e_vdW;
|
||||
|
||||
Reference in New Issue
Block a user