I want to dump/compute net dipole moment of my system within LAMMPS.

Externally i can compute easily by using a simple analysis on the trajectory. However i wanted to calculate time dependent auto-correlation function as well - requiring very frequent dumping of trajectory. But in doing so the trajectory file becomes unmanageably large.

Details of system- Multi chains of varying sizes, with 4 type charged atoms. Total number of atoms are 10000. I will be more than happy to provide any further details of the system.

I want to dump/compute net dipole moment of my system within LAMMPS.

Externally i can compute easily by using a simple analysis on the
trajectory. However i wanted to calculate time dependent
auto-correlation function as well - requiring very frequent dumping of
trajectory. But in doing so the trajectory file becomes unmanageably large.

Details of system- Multi chains of varying sizes, with 4 type charged
atoms. Total number of atoms are 10000. I will be more than happy to
provide any further details of the system.

you can just use LAMMPS' flexible output system to
compute and output the x, y, and z-component of the
dipole moment.

1) you get access to atom properties via the property/atom compute,
2) you can define an atom style variable that computes charge*coordinate
from the pre-stored properties (it may be beneficial to use unwrapped
coordinates, to reduce the noise from atoms jumping across PBC).
3) you can sum the individual charge*coordinate numbers to the global
components via compute reduce.
4) you can access the reduced numbers via equal style variables
and output them to a file with fix print
5) the output of that file you can then use for auto-correlation or other
forms of computing the spectral densities

One point to add. If you want to
compute a correlation of a single
or handful of quantities that you have
calculated via the computes Axel
mentioned, then you can use fix
ave/correlate at the end of the steps
he listed.

One point to add. If you want to
compute a correlation of a single
or handful of quantities that you have
calculated via the computes Axel
mentioned, then you can use fix
ave/correlate at the end of the steps
he listed.

stupid question:
how do you get ave/correlate to compute a correlation on
a vector property, for which you have the three components
as three equal style variables? i don't see it in the documentation,
but i may be overlooking something.

Fix ave/correlate lets you list several values (e.g.
equal-style variables) and correlate each to
themselves (auto) or the values to each other
(upper, lower, full). Is that what you mean?

Fix ave/correlate lets you list several values (e.g.
equal-style variables) and correlate each to
themselves (auto) or the values to each other
(upper, lower, full). Is that what you mean?

i was looking for a way to get:

D_ij = (qx_i*qx_j + qy_i*qy_j + qz_i*qz_j)

with i being t_0 and j being t_0 + t to get D_ij(t).
and qx, qy, qz being q*xu, q*yu and q*zu that are
computed and summed over all atoms.

as far as i understand the documentation, i can
only get auto-correlations for individual components
or cross-correlations between them. perhaps, i
am overlooking something.

Thanks Axel and Steve for the prompt solution to the issue , will implement and test the solution you provided. Will keep the community posted on the development.

If fix ave/correlate will compute one term
of the Dij eq below (an auto-correlate of
one of its inputs), then maybe you could
take the 3 outputs (3 terms) of fix ave/correlate
and sum them in a variable? The outputs
of fix ave/correlate are available to use
as inputs on timesteps that are a multiple
of Nfreq.