forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10032 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
af5a33fd16
commit
b1e4e5593b
31
src/USER-MISC/pair_dipole_sf.cpp → src/USER-MISC/pair_lj_sf_dipole_sf.cpp
Normal file → Executable file
31
src/USER-MISC/pair_dipole_sf.cpp → src/USER-MISC/pair_lj_sf_dipole_sf.cpp
Normal file → Executable file
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include "pair_dipole_sf.h"
|
#include "pair_lj_sf_dipole_sf.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "neighbor.h"
|
#include "neighbor.h"
|
||||||
#include "neigh_list.h"
|
#include "neigh_list.h"
|
||||||
|
@ -25,19 +25,21 @@
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "update.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
PairDipoleSF::PairDipoleSF(LAMMPS *lmp) : Pair(lmp)
|
PairLJSFDipoleSF::PairLJSFDipoleSF(LAMMPS *lmp) : Pair(lmp)
|
||||||
{
|
{
|
||||||
single_enable = 0;
|
single_enable = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
PairDipoleSF::~PairDipoleSF()
|
PairLJSFDipoleSF::~PairLJSFDipoleSF()
|
||||||
{
|
{
|
||||||
if (allocated) {
|
if (allocated) {
|
||||||
memory->destroy(setflag);
|
memory->destroy(setflag);
|
||||||
|
@ -58,7 +60,7 @@ PairDipoleSF::~PairDipoleSF()
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairDipoleSF::compute(int eflag, int vflag)
|
void PairLJSFDipoleSF::compute(int eflag, int vflag)
|
||||||
{
|
{
|
||||||
int i,j,ii,jj,inum,jnum,itype,jtype;
|
int i,j,ii,jj,inum,jnum,itype,jtype;
|
||||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fx,fy,fz;
|
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fx,fy,fz;
|
||||||
|
@ -293,7 +295,7 @@ void PairDipoleSF::compute(int eflag, int vflag)
|
||||||
allocate all arrays
|
allocate all arrays
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairDipoleSF::allocate()
|
void PairLJSFDipoleSF::allocate()
|
||||||
{
|
{
|
||||||
allocated = 1;
|
allocated = 1;
|
||||||
int n = atom->ntypes;
|
int n = atom->ntypes;
|
||||||
|
@ -321,11 +323,14 @@ void PairDipoleSF::allocate()
|
||||||
global settings
|
global settings
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairDipoleSF::settings(int narg, char **arg)
|
void PairLJSFDipoleSF::settings(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 1 || narg > 2)
|
if (narg < 1 || narg > 2)
|
||||||
error->all(FLERR,"Incorrect args in pair_style command");
|
error->all(FLERR,"Incorrect args in pair_style command");
|
||||||
|
|
||||||
|
if (strcmp(update->unit_style,"electron") == 0)
|
||||||
|
error->all(FLERR,"Cannot (yet) use 'electron' units with dipoles");
|
||||||
|
|
||||||
cut_lj_global = force->numeric(arg[0]);
|
cut_lj_global = force->numeric(arg[0]);
|
||||||
if (narg == 1) cut_coul_global = cut_lj_global;
|
if (narg == 1) cut_coul_global = cut_lj_global;
|
||||||
else cut_coul_global = force->numeric(arg[1]);
|
else cut_coul_global = force->numeric(arg[1]);
|
||||||
|
@ -347,7 +352,7 @@ void PairDipoleSF::settings(int narg, char **arg)
|
||||||
set coeffs for one or more type pairs
|
set coeffs for one or more type pairs
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairDipoleSF::coeff(int narg, char **arg)
|
void PairLJSFDipoleSF::coeff(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 4 || narg > 6)
|
if (narg < 4 || narg > 6)
|
||||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||||
|
@ -384,7 +389,7 @@ void PairDipoleSF::coeff(int narg, char **arg)
|
||||||
init specific to this pair style
|
init specific to this pair style
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairDipoleSF::init_style()
|
void PairLJSFDipoleSF::init_style()
|
||||||
{
|
{
|
||||||
if (!atom->q_flag || !atom->mu_flag || !atom->torque_flag)
|
if (!atom->q_flag || !atom->mu_flag || !atom->torque_flag)
|
||||||
error->all(FLERR,"Pair dipole/sf requires atom attributes q, mu, torque");
|
error->all(FLERR,"Pair dipole/sf requires atom attributes q, mu, torque");
|
||||||
|
@ -396,7 +401,7 @@ void PairDipoleSF::init_style()
|
||||||
init for one type pair i,j and corresponding j,i
|
init for one type pair i,j and corresponding j,i
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double PairDipoleSF::init_one(int i, int j)
|
double PairLJSFDipoleSF::init_one(int i, int j)
|
||||||
{
|
{
|
||||||
if (setflag[i][j] == 0) {
|
if (setflag[i][j] == 0) {
|
||||||
epsilon[i][j] = mix_energy(epsilon[i][i],epsilon[j][j],
|
epsilon[i][j] = mix_energy(epsilon[i][i],epsilon[j][j],
|
||||||
|
@ -429,7 +434,7 @@ double PairDipoleSF::init_one(int i, int j)
|
||||||
proc 0 writes to restart file
|
proc 0 writes to restart file
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairDipoleSF::write_restart(FILE *fp)
|
void PairLJSFDipoleSF::write_restart(FILE *fp)
|
||||||
{
|
{
|
||||||
write_restart_settings(fp);
|
write_restart_settings(fp);
|
||||||
|
|
||||||
|
@ -450,7 +455,7 @@ void PairDipoleSF::write_restart(FILE *fp)
|
||||||
proc 0 reads from restart file, bcasts
|
proc 0 reads from restart file, bcasts
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairDipoleSF::read_restart(FILE *fp)
|
void PairLJSFDipoleSF::read_restart(FILE *fp)
|
||||||
{
|
{
|
||||||
read_restart_settings(fp);
|
read_restart_settings(fp);
|
||||||
|
|
||||||
|
@ -481,7 +486,7 @@ void PairDipoleSF::read_restart(FILE *fp)
|
||||||
proc 0 writes to restart file
|
proc 0 writes to restart file
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairDipoleSF::write_restart_settings(FILE *fp)
|
void PairLJSFDipoleSF::write_restart_settings(FILE *fp)
|
||||||
{
|
{
|
||||||
fwrite(&cut_lj_global,sizeof(double),1,fp);
|
fwrite(&cut_lj_global,sizeof(double),1,fp);
|
||||||
fwrite(&cut_coul_global,sizeof(double),1,fp);
|
fwrite(&cut_coul_global,sizeof(double),1,fp);
|
||||||
|
@ -492,7 +497,7 @@ void PairDipoleSF::write_restart_settings(FILE *fp)
|
||||||
proc 0 reads from restart file, bcasts
|
proc 0 reads from restart file, bcasts
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairDipoleSF::read_restart_settings(FILE *fp)
|
void PairLJSFDipoleSF::read_restart_settings(FILE *fp)
|
||||||
{
|
{
|
||||||
if (comm->me == 0) {
|
if (comm->me == 0) {
|
||||||
fread(&cut_lj_global,sizeof(double),1,fp);
|
fread(&cut_lj_global,sizeof(double),1,fp);
|
108
src/USER-MISC/pair_dipole_sf.h → src/USER-MISC/pair_lj_sf_dipole_sf.h
Normal file → Executable file
108
src/USER-MISC/pair_dipole_sf.h → src/USER-MISC/pair_lj_sf_dipole_sf.h
Normal file → Executable file
|
@ -1,54 +1,54 @@
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
certain rights in this software. This software is distributed under
|
certain rights in this software. This software is distributed under
|
||||||
the GNU General Public License.
|
the GNU General Public License.
|
||||||
|
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef PAIR_CLASS
|
#ifdef PAIR_CLASS
|
||||||
|
|
||||||
PairStyle(dipole/sf,PairDipoleSF)
|
PairStyle(lj/sf/dipole/sf,PairLJSFDipoleSF)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef LMP_PAIR_DIPOLE_SF_H
|
#ifndef LMP_PAIR_LJ_SF_DIPOLE_SF_H
|
||||||
#define LMP_PAIR_DIPOLE_SF_H
|
#define LMP_PAIR_LJ_SF_DIPOLE_SF_H
|
||||||
|
|
||||||
#include "pair.h"
|
#include "pair.h"
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
class PairDipoleSF : public Pair {
|
class PairLJSFDipoleSF : public Pair {
|
||||||
public:
|
public:
|
||||||
PairDipoleSF(class LAMMPS *);
|
PairLJSFDipoleSF(class LAMMPS *);
|
||||||
virtual ~PairDipoleSF();
|
virtual ~PairLJSFDipoleSF();
|
||||||
virtual void compute(int, int);
|
virtual void compute(int, int);
|
||||||
void settings(int, char **);
|
void settings(int, char **);
|
||||||
void coeff(int, char **);
|
void coeff(int, char **);
|
||||||
void init_style();
|
void init_style();
|
||||||
double init_one(int, int);
|
double init_one(int, int);
|
||||||
void write_restart(FILE *);
|
void write_restart(FILE *);
|
||||||
void read_restart(FILE *);
|
void read_restart(FILE *);
|
||||||
void write_restart_settings(FILE *);
|
void write_restart_settings(FILE *);
|
||||||
void read_restart_settings(FILE *);
|
void read_restart_settings(FILE *);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double cut_lj_global,cut_coul_global;
|
double cut_lj_global,cut_coul_global;
|
||||||
double **cut_lj,**cut_ljsq;
|
double **cut_lj,**cut_ljsq;
|
||||||
double **cut_coul,**cut_coulsq;
|
double **cut_coul,**cut_coulsq;
|
||||||
double **epsilon,**sigma;
|
double **epsilon,**sigma;
|
||||||
double **lj1,**lj2,**lj3,**lj4;
|
double **lj1,**lj2,**lj3,**lj4;
|
||||||
|
|
||||||
void allocate();
|
void allocate();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue