git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3502 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2009-12-04 00:48:09 +00:00
parent 1453cc4864
commit 4aa127fd4a
3 changed files with 85 additions and 0 deletions

49
src/compute_gyration.cpp Normal file
View File

@ -0,0 +1,49 @@
/* ----------------------------------------------------------------------
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 "compute_gyration.h"
#include "update.h"
#include "group.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
ComputeGyration::ComputeGyration(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
{
if (narg != 3) error->all("Illegal compute gyration command");
scalar_flag = 1;
extscalar = 0;
}
/* ---------------------------------------------------------------------- */
void ComputeGyration::init()
{
masstotal = group->mass(igroup);
}
/* ---------------------------------------------------------------------- */
double ComputeGyration::compute_scalar()
{
invoked_scalar = update->ntimestep;
double xcm[3];
group->xcm(igroup,masstotal,xcm);
scalar = group->gyration(igroup,masstotal,xcm);
return scalar;
}

34
src/compute_gyration.h Normal file
View File

@ -0,0 +1,34 @@
/* ----------------------------------------------------------------------
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 COMPUTE_GYRATION_H
#define COMPUTE_GYRATION_H
#include "compute.h"
namespace LAMMPS_NS {
class ComputeGyration : public Compute {
public:
ComputeGyration(class LAMMPS *, int, char **);
~ComputeGyration() {}
void init();
double compute_scalar();
private:
double masstotal;
};
}
#endif

View File

@ -82,6 +82,7 @@ CommandStyle(write_restart,WriteRestart)
#include "compute_coord_atom.h"
#include "compute_displace_atom.h"
#include "compute_group_group.h"
#include "compute_gyration.h"
#include "compute_heat_flux.h"
#include "compute_ke.h"
#include "compute_ke_atom.h"
@ -110,6 +111,7 @@ ComputeStyle(com,ComputeCOM)
ComputeStyle(coord/atom,ComputeCoordAtom)
ComputeStyle(displace/atom,ComputeDisplaceAtom)
ComputeStyle(group/group,ComputeGroupGroup)
ComputeStyle(gyration,ComputeGyration)
ComputeStyle(heat/flux,ComputeHeatFlux)
ComputeStyle(ke,ComputeKE)
ComputeStyle(ke/atom,ComputeKEAtom)