How to dump or print details of 'atomfile' style variable

Hello LAMMPS users,

I am using the LAMMPS version 12Dec2018. I want to display/dump a per-atom array that I assign using variable style ‘atomfile’. I have read the documentation for it, but it has no examples there. I have tried write_dump, print, fix print etc., but I am not sure if I am using the right syntax.

variable neighlist atomfile Atoms.txt

Can anyone tell me how I can dump or print the contents of the variable ‘neighlist’ in the above line? Thank you.


You can use a custom style dump

Hello Dr. Kohlmeyer,

Thank you for the reply. My variable ‘neighlist’ would be a 13X5 array with 13 atoms containing their ID, type, x, y and z details. I have tried the following commands:

dump neighdump all custom 1 dumpneigh.lammpstrj v_neighlist

dump neighdump all custom 1 dumpneigh.lammpstrj v_neighlist[1] v_neighlist[2] v_neighlist[3] v_neighlist[4] v_neighlist[5]

Both commands gave me errors.
I have attached the part of my code where I am trying to use the variable style ‘atomfile’ to get a per-atom array that will supposedly give me zeroes for all the atoms whose IDs do not appear in that per-atom array/set.
Upload.txt (439 Bytes)

Please re-read the documentation of the variable command.
Your description is not consistent with how atomfile variable are documented to work.
You cannot just make up something and expect LAMMPS to work that way.

You are not providing sufficient information to be able to say more of give better advice.

Hello Dr. Kohlmeyer,

I have managed to dump the variable with style ‘atomfile’. But now I am trying to extract the non-zero IDs from this per-atom atomfile-style variable. But I cannot use Boolean expressions because it is not an equal style variable. Is there any way to isolate the non-zero IDs from the created atomfile-style variable? Thank you.


I think I have already commented that what you are trying to do is best described as “abuse” of the LAMMPS input script. It has not been designed as a general purpose programming language, yet you keep trying to use it exactly that way and - of course - you will be facing the limitations all the time.
Furthermore, you do not seem to properly appreciate the data model in LAMMPS with a domain decomposition of the per-atom data. For the script interface to work at a global level, loads of collective communications are necessary and those make processing extremely inefficient. Please note that this is independent from whether you actually do use multiple processors or not. LAMMPS has been designed that way and will do those operations regardless. In fact, it is even required in most cases, since periodic boundaries are implemented as part of the domain decomposition.

I have thus no interest to follow you on your increasingly confusing and complex path to make LAMMPS do things it was not designed for. There are multiple, better ways to implement complex tasks, e.g. via the C library interface or - by extension - the Python module. Of course this also requires some more low level understanding of the internals of LAMMPS, but you are already running into issues with those.

Of course you are free to continue your path, but don’t expect much sympathy and support for doing something that you have been advised against multiple times now.