 # [lammps-users] Help on modifying LAMMPS

Hi, I met two problems when I trying to modify LAMMPS to meet my research need, could you help me on these two issues? thanks a lot!

1. I need to get the number density profile (average number density along the x direction of the simulation box), it is calculated by averaging each types of atoms coordination. for example, every timestep, I know the x coordination of Carbon atom and Oxygen atom, so I divide the box length (xprd) by 100, counting the number of each type of atoms in the 100 sub shells, then plot the #shells V.S number density of these two types of atoms.
My basic idea: I can use “compute attribute/atom x” to get x coordination of each atoms at each step, then which program should I modify to get the desired profile? how can I get the averaged density profile?

2. I want to calculate average x direction force on a shell of atoms, so I use “compute attribut/atom fx” to get the force on each atoms at each step, but how can I average it along my simulation? when I use “fix ave/atom”, the core memory overflowed. same question as above, which program should I modify?

I think LAMMPS has all the information I need, but my problem now is how to get them, since I am not very familiar with C++ programming, it’s a little bit hard for me to modify the program (I’ve made it on the old fortran version, but it’s hard to start with the C++ one), please give me a hand on this, appreciate your kind help!

Huayun,

For 1) you can use the fix ave/spatial command. I am not sure whether your shell in (2) changes in time, but you may take a look at fix ave/atom.

Hope this helps,
vale

As vale said, you can you fix ave/spatial for your first question.
There is a also a compute coord/atom which will compute
coordination numbers for a group of atoms. So you should
be able to average the values for the two kinds of atoms
separately.

For Q2, there is no longer a compute attribute/atom in
the current version. You should be able to use fix ave/atom
directly to average the force on a group of atoms.
Then you can sum that and/or average it over time with
either compute sum or fix ave/time.

Steve