2014-10-22 01:09:24 +08:00
|
|
|
/* -*- c++ -*- ----------------------------------------------------------
|
2006-09-28 03:51:33 +08:00
|
|
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
2007-01-30 08:22:05 +08:00
|
|
|
http://lammps.sandia.gov, Sandia National Laboratories
|
|
|
|
Steve Plimpton, sjplimp@sandia.gov
|
2006-09-28 03:51:33 +08:00
|
|
|
|
|
|
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
|
|
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
2012-06-07 06:47:51 +08:00
|
|
|
certain rights in this software. This software is distributed under
|
2006-09-28 03:51:33 +08:00
|
|
|
the GNU General Public License.
|
|
|
|
|
|
|
|
See the README file in the top-level LAMMPS directory.
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2010-01-12 09:37:48 +08:00
|
|
|
#ifndef LMP_GROUP_H
|
|
|
|
#define LMP_GROUP_H
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
#include "pointers.h"
|
2014-06-28 07:28:02 +08:00
|
|
|
#include <map>
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
namespace LAMMPS_NS {
|
|
|
|
|
|
|
|
class Group : protected Pointers {
|
2006-09-28 03:51:33 +08:00
|
|
|
public:
|
2009-08-29 04:28:23 +08:00
|
|
|
int ngroup; // # of defined groups
|
2006-09-28 03:51:33 +08:00
|
|
|
char **names; // name of each group
|
|
|
|
int *bitmask; // one-bit mask for each group
|
2009-08-29 04:28:23 +08:00
|
|
|
int *inversemask; // inverse mask for each group
|
2014-02-06 01:30:23 +08:00
|
|
|
int *dynamic; // 1 if dynamic, 0 if not
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
Group(class LAMMPS *);
|
2006-09-28 03:51:33 +08:00
|
|
|
~Group();
|
|
|
|
void assign(int, char **); // assign atoms to a group
|
|
|
|
void create(char *, int *); // add flagged atoms to a group
|
2008-04-05 07:17:17 +08:00
|
|
|
int find(const char *); // lookup name in list of groups
|
2015-07-18 07:20:48 +08:00
|
|
|
int find_or_create(const char *); // lookup name or create new group
|
2006-09-28 03:51:33 +08:00
|
|
|
void write_restart(FILE *);
|
|
|
|
void read_restart(FILE *);
|
|
|
|
|
2018-08-08 05:05:07 +08:00
|
|
|
bigint count_all(); // count atoms in group all
|
2011-01-05 05:08:27 +08:00
|
|
|
bigint count(int); // count atoms in group
|
|
|
|
bigint count(int,int); // count atoms in group & region
|
2006-09-28 03:51:33 +08:00
|
|
|
double mass(int); // total mass of atoms in group
|
2009-04-29 03:46:52 +08:00
|
|
|
double mass(int,int);
|
2006-09-28 03:51:33 +08:00
|
|
|
double charge(int); // total charge of atoms in group
|
2009-04-29 03:46:52 +08:00
|
|
|
double charge(int,int);
|
2006-09-28 03:51:33 +08:00
|
|
|
void bounds(int, double *); // bounds of atoms in group
|
2009-04-29 03:46:52 +08:00
|
|
|
void bounds(int, double *, int);
|
2006-09-28 03:51:33 +08:00
|
|
|
void xcm(int, double, double *); // center-of-mass coords of group
|
2009-04-29 03:46:52 +08:00
|
|
|
void xcm(int, double, double *, int);
|
2006-09-28 03:51:33 +08:00
|
|
|
void vcm(int, double, double *); // center-of-mass velocity of group
|
2009-04-29 03:46:52 +08:00
|
|
|
void vcm(int, double, double *, int);
|
2007-03-23 01:05:51 +08:00
|
|
|
void fcm(int, double *); // total force on group
|
2009-04-29 03:46:52 +08:00
|
|
|
void fcm(int, double *, int);
|
2007-04-21 03:03:20 +08:00
|
|
|
double ke(int); // kinetic energy of group
|
2009-04-29 03:46:52 +08:00
|
|
|
double ke(int, int);
|
2006-09-28 03:51:33 +08:00
|
|
|
double gyration(int, double, double *); // radius-of-gyration of group
|
2009-04-29 03:46:52 +08:00
|
|
|
double gyration(int, double, double *, int);
|
2006-09-28 03:51:33 +08:00
|
|
|
void angmom(int, double *, double *); // angular momentum of group
|
2010-05-19 08:11:00 +08:00
|
|
|
void angmom(int, double *, double *, int);
|
2010-11-24 22:39:50 +08:00
|
|
|
void torque(int, double *, double *); // torque on group
|
|
|
|
void torque(int, double *, double *, int);
|
2007-01-30 08:22:05 +08:00
|
|
|
void inertia(int, double *, double [3][3]); // inertia tensor
|
2010-05-29 00:44:34 +08:00
|
|
|
void inertia(int, double *, double [3][3], int);
|
2007-01-30 08:22:05 +08:00
|
|
|
void omega(double *, double [3][3], double *); // angular velocity
|
2009-03-17 23:40:57 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
int me;
|
2014-06-28 07:28:02 +08:00
|
|
|
std::map<tagint,int> *hash;
|
2009-03-17 23:40:57 +08:00
|
|
|
|
|
|
|
int find_unused();
|
2014-06-28 07:28:02 +08:00
|
|
|
void add_molecules(int, int);
|
|
|
|
|
|
|
|
// callback functions for ring communication
|
|
|
|
|
2017-06-15 05:01:06 +08:00
|
|
|
static void molring(int, char *, void *);
|
2014-06-28 07:28:02 +08:00
|
|
|
int molbit;
|
2006-09-28 03:51:33 +08:00
|
|
|
};
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
#endif
|
2011-12-16 09:37:13 +08:00
|
|
|
|
|
|
|
/* ERROR/WARNING messages:
|
|
|
|
|
|
|
|
E: Group command before simulation box is defined
|
|
|
|
|
|
|
|
The group command cannot be used before a read_data, read_restart, or
|
|
|
|
create_box command.
|
|
|
|
|
|
|
|
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: Could not find group delete group ID
|
|
|
|
|
|
|
|
Self-explanatory.
|
|
|
|
|
|
|
|
E: Cannot delete group all
|
|
|
|
|
|
|
|
Self-explanatory.
|
|
|
|
|
|
|
|
E: Cannot delete group currently used by a fix
|
|
|
|
|
|
|
|
Self-explanatory.
|
|
|
|
|
|
|
|
E: Cannot delete group currently used by a compute
|
|
|
|
|
|
|
|
Self-explanatory.
|
|
|
|
|
|
|
|
E: Cannot delete group currently used by a dump
|
|
|
|
|
|
|
|
Self-explanatory.
|
|
|
|
|
|
|
|
E: Cannot delete group currently used by atom_modify first
|
|
|
|
|
|
|
|
Self-explanatory.
|
|
|
|
|
2015-03-19 05:54:52 +08:00
|
|
|
E: Could not find group clear group ID
|
|
|
|
|
2015-03-24 07:30:50 +08:00
|
|
|
Self-explanatory.
|
2015-03-19 05:54:52 +08:00
|
|
|
|
|
|
|
E: Cannot clear group all
|
|
|
|
|
2015-03-24 07:30:50 +08:00
|
|
|
This operation is not allowed.
|
2015-03-19 05:54:52 +08:00
|
|
|
|
2011-12-16 09:37:13 +08:00
|
|
|
E: Too many groups
|
|
|
|
|
2012-06-07 06:47:51 +08:00
|
|
|
The maximum number of atom groups (including the "all" group) is
|
2011-12-16 09:37:13 +08:00
|
|
|
given by MAX_GROUP in group.cpp and is 32.
|
|
|
|
|
|
|
|
E: Group region ID does not exist
|
|
|
|
|
|
|
|
A region ID used in the group command does not exist.
|
|
|
|
|
2016-02-09 00:18:20 +08:00
|
|
|
E: Illegal range increment value
|
|
|
|
|
2016-02-15 23:26:57 +08:00
|
|
|
The increment must be >= 1.
|
2016-02-09 00:18:20 +08:00
|
|
|
|
2013-02-16 01:32:15 +08:00
|
|
|
E: Variable name for group does not exist
|
|
|
|
|
2013-03-05 07:09:29 +08:00
|
|
|
Self-explanatory.
|
2013-02-16 01:32:15 +08:00
|
|
|
|
|
|
|
E: Variable for group is invalid style
|
|
|
|
|
2013-03-05 07:09:29 +08:00
|
|
|
Only atom-style variables can be used.
|
2013-02-16 01:32:15 +08:00
|
|
|
|
2011-12-16 09:37:13 +08:00
|
|
|
E: Group ID does not exist
|
|
|
|
|
|
|
|
A group ID used in the group command does not exist.
|
|
|
|
|
2015-03-19 05:54:52 +08:00
|
|
|
E: Cannot subtract groups using a dynamic group
|
|
|
|
|
2015-03-24 07:30:50 +08:00
|
|
|
This operation is not allowed.
|
2015-03-19 05:54:52 +08:00
|
|
|
|
|
|
|
E: Cannot union groups using a dynamic group
|
|
|
|
|
2015-03-24 07:30:50 +08:00
|
|
|
This operation is not allowed.
|
2015-03-19 05:54:52 +08:00
|
|
|
|
|
|
|
E: Cannot intersect groups using a dynamic group
|
|
|
|
|
2015-03-24 07:30:50 +08:00
|
|
|
This operation is not allowed.
|
2015-03-19 05:54:52 +08:00
|
|
|
|
|
|
|
E: Group dynamic cannot reference itself
|
|
|
|
|
2015-03-24 07:30:50 +08:00
|
|
|
Self-explanatory.
|
2015-03-19 05:54:52 +08:00
|
|
|
|
|
|
|
E: Group dynamic parent group does not exist
|
|
|
|
|
2015-03-24 07:30:50 +08:00
|
|
|
Self-explanatory.
|
2015-03-19 05:54:52 +08:00
|
|
|
|
|
|
|
E: Group all cannot be made dynamic
|
|
|
|
|
2015-03-24 07:30:50 +08:00
|
|
|
This operation is not allowed.
|
2015-03-19 05:54:52 +08:00
|
|
|
|
2018-04-04 07:48:31 +08:00
|
|
|
E: Insufficient Jacobi rotations for group::omega
|
|
|
|
|
|
|
|
UNDOCUMENTED
|
|
|
|
|
2011-12-16 09:37:13 +08:00
|
|
|
*/
|