git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10721 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
75
src/RIGID/compute_erotate_rigid.cpp
Normal file
75
src/RIGID/compute_erotate_rigid.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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 "mpi.h"
|
||||
#include "string.h"
|
||||
#include "compute_erotate_rigid.h"
|
||||
#include "update.h"
|
||||
#include "modify.h"
|
||||
#include "fix.h"
|
||||
#include "fix_rigid.h"
|
||||
#include "fix_rigid_small.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeERotateRigid::ComputeERotateRigid(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg)
|
||||
{
|
||||
if (narg != 4) error->all(FLERR,"Illegal compute erotate/rigid command");
|
||||
|
||||
scalar_flag = 1;
|
||||
extscalar = 1;
|
||||
|
||||
int n = strlen(arg[3]) + 1;
|
||||
rfix = new char[n];
|
||||
strcpy(rfix,arg[3]);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeERotateRigid::~ComputeERotateRigid()
|
||||
{
|
||||
delete [] rfix;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeERotateRigid::init()
|
||||
{
|
||||
irfix = modify->find_fix(rfix);
|
||||
if (irfix < 0)
|
||||
error->all(FLERR,"Fix ID for compute erotate/rigid does not exist");
|
||||
|
||||
int flag = 1;
|
||||
if (strcmp(modify->fix[irfix]->style,"rigid/small") == 0) flag = 0;
|
||||
else if (strstr(modify->fix[irfix]->style,"rigid")) flag = 0;
|
||||
if (flag) error->all(FLERR,"Compute ke/rigid with non-rigid fix-ID");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double ComputeERotateRigid::compute_scalar()
|
||||
{
|
||||
invoked_scalar = update->ntimestep;
|
||||
|
||||
if (strcmp(modify->fix[irfix]->style,"rigid/small") == 0)
|
||||
scalar = ((FixRigidSmall *) modify->fix[irfix])->extract_erotational();
|
||||
else if (strstr(modify->fix[irfix]->style,"rigid"))
|
||||
scalar = ((FixRigid *) modify->fix[irfix])->extract_erotational();
|
||||
|
||||
return scalar;
|
||||
}
|
||||
56
src/RIGID/compute_erotate_rigid.h
Normal file
56
src/RIGID/compute_erotate_rigid.h
Normal file
@ -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 COMPUTE_CLASS
|
||||
|
||||
ComputeStyle(erotate/rigid,ComputeERotateRigid)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_COMPUTE_EROTATE_RIGID_H
|
||||
#define LMP_COMPUTE_EROTATE_RIGID_H
|
||||
|
||||
#include "compute.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ComputeERotateRigid : public Compute {
|
||||
public:
|
||||
ComputeERotateRigid(class LAMMPS *, int, char **);
|
||||
~ComputeERotateRigid();
|
||||
void init();
|
||||
double compute_scalar();
|
||||
|
||||
private:
|
||||
int irfix;
|
||||
char *rfix;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#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: Compute erotate/sphere requires atom style sphere
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
*/
|
||||
73
src/RIGID/compute_ke_rigid.cpp
Normal file
73
src/RIGID/compute_ke_rigid.cpp
Normal file
@ -0,0 +1,73 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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 "mpi.h"
|
||||
#include "string.h"
|
||||
#include "compute_ke_rigid.h"
|
||||
#include "update.h"
|
||||
#include "modify.h"
|
||||
#include "fix.h"
|
||||
#include "fix_rigid.h"
|
||||
#include "fix_rigid_small.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeKERigid::ComputeKERigid(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg)
|
||||
{
|
||||
if (narg != 4) error->all(FLERR,"Illegal compute ke/rigid command");
|
||||
|
||||
scalar_flag = 1;
|
||||
extscalar = 1;
|
||||
|
||||
int n = strlen(arg[3]) + 1;
|
||||
rfix = new char[n];
|
||||
strcpy(rfix,arg[3]);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeKERigid::~ComputeKERigid()
|
||||
{
|
||||
delete [] rfix;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeKERigid::init()
|
||||
{
|
||||
irfix = modify->find_fix(rfix);
|
||||
if (irfix < 0) error->all(FLERR,"Fix ID for compute ke/rigid does not exist");
|
||||
|
||||
int flag = 1;
|
||||
if (strcmp(modify->fix[irfix]->style,"rigid/small") == 0) flag = 0;
|
||||
else if (strstr(modify->fix[irfix]->style,"rigid")) flag = 0;
|
||||
if (flag) error->all(FLERR,"Compute ke/rigid with non-rigid fix-ID");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double ComputeKERigid::compute_scalar()
|
||||
{
|
||||
invoked_scalar = update->ntimestep;
|
||||
|
||||
if (strcmp(modify->fix[irfix]->style,"rigid/small") == 0)
|
||||
scalar = ((FixRigidSmall *) modify->fix[irfix])->extract_ke();
|
||||
else if (strstr(modify->fix[irfix]->style,"rigid"))
|
||||
scalar = ((FixRigid *) modify->fix[irfix])->extract_ke();
|
||||
|
||||
return scalar;
|
||||
}
|
||||
52
src/RIGID/compute_ke_rigid.h
Normal file
52
src/RIGID/compute_ke_rigid.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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 COMPUTE_CLASS
|
||||
|
||||
ComputeStyle(ke/rigid,ComputeKERigid)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_COMPUTE_KE_RIGID_H
|
||||
#define LMP_COMPUTE_KE_RIGID_H
|
||||
|
||||
#include "compute.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ComputeKERigid : public Compute {
|
||||
public:
|
||||
ComputeKERigid(class LAMMPS *, int, char **);
|
||||
~ComputeKERigid();
|
||||
void init();
|
||||
double compute_scalar();
|
||||
|
||||
private:
|
||||
int irfix;
|
||||
char *rfix;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#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.
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user