From c74f5ae41683871ce2c42658c86baed680f6441d Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Thu, 22 Aug 2019 11:37:21 -0600 Subject: [PATCH] add another example to Howto chunk doc page --- doc/src/Howto_chunk.txt | 16 ++++++++--- doc/src/compute_chunk_spread_atom.txt | 39 +++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/doc/src/Howto_chunk.txt b/doc/src/Howto_chunk.txt index e29cf13167..a4212914a1 100644 --- a/doc/src/Howto_chunk.txt +++ b/doc/src/Howto_chunk.txt @@ -136,7 +136,9 @@ The "compute chunk/spread/atom"_compute_chunk_spread_atom.html command spreads per-chunk values to each atom in the chunk, producing per-atom values as its output. This can be useful for outputting per-chunk values to a per-atom "dump file"_dump.html. Or for using an atom's -associated chunk value in an "atom-style variable"_variable.html. +associated chunk value in an "atom-style variable"_variable.html. Or +as input to the "fix ave/chunk"_fix_ave_chunk.html command to +spatially average per-chunk values calculated by a per-chunk compute. The "compute reduce/chunk"_compute_reduce_chunk.html command reduces a peratom value across the atoms in each chunk to produce a value per @@ -184,12 +186,20 @@ compute cc1 all chunk/atom c_cluster compress yes compute size all property/chunk cc1 count fix 1 all ave/histo 100 1 100 0 20 20 c_size mode vector ave running beyond ignore file tmp.histo :pre -(6) An example of using a per-chunk value to apply per-atom forces to +(6) An example for using a per-chunk value to apply per-atom forces to compress individual polymer chains (molecules) in a mixture, is explained on the "compute chunk/spread/atom"_compute_chunk_spread_atom.html command doc page. -(7) An example of using one set of per-chunk values for molecule +(7) An example for using one set of per-chunk values for molecule chunks, to create a 2nd set of micelle-scale chunks (clustered molecules, due to hydrophobicity), is explained on the "compute chunk/reduce"_compute_reduce_chunk.html command doc page. + +(8) An example for using one set of per-chunk values (dipole moment +vectors) for molecule chunks, spreading the values to each atom in +each chunk, then defining a second set of chunks as spatial bins, and +using the "fix ave/chunk"_fix_ave_chunk.html command to calulate an +average dipole moment vector for each bin. This example is explained +on the "compute chunk/spread/atom"_compute_chunk_spread_atom.html +command doc page. diff --git a/doc/src/compute_chunk_spread_atom.txt b/doc/src/compute_chunk_spread_atom.txt index 4afb62683e..c84fe679ee 100644 --- a/doc/src/compute_chunk_spread_atom.txt +++ b/doc/src/compute_chunk_spread_atom.txt @@ -30,11 +30,18 @@ compute 1 all chunk/spread/atom mychunk c_com[*] c_gyration :pre [Description:] Define a calculation that "spreads" one or more per-chunk values to -each atom in the chunk. This can be useful for creating a "dump -file"_dump.html where each atom lists info about the chunk it is in, -e.g. for post-processing purposes. It can also be used in "atom-style -variables"_variable.html that need info about the chunk each atom is -in. Examples are given below. +each atom in the chunk. This can be useful in several scenarios: + +For creating a "dump file"_dump.html where each atom lists info about +the chunk it is in, e.g. for post-processing purposes. :ulb,l + +To access chunk value in "atom-style variables"_variable.html that +need info about the chunk each atom is in. :l + +To use the "fix ave/chunk"_fix_ave_chunk.html command to spatially +average per-chunk values calculated by a per-chunk compute. :l,ule + +Examples are given below. In LAMMPS, chunks are collections of atoms defined by a "compute chunk/atom"_compute_chunk_atom.html command, which assigns each atom @@ -148,6 +155,28 @@ thermo_style custom step etotal press v_ave :pre :line +Here is an example for using one set of chunks, defined for molecules, +to compute the dipole moment vector for each chunk. E.g. for water +molecules. Then spreading those values to each atom in each chunk. +Then defining a second set of chunks based on spatial bins. And +finally, using the "fix ave/chunk"_fix_ave_chunk.html command to +calculate an average dipole moment vector per spatial bin. + +compute cmol all chunk/atom molecule +compute dipole all dipole/chunk cmol +compute spread all chunk/spread/atom cmol c_dipole\[1\] c_dipole\[2\] c_dipole\[3\] +compute cspatial all chunk/atom bin/1d z lower 0.1 units reduced +fix ave all ave/chunk 100 10 1000 cspatial c_spread\[*\] :pre + +Note that the "fix ave/chunk"_fix_ave_chunk.html command requires +per-atom values as input. That is why the compute chunk/spread/atom +command is used to assign per-chunk values to each atom in the chunk. +If a molecule straddles bin boundaries, each of its atoms contributes +in a weighted manner to the average dipole moment of the spatial bin +it is in. + +:line + [Output info:] This compute calculates a per-atom vector or array, which can be