Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F87692448
fix_plane_force.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Oct 14, 07:20
Size
2 KB
Mime Type
text/x-c
Expires
Wed, Oct 16, 07:20 (2 d)
Engine
blob
Format
Raw Data
Handle
21457289
Attached To
rLAMMPS lammps
fix_plane_force.cpp
View Options
/* ----------------------------------------------------------------------
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.
------------------------------------------------------------------------- */
#include "string.h"
#include "stdlib.h"
#include "fix_plane_force.h"
#include "atom.h"
#include "update.h"
#include "respa.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
FixPlaneForce::FixPlaneForce(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
{
if (narg != 6) error->all("Illegal fix planeforce command");
xdir = atof(arg[3]);
ydir = atof(arg[4]);
zdir = atof(arg[5]);
}
/* ---------------------------------------------------------------------- */
int FixPlaneForce::setmask()
{
int mask = 0;
mask |= POST_FORCE;
mask |= POST_FORCE_RESPA;
mask |= MIN_POST_FORCE;
return mask;
}
/* ---------------------------------------------------------------------- */
void FixPlaneForce::setup(int vflag)
{
if (strcmp(update->integrate_style,"verlet") == 0)
post_force(vflag);
else {
int nlevels_respa = ((Respa *) update->integrate)->nlevels;
for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) {
((Respa *) update->integrate)->copy_flevel_f(ilevel);
post_force_respa(vflag,ilevel,0);
((Respa *) update->integrate)->copy_f_flevel(ilevel);
}
}
}
/* ---------------------------------------------------------------------- */
void FixPlaneForce::min_setup(int vflag)
{
post_force(vflag);
}
/* ---------------------------------------------------------------------- */
void FixPlaneForce::post_force(int vflag)
{
double **f = atom->f;
int *mask = atom->mask;
int nlocal = atom->nlocal;
double dot;
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
dot = f[i][0]*xdir + f[i][1]*ydir + f[i][2]*zdir;
f[i][0] -= dot * xdir;
f[i][1] -= dot * ydir;
f[i][2] -= dot * zdir;
}
}
/* ---------------------------------------------------------------------- */
void FixPlaneForce::post_force_respa(int vflag, int ilevel, int iloop)
{
post_force(vflag);
}
/* ---------------------------------------------------------------------- */
void FixPlaneForce::min_post_force(int vflag)
{
post_force(vflag);
}
Event Timeline
Log In to Comment