GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.lammps.org — 2.3.9. Scatter/gather operations — LAMMPS documentation 2.3.9. Scatter/gather operationsdata = lmp.gather_atoms(name,dtype,count) # return per-atom property of all atoms gathered into data, ordered by atom ID # name = "x", "q", "type", etc data = lmp.gather_atoms_concat(name,dtype,count) # ditto, but concatenated atom values from each proc (unordered) data = lmp.gather_atoms_subset(name,dtype,count,ndata,ids) # ditto, but for subset of Ndata atoms with IDs lmp.scatter_atoms(name,dtype,count,data) # scatter per-atom property to all atoms from data, ordered by atom ID # name = "x", "q", "type", etc # count = # of per-atom values, 1 or 3, etc lmp.scatter_atoms_subset(name,dtype,count,ndata,ids,data) # ditto, but for subset of Ndata atoms with IDs The gather methods collect peratom info of the requested type (atom coords, atom types, forces, etc) from all processors, and returns the same vector of values to each calling processor. The scatter functions do the inverse. They distribute a vector of peratom values, passed by all calling processors, to individual atoms, which may be owned by different processors. The dtype parameter is 0 for Note that the data returned by the gather methods,
e.g. For the scatter methods, the array of coordinates passed to must be a ctypes vector of ints or doubles, allocated and initialized something like this: from ctypes import c_double natoms = lmp.get_natoms() n3 = 3*natoms x = (n3*c_double)() x[0] = x coord of atom with ID 1 x[1] = y coord of atom with ID 1 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_atoms("x", 1, 3, x) The coordinates can also be provided as arguments to the initializer of x: from ctypes import c_double natoms = 2 n3 = 3*natoms # init in constructor x = (n3*c_double)(0.0, 0.0, 0.0, 1.0, 1.0, 1.0) lmp.scatter_atoms("x", 1, 3, x) # or using a list coords = [1.0, 2.0, 3.0, -3.0, -2.0, -1.0] x = (c_double*len(coords))(*coords) Alternatively, you can just change values in the vector returned by the gather methods, since they are also ctypes vectors. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |