How to use per-atom quantity as chunck ID

Dear Lammps users

I want to treat per atom as per chunk, so I used below command to do it.

variable position atom x
compute chunk_x2 water chunk/atom v_position
compute myChunk2 water dipole/chunk chunk_x2
fix ave_T_P all ave/time 1 10 10 c_myChunk2[*] file current2.profile mode vector

However, the output only has 30 rows rather than the number of raws equal to the atom number. I do not understand why. How to to use per-atom quantity as chunck ID?

Thanks for the help.

fan

You need something integer, v_position is not.

What you do looks like 1-d binning. Why not use compute chunk/atom bin/1d?

According to the manual, chunk/atom bin/1d will divide the atoms into 1d bins, which means the number of chunk should be same as the number of bins, not the number of atoms. Or there is a trick I don’t know?

Using 1 chunk per atom makes no sense. You need to better explain what you are trying to do.

I am trying to calculate the dielectric constant of bulk water. According to this post replied by you as well
https://matsci.org/t/can-anyone-help-me-understand-why-my-dielectric-constant-calculation-is-not-leading-to-the-correct-result/33032

I am testing the results of computing the total dipole moment by summing over the dipole moments of the individual water molecules and over individual charges. For the latter, I have to use each atom as a chunk and calculate the dipole moment for each chunk, followed by sum them up. This is why need to teat per atom as a chunk.

Dielectric constant can be tricky to calculate, it can be safer to use postprocessing open source code that have been carefully tested, such as:

  • MDAnalysis for bulk analysis,
  • MAICoS for spatially dependent analysis (planar, cylinder, and spherical) – see also these explanations and guide to avoid falling in the common pitfalls associated with dielectric constant calculation.

That is needlessly complicated and makes no sense. Technically speaking, there is no dipole moment to be computed from a single point change. So that kind of calculation cannot work.

Instead the (total like any) dipole moment is easily computed from:

\vec{M} = \sum q_i\cdot\vec{r}_i

That is the sum of the charges times the unwrapped(!) positions.
For that LAMMPS already has a compute: compute dipole command — LAMMPS documentation

When I did the research in mentioned in the post that you are referring to, I wrote my own analysis tool, since none of the available tools were 100% accurate, which you would not easily notice, since people at the time didn’t do trajectories as long as I did, but that was required due to nature of the Ewald summation implementations. It is also extremely important that the correct fluctuation formula is applied. This is all extremely subtle business. I have spelled most of it out in my PhD thesis. I am happy to send you a copy, but it was written in German. :frowning:

Update: I am uploading some talk slides from a talk I gave a few years later, that summarizes the results (in English!) and also has key references included. I strongly advise to read up on this to properly understand what you are doing. Dielectric properties are highly difficult. I also strongly advise to get and study the text book “Theory of Simple Liquids” by Hansen, McDonald for better insight. I would not have figured this all out without that book. It saved my bacon many times.
talk-trieste2004.pdf (1.1 MB)

Hi

Thanks for the useful information and disscussion.