How to get values computed in another chunk for any atom ?

Dear lammps users,

I used the following instructions to compute the local density into the simulation box. I divided the box in 10x10x10 chunks.

compute chunkdens all chunk/atom bin/3d x lower 0.1 y lower 0.1 z lower 0.1 units reduced
fix favedens all ave/chunk 1 100 1000 chunkdens density/number ave one file chunck.txt

compute cspread all chunk/spread/atom chunkdens f_favedens[5]

For any atoms, I would like to get the density of its upper chunk. That is the density in its "chunk ID" + 100.

variable mybin atom c_chunkdens #my chunkID
variable upperbin atom v_mybin+100 #ID of the upper chunk
variable binpbc atom v_upperbin*(v_upperbin<=1000)+(v_upperbin-1000)*(v_upperbin>1000) #apply pbc on the chunk ID for chunks in the top layer of the box

For any atoms, I tried unsuccessfully to use oene of the following command to get the density of its chunk ID +100 (chunk ID == v_binpbc)

variable neighbdens1 atom f_favedens[v_binpbc][5]

compute neighdens all global/atom v_binpbc f_favedens[5]

There is something I misunderstood and I’m stuck with this. I’m wondering if there is any way of doing it. Any advices will be greatly appreciated.

Regards,

Olivier

i think you are pushing the LAMMPS script language beyond its capabilities.
it is meant to do some simple stuff, but not a full fledged programming language.
for more complex programming you would have to either write your own C++ code, or try what you can achieve through the python script interface (which has its own challenges and restrictions) or be limited to do the analysis in post-processing.

axel.

Dear LAMMPS users,

I am new at LAMMPS and I don’t know where to start, can anybody help me with the following questions:

What’s post-processing?

The physics of equilibration in polymer melts

Any links or materials will be highly appreciated.

Regards,
Umer

Umer,

it is a very bad practice to ask a new question as a reply to completely different question. this is called “hijacking a thread” and makes you appear as you are too lazy or to incompetent to write a new email. with that appearance (even when it is not true), how can you expect somebody to spend time and effort on helping you.

your questions are very fundamental. you need to find yourself a personal tutor. the kind of tutoring you need cannot be provided via email.

axel.

Dear Axel,

Thanks for your answer. However, I will reconsider the problem. I’m wondering if I do not observe a bug with “compute global/atom” command.

Wiith this compute, the index may be a compute or a per-atom vector. That is the two samples of code below should provide identical result as v_mybin is an atom vector strictly identical to the global vector c_chunkdens.

However, the second exemple below using as index v_mybin gives a segmentation fault (core dump). What do you think ?

Example 1:

compute chunkdens all chunk/atom bin/3d x lower 0.1 y lower 0.1 z lower 0.1 units reduced
fix favedens all ave/chunk 1 1 1 chunkdens density/number ave one file chunck.txt

compute 1 all global/atom c_chunkdens f_favedens[5]

Exemple 2:

compute chunkdens all chunk/atom bin/3d x lower 0.1 y lower 0.1 z lower 0.1 units reduced
fix favedens all ave/chunk 1 1 1 chunkdens density/number ave one file chunck.txt

variable mybin atom c_chunkdens
compute 1 all global/atom v_mybin f_favedens[5]

Best regards,

Olivier

to verify (and correct) a possible bug, we need a simple, small, fast to run, and minimal but complete input deck that reproduces the issue.
you also need to verify, that the issue can be reproduced with the latest LAMMPS patch release.

axel.

Here is a minimal code allowing to reproduce the issue. The two statements (examples in my previous email) are one after the other. My version of lammps is 9 Jan 2020.

Olivier

in.crack-s (1010 Bytes)

Here is a minimal code allowing to reproduce the issue. The two statements (examples in my previous email) are one after the other. My version of lammps is 9 Jan 2020.

thanks. this is indeed a bug and a bit of a puzzle to resolve. i see why it happens, but have to think about how to make this situation work. expect a fix in the next patch release.

axel.

this change should fix the bug (it does it for me)
https://github.com/lammps/lammps/pull/1853/commits/48cae2703b8ae27e9df05d3670cd19d9cc370892

I applied the patch and it now work fine with my « real » input script. Many thanks for the support and (as usual) great reactivity,

Olivier