git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8706 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
2386
src/fix_rigid.cpp
2386
src/fix_rigid.cpp
File diff suppressed because it is too large
Load Diff
234
src/fix_rigid.h
234
src/fix_rigid.h
@ -1,234 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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 FIX_CLASS
|
||||
|
||||
FixStyle(rigid,FixRigid)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_RIGID_H
|
||||
#define LMP_FIX_RIGID_H
|
||||
|
||||
#include "fix.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixRigid : public Fix {
|
||||
public:
|
||||
// public so that granular pair styles can access them
|
||||
int *body; // which body each atom is part of (-1 if none)
|
||||
double *masstotal; // total mass of each rigid body
|
||||
|
||||
FixRigid(class LAMMPS *, int, char **);
|
||||
virtual ~FixRigid();
|
||||
virtual int setmask();
|
||||
virtual void init();
|
||||
virtual void setup(int);
|
||||
virtual void initial_integrate(int);
|
||||
void post_force(int);
|
||||
virtual void final_integrate();
|
||||
void initial_integrate_respa(int, int, int);
|
||||
void final_integrate_respa(int, int);
|
||||
virtual double compute_scalar();
|
||||
virtual int modify_param(int, char **) {return 0;}
|
||||
|
||||
double memory_usage();
|
||||
void grow_arrays(int);
|
||||
void copy_arrays(int, int);
|
||||
void set_arrays(int);
|
||||
int pack_exchange(int, double *);
|
||||
int unpack_exchange(int, double *);
|
||||
|
||||
void pre_neighbor();
|
||||
int dof(int);
|
||||
void deform(int);
|
||||
void reset_dt();
|
||||
virtual void *extract(const char*,int &);
|
||||
double compute_array(int, int);
|
||||
|
||||
protected:
|
||||
int me,nprocs;
|
||||
double dtv,dtf,dtq;
|
||||
double *step_respa;
|
||||
int triclinic;
|
||||
double MINUSPI,TWOPI;
|
||||
|
||||
int rstyle; // SINGLE,MOLECULE,GROUP
|
||||
int firstflag; // 1 for first-time setup of rigid bodies
|
||||
char *infile; // file to read rigid body attributes from
|
||||
|
||||
int dimension; // # of dimensions
|
||||
int nbody; // # of rigid bodies
|
||||
int *nrigid; // # of atoms in each rigid body
|
||||
int *mol2body; // convert mol-ID to rigid body index
|
||||
int maxmol; // size of mol2body = max mol-ID
|
||||
|
||||
double **xcm; // coords of center-of-mass of each rigid body
|
||||
double **vcm; // velocity of center-of-mass of each
|
||||
double **fcm; // force on center-of-mass of each
|
||||
double **inertia; // 3 principal components of inertia of each
|
||||
double **ex_space,**ey_space,**ez_space;
|
||||
// principal axes of each in space coords
|
||||
double **angmom; // angular momentum of each in space coords
|
||||
double **omega; // angular velocity of each in space coords
|
||||
double **torque; // torque on each rigid body in space coords
|
||||
double **quat; // quaternion of each rigid body
|
||||
tagint *imagebody; // image flags of xcm of each rigid body
|
||||
double **fflag; // flag for on/off of center-of-mass force
|
||||
double **tflag; // flag for on/off of center-of-mass torque
|
||||
double **langextra; // Langevin thermostat forces and torques
|
||||
|
||||
double **displace; // displacement of each atom in body coords
|
||||
|
||||
double **sum,**all; // work vectors for each rigid body
|
||||
int **remapflag; // PBC remap flags for each rigid body
|
||||
|
||||
int extended; // 1 if any particles have extended attributes
|
||||
int orientflag; // 1 if particles store spatial orientation
|
||||
int dorientflag; // 1 if particles store dipole orientation
|
||||
|
||||
int *eflags; // flags for extended particles
|
||||
double **orient; // orientation vector of particle wrt rigid body
|
||||
double **dorient; // orientation of dipole mu wrt rigid body
|
||||
|
||||
double tfactor; // scale factor on temperature of rigid bodies
|
||||
int langflag; // 0/1 = no/yes Langevin thermostat
|
||||
|
||||
int tstat_flag; // NVT settings
|
||||
double t_start,t_stop,t_target;
|
||||
double t_period,t_freq;
|
||||
int t_chain,t_iter,t_order;
|
||||
|
||||
int pstat_flag; // NPT settings
|
||||
double p_start[3],p_stop[3];
|
||||
double p_period[3],p_freq[3];
|
||||
int p_flag[3];
|
||||
int pcouple,pstyle;
|
||||
int p_chain;
|
||||
|
||||
int allremap; // remap all atoms
|
||||
int dilate_group_bit; // mask for dilation group
|
||||
char *id_dilate; // group name to dilate
|
||||
|
||||
class RanMars *random;
|
||||
class AtomVecEllipsoid *avec_ellipsoid;
|
||||
class AtomVecLine *avec_line;
|
||||
class AtomVecTri *avec_tri;
|
||||
|
||||
int POINT,SPHERE,ELLIPSOID,LINE,TRIANGLE,DIPOLE; // bitmasks for eflags
|
||||
int OMEGA,ANGMOM,TORQUE;
|
||||
|
||||
void no_squish_rotate(int, double *, double *, double *, double);
|
||||
void set_xv();
|
||||
void set_v();
|
||||
void setup_bodies();
|
||||
void readfile(int, double *, double **, int *);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Fix rigid molecule requires atom attribute molecule
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Could not find fix rigid group ID
|
||||
|
||||
A group ID used in the fix rigid command does not exist.
|
||||
|
||||
E: One or more atoms belong to multiple rigid bodies
|
||||
|
||||
Two or more rigid bodies defined by the fix rigid command cannot
|
||||
contain the same atom.
|
||||
|
||||
E: No rigid bodies defined
|
||||
|
||||
The fix specification did not end up defining any rigid bodies.
|
||||
|
||||
E: Fix rigid z force cannot be on for 2d simulation
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Fix rigid xy torque cannot be on for 2d simulation
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Fix rigid langevin period must be > 0.0
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: One or zero atoms in rigid body
|
||||
|
||||
Any rigid body defined by the fix rigid command must contain 2 or more
|
||||
atoms.
|
||||
|
||||
W: More than one fix rigid
|
||||
|
||||
It is not efficient to use fix rigid more than once.
|
||||
|
||||
E: Rigid fix must come before NPT/NPH fix
|
||||
|
||||
NPT/NPH fix must be defined in input script after all rigid fixes,
|
||||
else the rigid fix contribution to the pressure virial is
|
||||
incorrect.
|
||||
|
||||
W: Computing temperature of portions of rigid bodies
|
||||
|
||||
The group defined by the temperature compute does not encompass all
|
||||
the atoms in one or more rigid bodies, so the change in
|
||||
degrees-of-freedom for the atoms in those partial rigid bodies will
|
||||
not be accounted for.
|
||||
|
||||
E: Fix rigid atom has non-zero image flag in a non-periodic dimension
|
||||
|
||||
You cannot set image flags for non-periodic dimensions.
|
||||
|
||||
E: Insufficient Jacobi rotations for rigid body
|
||||
|
||||
Eigensolve for rigid body was not sufficiently accurate.
|
||||
|
||||
E: Fix rigid: Bad principal moments
|
||||
|
||||
The principal moments of inertia computed for a rigid body
|
||||
are not within the required tolerances.
|
||||
|
||||
E: Cannot open fix rigid infile %s
|
||||
|
||||
The specified file cannot be opened. Check that the path and name are
|
||||
correct.
|
||||
|
||||
E: Unexpected end of fix rigid file
|
||||
|
||||
A read operation from the file failed.
|
||||
|
||||
E: Incorrect rigid body format in fix rigid file
|
||||
|
||||
The number of fields per line is not what expected.
|
||||
|
||||
E: Invalid rigid body ID in fix rigid file
|
||||
|
||||
The ID does not match the number or an existing ID of rigid bodies
|
||||
that are defined by the fix rigid command.
|
||||
|
||||
*/
|
||||
1436
src/fix_rigid_nh.cpp
1436
src/fix_rigid_nh.cpp
File diff suppressed because it is too large
Load Diff
@ -1,178 +0,0 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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 LMP_FIX_RIGID_NH_H
|
||||
#define LMP_FIX_RIGID_NH_H
|
||||
|
||||
#include "fix_rigid.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixRigidNH : public FixRigid {
|
||||
public:
|
||||
FixRigidNH(class LAMMPS *, int, char **);
|
||||
virtual ~FixRigidNH();
|
||||
virtual int setmask();
|
||||
virtual void init();
|
||||
virtual void setup(int);
|
||||
virtual void initial_integrate(int);
|
||||
virtual void final_integrate();
|
||||
virtual double compute_scalar();
|
||||
int modify_param(int, char **);
|
||||
void write_restart(FILE *);
|
||||
void restart(char *buf);
|
||||
void reset_target(double);
|
||||
|
||||
protected:
|
||||
double **conjqm; // conjugate quaternion momentum
|
||||
double boltz,nktv2p,mvv2e; // boltzman constant, conversion factors
|
||||
|
||||
int nf_t,nf_r; // trans/rot degrees of freedom
|
||||
double onednft,onednfr; // factors 1 + dimension/trans(rot) degrees of freedom
|
||||
double *w,*wdti1,*wdti2,*wdti4; // Yoshida-Suzuki coefficients
|
||||
double *q_t,*q_r; // trans/rot thermostat masses
|
||||
double *eta_t,*eta_r; // trans/rot thermostat positions
|
||||
double *eta_dot_t,*eta_dot_r; // trans/rot thermostat velocities
|
||||
double *f_eta_t,*f_eta_r; // trans/rot thermostat forces
|
||||
|
||||
double epsilon_mass[3], *q_b; // baro/thermo masses
|
||||
double epsilon[3],*eta_b; // baro/thermo positions
|
||||
double epsilon_dot[3],*eta_dot_b; // baro/thermo velocities
|
||||
double *f_eta_b; // thermo forces
|
||||
double akin_t,akin_r; // translational/rotational kinetic energies
|
||||
|
||||
int kspace_flag; // 1 if KSpace invoked, 0 if not
|
||||
int nrigidfix; // number of rigid fixes
|
||||
int *rfix; // indicies of rigid fixes
|
||||
|
||||
double vol0; // reference volume
|
||||
double t0; // reference temperature
|
||||
int pdim,g_f; // number of barostatted dims, total DoFs
|
||||
double p_hydro; // hydrostatic target pressure
|
||||
double p_freq_max; // maximum barostat frequency
|
||||
|
||||
double mtk_term1,mtk_term2; // Martyna-Tobias-Klein corrections
|
||||
|
||||
double t_current,t_target;
|
||||
double p_current[3],p_target[3];
|
||||
|
||||
char *id_temp,*id_press;
|
||||
class Compute *temperature,*pressure;
|
||||
int tcomputeflag,pcomputeflag;
|
||||
|
||||
void couple();
|
||||
void remap();
|
||||
void nhc_temp_integrate();
|
||||
void nhc_press_integrate();
|
||||
|
||||
virtual void compute_temp_target();
|
||||
void compute_press_target();
|
||||
void nh_epsilon_dot();
|
||||
|
||||
void allocate_chain();
|
||||
void allocate_order();
|
||||
void deallocate_chain();
|
||||
void deallocate_order();
|
||||
|
||||
inline double maclaurin_series(double);
|
||||
};
|
||||
|
||||
inline double FixRigidNH::maclaurin_series(double x)
|
||||
{
|
||||
double x2,x4;
|
||||
x2 = x * x;
|
||||
x4 = x2 * x2;
|
||||
return (1.0 + (1.0/6.0) * x2 + (1.0/120.0) * x4 + (1.0/5040.0) * x2 * x4 +
|
||||
(1.0/362880.0) * x4 * x4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Target temperature for fix rigid nvt/npt cannot be 0.0
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Invalid fix rigid npt/nph command for a 2d simulation
|
||||
|
||||
Cannot control z dimension in a 2d model.
|
||||
|
||||
E: Fix rigid npt/nph dilate group ID does not exist
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Invalid fix rigid npt/nph command pressure settings
|
||||
|
||||
If multiple dimensions are coupled, those dimensions must be
|
||||
specified.
|
||||
|
||||
E: Cannot use fix rigid npt/nph on a non-periodic dimension
|
||||
|
||||
When specifying a diagonal pressure component, the dimension must be
|
||||
periodic.
|
||||
|
||||
E: Invalid fix rigid npt/nph pressure settings
|
||||
|
||||
Settings for coupled dimensions must be the same.
|
||||
|
||||
E: Fix rigid nvt/npt/nph damping parameters must be > 0.0
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Cannot use fix rigid npt/nph and fix deform on same component of stress tensor
|
||||
|
||||
This would be changing the same box dimension twice.
|
||||
|
||||
E: Temperature ID for fix rigid npt/nph does not exist
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Pressure ID for fix rigid npt/nph does not exist
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Could not find fix_modify temperature ID
|
||||
|
||||
The compute ID for computing temperature does not exist.
|
||||
|
||||
E: Fix_modify temperature ID does not compute temperature
|
||||
|
||||
The compute ID assigned to the fix must compute temperature.
|
||||
|
||||
W: Temperature for fix modify is not for group all
|
||||
|
||||
The temperature compute is being used with a pressure calculation
|
||||
which does operate on group all, so this may be inconsistent.
|
||||
|
||||
E: Pressure ID for fix modify does not exist
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Could not find fix_modify pressure ID
|
||||
|
||||
The compute ID for computing pressure does not exist.
|
||||
|
||||
E: Fix_modify pressure ID does not compute pressure
|
||||
|
||||
The compute ID assigned to the fix must compute pressure.
|
||||
|
||||
*/
|
||||
@ -1,92 +0,0 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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: Tony Sheh (U Michigan), Trung Dac Nguyen (U Michigan)
|
||||
references: Kamberaj et al., J. Chem. Phys. 122, 224114 (2005)
|
||||
Miller et al., J Chem Phys. 116, 8649-8659 (2002)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "string.h"
|
||||
#include "fix_rigid_nph.h"
|
||||
#include "domain.h"
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixRigidNPH::FixRigidNPH(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixRigidNH(lmp, narg, arg)
|
||||
{
|
||||
// other setting are made by parent
|
||||
|
||||
scalar_flag = 1;
|
||||
restart_global = 1;
|
||||
box_change = 1;
|
||||
extscalar = 1;
|
||||
|
||||
// error checks
|
||||
|
||||
if (pstat_flag == 0)
|
||||
error->all(FLERR,"Pressure control must be used with fix nph");
|
||||
if (tstat_flag == 1)
|
||||
error->all(FLERR,"Temperature control must not be used with fix nph");
|
||||
if (p_start[0] < 0.0 || p_start[1] < 0.0 || p_start[2] < 0.0 ||
|
||||
p_stop[0] < 0.0 || p_stop[1] < 0.0 || p_stop[2] < 0.0)
|
||||
error->all(FLERR,"Target pressure for fix rigid/nph cannot be 0.0");
|
||||
|
||||
// convert input periods to frequency
|
||||
p_freq[0] = p_freq[1] = p_freq[2] = 0.0;
|
||||
|
||||
if (p_flag[0]) p_freq[0] = 1.0 / p_period[0];
|
||||
if (p_flag[1]) p_freq[1] = 1.0 / p_period[1];
|
||||
if (p_flag[2]) p_freq[2] = 1.0 / p_period[2];
|
||||
|
||||
// create a new compute temp style
|
||||
// id = fix-ID + temp
|
||||
// compute group = all since pressure is always global (group all)
|
||||
// and thus its KE/temperature contribution should use group all
|
||||
|
||||
int n = strlen(id) + 6;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "temp";
|
||||
modify->add_compute(3,newarg);
|
||||
delete [] newarg;
|
||||
tcomputeflag = 1;
|
||||
|
||||
// create a new compute pressure style
|
||||
// id = fix-ID + press, compute group = all
|
||||
// pass id_temp as 4th arg to pressure constructor
|
||||
|
||||
n = strlen(id) + 7;
|
||||
id_press = new char[n];
|
||||
strcpy(id_press,id);
|
||||
strcat(id_press,"_press");
|
||||
|
||||
newarg = new char*[4];
|
||||
newarg[0] = id_press;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "pressure";
|
||||
newarg[3] = id_temp;
|
||||
modify->add_compute(4,newarg);
|
||||
delete [] newarg;
|
||||
pcomputeflag = 1;
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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 FIX_CLASS
|
||||
|
||||
FixStyle(rigid/nph,FixRigidNPH)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_RIGID_NPH_H
|
||||
#define LMP_FIX_RIGID_NPH_H
|
||||
|
||||
#include "fix_rigid_nh.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixRigidNPH : public FixRigidNH {
|
||||
public:
|
||||
FixRigidNPH(class LAMMPS *, int, char **);
|
||||
~FixRigidNPH() {}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -1,104 +0,0 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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: Tony Sheh (U Michigan), Trung Dac Nguyen (U Michigan)
|
||||
references: Kamberaj et al., J. Chem. Phys. 122, 224114 (2005)
|
||||
Miller et al., J Chem Phys. 116, 8649-8659 (2002)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "string.h"
|
||||
#include "fix_rigid_npt.h"
|
||||
#include "domain.h"
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixRigidNPT::FixRigidNPT(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixRigidNH(lmp, narg, arg)
|
||||
{
|
||||
// other setting are made by parent
|
||||
|
||||
scalar_flag = 1;
|
||||
restart_global = 1;
|
||||
box_change = 1;
|
||||
extscalar = 1;
|
||||
|
||||
// error checks
|
||||
|
||||
if (tstat_flag == 0 || pstat_flag == 0)
|
||||
error->all(FLERR,"Did not set temp or press for fix rigid/npt");
|
||||
if (t_start <= 0.0 || t_stop <= 0.0)
|
||||
error->all(FLERR,"Target temperature for fix rigid/npt cannot be 0.0");
|
||||
if (p_start[0] < 0.0 || p_start[1] < 0.0 || p_start[2] < 0.0 ||
|
||||
p_stop[0] < 0.0 || p_stop[1] < 0.0 || p_stop[2] < 0.0)
|
||||
error->all(FLERR,"Target pressure for fix rigid/npt cannot be 0.0");
|
||||
|
||||
if (t_period <= 0.0) error->all(FLERR,"Fix rigid/npt period must be > 0.0");
|
||||
|
||||
// thermostat chain parameters
|
||||
|
||||
if (t_chain < 1) error->all(FLERR,"Illegal fix_modify command");
|
||||
if (t_iter < 1) error->all(FLERR,"Illegal fix_modify command");
|
||||
if (t_order != 3 && t_order != 5)
|
||||
error->all(FLERR,"Fix_modify order must be 3 or 5");
|
||||
|
||||
// convert input periods to frequency
|
||||
|
||||
t_freq = 0.0;
|
||||
p_freq[0] = p_freq[1] = p_freq[2] = 0.0;
|
||||
|
||||
t_freq = 1.0 / t_period;
|
||||
if (p_flag[0]) p_freq[0] = 1.0 / p_period[0];
|
||||
if (p_flag[1]) p_freq[1] = 1.0 / p_period[1];
|
||||
if (p_flag[2]) p_freq[2] = 1.0 / p_period[2];
|
||||
|
||||
// create a new compute temp style
|
||||
// id = fix-ID + temp
|
||||
// compute group = all since pressure is always global (group all)
|
||||
// and thus its KE/temperature contribution should use group all
|
||||
|
||||
int n = strlen(id) + 6;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "temp";
|
||||
modify->add_compute(3,newarg);
|
||||
delete [] newarg;
|
||||
tcomputeflag = 1;
|
||||
|
||||
// create a new compute pressure style
|
||||
// id = fix-ID + press, compute group = all
|
||||
// pass id_temp as 4th arg to pressure constructor
|
||||
|
||||
n = strlen(id) + 7;
|
||||
id_press = new char[n];
|
||||
strcpy(id_press,id);
|
||||
strcat(id_press,"_press");
|
||||
|
||||
newarg = new char*[4];
|
||||
newarg[0] = id_press;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "pressure";
|
||||
newarg[3] = id_temp;
|
||||
modify->add_compute(4,newarg);
|
||||
delete [] newarg;
|
||||
pcomputeflag = 1;
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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 FIX_CLASS
|
||||
|
||||
FixStyle(rigid/npt,FixRigidNPT)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_RIGID_NPT_H
|
||||
#define LMP_FIX_RIGID_NPT_H
|
||||
|
||||
#include "fix_rigid_nh.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixRigidNPT : public FixRigidNH {
|
||||
public:
|
||||
FixRigidNPT(class LAMMPS *, int, char **);
|
||||
~FixRigidNPT() {}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -1,28 +0,0 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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: Tony Sheh (U Michigan), Trung Dac Nguyen (U Michigan)
|
||||
references: Kamberaj et al., J. Chem. Phys. 122, 224114 (2005)
|
||||
Miller et al., J Chem Phys. 116, 8649-8659 (2002)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_rigid_nve.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixRigidNVE::FixRigidNVE(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixRigidNH(lmp, narg, arg) {}
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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 FIX_CLASS
|
||||
|
||||
FixStyle(rigid/nve,FixRigidNVE)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_RIGID_NVE_H
|
||||
#define LMP_FIX_RIGID_NVE_H
|
||||
|
||||
#include "fix_rigid_nh.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixRigidNVE : public FixRigidNH {
|
||||
public:
|
||||
FixRigidNVE(class LAMMPS *, int, char **);
|
||||
~FixRigidNVE() {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -1,50 +0,0 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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: Tony Sheh (U Michigan), Trung Dac Nguyen (U Michigan)
|
||||
references: Kamberaj et al., J. Chem. Phys. 122, 224114 (2005)
|
||||
Miller et al., J Chem Phys. 116, 8649-8659 (2002)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_rigid_nvt.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixRigidNVT::FixRigidNVT(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixRigidNH(lmp, narg, arg)
|
||||
{
|
||||
// other settings are made by parent
|
||||
|
||||
scalar_flag = 1;
|
||||
restart_global = 1;
|
||||
extscalar = 1;
|
||||
|
||||
// error checking
|
||||
// convert input period to frequency
|
||||
|
||||
if (tstat_flag == 0)
|
||||
error->all(FLERR,"Did not set temp for fix rigid/nvt");
|
||||
if (t_start < 0.0 || t_stop <= 0.0)
|
||||
error->all(FLERR,"Target temperature for fix rigid/nvt cannot be 0.0");
|
||||
if (t_period <= 0.0) error->all(FLERR,"Fix rigid/nvt period must be > 0.0");
|
||||
t_freq = 1.0 / t_period;
|
||||
|
||||
if (t_chain < 1) error->all(FLERR,"Illegal fix_modify command");
|
||||
if (t_iter < 1) error->all(FLERR,"Illegal fix_modify command");
|
||||
if (t_order != 3 && t_order != 5)
|
||||
error->all(FLERR,"Fix_modify order must be 3 or 5");
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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 FIX_CLASS
|
||||
|
||||
FixStyle(rigid/nvt,FixRigidNVT)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_RIGID_NVT_H
|
||||
#define LMP_FIX_RIGID_NVT_H
|
||||
|
||||
#include "fix_rigid_nh.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixRigidNVT : public FixRigidNH {
|
||||
public:
|
||||
FixRigidNVT(class LAMMPS *, int, char **);
|
||||
~FixRigidNVT() {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user