[lammps-users] compute chunk/atom molecule, bin/sphere. Ndensity


I have a difficulty in calculating and asking for advice from the experts.

My model is nanofluid, which includes water molecules and nanoparticles. Now, I want to calculate the number density of water molecules on the surface of the nanoparticel, starting from the surface of the nanoparticle, as the distance increases.

I want to output the result is similar to “compute chunk/atom bin/sphere”. How to I implement it??? Please help me, thank you very much.
For now, I look at the manual and use the following command:

echo screen
units real
dimension 3
boundary p p p

region aa block -30 110 -30 110 -30 70
atom_style full
atom_modify id yes map array
bond_style harmonic
angle_style harmonic
dihedral_style harmonic
improper_style cvff
kspace_style pppm 1.0e-4
pair_style lj/cut/coul/long 10 12

read_data data.681.218_msGnH1 extra/atom/types 2 extra/bond/types 1 extra/angle/types 1
molecule spce spce.mol offset 5 6 12 13 1
lattice sc 4
create_atoms 0 region aa mol spce 12346 units lattice
change_box all x final -30 110 y final -30 110 z final -30 70 units box

mass 1
mass 2
mass 3
mass 4
mass 5
mass 6 15.9994
mass 7 1.008 #h
set type 6 charge -0.8472
set type 7 charge 0.4236
group G1 type 1:5
group G2 type 6:7
delete_atoms overlap 2.5 G2 G1 mol yes compress yes

neighbor 2.0 bin
neigh_modify delay 0 every 1 check yes
minimize 1.0e-4 1.0e-6 1000 1000
min_modify dmax 0.2
min_style cg #共轭梯度法
dump 1 all custom 10000 water-np-min.lammpstrj id type x y z mass element q
dump_modify 1 sort id element X X X X o h

timestep 1
fix 2 all npt temp 298 298 100 iso 1 1 1000 #drag 1
variable density equal mass(G2)10/(6.0221417930vol)
thermo 1000
thermo_style custom step temp press vol etotal epair emol pxx pyy pzz pe density v_density
restart 1000 restart.water-np-npt1ns1 restart.water-np-npt1ns2
run 2000

unfix 2
reset_timestep 0
timestep 1
compute chunk1 G2 chunk/atom molecule region aa nchunk once ids once compress yes
fix 3 G1 spring/chunk 100 chunk1 com1
fix 4 G2 ave/chunk 100 10 1000 chunk1 density/number file Ndensity.txt
run 20000

i don’t see an efficient and reasonably simple way to do this during a simulation as you would have to track the surface of your nanoparticles and then compute the normal to it and then bin atoms according to distance and normalize by volume. even if you would may some simplifications about the geometry of those nanoparticles. the LAMMPS script interface doesn’t have the flexibility and the syntactical power to do such operations and you are severely limited by the domain decomposition and thus only having some of the particles present on each processor when running in parallel.

on the other hand, it would be rather straightforward to do this analysis in post-processing from a trajectory file with a custom script, e.g. written in python or matlab or similar.
that script would not have to be parallelized over domains and can look up particles easily across periodic boundaries as far out as needed. since adjacent trajectory frames are highly correlated, it would not require writing out coordinates very frequently (anything more frequent than every 1ps is going to suffer from limited statistical relevance).