From e69f74203e3dae0ab0f5e580ac67da4eeb221ea2 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 20 Jun 2007 15:42:40 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@630 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/COLLOID/Install.csh | 20 + src/COLLOID/pair_colloid.cpp | 532 +++++++++++++++++++++ src/COLLOID/pair_colloid.h | 48 ++ src/COLLOID/style_colloid.h | 20 + src/MEAM/Install.csh | 20 + src/MEAM/pair_meam.cpp | 887 +++++++++++++++++++++++++++++++++++ src/MEAM/pair_meam.h | 95 ++++ src/MEAM/style_meam.h | 20 + src/fix_deform.cpp | 72 ++- src/style_asphere.h | 48 ++ src/style_class2.h | 56 +++ src/style_colloid.h | 20 + src/style_dpd.h | 28 ++ src/style_granular.h | 50 ++ src/style_kspace.h | 38 ++ src/style_manybody.h | 28 ++ src/style_molecule.h | 116 +++++ src/style_opt.h | 30 ++ src/style_xtc.h | 20 + 19 files changed, 2126 insertions(+), 22 deletions(-) create mode 100644 src/COLLOID/Install.csh create mode 100644 src/COLLOID/pair_colloid.cpp create mode 100644 src/COLLOID/pair_colloid.h create mode 100644 src/COLLOID/style_colloid.h create mode 100644 src/MEAM/Install.csh create mode 100644 src/MEAM/pair_meam.cpp create mode 100644 src/MEAM/pair_meam.h create mode 100644 src/MEAM/style_meam.h diff --git a/src/COLLOID/Install.csh b/src/COLLOID/Install.csh new file mode 100644 index 0000000000..631defda14 --- /dev/null +++ b/src/COLLOID/Install.csh @@ -0,0 +1,20 @@ +# Install/unInstall package classes in LAMMPS + +if ($1 == 1) then + + cp style_colloid.h .. + + cp pair_colloid.cpp .. + + cp pair_colloid.h .. + +else if ($1 == 0) then + + rm ../style_colloid.h + touch ../style_colloid.h + + rm ../pair_colloid.cpp + + rm ../pair_colloid.h + +endif diff --git a/src/COLLOID/pair_colloid.cpp b/src/COLLOID/pair_colloid.cpp new file mode 100644 index 0000000000..1ec86fd5aa --- /dev/null +++ b/src/COLLOID/pair_colloid.cpp @@ -0,0 +1,532 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Pieter in 't Veld (SNL) +------------------------------------------------------------------------- */ + +#include "math.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "pair_colloid.h" +#include "atom.h" +#include "comm.h" +#include "force.h" +#include "neighbor.h" +#include "update.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +enum{SMALL_SMALL,SMALL_LARGE,LARGE_LARGE}; + +/* ---------------------------------------------------------------------- */ + +PairColloid::PairColloid(LAMMPS *lmp) : Pair(lmp) {} + +/* ---------------------------------------------------------------------- */ + +PairColloid::~PairColloid() +{ + if (allocated) { + memory->destroy_2d_int_array(setflag); + memory->destroy_2d_double_array(cutsq); + + memory->destroy_2d_int_array(form); + memory->destroy_2d_double_array(a12); + memory->destroy_2d_double_array(sigma); + memory->destroy_2d_double_array(d1); + memory->destroy_2d_double_array(d2); + memory->destroy_2d_double_array(a1); + memory->destroy_2d_double_array(a2); + memory->destroy_2d_double_array(cut); + memory->destroy_2d_double_array(offset); + memory->destroy_2d_double_array(sigma3); + memory->destroy_2d_double_array(sigma6); + memory->destroy_2d_double_array(lj1); + memory->destroy_2d_double_array(lj2); + memory->destroy_2d_double_array(lj3); + memory->destroy_2d_double_array(lj4); + } +} + +/* ---------------------------------------------------------------------- */ + +void PairColloid::compute(int eflag, int vflag) +{ + int i,j,k,numneigh,itype,jtype; + double xtmp,ytmp,ztmp,delx,dely,delz; + double rsq,r,fforce,forcelj,factor_lj,phi; + double r2inv,r6inv,c1,c2,aij,s2,s6,fR,dUR,dUA; + double K[9],h[4],g[4]; + int *neighs; + double **f; + + eng_vdwl = 0.0; + if (vflag) for (i = 0; i < 6; i++) virial[i] = 0.0; + + if (vflag == 2) f = update->f_pair; + else f = atom->f; + double **x = atom->x; + int *type = atom->type; + int nlocal = atom->nlocal; + int nall = atom->nlocal + atom->nghost; + double *special_lj = force->special_lj; + int newton_pair = force->newton_pair; + + // loop over neighbors of my atoms + + for (i = 0; i < nlocal; ++i) { + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + neighs = neighbor->firstneigh[i]; + numneigh = neighbor->numneigh[i]; + + for (k = 0; k < numneigh; k++) { + j = neighs[k]; + + if (j < nall) factor_lj = 1.0; + else { + factor_lj = special_lj[j/nall]; + j %= nall; + } + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + jtype = type[j]; + + if (rsq >= cutsq[itype][jtype]) continue; + + switch (form[itype][jtype]) { + case SMALL_SMALL: + r2inv = 1.0/rsq; + r6inv = r2inv*r2inv*r2inv; + forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]); + fforce = factor_lj*forcelj*r2inv; + if (eflag) phi = r6inv*(r6inv*lj3[itype][jtype]-lj4[itype][jtype]) - + offset[itype][jtype]; + break; + + case SMALL_LARGE: + c2 = a2[itype][jtype]; + K[1] = c2*c2; + K[2] = rsq; + K[0] = K[1] - rsq; + K[4] = rsq*rsq; + K[3] = K[1] - K[2]; + K[3] *= K[3]*K[3]; + K[6] = K[3]*K[3]; + fR = sigma3[itype][jtype]*a12[itype][jtype]*c2*K[1]/K[3]; + fforce = 4.0/15.0*sqrt(rsq)*fR*factor_lj * + (2.0*(K[1]+K[2]) * (K[1]*(5.0*K[1]+22.0*K[2])+5.0*K[4]) * + sigma6[itype][jtype]/K[6]-5.0) / K[0]; + if (eflag) + phi = 2.0/9.0*fR * + (1.0-(K[1]*(K[1]*(K[1]/3.0+3.0*K[2])+4.2*K[4])+K[2]*K[4]) * + sigma6[itype][jtype]/K[6]) - offset[itype][jtype]; + break; + + case LARGE_LARGE: + r = sqrt(rsq); + c1 = a1[itype][jtype]; + c2 = a2[itype][jtype]; + K[0] = c1*c2; + K[1] = c1+c2; + K[2] = c1-c2; + K[3] = K[1]+r; + K[4] = K[1]-r; + K[5] = K[2]+r; + K[6] = K[2]-r; + K[7] = 1.0/(K[3]*K[4]); + K[8] = 1.0/(K[5]*K[6]); + g[0] = pow(K[3],-7.0); + g[1] = pow(K[4],-7.0); + g[2] = pow(K[5],-7.0); + g[3] = pow(K[6],-7.0); + h[0] = ((K[3]+5.0*K[1])*K[3]+30.0*K[0])*g[0]; + h[1] = ((K[4]+5.0*K[1])*K[4]+30.0*K[0])*g[1]; + h[2] = ((K[5]+5.0*K[2])*K[5]-30.0*K[0])*g[2]; + h[3] = ((K[6]+5.0*K[2])*K[6]-30.0*K[0])*g[3]; + g[0] *= 42.0*K[0]/K[3]+6.0*K[1]+K[3]; + g[1] *= 42.0*K[0]/K[4]+6.0*K[1]+K[4]; + g[2] *= -42.0*K[0]/K[5]+6.0*K[2]+K[5]; + g[3] *= -42.0*K[0]/K[6]+6.0*K[2]+K[6]; + + fR = a12[itype][jtype]*sigma6[itype][jtype]/r/37800.0; + phi = fR * (h[0]-h[1]-h[2]+h[3]); + dUR = phi/r + 5.0*fR*(g[0]+g[1]-g[2]-g[3]); + dUA = -a12[itype][jtype]/3.0*r*((2.0*K[0]*K[7]+1.0)*K[7] + + (2.0*K[0]*K[8]-1.0)*K[8]); + fforce = factor_lj * (dUR+dUA)/r; + if (eflag) + phi += a12[itype][jtype]/6.0*(2.0*K[0]*(K[7]+K[8])-log(K[8]/K[7])) - + offset[itype][jtype]; + break; + } + + if (eflag) { + if (newton_pair || j < nlocal) eng_vdwl += factor_lj*phi; + else eng_vdwl += 0.5*factor_lj*phi; + } + + f[i][0] += delx*fforce; + f[i][1] += dely*fforce; + f[i][2] += delz*fforce; + if (newton_pair || j < nlocal) { + f[j][0] -= delx*fforce; + f[j][1] -= dely*fforce; + f[j][2] -= delz*fforce; + } + + if (vflag == 1) { + if (newton_pair == 0 && j >= nlocal) fforce *= 0.5; + virial[0] += delx*delx*fforce; + virial[1] += dely*dely*fforce; + virial[2] += delz*delz*fforce; + virial[3] += delx*dely*fforce; + virial[4] += delx*delz*fforce; + virial[5] += dely*delz*fforce; + } + } + } + if (vflag == 2) virial_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairColloid::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + setflag = memory->create_2d_int_array(n+1,n+1,"pair:setflag"); + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + cutsq = memory->create_2d_double_array(n+1,n+1,"pair:cutsq"); + + form = memory->create_2d_int_array(n+1,n+1,"pair:form"); + a12 = memory->create_2d_double_array(n+1,n+1,"pair:a12"); + sigma = memory->create_2d_double_array(n+1,n+1,"pair:sigma"); + d1 = memory->create_2d_double_array(n+1,n+1,"pair:d1"); + d2 = memory->create_2d_double_array(n+1,n+1,"pair:d2"); + a1 = memory->create_2d_double_array(n+1,n+1,"pair:a1"); + a2 = memory->create_2d_double_array(n+1,n+1,"pair:a2"); + cut = memory->create_2d_double_array(n+1,n+1,"pair:cut"); + offset = memory->create_2d_double_array(n+1,n+1,"pair:offset"); + sigma3 = memory->create_2d_double_array(n+1,n+1,"pair:sigma3"); + sigma6 = memory->create_2d_double_array(n+1,n+1,"pair:sigma6"); + lj1 = memory->create_2d_double_array(n+1,n+1,"pair:lj1"); + lj2 = memory->create_2d_double_array(n+1,n+1,"pair:lj2"); + lj3 = memory->create_2d_double_array(n+1,n+1,"pair:lj3"); + lj4 = memory->create_2d_double_array(n+1,n+1,"pair:lj4"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairColloid::settings(int narg, char **arg) +{ + if (narg != 1) error->all("Illegal pair_style command"); + + cut_global = atof(arg[0]); + + // reset cutoffs that have been explicitly set + + if (allocated) { + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i+1; j <= atom->ntypes; j++) + if (setflag[i][j]) cut[i][j] = cut_global; + } +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairColloid::coeff(int narg, char **arg) +{ + if (narg < 6 || narg > 7) error->all("Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + int ilo,ihi,jlo,jhi; + force->bounds(arg[0],atom->ntypes,ilo,ihi); + force->bounds(arg[1],atom->ntypes,jlo,jhi); + + double a12_one = atof(arg[2]); + double sigma_one = atof(arg[3]); + double d1_one = atof(arg[4]); + double d2_one = atof(arg[5]); + + double cut_one = cut_global; + if (narg == 7) cut_one = atof(arg[6]); + + if (d1_one < 0.0 || d2_one < 0.0) + error->all("Invalid d1 or d2 value for pair colloid coeff"); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo,i); j <= jhi; j++) { + a12[i][j] = a12_one; + sigma[i][j] = sigma_one; + if (i == j && d1_one != d2_one) + error->all("Invalid d1 or d2 value for pair colloid coeff"); + d1[i][j] = d1_one; + d2[i][j] = d2_one; + cut[i][j] = cut_one; + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) error->all("Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairColloid::init_one(int i, int j) +{ + if (setflag[i][j] == 0) { + a12[i][j] = mix_energy(a12[i][i],a12[j][j],sigma[i][i],sigma[j][j]); + sigma[i][j] = mix_distance(sigma[i][i],sigma[j][j]); + d1[i][j] = mix_distance(d1[i][i],d1[j][j]); + d2[i][j] = mix_distance(d2[i][i],d2[j][j]); + cut[i][j] = mix_distance(cut[i][i],cut[j][j]); + } + + sigma3[i][j] = sigma[i][j]*sigma[i][j]*sigma[i][j]; + sigma6[i][j] = sigma3[i][j]*sigma3[i][j]; + + if (d1[i][j] == 0.0 && d2[i][j] == 0.0) form[i][j] = SMALL_SMALL; + else if (d1[i][j] == 0.0 || d2[i][j] == 0.0) form[i][j] = SMALL_LARGE; + else form[i][j] = LARGE_LARGE; + + // for SMALL_SMALL, a1/a2 do not need to be set + // for SMALL_LARGE, a1 does not need to be set, a2 = radius for i,j and j,i + // for LARGE_LARGE, a1/a2 are radii, swap them for j,i + + if (form[i][j] == SMALL_LARGE) { + if (d1[i][j] > 0.0) a2[i][j] = 0.5*d1[i][j]; + else a2[i][j] = 0.5*d2[i][j]; + a2[j][i] = a2[i][j]; + } else if (form[i][j] == LARGE_LARGE) { + a2[j][i] = a1[i][j] = 0.5*d1[i][j]; + a1[j][i] = a2[i][j] = 0.5*d2[i][j]; + } + + form[j][i] = form[i][j]; + a12[j][i] = a12[i][j]; + sigma[j][i] = sigma[i][j]; + sigma3[j][i] = sigma3[i][j]; + sigma6[j][i] = sigma6[i][j]; + cut[j][i] = cut[i][j]; + cutsq[j][i] = cutsq[i][j] = cut[i][j] * cut[i][j]; + + double epsilon = a12[i][j]/144.0; + lj1[j][i] = lj1[i][j] = 48.0 * epsilon * sigma6[i][j] * sigma6[i][j]; + lj2[j][i] = lj2[i][j] = 24.0 * epsilon * sigma6[i][j]; + lj3[j][i] = lj3[i][j] = 4.0 * epsilon * sigma6[i][j] * sigma6[i][j]; + lj4[j][i] = lj4[i][j] = 4.0 * epsilon * sigma6[i][j]; + + offset[j][i] = offset[i][j] = 0.0; + if (offset_flag) { + One one; + single(0,0,i,j,cutsq[i][j],0.0,1.0,1,one); + offset[j][i] = offset[i][j] = one.eng_vdwl; + } + + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairColloid::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i,j,flag; + double d; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j],sizeof(int),1,fp); + if (setflag[i][j]) { + fwrite(&a12[i][j],sizeof(double),1,fp); + fwrite(&sigma[i][j],sizeof(double),1,fp); + fwrite(&d1[i][j],sizeof(double),1,fp); + fwrite(&d2[i][j],sizeof(double),1,fp); + fwrite(&cut[i][j],sizeof(double),1,fp); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairColloid::read_restart(FILE *fp) +{ + read_restart_settings(fp); + allocate(); + + int i,j; + int me = comm->me; + double d; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); + MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (setflag[i][j]) { + if (me == 0) { + fread(&a12[i][j],sizeof(double),1,fp); + fread(&sigma[i][j],sizeof(double),1,fp); + fread(&d1[i][j],sizeof(double),1,fp); + fread(&d2[i][j],sizeof(double),1,fp); + fread(&cut[i][j],sizeof(double),1,fp); + } + MPI_Bcast(&a12[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&d1[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&d2[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairColloid::write_restart_settings(FILE *fp) +{ + fwrite(&cut_global,sizeof(double),1,fp); + fwrite(&offset_flag,sizeof(int),1,fp); + fwrite(&mix_flag,sizeof(int),1,fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairColloid::read_restart_settings(FILE *fp) +{ + int me = comm->me; + if (me == 0) { + fread(&cut_global,sizeof(double),1,fp); + fread(&offset_flag,sizeof(int),1,fp); + fread(&mix_flag,sizeof(int),1,fp); + } + MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); + MPI_Bcast(&offset_flag,1,MPI_INT,0,world); + MPI_Bcast(&mix_flag,1,MPI_INT,0,world); +} + +/* ---------------------------------------------------------------------- */ + +void PairColloid::single(int i, int j, int itype, int jtype, double rsq, + double factor_coul, double factor_lj, int eflag, + One &one) +{ + double K[9],h[4],g[4]; + double r,r2inv,r6inv,forcelj,c1,c2,aij,s6,phi,fR,dUR,dUA; + + switch (form[itype][jtype]) { + case SMALL_SMALL: + r2inv = 1.0/rsq; + r6inv = r2inv*r2inv*r2inv; + forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]); + one.fforce = factor_lj*forcelj*r2inv; + if (eflag) phi = r6inv*(r6inv*lj3[itype][jtype]-lj4[itype][jtype]) - + offset[itype][jtype]; + break; + + case SMALL_LARGE: + r = sqrt(rsq); + c2 = a2[itype][jtype]; + K[1] = c2*c2; + K[2] = rsq; + K[4] = rsq*rsq; + K[3] = K[1] - K[2]; + K[3] *= K[3]*K[3]; + K[6] = K[3]*K[3]; + fR = sigma3[itype][jtype]*a12[itype][jtype]*c2*K[1]/K[3]; + one.fforce = 4.0/15.0*r*fR*factor_lj * + (2.0*(K[1]+K[2])*(K[1]*(5.0*K[1]+22.0*K[2])+5.0*K[4]) * + sigma6[itype][jtype]/K[6] - 5.0)/K[0]; + if (eflag) + phi = 2.0/9.0*fR * + (1.0-(K[1]*(K[1]*(K[1]/3.0+3.0*K[2])+4.2*K[4])+K[2]*K[4]) * + sigma6[itype][jtype]/K[6]) - offset[itype][jtype]; + break; + + case LARGE_LARGE: + r = sqrt(rsq); + c1 = a1[itype][jtype]; + c2 = a2[itype][jtype]; + K[0] = c1*c2; + K[1] = c1+c2; + K[2] = c1-c2; + K[3] = K[1]+r; + K[4] = K[1]-r; + K[5] = K[2]+r; + K[6] = K[2]-r; + K[7] = 1.0/(K[3]*K[4]); + K[8] = 1.0/(K[5]*K[6]); + g[0] = pow(K[3],-7.0); + g[1] = pow(K[4],-7.0); + g[2] = pow(K[5],-7.0); + g[3] = pow(K[6],-7.0); + h[0] = ((K[3]+5.0*K[1])*K[3]+30.0*K[0])*g[0]; + h[1] = ((K[4]+5.0*K[1])*K[4]+30.0*K[0])*g[1]; + h[2] = ((K[5]+5.0*K[2])*K[5]-30.0*K[0])*g[2]; + h[3] = ((K[6]+5.0*K[2])*K[6]-30.0*K[0])*g[3]; + g[0] *= 42.0*K[0]/K[3]+6.0*K[1]+K[3]; + g[1] *= 42.0*K[0]/K[4]+6.0*K[1]+K[4]; + g[2] *= -42.0*K[0]/K[5]+6.0*K[2]+K[5]; + g[3] *= -42.0*K[0]/K[6]+6.0*K[2]+K[6]; + + fR = a12[itype][jtype]*sigma6[itype][jtype]/r/37800.0; + phi = fR * (h[0]-h[1]-h[2]+h[3]); + dUR = phi/r + 5.0*fR*(g[0]+g[1]-g[2]-g[3]); + dUA = -a12[itype][jtype]/3.0*r*((2.0*K[0]*K[7]+1.0)*K[7] + + (2.0*K[0]*K[8]-1.0)*K[8]); + one.fforce = factor_lj*(dUR+dUA)/r; + + if (eflag) + phi += a12[itype][jtype]/6.0*(2.0*K[0]*(K[7]+K[8])-log(K[8]/K[7])) - + offset[itype][jtype]; + break; + } + + if (eflag) { + one.eng_vdwl = factor_lj*phi; + one.eng_coul = 0.0; + } +} diff --git a/src/COLLOID/pair_colloid.h b/src/COLLOID/pair_colloid.h new file mode 100644 index 0000000000..ab89a3e728 --- /dev/null +++ b/src/COLLOID/pair_colloid.h @@ -0,0 +1,48 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + www.cs.sandia.gov/~sjplimp/lammps.html + Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef PAIR_COLLOID_H +#define PAIR_COLLOID_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairColloid : public Pair { + public: + PairColloid(class LAMMPS *); + ~PairColloid(); + void compute(int, int); + void settings(int, char **); + void coeff(int, char **); + double init_one(int, int); + void write_restart(FILE *); + void read_restart(FILE *); + void write_restart_settings(FILE *); + void read_restart_settings(FILE *); + void single(int, int, int, int, double, double, double, int, One &); + + private: + double cut_global; + double **cut; + double **a12,**d1,**d2,**a1,**a2,**offset; + double **sigma,**sigma3,**sigma6; + double **lj1,**lj2,**lj3,**lj4; + int **form; + + void allocate(); +}; + +} + +#endif diff --git a/src/COLLOID/style_colloid.h b/src/COLLOID/style_colloid.h new file mode 100644 index 0000000000..393605e64e --- /dev/null +++ b/src/COLLOID/style_colloid.h @@ -0,0 +1,20 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PairInclude +#include "pair_colloid.h" +#endif + +#ifdef PairClass +PairStyle(colloid,PairColloid) +#endif diff --git a/src/MEAM/Install.csh b/src/MEAM/Install.csh new file mode 100644 index 0000000000..5f6b5116de --- /dev/null +++ b/src/MEAM/Install.csh @@ -0,0 +1,20 @@ +# Install/unInstall package classes in LAMMPS + +if ($1 == 1) then + + cp style_meam.h .. + + cp pair_meam.cpp .. + + cp pair_meam.h .. + +else if ($1 == 0) then + + rm ../style_meam.h + touch ../style_meam.h + + rm ../pair_meam.cpp + + rm ../pair_meam.h + +endif diff --git a/src/MEAM/pair_meam.cpp b/src/MEAM/pair_meam.cpp new file mode 100644 index 0000000000..2ce47bce04 --- /dev/null +++ b/src/MEAM/pair_meam.cpp @@ -0,0 +1,887 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Greg Wagner (SNL) +------------------------------------------------------------------------- */ + +#include "math.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "pair_meam.h" +#include "atom.h" +#include "force.h" +#include "comm.h" +#include "update.h" +#include "memory.h" +#include "neighbor.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +#define MAXLINE 1024 + +enum{FCC,BCC,HCP,DIM,DIAMOND,B1,C11}; +int nkeywords = 15; +char *keywords[] = {"Ec","alpha","rho0","delta","lattce", + "attrac","repuls","nn2","Cmin","Cmax","rc","delr", + "augt1","gsmooth_factor","re"}; + +/* ---------------------------------------------------------------------- */ + +PairMEAM::PairMEAM(LAMMPS *lmp) : Pair(lmp) +{ + neigh_half_every = neigh_full_every = 1; + single_enable = 0; + one_coeff = 1; + + nmax = 0; + rho = rho0 = rho1 = rho2 = rho3 = frhop = NULL; + gamma = dgamma1 = dgamma2 = dgamma3 = arho2b = NULL; + arho1 = arho2 = arho3 = arho3b = t_ave = NULL; + strssa = NULL; + + maxneigh = 0; + scrfcn = dscrfcn = fcpair = NULL; + + nelements = 0; + elements = NULL; + mass = NULL; + + // set comm size needed by this Pair + + comm_forward = 35; + comm_reverse = 27; +} + +/* ---------------------------------------------------------------------- + free all arrays + check if allocated, since class can be destructed when incomplete +------------------------------------------------------------------------- */ + +PairMEAM::~PairMEAM() +{ + meam_cleanup_(); + + memory->sfree(rho); + memory->sfree(rho0); + memory->sfree(rho1); + memory->sfree(rho2); + memory->sfree(rho3); + memory->sfree(frhop); + memory->sfree(gamma); + memory->sfree(dgamma1); + memory->sfree(dgamma2); + memory->sfree(dgamma3); + memory->sfree(arho2b); + + memory->destroy_2d_double_array(arho1); + memory->destroy_2d_double_array(arho2); + memory->destroy_2d_double_array(arho3); + memory->destroy_2d_double_array(arho3b); + memory->destroy_2d_double_array(t_ave); + + memory->destroy_3d_double_array(strssa); + + memory->sfree(scrfcn); + memory->sfree(dscrfcn); + memory->sfree(fcpair); + + for (int i = 0; i < nelements; i++) delete [] elements[i]; + delete [] elements; + delete [] mass; + + if (allocated) { + memory->destroy_2d_int_array(setflag); + memory->destroy_2d_double_array(cutsq); + delete [] map; + delete [] fmap; + } +} + +/* ---------------------------------------------------------------------- */ + +void PairMEAM::compute(int eflag, int vflag) +{ + int i,j,n,errorflag; + double **f; + + // grow local arrays if necessary + + if (atom->nmax > nmax) { + memory->sfree(rho); + memory->sfree(rho0); + memory->sfree(rho1); + memory->sfree(rho2); + memory->sfree(rho3); + memory->sfree(frhop); + memory->sfree(gamma); + memory->sfree(dgamma1); + memory->sfree(dgamma2); + memory->sfree(dgamma3); + memory->sfree(arho2b); + memory->destroy_2d_double_array(arho1); + memory->destroy_2d_double_array(arho2); + memory->destroy_2d_double_array(arho3); + memory->destroy_2d_double_array(arho3b); + memory->destroy_2d_double_array(t_ave); + memory->destroy_3d_double_array(strssa); + + nmax = atom->nmax; + + rho = (double *) memory->smalloc(nmax*sizeof(double),"pair:rho"); + rho0 = (double *) memory->smalloc(nmax*sizeof(double),"pair:rho0"); + rho1 = (double *) memory->smalloc(nmax*sizeof(double),"pair:rho1"); + rho2 = (double *) memory->smalloc(nmax*sizeof(double),"pair:rho2"); + rho3 = (double *) memory->smalloc(nmax*sizeof(double),"pair:rho3"); + frhop = (double *) memory->smalloc(nmax*sizeof(double),"pair:frhop"); + gamma = (double *) memory->smalloc(nmax*sizeof(double),"pair:gamma"); + dgamma1 = (double *) memory->smalloc(nmax*sizeof(double),"pair:dgamma1"); + dgamma2 = (double *) memory->smalloc(nmax*sizeof(double),"pair:dgamma2"); + dgamma3 = (double *) memory->smalloc(nmax*sizeof(double),"pair:dgamma3"); + arho2b = (double *) memory->smalloc(nmax*sizeof(double),"pair:arho2b"); + arho1 = memory->create_2d_double_array(nmax,3,"pair:arho1"); + arho2 = memory->create_2d_double_array(nmax,6,"pair:arho2"); + arho3 = memory->create_2d_double_array(nmax,10,"pair:arho3"); + arho3b = memory->create_2d_double_array(nmax,3,"pair:arho3b"); + t_ave = memory->create_2d_double_array(nmax,3,"pair:t_ave"); + strssa = memory->create_3d_double_array(nmax,3,3,"pair:strssa"); + } + + // check size of scrfcn based on half neighbor list + + int **firstneigh = neighbor->firstneigh; + int *numneigh = neighbor->numneigh; + int **firstneigh_full = neighbor->firstneigh_full; + int *numneigh_full = neighbor->numneigh_full; + int nlocal = atom->nlocal; + int nall = atom->nlocal + atom->nghost; + + n = 0; + for (i = 0; i < nlocal; i++) n += numneigh[i]; + if (n > maxneigh) { + memory->sfree(scrfcn); + memory->sfree(dscrfcn); + memory->sfree(fcpair); + maxneigh = n; + scrfcn = + (double *) memory->smalloc(maxneigh*sizeof(double),"pair:scrfcn"); + dscrfcn = + (double *) memory->smalloc(maxneigh*sizeof(double),"pair:dscrfcn"); + fcpair = + (double *) memory->smalloc(maxneigh*sizeof(double),"pair:fcpair"); + } + + eng_vdwl = 0.0; + if (vflag) for (i = 0; i < 6; i++) virial[i] = 0.0; + + // zero out local arrays + + for (i = 0; i < nall; i++) { + rho0[i] = 0.0; + arho2b[i] = 0.0; + arho1[i][0] = arho1[i][1] = arho1[i][2] = 0.0; + for (j = 0; j < 6; j++) arho2[i][j] = 0.0; + for (j = 0; j < 10; j++) arho3[i][j] = 0.0; + arho3b[i][0] = arho3b[i][1] = arho3b[i][2] = 0.0; + t_ave[i][0] = t_ave[i][1] = t_ave[i][2] = 0.0; + } + + if (vflag == 2) f = update->f_pair; + else f = atom->f; + double **x = atom->x; + int *type = atom->type; + int ntype = atom->ntypes; + + // change neighbor list indices to Fortran indexing + + neigh_c2f(numneigh,firstneigh); + neigh_c2f(numneigh_full,firstneigh_full); + + // 3 stages of MEAM calculation + // loop over my atoms followed by communication + + errorflag = 0; + int offset = 0; + for (i = 0; i < nlocal; i++) { + int ifort = i+1; + meam_dens_init_(&ifort,&nmax,&eflag,&eng_vdwl,&ntype,type,fmap,&x[0][0], + &numneigh[i],firstneigh[i], + &numneigh_full[i],firstneigh_full[i], + &scrfcn[offset],&dscrfcn[offset],&fcpair[offset], + rho0,&arho1[0][0],&arho2[0][0],arho2b, + &arho3[0][0],&arho3b[0][0],&t_ave[0][0],&errorflag); + if (errorflag) { + char str[128]; + sprintf(str,"MEAM library error %d",errorflag); + error->one(str); + } + offset += numneigh[i]; + } + + reverse_flag = 0; + comm->reverse_comm_pair(this); + + meam_dens_final_(&nlocal,&nmax,&eflag,&eng_vdwl,&ntype,type,fmap, + &arho1[0][0],&arho2[0][0],arho2b,&arho3[0][0], + &arho3b[0][0],&t_ave[0][0],gamma,dgamma1, + dgamma2,dgamma3,rho,rho0,rho1,rho2,rho3,frhop,&errorflag); + if (errorflag) { + char str[128]; + sprintf(str,"MEAM library error %d",errorflag); + error->one(str); + } + + comm->comm_pair(this); + + offset = 0; + for (i = 0; i < nlocal; i++) { + int ifort = i+1; + meam_force_(&ifort,&nmax,&eflag,&eng_vdwl,&ntype,type,fmap,&x[0][0], + &numneigh[i],firstneigh[i], + &numneigh_full[i],firstneigh_full[i], + &scrfcn[offset],&dscrfcn[offset],&fcpair[offset], + dgamma1,dgamma2,dgamma3,rho0,rho1,rho2,rho3,frhop, + &arho1[0][0],&arho2[0][0],arho2b,&arho3[0][0],&arho3b[0][0], + &t_ave[0][0],&f[0][0],&strssa[0][0][0],&errorflag); + if (errorflag) { + char str[128]; + sprintf(str,"MEAM library error %d",errorflag); + error->one(str); + } + offset += numneigh[i]; + } + + reverse_flag = 1; + comm->reverse_comm_pair(this); + + // change neighbor list indices back to C indexing + + neigh_f2c(numneigh,firstneigh); + neigh_f2c(numneigh_full,firstneigh_full); + + if (vflag == 2) virial_compute(); +} + +/* ---------------------------------------------------------------------- */ + +void PairMEAM::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + setflag = memory->create_2d_int_array(n+1,n+1,"pair:setflag"); + cutsq = memory->create_2d_double_array(n+1,n+1,"pair:cutsq"); + + map = new int[n+1]; + fmap = new int[n]; +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairMEAM::settings(int narg, char **arg) +{ + if (narg != 0) error->all("Illegal pair_style command"); +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairMEAM::coeff(int narg, char **arg) +{ + int i,j,m,n; + + if (!allocated) allocate(); + + if (narg < 6) error->all("Incorrect args for pair coefficients"); + + // insure I,J args are * * + + if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) + error->all("Incorrect args for pair coefficients"); + + // read MEAM element names between 2 filenames + // nelements = # of MEAM elements + // elements = list of unique element names + + if (nelements) { + for (i = 0; i < nelements; i++) delete [] elements[i]; + delete [] elements; + delete [] mass; + } + nelements = narg - 4 - atom->ntypes; + if (nelements < 1) error->all("Incorrect args for pair coefficients"); + elements = new char*[nelements]; + mass = new double[nelements]; + + for (i = 0; i < nelements; i++) { + n = strlen(arg[i+3]) + 1; + elements[i] = new char[n]; + strcpy(elements[i],arg[i+3]); + } + + // read MEAM library and parameter files + // pass all parameters to MEAM package + // tell MEAM package that setup is done + + read_files(arg[2],arg[2+nelements+1]); + meam_setup_done_(&cutmax); + + // read args that map atom types to MEAM elements + // map[i] = which element the Ith atom type is, -1 if not mapped + + for (i = 4 + nelements; i < narg; i++) { + m = i - (4+nelements) + 1; + for (j = 0; j < nelements; j++) + if (strcmp(arg[i],elements[j]) == 0) break; + if (j < nelements) map[m] = j; + else if (strcmp(arg[i],"NULL") == 0) map[m] = -1; + else error->all("Incorrect args for pair coefficients"); + } + + // clear setflag since coeff() called once with I,J = * * + + n = atom->ntypes; + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + // set setflag i,j for type pairs where both are mapped to elements + // set mass for i,i in atom class + + int count = 0; + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + if (map[i] >= 0 && map[j] >= 0) { + setflag[i][j] = 1; + if (i == j) atom->set_mass(i,mass[map[i]]); + count++; + } + + if (count == 0) error->all("Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairMEAM::init_one(int i, int j) +{ + return cutmax; +} + +/* ---------------------------------------------------------------------- */ + +void PairMEAM::init_style() +{ + if (force->newton_pair == 0) + error->all("Pair style MEAM requires newton pair on"); + + // setup Fortran-style mapping array needed by MEAM package + // fmap is indexed from 1:ntypes by Fortran and stores a Fortran index + // if type I is not a MEAM atom, fmap stores a 0 + + for (int i = 1; i <= atom->ntypes; i++) fmap[i-1] = map[i] + 1; +} + +/* ---------------------------------------------------------------------- */ + +void PairMEAM::read_files(char *globalfile, char *userfile) +{ + // open global meamf file on proc 0 + + FILE *fp; + if (comm->me == 0) { + fp = fopen(globalfile,"r"); + if (fp == NULL) { + char str[128]; + sprintf(str,"Cannot open MEAM potential file %s",globalfile); + error->one(str); + } + } + + // allocate parameter arrays + + int params_per_line = 19; + + int *lat = new int[nelements]; + int *ielement = new int[nelements]; + int *ibar = new int[nelements]; + double *z = new double[nelements]; + double *atwt = new double[nelements]; + double *alpha = new double[nelements]; + double *b0 = new double[nelements]; + double *b1 = new double[nelements]; + double *b2 = new double[nelements]; + double *b3 = new double[nelements]; + double *alat = new double[nelements]; + double *esub = new double[nelements]; + double *asub = new double[nelements]; + double *t0 = new double[nelements]; + double *t1 = new double[nelements]; + double *t2 = new double[nelements]; + double *t3 = new double[nelements]; + double *rozero = new double[nelements]; + + bool *found = new bool[nelements]; + for (int i = 0; i < nelements; i++) found[i] = false; + + // read each set of params from global MEAM file + // one set of params can span multiple lines + // store params if element name is in element list + // if element name appears multiple times, only store 1st entry + + int i,n,nwords; + char **words = new char*[params_per_line+1]; + char line[MAXLINE],*ptr; + int eof = 0; + + int nset = 0; + while (1) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fp); + if (ptr == NULL) { + eof = 1; + fclose(fp); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) break; + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + // strip comment, skip line if blank + + if (ptr = strchr(line,'#')) *ptr = '\0'; + nwords = atom->count_words(line); + if (nwords == 0) continue; + + // concatenate additional lines until have params_per_line words + + while (nwords < params_per_line) { + n = strlen(line); + if (comm->me == 0) { + ptr = fgets(&line[n],MAXLINE-n,fp); + if (ptr == NULL) { + eof = 1; + fclose(fp); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) break; + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + if (ptr = strchr(line,'#')) *ptr = '\0'; + nwords = atom->count_words(line); + } + + if (nwords != params_per_line) + error->all("Incorrect format in MEAM potential file"); + + // words = ptrs to all words in line + // strip single and double quotes from words + + nwords = 0; + words[nwords++] = strtok(line,"' \t\n\r\f"); + while (words[nwords++] = strtok(NULL,"' \t\n\r\f")) continue; + + // skip if element name isn't in element list + + for (i = 0; i < nelements; i++) + if (strcmp(words[0],elements[i]) == 0) break; + if (i == nelements) continue; + + // skip if element already appeared + + if (found[i] == true) continue; + found[i] = true; + + // map lat string to an integer + + if (strcmp(words[1],"fcc") == 0) lat[i] = FCC; + else if (strcmp(words[1],"bcc") == 0) lat[i] = BCC; + else if (strcmp(words[1],"hcp") == 0) lat[i] = HCP; + else if (strcmp(words[1],"dim") == 0) lat[i] = DIM; + else if (strcmp(words[1],"dia") == 0) lat[i] = DIAMOND; + else error->all("Unrecognized lattice type in MEAM file 1"); + + // store parameters + + z[i] = atof(words[2]); + ielement[i] = atoi(words[3]); + atwt[i] = atof(words[4]); + alpha[i] = atof(words[5]); + b0[i] = atof(words[6]); + b1[i] = atof(words[7]); + b2[i] = atof(words[8]); + b3[i] = atof(words[9]); + alat[i] = atof(words[10]); + esub[i] = atof(words[11]); + asub[i] = atof(words[12]); + t0[i] = atof(words[13]); + t1[i] = atof(words[14]); + t2[i] = atof(words[15]); + t3[i] = atof(words[16]); + rozero[i] = atof(words[17]); + ibar[i] = atoi(words[18]); + + nset++; + } + + // error if didn't find all elements in file + + if (nset != nelements) + error->all("Did not find all elements in MEAM library file"); + + // pass element parameters to MEAM package + + meam_setup_global_(&nelements,lat,z,ielement,atwt,alpha,b0,b1,b2,b3, + alat,esub,asub,t0,t1,t2,t3,rozero,ibar); + + // set element masses + + for (i = 0; i < nelements; i++) mass[i] = atwt[i]; + + // clean-up memory + + delete [] words; + + delete [] lat; + delete [] ielement; + delete [] ibar; + delete [] z; + delete [] atwt; + delete [] alpha; + delete [] b0; + delete [] b1; + delete [] b2; + delete [] b3; + delete [] alat; + delete [] esub; + delete [] asub; + delete [] t0; + delete [] t1; + delete [] t2; + delete [] t3; + delete [] rozero; + delete [] found; + + // done if user param file is NULL + + if (strcmp(userfile,"NULL") == 0) return; + + // open user param file on proc 0 + + if (comm->me == 0) { + fp = fopen(userfile,"r"); + if (fp == NULL) { + char str[128]; + sprintf(str,"Cannot open MEAM potential file %s",userfile); + error->one(str); + } + } + + // read settings + // pass them one at a time to MEAM package + // match strings to list of corresponding ints + + int which; + double value; + int nindex,index[3]; + int maxparams = 6; + int nparams; + char *params[maxparams]; + + eof = 0; + while (1) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fp); + if (ptr == NULL) { + eof = 1; + fclose(fp); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) break; + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + // strip comment, skip line if blank + + if (ptr = strchr(line,'#')) *ptr = '\0'; + nparams = atom->count_words(line); + if (nparams == 0) continue; + + // words = ptrs to all words in line + + nparams = 0; + params[nparams++] = strtok(line,"=(), '\t\n\r\f"); + while (nparams < maxparams && + (params[nparams++] = strtok(NULL,"=(), '\t\n\r\f"))) + continue; + nparams--; + + for (which = 0; which < nkeywords; which++) + if (strcmp(params[0],keywords[which]) == 0) break; + if (which == nkeywords) { + char str[128]; + sprintf(str,"Keyword %s in MEAM parameter file not recognized", + params[0]); + error->all(str); + } + nindex = nparams - 2; + for (i = 0; i < nindex; i++) index[i] = atoi(params[i+1]); + + // map lattce_meam value to an integer + + if (which == 4) { + if (strcmp(params[nparams-1],"fcc") == 0) value = FCC; + else if (strcmp(params[nparams-1],"bcc") == 0) value = BCC; + else if (strcmp(params[nparams-1],"hcp") == 0) value = HCP; + else if (strcmp(params[nparams-1],"dim") == 0) value = DIM; + else if (strcmp(params[nparams-1],"dia") == 0) value = DIAMOND; + else if (strcmp(params[nparams-1],"b1") == 0) value = B1; + else if (strcmp(params[nparams-1],"c11") == 0) value = C11; + else error->all("Unrecognized lattice type in MEAM file 2"); + } + else value = atof(params[nparams-1]); + + // pass single setting to MEAM package + + int errorflag = 0; + meam_setup_param_(&which,&value,&nindex,index,&errorflag); + if (errorflag) { + char str[128]; + sprintf(str,"MEAM library error %d",errorflag); + error->all(str); + } + } +} + +/* ---------------------------------------------------------------------- */ + +int PairMEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +{ + int i,j,k,m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = rho0[j]; + buf[m++] = rho1[j]; + buf[m++] = rho2[j]; + buf[m++] = rho3[j]; + buf[m++] = frhop[j]; + buf[m++] = gamma[j]; + buf[m++] = dgamma1[j]; + buf[m++] = dgamma2[j]; + buf[m++] = dgamma3[j]; + buf[m++] = arho2b[j]; + buf[m++] = arho1[j][0]; + buf[m++] = arho1[j][1]; + buf[m++] = arho1[j][2]; + buf[m++] = arho2[j][0]; + buf[m++] = arho2[j][1]; + buf[m++] = arho2[j][2]; + buf[m++] = arho2[j][3]; + buf[m++] = arho2[j][4]; + buf[m++] = arho2[j][5]; + for (k = 0; k < 10; k++) buf[m++] = arho3[j][k]; + buf[m++] = arho3b[j][0]; + buf[m++] = arho3b[j][1]; + buf[m++] = arho3b[j][2]; + buf[m++] = t_ave[j][0]; + buf[m++] = t_ave[j][1]; + buf[m++] = t_ave[j][2]; + } + return 35; +} + +/* ---------------------------------------------------------------------- */ + +void PairMEAM::unpack_comm(int n, int first, double *buf) +{ + int i,k,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + rho0[i] = buf[m++]; + rho1[i] = buf[m++]; + rho2[i] = buf[m++]; + rho3[i] = buf[m++]; + frhop[i] = buf[m++]; + gamma[i] = buf[m++]; + dgamma1[i] = buf[m++]; + dgamma2[i] = buf[m++]; + dgamma3[i] = buf[m++]; + arho2b[i] = buf[m++]; + arho1[i][0] = buf[m++]; + arho1[i][1] = buf[m++]; + arho1[i][2] = buf[m++]; + arho2[i][0] = buf[m++]; + arho2[i][1] = buf[m++]; + arho2[i][2] = buf[m++]; + arho2[i][3] = buf[m++]; + arho2[i][4] = buf[m++]; + arho2[i][5] = buf[m++]; + for (k = 0; k < 10; k++) arho3[i][k] = buf[m++]; + arho3b[i][0] = buf[m++]; + arho3b[i][1] = buf[m++]; + arho3b[i][2] = buf[m++]; + t_ave[i][0] = buf[m++]; + t_ave[i][1] = buf[m++]; + t_ave[i][2] = buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +int PairMEAM::pack_reverse_comm(int n, int first, double *buf) +{ + int i,k,m,last,size; + + m = 0; + last = first + n; + if (reverse_flag == 0) { + for (i = first; i < last; i++) { + buf[m++] = rho0[i]; + buf[m++] = arho2b[i]; + buf[m++] = arho1[i][0]; + buf[m++] = arho1[i][1]; + buf[m++] = arho1[i][2]; + buf[m++] = arho2[i][0]; + buf[m++] = arho2[i][1]; + buf[m++] = arho2[i][2]; + buf[m++] = arho2[i][3]; + buf[m++] = arho2[i][4]; + buf[m++] = arho2[i][5]; + for (k = 0; k < 10; k++) buf[m++] = arho3[i][k]; + buf[m++] = arho3b[i][0]; + buf[m++] = arho3b[i][1]; + buf[m++] = arho3b[i][2]; + buf[m++] = t_ave[i][0]; + buf[m++] = t_ave[i][1]; + buf[m++] = t_ave[i][2]; + } + size = 27; + + } else { + for (i = first; i < last; i++) { + buf[m++] = strssa[i][0][0]; + buf[m++] = strssa[i][0][1]; + buf[m++] = strssa[i][0][2]; + buf[m++] = strssa[i][1][0]; + buf[m++] = strssa[i][1][1]; + buf[m++] = strssa[i][1][2]; + buf[m++] = strssa[i][2][0]; + buf[m++] = strssa[i][2][1]; + buf[m++] = strssa[i][2][2]; + } + size = 9; + } + + return size; +} + +/* ---------------------------------------------------------------------- */ + +void PairMEAM::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i,j,k,m; + + m = 0; + if (reverse_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + rho0[j] += buf[m++]; + arho2b[j] += buf[m++]; + arho1[j][0] += buf[m++]; + arho1[j][1] += buf[m++]; + arho1[j][2] += buf[m++]; + arho2[j][0] += buf[m++]; + arho2[j][1] += buf[m++]; + arho2[j][2] += buf[m++]; + arho2[j][3] += buf[m++]; + arho2[j][4] += buf[m++]; + arho2[j][5] += buf[m++]; + for (k = 0; k < 10; k++) arho3[j][k] += buf[m++]; + arho3b[j][0] += buf[m++]; + arho3b[j][1] += buf[m++]; + arho3b[j][2] += buf[m++]; + t_ave[j][0] += buf[m++]; + t_ave[j][1] += buf[m++]; + t_ave[j][2] += buf[m++]; + } + + } else { + for (i = 0; i < n; i++) { + j = list[i]; + strssa[j][0][0] += buf[m++]; + strssa[j][0][1] += buf[m++]; + strssa[j][0][2] += buf[m++]; + strssa[j][1][0] += buf[m++]; + strssa[j][1][1] += buf[m++]; + strssa[j][1][2] += buf[m++]; + strssa[j][2][0] += buf[m++]; + strssa[j][2][1] += buf[m++]; + strssa[j][2][2] += buf[m++]; + } + } +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based arrays +------------------------------------------------------------------------- */ + +int PairMEAM::memory_usage() +{ + int bytes = 7 * nmax * sizeof(double); + bytes += (3 + 6 + 10 + 3 + 3) * nmax * sizeof(double); + bytes += 3*3 * nmax * sizeof(double); + bytes += 2 * maxneigh * sizeof(double); + return bytes; +} + +/* ---------------------------------------------------------------------- + toggle neighbor list indices between zero- and one-based values + needed for access by MEAM Fortran library +------------------------------------------------------------------------- */ + +void PairMEAM::neigh_f2c(int *numn, int **firstn) +{ + int nlocal = atom->nlocal; + for (int i = 0; i < nlocal; i++) { + int *neigh = firstn[i]; + int nsize = numn[i]; + for (int j = 0; j < nsize; j++) neigh[j] -= 1; + } +} + +void PairMEAM::neigh_c2f(int *numn, int **firstn) +{ + int nlocal = atom->nlocal; + for (int i = 0; i < nlocal; i++) { + int *neigh = firstn[i]; + int nsize = numn[i]; + for (int j = 0; j < nsize; j++) neigh[j] += 1; + } +} diff --git a/src/MEAM/pair_meam.h b/src/MEAM/pair_meam.h new file mode 100644 index 0000000000..3471bea393 --- /dev/null +++ b/src/MEAM/pair_meam.h @@ -0,0 +1,95 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef PAIR_MEAM_H +#define PAIR_MEAM_H + +extern "C" { + void meam_setup_global_(int *, int *, double *, int *, double *, double *, + double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, + double *, double *, int *); + void meam_setup_param_(int *, double *, int *, int *, int *); + void meam_setup_done_(double *); + + void meam_dens_init_(int *, int *, int *, double *, int *, int *, int *, + double *, int *, int *, int *, int *, + double *, double *, double *, double *, + double *, double *, + double *, double *, double *, double *, int *); + + void meam_dens_final_(int *, int *, int *, double *, int *, int *, int *, + double *, double *, double *, double *, + double *, double *, + double *, double *, double *, double *, + double *, double *, + double *, double *, double *, double *, int *); + + void meam_force_(int *, int *, int *, double *, int *, int *, int *, + double *, int *, int *, int *, int *, double *, double *, + double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, int *); + + void meam_cleanup_(); +} + + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairMEAM : public Pair { + public: + PairMEAM(class LAMMPS *); + ~PairMEAM(); + void compute(int, int); + void settings(int, char **); + void coeff(int, char **); + double init_one(int, int); + void init_style(); + + int pack_comm(int, int *, double *, int, int *); + void unpack_comm(int, int, double *); + int pack_reverse_comm(int, int, double *); + void unpack_reverse_comm(int, int *, double *); + int memory_usage(); + + private: + double cutmax; // max cutoff for all elements + int nelements; // # of unique elements + char **elements; // names of unique elements + double *mass; // mass of each element + int reverse_flag; // which pass of reverse comm is being done + + int *map; // mapping from atom types to elements + int *fmap; // Fortran version of map array for MEAM lib + + int maxneigh; + double *scrfcn,*dscrfcn,*fcpair; + + int nmax; + double *rho,*rho0,*rho1,*rho2,*rho3,*frhop; + double *gamma,*dgamma1,*dgamma2,*dgamma3,*arho2b; + double **arho1,**arho2,**arho3,**arho3b,**t_ave; + double ***strssa; + + void allocate(); + void read_files(char *, char *); + void neigh_f2c(int *, int **); + void neigh_c2f(int *, int **); +}; + +} + +#endif diff --git a/src/MEAM/style_meam.h b/src/MEAM/style_meam.h new file mode 100644 index 0000000000..221a363f11 --- /dev/null +++ b/src/MEAM/style_meam.h @@ -0,0 +1,20 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PairInclude +#include "pair_meam.h" +#endif + +#ifdef PairClass +PairStyle(meam,PairMEAM) +#endif diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index 6bfe803465..c3e325d40b 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; -enum{NONE,FINAL,DELTA,SCALE,VEL,RATE,VOLUME}; +enum{NONE,FINAL,DELTA,SCALE,VEL,ERATE,TRATE,VOLUME}; enum{ONE_FROM_ONE,ONE_FROM_TWO,TWO_FROM_ONE}; // same as domain.cpp, fix_nvt_sllod.cpp, compute_temp_deform.cpp @@ -91,9 +91,14 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) set[index].style = VEL; set[index].vel = atof(arg[iarg+2]); iarg += 3; - } else if (strcmp(arg[iarg+1],"rate") == 0) { + } else if (strcmp(arg[iarg+1],"erate") == 0) { if (iarg+3 > narg) error->all("Illegal fix deform command"); - set[index].style = RATE; + set[index].style = ERATE; + set[index].rate = atof(arg[iarg+2]); + iarg += 3; + } else if (strcmp(arg[iarg+1],"trate") == 0) { + if (iarg+3 > narg) error->all("Illegal fix deform command"); + set[index].style = TRATE; set[index].rate = atof(arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"volume") == 0) { @@ -124,12 +129,18 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) set[index].style = VEL; set[index].vel = atof(arg[iarg+2]); iarg += 3; - } else if (strcmp(arg[iarg+1],"rate") == 0) { + } else if (strcmp(arg[iarg+1],"erate") == 0) { if (iarg+3 > narg) error->all("Illegal fix deform command"); - set[index].style = RATE; + set[index].style = ERATE; + set[index].rate = atof(arg[iarg+2]); + iarg += 3; + } else if (strcmp(arg[iarg+1],"trate") == 0) { + if (iarg+3 > narg) error->all("Illegal fix deform command"); + set[index].style = TRATE; set[index].rate = atof(arg[iarg+2]); iarg += 3; } else error->all("Illegal fix deform command"); + } else break; } @@ -189,7 +200,7 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } // set initial/final values for box size and shape for FINAL,DELTA,SCALE - // final not possible for VEL,RATE since don't know length of run yet + // final not possible for VEL,ERATE,TRATE since don't know length of run yet // final = initial if no setting for (int i = 0; i < 3; i++) { @@ -317,36 +328,51 @@ void FixDeform::init() double delt = (update->endstep - update->beginstep) * update->dt; if (delt == 0.0) error->all("Cannot use fix deform for 0 timestep run"); - // set final values for box size and shape for VEL,RATE + // set final values for box size and shape for VEL,ERATE,TRATE // now possible since length of run is known for (int i = 0; i < 3; i++) { if (set[i].style == VEL) { set[i].lo_stop = set[i].lo_start - 0.5*delt*set[i].vel; set[i].hi_stop = set[i].hi_start + 0.5*delt*set[i].vel; - } else if (set[i].style == RATE) { + } else if (set[i].style == ERATE) { + set[i].lo_stop = set[i].lo_start - + 0.5*delt*set[i].rate * (set[i].hi_start-set[i].lo_start); + set[i].hi_stop = set[i].hi_start + + 0.5*delt*set[i].rate * (set[i].hi_start-set[i].lo_start); + if (set[i].hi_stop <= set[i].lo_stop) + error->all("Final box dimension due to fix deform is < 0.0"); + } else if (set[i].style == TRATE) { set[i].lo_stop = 0.5*(set[i].lo_start+set[i].hi_start) - 0.5*((set[i].hi_start-set[i].lo_start)*pow(1.0+set[i].rate,delt)); set[i].hi_stop = 0.5*(set[i].lo_start+set[i].hi_start) + 0.5*((set[i].hi_start-set[i].lo_start)*pow(1.0+set[i].rate,delt)); } } + for (int i = 3; i < 6; i++) { if (set[i].style == VEL) { set[i].tilt_stop = set[i].tilt_start + delt*set[i].vel; - } else if (set[i].style == RATE) { + } else if (set[i].style == ERATE) { + if (i == 3) set[i].tilt_stop = set[i].tilt_start + + delt*set[i].rate * (set[2].hi_start-set[2].lo_start); + if (i == 4) set[i].tilt_stop = set[i].tilt_start + + delt*set[i].rate * (set[2].hi_start-set[2].lo_start); + if (i == 5) set[i].tilt_stop = set[i].tilt_start + + delt*set[i].rate * (set[1].hi_start-set[1].lo_start); + } else if (set[i].style == TRATE) { set[i].tilt_stop = set[i].tilt_start * pow(1.0+set[i].rate,delt); } } - // if using tilt RATE, then initial tilt must be non-zero + // if using tilt TRATE, then initial tilt must be non-zero for (int i = 3; i < 6; i++) - if (set[i].style == RATE) + if (set[i].style == TRATE) if ((i == 5 && domain->xy == 0.0) || (i == 4 && domain->xz == 0.0) || (i == 3 && domain->yz == 0.0)) - error->all("Cannot use fix deform rate to tilt a box with zero tilt"); + error->all("Cannot use fix deform trate on a box with zero tilt"); // if yz changes and will cause box flip, then xy cannot be changing // this is b/c the flips would induce continuous changes in xz @@ -362,7 +388,7 @@ void FixDeform::init() // set domain->h_rate values for use by domain and other fixes/computes // initialize all rates to 0.0 - // cannot set rate now for RATE,VOLUME styles since not constant + // cannot set h_rate now for TRATE,VOLUME styles since not constant h_rate = domain->h_rate; h_ratelo = domain->h_ratelo; @@ -370,17 +396,19 @@ void FixDeform::init() for (int i = 0; i < 3; i++) { h_rate[i] = h_ratelo[i] = 0.0; if (set[i].style == FINAL || set[i].style == DELTA || - set[i].style == SCALE || set[i].style == VEL) { + set[i].style == SCALE || set[i].style == VEL || + set[i].style == ERATE) { double dlo_dt = (set[i].lo_stop - set[i].lo_start) / delt; double dhi_dt = (set[i].hi_stop - set[i].hi_start) / delt; h_rate[i] = dhi_dt - dlo_dt; h_ratelo[i] = dlo_dt; } - } + } + for (int i = 3; i < 6; i++) { h_rate[i] = 0.0; if (set[i].style == FINAL || set[i].style == DELTA || - set[i].style == VEL) + set[i].style == VEL || set[i].style == ERATE) h_rate[i] = (set[i].tilt_stop - set[i].tilt_start) / delt; } @@ -443,13 +471,13 @@ void FixDeform::end_of_step() delta /= update->endstep - update->beginstep; // set new box size - // for RATE, set target directly based on current time and set h_rate + // for TRATE, set target directly based on current time and set h_rate // for others except VOLUME, target is linear value between start and stop for (i = 0; i < 3; i++) { if (set[i].style == NONE) continue; - if (set[i].style == RATE) { + if (set[i].style == TRATE) { double delt = (update->ntimestep - update->beginstep) * update->dt; set[i].lo_target = 0.5*(set[i].lo_start+set[i].hi_start) - 0.5*((set[i].hi_start-set[i].lo_start)*pow(1.0+set[i].rate,delt)); @@ -467,7 +495,7 @@ void FixDeform::end_of_step() } // set new box size for VOLUME dims that are linked to other dims - // also need to set h_rate + // also need to set h_rate for these dims for (int i = 0; i < 3; i++) { if (set[i].style != VOLUME) continue; @@ -517,8 +545,8 @@ void FixDeform::end_of_step() } // for triclinic, set new box shape - // for RATE, set target directly based on current time and set h_rate - // for all others, target is linear value between start and stop values + // for TRATE, set target directly based on current time and set h_rate + // for other styles, target is linear value between start and stop values if (triclinic) { double *h = domain->h; @@ -526,7 +554,7 @@ void FixDeform::end_of_step() for (i = 3; i < 6; i++) { if (set[i].style == NONE) continue; - if (set[i].style == RATE) { + if (set[i].style == TRATE) { double delt = (update->ntimestep - update->beginstep) * update->dt; set[i].tilt_target = set[i].tilt_start * pow(1.0+set[i].rate,delt); h_rate[i] = set[i].rate * domain->h[i]; diff --git a/src/style_asphere.h b/src/style_asphere.h index e69de29bb2..f67f9033ee 100644 --- a/src/style_asphere.h +++ b/src/style_asphere.h @@ -0,0 +1,48 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef AtomInclude +#include "atom_vec_ellipsoid.h" +#endif + +#ifdef AtomClass +AtomStyle(ellipsoid,AtomVecEllipsoid) +# endif + +#ifdef ComputeInclude +#include "compute_temp_asphere.h" +#endif + +#ifdef ComputeClass +ComputeStyle(temp/asphere,ComputeTempAsphere) +#endif + +#ifdef FixInclude +#include "fix_nve_asphere.h" +#include "fix_nvt_asphere.h" +#include "fix_npt_asphere.h" +#endif + +#ifdef FixClass +FixStyle(nve/asphere,FixNVEASphere) +FixStyle(nvt/asphere,FixNVTASphere) +FixStyle(npt/asphere,FixNPTASphere) +#endif + +#ifdef PairInclude +#include "pair_gayberne.h" +#endif + +#ifdef PairClass +PairStyle(gayberne,PairGayBerne) +#endif diff --git a/src/style_class2.h b/src/style_class2.h index e69de29bb2..3ba9b32df4 100644 --- a/src/style_class2.h +++ b/src/style_class2.h @@ -0,0 +1,56 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef AngleInclude +#include "angle_class2.h" +#endif + +#ifdef AngleClass +AngleStyle(class2,AngleClass2) +#endif + +#ifdef BondInclude +#include "bond_class2.h" +#endif + +#ifdef BondClass +BondStyle(class2,BondClass2) +#endif + +#ifdef DihedralInclude +#include "dihedral_class2.h" +#endif + +#ifdef DihedralClass +DihedralStyle(class2,DihedralClass2) +#endif + +#ifdef ImproperInclude +#include "improper_class2.h" +#endif + +#ifdef ImproperClass +ImproperStyle(class2,ImproperClass2) +#endif + +#ifdef PairInclude +#include "pair_lj_class2.h" +#include "pair_lj_class2_coul_cut.h" +#include "pair_lj_class2_coul_long.h" +#endif + +#ifdef PairClass +PairStyle(lj/class2,PairLJClass2) +PairStyle(lj/class2/coul/cut,PairLJClass2CoulCut) +PairStyle(lj/class2/coul/long,PairLJClass2CoulLong) +#endif diff --git a/src/style_colloid.h b/src/style_colloid.h index e69de29bb2..393605e64e 100644 --- a/src/style_colloid.h +++ b/src/style_colloid.h @@ -0,0 +1,20 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PairInclude +#include "pair_colloid.h" +#endif + +#ifdef PairClass +PairStyle(colloid,PairColloid) +#endif diff --git a/src/style_dpd.h b/src/style_dpd.h index e69de29bb2..8ce617c0c2 100644 --- a/src/style_dpd.h +++ b/src/style_dpd.h @@ -0,0 +1,28 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef AtomInclude +#include "atom_vec_dpd.h" +#endif + +#ifdef AtomClass +AtomStyle(dpd,AtomVecDPD) +#endif + +#ifdef PairInclude +#include "pair_dpd.h" +#endif + +#ifdef PairClass +PairStyle(dpd,PairDPD) +#endif diff --git a/src/style_granular.h b/src/style_granular.h index e69de29bb2..7b0f4b6a71 100644 --- a/src/style_granular.h +++ b/src/style_granular.h @@ -0,0 +1,50 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef AtomInclude +#include "atom_vec_granular.h" +#endif + +#ifdef AtomClass +AtomStyle(granular,AtomVecGranular) +# endif + +#ifdef FixInclude +#include "fix_freeze.h" +#include "fix_gran_diag.h" +#include "fix_nve_gran.h" +#include "fix_pour.h" +#include "fix_shear_history.h" +#include "fix_wall_gran.h" +#endif + +#ifdef FixClass +FixStyle(freeze,FixFreeze) +FixStyle(gran/diag,FixGranDiag) +FixStyle(nve/gran,FixNVEGran) +FixStyle(pour,FixPour) +FixStyle(SHEAR_HISTORY,FixShearHistory) +FixStyle(wall/gran,FixWallGran) +#endif + +#ifdef PairInclude +#include "pair_gran_hertzian.h" +#include "pair_gran_history.h" +#include "pair_gran_no_history.h" +#endif + +#ifdef PairClass +PairStyle(gran/hertzian,PairGranHertzian) +PairStyle(gran/history,PairGranHistory) +PairStyle(gran/no_history,PairGranNoHistory) +#endif diff --git a/src/style_kspace.h b/src/style_kspace.h index e69de29bb2..52cae87bdb 100644 --- a/src/style_kspace.h +++ b/src/style_kspace.h @@ -0,0 +1,38 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef KSpaceInclude +#include "ewald.h" +#include "pppm.h" +#include "pppm_tip4p.h" +#endif + +#ifdef KSpaceClass +KSpaceStyle(ewald,Ewald) +KSpaceStyle(pppm,PPPM) +KSpaceStyle(pppm/tip4p,PPPMTIP4P) +#endif + +#ifdef PairInclude +#include "pair_buck_coul_long.h" +#include "pair_lj_cut_coul_long.h" +#include "pair_lj_cut_coul_long_tip4p.h" +#include "pair_lj_charmm_coul_long.h" +#endif + +#ifdef PairClass +PairStyle(buck/coul/long,PairBuckCoulLong) +PairStyle(lj/cut/coul/long,PairLJCutCoulLong) +PairStyle(lj/cut/coul/long/tip4p,PairLJCutCoulLongTIP4P) +PairStyle(lj/charmm/coul/long,PairLJCharmmCoulLong) +#endif diff --git a/src/style_manybody.h b/src/style_manybody.h index e69de29bb2..449895a530 100644 --- a/src/style_manybody.h +++ b/src/style_manybody.h @@ -0,0 +1,28 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PairInclude +#include "pair_eam.h" +#include "pair_eam_alloy.h" +#include "pair_eam_fs.h" +#include "pair_sw.h" +#include "pair_tersoff.h" +#endif + +#ifdef PairClass +PairStyle(eam,PairEAM) +PairStyle(eam/alloy,PairEAMAlloy) +PairStyle(eam/fs,PairEAMFS) +PairStyle(sw,PairSW) +PairStyle(tersoff,PairTersoff) +#endif diff --git a/src/style_molecule.h b/src/style_molecule.h index e69de29bb2..6e424035a9 100644 --- a/src/style_molecule.h +++ b/src/style_molecule.h @@ -0,0 +1,116 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef AngleInclude +#include "angle_charmm.h" +#include "angle_cosine.h" +#include "angle_cosine_squared.h" +#include "angle_harmonic.h" +#include "angle_hybrid.h" +#endif + +#ifdef AngleClass +AngleStyle(charmm,AngleCharmm) +AngleStyle(cosine,AngleCosine) +AngleStyle(cosine/squared,AngleCosineSquared) +AngleStyle(harmonic,AngleHarmonic) +AngleStyle(hybrid,AngleHybrid) +#endif + +#ifdef AtomInclude +#include "atom_vec_angle.h" +#include "atom_vec_bond.h" +#include "atom_vec_full.h" +#include "atom_vec_molecular.h" +#endif + +#ifdef AtomClass +AtomStyle(angle,AtomVecAngle) +AtomStyle(bond,AtomVecBond) +AtomStyle(full,AtomVecFull) +AtomStyle(molecular,AtomVecMolecular) +#endif + +#ifdef BondInclude +#include "bond_fene.h" +#include "bond_fene_expand.h" +#include "bond_harmonic.h" +#include "bond_hybrid.h" +#include "bond_morse.h" +#include "bond_nonlinear.h" +#include "bond_quartic.h" +#endif + +#ifdef BondClass +BondStyle(fene,BondFENE) +BondStyle(fene/expand,BondFENEExpand) +BondStyle(harmonic,BondHarmonic) +BondStyle(hybrid,BondHybrid) +BondStyle(morse,BondMorse) +BondStyle(nonlinear,BondNonlinear) +BondStyle(quartic,BondQuartic) +#endif + +#ifdef DihedralInclude +#include "dihedral_charmm.h" +#include "dihedral_harmonic.h" +#include "dihedral_helix.h" +#include "dihedral_hybrid.h" +#include "dihedral_multi_harmonic.h" +#include "dihedral_opls.h" +#endif + +#ifdef DihedralClass +DihedralStyle(charmm,DihedralCharmm) +DihedralStyle(harmonic,DihedralHarmonic) +DihedralStyle(helix,DihedralHelix) +DihedralStyle(hybrid,DihedralHybrid) +DihedralStyle(multi/harmonic,DihedralMultiHarmonic) +DihedralStyle(opls,DihedralOPLS) +#endif + +#ifdef DumpInclude +#include "dump_bond.h" +#endif + +#ifdef DumpClass +DumpStyle(bond,DumpBond) +#endif + +#ifdef FixInclude +#endif + +#ifdef FixClass +#endif + +#ifdef ImproperInclude +#include "improper_cvff.h" +#include "improper_harmonic.h" +#include "improper_hybrid.h" +#endif + +#ifdef ImproperClass +ImproperStyle(cvff,ImproperCvff) +ImproperStyle(harmonic,ImproperHarmonic) +ImproperStyle(hybrid,ImproperHybrid) +#endif + +#ifdef PairInclude +#include "pair_lj_charmm_coul_charmm.h" +#include "pair_lj_charmm_coul_charmm_implicit.h" +#endif + +#ifdef PairClass +PairStyle(lj/charmm/coul/charmm,PairLJCharmmCoulCharmm) +PairStyle(lj/charmm/coul/charmm/implicit,PairLJCharmmCoulCharmmImplicit) +#endif diff --git a/src/style_opt.h b/src/style_opt.h index e69de29bb2..061816e136 100644 --- a/src/style_opt.h +++ b/src/style_opt.h @@ -0,0 +1,30 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PairInclude +#include "pair_eam_opt.h" +#include "pair_eam_alloy_opt.h" +#include "pair_eam_fs_opt.h" +#include "pair_lj_charmm_coul_long_opt.h" +#include "pair_lj_cut_opt.h" +#include "pair_morse_opt.h" +#endif + +#ifdef PairClass +PairStyle(eam/opt,PairEAMOpt) +PairStyle(eam/alloy/opt,PairEAMAlloyOpt) +PairStyle(eam/fs/opt,PairEAMFSOpt) +PairStyle(lj/cut/opt,PairLJCutOpt) +PairStyle(lj/charmm/coul/long/opt,PairLJCharmmCoulLongOpt) +PairStyle(morse/opt,PairMorseOpt) +#endif diff --git a/src/style_xtc.h b/src/style_xtc.h index e69de29bb2..7110dda312 100644 --- a/src/style_xtc.h +++ b/src/style_xtc.h @@ -0,0 +1,20 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef DumpInclude +#include "dump_xtc.h" +#endif + +#ifdef DumpClass +DumpStyle(xtc,DumpXTC) +#endif