git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10985 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -45,8 +45,8 @@ FixTIRS::FixTIRS(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
|||||||
extvector = 1;
|
extvector = 1;
|
||||||
|
|
||||||
// Time variables.
|
// Time variables.
|
||||||
t_switch = atof(arg[5]);
|
t_switch = atoi(arg[5]);
|
||||||
t_equil = atof(arg[6]);
|
t_equil = atoi(arg[6]);
|
||||||
t0 = update->ntimestep;
|
t0 = update->ntimestep;
|
||||||
if (t_switch < 0.0) error->all(FLERR,"Illegal fix ti/rs command");
|
if (t_switch < 0.0) error->all(FLERR,"Illegal fix ti/rs command");
|
||||||
if (t_equil < 0.0) error->all(FLERR,"Illegal fix ti/rs command");
|
if (t_equil < 0.0) error->all(FLERR,"Illegal fix ti/rs command");
|
||||||
|
|||||||
@ -11,6 +11,12 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing authors:
|
||||||
|
Rodrigo Freitas (Unicamp/Brazil) - rodrigohb@gmail.com
|
||||||
|
Maurice de Koning (Unicamp/Brazil) - dekoning@ifi.unicamp.br
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
|
||||||
FixStyle(ti/rs,FixTIRS)
|
FixStyle(ti/rs,FixTIRS)
|
||||||
|
|||||||
@ -26,20 +26,23 @@
|
|||||||
#include "respa.h"
|
#include "respa.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) {
|
FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
Fix(lmp, narg, arg)
|
||||||
|
{
|
||||||
if (narg < 6 || narg > 8)
|
if (narg < 6 || narg > 8)
|
||||||
error->all(FLERR,"Illegal fix ti/spring command");
|
error->all(FLERR,"Illegal fix ti/spring command");
|
||||||
|
|
||||||
// Flags.
|
// Flags.
|
||||||
restart_peratom = 1;
|
restart_peratom = 1;
|
||||||
scalar_flag = 1;
|
scalar_flag = 1;
|
||||||
|
global_freq = 1;
|
||||||
vector_flag = 1;
|
vector_flag = 1;
|
||||||
size_vector = 2;
|
size_vector = 2;
|
||||||
global_freq = 1;
|
global_freq = 1;
|
||||||
@ -47,29 +50,31 @@ FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg
|
|||||||
extvector = 1;
|
extvector = 1;
|
||||||
|
|
||||||
// Spring constant.
|
// Spring constant.
|
||||||
k = atof(arg[3]);
|
k = force->numeric(FLERR,arg[3]);
|
||||||
espring = 0.0;
|
|
||||||
if (k <= 0.0) error->all(FLERR,"Illegal fix ti/spring command");
|
if (k <= 0.0) error->all(FLERR,"Illegal fix ti/spring command");
|
||||||
|
|
||||||
// Initial position.
|
// Perform initial allocation of atom-based array.
|
||||||
|
// Registar with Atom class.
|
||||||
xoriginal = NULL;
|
xoriginal = NULL;
|
||||||
grow_arrays(atom->nmax);
|
grow_arrays(atom->nmax);
|
||||||
atom->add_callback(0);
|
atom->add_callback(0);
|
||||||
atom->add_callback(1);
|
atom->add_callback(1);
|
||||||
|
|
||||||
|
// xoriginal = initial unwrapped positions of atom.
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
tagint *image = atom->image;
|
tagint *image = atom->image;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
if (mask[i] & groupbit) domain->unmap(x[i], image[i], xoriginal[i]);
|
if (mask[i] & groupbit) domain->unmap(x[i],image[i],xoriginal[i]);
|
||||||
else xoriginal[i][0] = xoriginal[i][1] = xoriginal[i][2] = 0.0;
|
else xoriginal[i][0] = xoriginal[i][1] = xoriginal[i][2] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time variables.
|
// Time variables.
|
||||||
t_switch = atof(arg[4]); // Switching time.
|
t_switch = atoi(arg[4]); // Switching time.
|
||||||
t_equil = atof(arg[5]); // Equilibration time.
|
t_equil = atoi(arg[5]); // Equilibration time.
|
||||||
t0 = update->ntimestep; // Initial time.
|
t0 = update->ntimestep; // Initial time.
|
||||||
if (t_switch < 0.0) error->all(FLERR,"Illegal fix ti/spring command");
|
if (t_switch < 0.0) error->all(FLERR,"Illegal fix ti/spring command");
|
||||||
if (t_equil < 0.0) error->all(FLERR,"Illegal fix ti/spring command");
|
if (t_equil < 0.0) error->all(FLERR,"Illegal fix ti/spring command");
|
||||||
@ -84,6 +89,8 @@ FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg
|
|||||||
}
|
}
|
||||||
lambda = switch_func(0);
|
lambda = switch_func(0);
|
||||||
dlambda = dswitch_func(0);
|
dlambda = dswitch_func(0);
|
||||||
|
|
||||||
|
espring = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -143,10 +150,8 @@ void FixTISpring::min_setup(int vflag)
|
|||||||
|
|
||||||
void FixTISpring::post_force(int vflag)
|
void FixTISpring::post_force(int vflag)
|
||||||
{
|
{
|
||||||
|
|
||||||
// If on the first equilibration do not calculate forces.
|
// If on the first equilibration do not calculate forces.
|
||||||
int t = update->ntimestep - t0;
|
int t = update->ntimestep - t0;
|
||||||
espring = 0.0;
|
|
||||||
if(t < t_equil) return;
|
if(t < t_equil) return;
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
@ -158,9 +163,11 @@ void FixTISpring::post_force(int vflag)
|
|||||||
double dx, dy, dz;
|
double dx, dy, dz;
|
||||||
double unwrap[3];
|
double unwrap[3];
|
||||||
|
|
||||||
|
espring = 0.0;
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
domain->unmap(x[i], image[i], unwrap);
|
domain->unmap(x[i],image[i],unwrap);
|
||||||
dx = unwrap[0] - xoriginal[i][0];
|
dx = unwrap[0] - xoriginal[i][0];
|
||||||
dy = unwrap[1] - xoriginal[i][1];
|
dy = unwrap[1] - xoriginal[i][1];
|
||||||
dz = unwrap[2] - xoriginal[i][2];
|
dz = unwrap[2] - xoriginal[i][2];
|
||||||
@ -250,7 +257,7 @@ void FixTISpring::grow_arrays(int nmax)
|
|||||||
copy values within local atom-based array
|
copy values within local atom-based array
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixTISpring::copy_arrays(int i, int j)
|
void FixTISpring::copy_arrays(int i, int j, int delflag)
|
||||||
{
|
{
|
||||||
xoriginal[j][0] = xoriginal[i][0];
|
xoriginal[j][0] = xoriginal[i][0];
|
||||||
xoriginal[j][1] = xoriginal[i][1];
|
xoriginal[j][1] = xoriginal[i][1];
|
||||||
@ -294,7 +301,6 @@ int FixTISpring::pack_restart(int i, double *buf)
|
|||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
unpack values from atom->extra array to restart the fix
|
unpack values from atom->extra array to restart the fix
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -11,6 +11,12 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing authors:
|
||||||
|
Rodrigo Freitas (Unicamp/Brazil) - rodrigohb@gmail.com
|
||||||
|
Maurice de Koning (Unicamp/Brazil) - dekoning@ifi.unicamp.br
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
|
||||||
FixStyle(ti/spring,FixTISpring)
|
FixStyle(ti/spring,FixTISpring)
|
||||||
@ -41,7 +47,7 @@ class FixTISpring : public Fix {
|
|||||||
|
|
||||||
double memory_usage();
|
double memory_usage();
|
||||||
void grow_arrays(int);
|
void grow_arrays(int);
|
||||||
void copy_arrays(int, int);
|
void copy_arrays(int, int, int);
|
||||||
int pack_exchange(int, double *);
|
int pack_exchange(int, double *);
|
||||||
int unpack_exchange(int, double *);
|
int unpack_exchange(int, double *);
|
||||||
int pack_restart(int, double *);
|
int pack_restart(int, double *);
|
||||||
|
|||||||
Reference in New Issue
Block a user