lammps code for giving a atom certain amount of energy
Answers
Answered by
3
Classes that define an atom style are derived from the AtomVec class and managed by the Atom class. The atom style determines what attributes are associated with an atom. A new atom style can be created if one of the existing atom styles does not define all the attributes you need to store and communicate with atoms.
Atom_vec_atomic.cpp is a simple example of an atom style.
The constructor of the derived class sets values for several variables that you must set when defining a new atom style, which are documented in atom_vec.h. New atom arrays are defined in atom.cpp. Search for the word “customize” and you will find locations you will need to modify.
New pair styles, fixes, or computes can be added to LAMMPS, as discussed below. The code for these classes can use the per-atom properties defined by fix property/atom. The Atom class has a find_custom() method that is useful in this context:
int index = atom->find_custom(char *name, int &flag);
The “name” of a custom attribute, as specified in the fix property/atom command, is checked to verify that it exists and its index is returned. The method also sets flag = 0/1 depending on whether it is an integer or floating-point attribute. The vector of values associated with the attribute can then be accessed using the returned index as
int *ivector = atom->ivector[index]; double *dvector = atom->dvector[index];
Ivector or dvector are vectors of length Nlocal = # of owned atoms, which store the attributes of individual atoms.
Atom_vec_atomic.cpp is a simple example of an atom style.
The constructor of the derived class sets values for several variables that you must set when defining a new atom style, which are documented in atom_vec.h. New atom arrays are defined in atom.cpp. Search for the word “customize” and you will find locations you will need to modify.
New pair styles, fixes, or computes can be added to LAMMPS, as discussed below. The code for these classes can use the per-atom properties defined by fix property/atom. The Atom class has a find_custom() method that is useful in this context:
int index = atom->find_custom(char *name, int &flag);
The “name” of a custom attribute, as specified in the fix property/atom command, is checked to verify that it exists and its index is returned. The method also sets flag = 0/1 depending on whether it is an integer or floating-point attribute. The vector of values associated with the attribute can then be accessed using the returned index as
int *ivector = atom->ivector[index]; double *dvector = atom->dvector[index];
Ivector or dvector are vectors of length Nlocal = # of owned atoms, which store the attributes of individual atoms.
Similar questions