2014-10-22 01:09:24 +08:00
|
|
|
/* -*- c++ -*- ----------------------------------------------------------
|
2007-01-30 08:31:11 +08:00
|
|
|
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
|
2012-06-07 06:47:51 +08:00
|
|
|
certain rights in this software. This software is distributed under
|
2007-01-30 08:31:11 +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_ATOM_VEC_H
|
|
|
|
#define LMP_ATOM_VEC_H
|
2007-01-30 08:31:11 +08:00
|
|
|
|
2015-10-31 04:04:06 +08:00
|
|
|
#include <stdio.h>
|
2007-01-30 08:31:11 +08:00
|
|
|
#include "pointers.h"
|
|
|
|
|
|
|
|
namespace LAMMPS_NS {
|
|
|
|
|
|
|
|
class AtomVec : protected Pointers {
|
|
|
|
public:
|
|
|
|
int molecular; // 0 = atomic, 1 = molecular system
|
|
|
|
int bonds_allow,angles_allow; // 1 if bonds, angles are used
|
|
|
|
int dihedrals_allow,impropers_allow; // 1 if dihedrals, impropers used
|
|
|
|
int mass_type; // 1 if per-type masses
|
|
|
|
int dipole_type; // 1 if per-type dipole moments
|
2014-06-05 06:12:23 +08:00
|
|
|
int forceclearflag; // 1 if has forceclear() method
|
2009-11-10 02:20:20 +08:00
|
|
|
|
2007-01-30 08:31:11 +08:00
|
|
|
int comm_x_only; // 1 if only exchange x in forward comm
|
|
|
|
int comm_f_only; // 1 if only exchange f in reverse comm
|
2008-02-09 03:47:58 +08:00
|
|
|
|
2012-06-07 06:47:51 +08:00
|
|
|
int size_forward; // # of values per atom in comm
|
2007-01-30 08:31:11 +08:00
|
|
|
int size_reverse; // # in reverse comm
|
|
|
|
int size_border; // # in border comm
|
2009-11-10 02:20:20 +08:00
|
|
|
int size_velocity; // # of velocity based quantities
|
2007-01-30 08:31:11 +08:00
|
|
|
int size_data_atom; // number of values in Atom line
|
|
|
|
int size_data_vel; // number of values in Velocity line
|
2011-04-16 06:25:19 +08:00
|
|
|
int size_data_bonus; // number of values in Bonus line
|
2007-01-30 08:31:11 +08:00
|
|
|
int xcol_data; // column (1-N) where x is in Atom line
|
|
|
|
|
2014-01-26 06:46:08 +08:00
|
|
|
class Molecule **onemols; // list of molecules for style template
|
|
|
|
int nset; // # of molecules in list
|
|
|
|
|
2014-02-12 08:33:16 +08:00
|
|
|
int kokkosable; // 1 if atom style is KOKKOS-enabled
|
2011-05-20 23:50:14 +08:00
|
|
|
|
2014-01-26 06:46:08 +08:00
|
|
|
int nargcopy; // copy of command-line args for atom_style command
|
|
|
|
char **argcopy; // used when AtomVec is realloced (restart,replicate)
|
|
|
|
|
2013-02-01 00:31:03 +08:00
|
|
|
AtomVec(class LAMMPS *);
|
2014-01-26 06:46:08 +08:00
|
|
|
virtual ~AtomVec();
|
|
|
|
void store_args(int, char **);
|
|
|
|
virtual void process_args(int, char **);
|
2011-03-09 01:27:22 +08:00
|
|
|
virtual void init();
|
2007-01-30 08:31:11 +08:00
|
|
|
|
|
|
|
virtual void grow(int) = 0;
|
2009-11-18 00:07:28 +08:00
|
|
|
virtual void grow_reset() = 0;
|
2011-04-16 06:25:19 +08:00
|
|
|
virtual void copy(int, int, int) = 0;
|
|
|
|
virtual void clear_bonus() {}
|
2014-06-05 04:52:04 +08:00
|
|
|
virtual void force_clear(int, size_t) {}
|
2007-01-30 08:31:11 +08:00
|
|
|
|
2007-03-16 05:49:48 +08:00
|
|
|
virtual int pack_comm(int, int *, double *, int, int *) = 0;
|
2009-11-10 02:20:20 +08:00
|
|
|
virtual int pack_comm_vel(int, int *, double *, int, int *) = 0;
|
2011-04-15 01:40:40 +08:00
|
|
|
virtual int pack_comm_hybrid(int, int *, double *) {return 0;}
|
2007-01-30 08:31:11 +08:00
|
|
|
virtual void unpack_comm(int, int, double *) = 0;
|
2009-11-10 02:20:20 +08:00
|
|
|
virtual void unpack_comm_vel(int, int, double *) = 0;
|
2011-04-15 01:40:40 +08:00
|
|
|
virtual int unpack_comm_hybrid(int, int, double *) {return 0;}
|
2007-01-30 08:31:11 +08:00
|
|
|
|
|
|
|
virtual int pack_reverse(int, int, double *) = 0;
|
2011-04-15 01:40:40 +08:00
|
|
|
virtual int pack_reverse_hybrid(int, int, double *) {return 0;}
|
2007-01-30 08:31:11 +08:00
|
|
|
virtual void unpack_reverse(int, int *, double *) = 0;
|
2011-04-15 01:40:40 +08:00
|
|
|
virtual int unpack_reverse_hybrid(int, int *, double *) {return 0;}
|
2007-01-30 08:31:11 +08:00
|
|
|
|
2007-03-16 05:49:48 +08:00
|
|
|
virtual int pack_border(int, int *, double *, int, int *) = 0;
|
2009-11-10 02:20:20 +08:00
|
|
|
virtual int pack_border_vel(int, int *, double *, int, int *) = 0;
|
2011-04-15 01:40:40 +08:00
|
|
|
virtual int pack_border_hybrid(int, int *, double *) {return 0;}
|
2007-01-30 08:31:11 +08:00
|
|
|
virtual void unpack_border(int, int, double *) = 0;
|
2009-11-10 02:20:20 +08:00
|
|
|
virtual void unpack_border_vel(int, int, double *) = 0;
|
2011-04-15 01:40:40 +08:00
|
|
|
virtual int unpack_border_hybrid(int, int, double *) {return 0;}
|
2007-01-30 08:31:11 +08:00
|
|
|
|
|
|
|
virtual int pack_exchange(int, double *) = 0;
|
|
|
|
virtual int unpack_exchange(double *) = 0;
|
|
|
|
|
|
|
|
virtual int size_restart() = 0;
|
|
|
|
virtual int pack_restart(int, double *) = 0;
|
|
|
|
virtual int unpack_restart(double *) = 0;
|
|
|
|
|
2007-06-20 21:17:59 +08:00
|
|
|
virtual void create_atom(int, double *) = 0;
|
2013-04-04 00:52:29 +08:00
|
|
|
|
2014-01-15 00:17:20 +08:00
|
|
|
virtual void data_atom(double *, imageint, char **) = 0;
|
2011-04-16 06:25:19 +08:00
|
|
|
virtual void data_atom_bonus(int, char **) {}
|
2009-11-17 07:13:17 +08:00
|
|
|
virtual int data_atom_hybrid(int, char **) {return 0;}
|
2007-06-20 21:17:59 +08:00
|
|
|
virtual void data_vel(int, char **);
|
|
|
|
virtual int data_vel_hybrid(int, char **) {return 0;}
|
2007-01-30 08:31:11 +08:00
|
|
|
|
2013-04-04 00:52:29 +08:00
|
|
|
virtual void pack_data(double **) = 0;
|
|
|
|
virtual int pack_data_hybrid(int, double *) {return 0;}
|
|
|
|
virtual void write_data(FILE *, int, double **) = 0;
|
|
|
|
virtual int write_data_hybrid(FILE *, double *) {return 0;}
|
|
|
|
virtual void pack_vel(double **);
|
|
|
|
virtual int pack_vel_hybrid(int, double *) {return 0;}
|
|
|
|
virtual void write_vel(FILE *, int, double **);
|
|
|
|
virtual int write_vel_hybrid(FILE *, double *) {return 0;}
|
|
|
|
|
2014-01-18 02:43:09 +08:00
|
|
|
int pack_bond(tagint **);
|
|
|
|
void write_bond(FILE *, int, tagint **, int);
|
|
|
|
int pack_angle(tagint **);
|
|
|
|
void write_angle(FILE *, int, tagint **, int);
|
2018-01-23 14:56:11 +08:00
|
|
|
int pack_dihedral(tagint **);
|
2014-01-18 02:43:09 +08:00
|
|
|
void write_dihedral(FILE *, int, tagint **, int);
|
2018-01-23 14:56:11 +08:00
|
|
|
int pack_improper(tagint **);
|
2014-01-18 02:43:09 +08:00
|
|
|
void write_improper(FILE *, int, tagint **, int);
|
2015-10-31 04:04:06 +08:00
|
|
|
|
2014-06-05 06:12:23 +08:00
|
|
|
virtual int property_atom(char *) {return -1;}
|
|
|
|
virtual void pack_property_atom(int, double *, int, int) {}
|
2013-04-04 00:52:29 +08:00
|
|
|
|
2011-03-17 04:03:49 +08:00
|
|
|
virtual bigint memory_usage() = 0;
|
2007-01-30 08:31:11 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int nmax; // local copy of atom->nmax
|
2011-03-08 06:47:03 +08:00
|
|
|
int deform_vremap; // local copy of domain properties
|
|
|
|
int deform_groupbit;
|
|
|
|
double *h_rate;
|
2013-11-20 23:36:26 +08:00
|
|
|
|
2013-11-21 01:32:53 +08:00
|
|
|
// union data struct for packing 32-bit and 64-bit ints into double bufs
|
|
|
|
// this avoids aliasing issues by having 2 pointers (double,int)
|
|
|
|
// to same buf memory
|
|
|
|
// constructor for 32-bit int prevents compiler
|
|
|
|
// from possibly calling the double constructor when passed an int
|
|
|
|
// copy to a double *buf:
|
|
|
|
// buf[m++] = ubuf(foo).d, where foo is a 32-bit or 64-bit int
|
|
|
|
// copy from a double *buf:
|
|
|
|
// foo = (int) ubuf(buf[m++]).i;, where (int) or (tagint) match foo
|
|
|
|
// the cast prevents compiler warnings about possible truncation
|
|
|
|
|
2013-11-20 23:36:26 +08:00
|
|
|
union ubuf {
|
2014-01-18 02:43:09 +08:00
|
|
|
double d;
|
|
|
|
int64_t i;
|
2013-11-20 23:36:26 +08:00
|
|
|
ubuf(double arg) : d(arg) {}
|
|
|
|
ubuf(int64_t arg) : i(arg) {}
|
|
|
|
ubuf(int arg) : i(arg) {}
|
|
|
|
};
|
2014-05-08 00:15:31 +08:00
|
|
|
|
|
|
|
void grow_nmax();
|
2014-05-08 00:25:27 +08:00
|
|
|
int grow_nmax_bonus(int);
|
2007-01-30 08:31:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2012-03-03 01:05:40 +08:00
|
|
|
|
2011-12-16 09:37:13 +08:00
|
|
|
/* ERROR/WARNING messages:
|
|
|
|
|
2013-02-16 01:32:15 +08:00
|
|
|
E: Invalid atom_style command
|
|
|
|
|
|
|
|
Self-explanatory.
|
|
|
|
|
2015-03-19 05:54:52 +08:00
|
|
|
E: KOKKOS package requires a kokkos enabled atom_style
|
|
|
|
|
2015-03-24 07:30:50 +08:00
|
|
|
Self-explanatory.
|
2015-03-19 05:54:52 +08:00
|
|
|
|
2011-12-16 09:37:13 +08:00
|
|
|
*/
|