fix ave/chunk fixes, 2d disc option, fix_modify dynamic/dof
This commit is contained in:
@ -594,10 +594,10 @@ flag = lmp.set_variable(name,value) # set existing named string-style vari
|
||||
value = lmp.get_thermo(name) # return current value of a thermo keyword
|
||||
|
||||
natoms = lmp.get_natoms() # total # of atoms as int
|
||||
data = lmp.gather_atoms(name,type,count) # return atom attribute of all atoms gathered into data, ordered by atom ID
|
||||
data = lmp.gather_atoms(name,type,count) # return per-atom property of all atoms gathered into data, ordered by atom ID
|
||||
# name = "x", "charge", "type", etc
|
||||
# count = # of per-atom values, 1 or 3, etc
|
||||
lmp.scatter_atoms(name,type,count,data) # scatter atom attribute of all atoms from data, ordered by atom ID
|
||||
lmp.scatter_atoms(name,type,count,data) # scatter per-atom property to all atoms from data, ordered by atom ID
|
||||
# name = "x", "charge", "type", etc
|
||||
# count = # of per-atom values, 1 or 3, etc :pre
|
||||
|
||||
@ -656,10 +656,10 @@ argument.
|
||||
For extract_atom(), a pointer to internal LAMMPS atom-based data is
|
||||
returned, which you can use via normal Python subscripting. See the
|
||||
extract() method in the src/atom.cpp file for a list of valid names.
|
||||
Again, new names could easily be added. A pointer to a vector of
|
||||
doubles or integers, or a pointer to an array of doubles (double **)
|
||||
or integers (int **) is returned. You need to specify the appropriate
|
||||
data type via the type argument.
|
||||
Again, new names could easily be added if the property you want is not
|
||||
listed. A pointer to a vector of doubles or integers, or a pointer to
|
||||
an array of doubles (double **) or integers (int **) is returned. You
|
||||
need to specify the appropriate data type via the type argument.
|
||||
|
||||
For extract_compute() and extract_fix(), the global, per-atom, or
|
||||
local data calculated by the compute or fix can be accessed. What is
|
||||
@ -689,12 +689,16 @@ specified group.
|
||||
The get_natoms() method returns the total number of atoms in the
|
||||
simulation, as an int.
|
||||
|
||||
The gather_atoms() method returns a ctypes vector of ints or doubles
|
||||
as specified by type, of length count*natoms, for the property of all
|
||||
the atoms in the simulation specified by name, ordered by count and
|
||||
then by atom ID. The vector can be used via normal Python
|
||||
subscripting. If atom IDs are not consecutively ordered within
|
||||
LAMMPS, a None is returned as indication of an error.
|
||||
The gather_atoms() method allows any per-atom property (coordinates,
|
||||
velocities, etc) to be extracted from LAMMPS. It returns a ctypes
|
||||
vector of ints or doubles as specified by type, of length
|
||||
count*natoms, for the named property for all atoms in the simulation.
|
||||
The data is ordered by count and then by atom ID. See the extract()
|
||||
method in the src/atom.cpp file for a list of valid names. Again, new
|
||||
names could easily be added if the property you want is missing. The
|
||||
vector can be used via normal Python subscripting. If atom IDs are
|
||||
not consecutively ordered within LAMMPS, a None is returned as
|
||||
indication of an error.
|
||||
|
||||
Note that the data structure gather_atoms("x") returns is different
|
||||
from the data structure returned by extract_atom("x") in four ways.
|
||||
@ -711,14 +715,18 @@ assigning a new values to the extract_atom() array. To do this with
|
||||
the gather_atoms() vector, you need to change values in the vector,
|
||||
then invoke the scatter_atoms() method.
|
||||
|
||||
The scatter_atoms() method takes a vector of ints or doubles as
|
||||
specified by type, of length count*natoms, for the property of all the
|
||||
atoms in the simulation specified by name, ordered by bount and then
|
||||
by atom ID. It uses the vector of data to overwrite the corresponding
|
||||
properties for each atom inside LAMMPS. This requires LAMMPS to have
|
||||
its "map" option enabled; see the "atom_modify"_atom_modify.html
|
||||
command for details. If it is not, or if atom IDs are not
|
||||
consecutively ordered, no coordinates are reset.
|
||||
The scatter_atoms() method allows any per-atom property (coordinates,
|
||||
velocities, etc) to be inserted into LAMMPS, overwriting the current
|
||||
property. It takes a vector of ints or doubles as specified by type,
|
||||
of length count*natoms, for the named property for all atoms in the
|
||||
simulation. The data should be ordered by count and then by atom ID.
|
||||
See the extract() method in the src/atom.cpp file for a list of valid
|
||||
names. Again, new names could easily be added if the property you
|
||||
want is missing. It uses the vector of data to overwrite the
|
||||
corresponding properties for each atom inside LAMMPS. This requires
|
||||
LAMMPS to have its "map" option enabled; see the
|
||||
"atom_modify"_atom_modify.html command for details. If it is not, or
|
||||
if atom IDs are not consecutively ordered, no coordinates are reset.
|
||||
|
||||
The array of coordinates passed to scatter_atoms() must be a ctypes
|
||||
vector of ints or doubles, allocated and initialized something like
|
||||
@ -734,7 +742,7 @@ x\[2\] = z coord of atom with ID 1
|
||||
x\[3\] = x coord of atom with ID 2
|
||||
...
|
||||
x\[n3-1\] = z coord of atom with ID natoms
|
||||
lmp.scatter_coords("x",1,3,x) :pre
|
||||
lmp.scatter_atoms("x",1,3,x) :pre
|
||||
|
||||
Alternatively, you can just change values in the vector returned by
|
||||
gather_atoms("x",1,3), since it is a ctypes vector of doubles.
|
||||
|
||||
Reference in New Issue
Block a user