Thanks for your comment. I have the script below. In my simulation, I’m studying the interactions between an ion and other atoms/molecules in the system. The entire system is charge neutral.
units real
dimension 3
boundary p p p
atom_style full
neigh_modify delay 0 every 1 check yes exclude type 2 2 exclude type 6 6 #exclude type 1 2
processors * * *
variable timecoef equal 1.00
variable T equal 300
variable thermo_itv equal 50
variable dump_itv equal 50
variable dumpvel_itv equal 50
variable equi_steps equal 100000
variable flow_stepsA equal 40000
variable seed equal 2012
#variable fid equal 30604
atom definition:
read_data ./…/…/Neutral_1M_1nm_chloride_drag.data #change
###############################################
group definition:
group cnt type 2 6 # silica
group oxygen type 3
group hydrogens type 1
group sod type 4
group anion type 5 # CLA
group ions type 4 5
group water type 1 3
group fluidmols type 1 3 4 5
group theion id 78137 #chloride #change
group otherions id 58639:59104 77894:78137 #other ions #change
#################################################
force fields
variable rcF equal 12.0
pair_style lj/cut/coul/long {rcF} {rcF}
pair_coeff 1 1 0.0 0.0 # H
pair_coeff 2 2 0.054 3.47 # O of SiO2
pair_coeff 3 3 0.15539 3.1656 # O of water
pair_coeff 4 4 0.3526 2.159 # Na
pair_coeff 5 5 0.0128 4.83 # anion CL
pair_coeff 6 6 0.093 4.15 # Si
pair_modify mix arithmetic
############################################
kspace_style pppm 1e-05
dielectric 1.0
bond_style harmonic
bond_coeff 1 450.0 0.9572
angle_style harmonic
angle_coeff 1 100.0 104.52
velocity cnt set 0.0 0.0 0.0 units box
fix 5 cnt setforce 0.0 0.0 0.0
minimization
#min_style sd
#minimize 1.0e-4 1.0e-5 1000 10000
#print “Min”
###############################################3
reset_timestep 0
timestep {timecoef}
compute fluidtemp fluidmols temp
#velocity fluidmols create {T} ${seed} dist gaussian temp fluidtemp mom yes rot yes units box
######################################################################################
fix 1 water shake 0.0001 20 0 b 1 a 1
fix 3 fluidmols nvt temp 300 300 100.0
######################################################################################################
external bias
#fix 4 all efield 0.0 0.0 0.000494 #L=101.2A 1lammps=V/A*101.2A=101.2V 0.7084
####################################################################################################
#compute energy all pe/atom pair kspace
#compute coord all coord/atom 3.3 2 # oxygen rdf distance
#dump 5 solutions custom 1000 pe.txt mol id type c_energy c_coord
#dump 55 oxygen custom 1000 coord.txt mol id type c_coord
dump 6 theion custom 100 rerun.lammpstrj id type z fz #100 follows the original simulation dumping frequency
#######################################################################################################
##group/group
compute ion_water_short_range theion group/group water kspace no
compute ion_water_long_range theion group/group water kspace yes
variable ion_water_short_range_fz equal c_ion_water_short_range[3]
variable ion_water_long_range_fz equal c_ion_water_long_range[3]
compute ion_membr_short_range theion group/group cnt kspace no
compute ion_membr_long_range theion group/group cnt kspace yes
variable ion_membr_short_range_fz equal c_ion_membr_short_range[3]
variable ion_membr_long_range_fz equal c_ion_membr_long_range[3]
compute ion_ion_short_range theion group/group otherions kspace no
compute ion_ion_long_range theion group/group otherions kspace yes
variable ion_ion_short_range_fz equal c_ion_ion_short_range[3]
variable ion_ion_long_range_fz equal c_ion_ion_long_range[3]
compute ion_all_short_range theion group/group all kspace no
compute ion_all_long_range theion group/group all kspace yes
variable ion_all_short_range_fz equal c_ion_all_short_range[3]
variable ion_all_long_range_fz equal c_ion_all_long_range[3]
fix group_group_short_range_fz all print 100 “{ion_water_short_range_fz} {ion_membr_short_range_fz} {ion_ion_short_range_fz} {ion_all_short_range_fz}” file fz_group_group_short_range.txt #100 follows
the original simulation dumping frequenc
fix group_group_long_range_fz all print 100 “{ion_water_long_range_fz} {ion_membr_long_range_fz} {ion_ion_long_range_fz} {ion_all_long_range_fz}” file fz_group_group_long_range.txt
########################################################################################################i
#reset_timestep 0
#thermo ${thermo_itv}
#thermo_style multi
rerun ./…/all.lammpstrj dump x y z #is the name the same