Hi everyone,
I have a simulation box filled with polymer molecules. However, I placed/fixed a ZnO nanoparticle at the center of the box, which overlaps with several polymer atoms. Naturally, when I run the simulation using this data file, the NPT run terminates. I suspect this is due to overlapping atomic coordinates.
Now, I want to remove the polymer atoms - and their entire corresponding polymer chain - if they overlap with the ZnO nanoparticle. Is there a LAMMPS command, such as delete_atoms
, that can help with this? This would create a void in the polymer matrix for the ZnO nanoparticle (which is kept fixed at that position in the box) so that its atoms do not overlap with those of the polymer.
Additionally, I want to print out the polymer atoms that remain after removal and verify that the ZnO nanoparticle atoms are still intact by printing their atom indices. I want to understand what’s going wrong.
ERROR: Velocity command with no atoms existing (src/velocity.cpp:57)
Last command: velocity nanoparticle set 0.0 0.0 0.0
Below is my Lammps script
echo screen
variable dcdfreq index 500
variable outputname index step5_production_npt
units real
boundary p p p
newton off
pair_style lj/charmmfsw/coul/long 10 12
pair_modify mix arithmetic
kspace_style pppm 1e-6
atom_style full
bond_style harmonic
angle_style charmm
dihedral_style charmmfsw
improper_style harmonic
special_bonds charmm
timestep 1.0
=== Read initial data ===
read_data merged.data
=== Define ZnO nanoparticle group ===
group nanoparticle id 14289:14462
=== Define polymer group before deletion ===
group polymer subtract all nanoparticle
variable zno_before equal count(nanoparticle)
print “ZnO atom count before deletion: ${zno_before}”
variable polymer_before equal count(polymer)
print “Polymer atom count before deletion: ${polymer_before}”
=== Delete overlapping polymer atoms and their molecules ===
delete_atoms overlap 2.5 polymer nanoparticle mol yes
=== Redefine polymer group after deletion ===
group polymer subtract all nanoparticle
variable polymer_after equal count(polymer)
print “Polymer atom count after deletion: ${polymer_after}”
variable zno_check equal count(nanoparticle)
print “ZnO atom count after deletion: ${zno_check}”
=== Output groups for verification ===
group polymer_left union polymer
group zno_left union nanoparticle
dump dump_polymer polymer_left custom 1 polymer_left.dump id mol type x y z
dump dump_zno zno_left custom 1 zno_left.dump id mol type x y z
=== Neighbor and force settings ===
neighbor 2 bin
neigh_modify delay 5 every 1 check yes
comm_modify vel yes
=== Apply fixes ===
velocity nanoparticle set 0.0 0.0 0.0
fix freezeZnO nanoparticle setforce 0.0 0.0 0.0
velocity polymer create 500 12345 dist gaussian
fix 1 polymer npt temp 500 500 100.0 iso 1.0 1.0 1000.0
=== Output ===
thermo ${dcdfreq}
thermo_style custom step time xlo xhi ylo yhi zlo zhi etotal pe ke temp press ebond eangle edihed eimp evdwl ecoul elong temp vol
dump 1 all atom 100 step5_production_npt.lammpstrj
dump 7 all custom 1000 step5_production_npt.xyz id mol type x y z xu yu zu
dump_modify 7 sort id
run 400000
=== Save final output ===
write_dump all custom {outputname}.dump id type x y z vx vy vz ix iy iz write_data {outputname}.data
My input merged.data file is in the following format: it contains 94 polymer chains, each consisting of 152 atoms (corresponding to 10 monomers), with atom IDs ranging from 1 to 14,288. Atom IDs from 14,289 to 14,462 correspond to the ZnO nanoparticle atoms.
Atoms
1 1 8 -0.27000000000000002 19.674173733527343 49.352861146467873 16.510434323073341
2 1 3 8.9999999999999997E-002 19.699819226427344 50.161802107967873 15.708286921073340
3 1 3 8.9999999999999997E-002 18.871962013827343 48.586732839067871 16.248055911973339
4 1 3 8.9999999999999997E-002 19.437190105227344 49.815609037867873 17.524461173973339
5 1 5 -0.10000000000000001 21.162531118327344 48.584779338767873 16.580801409573340
6 1 4 0.95999999999999996 21.130728204727344 47.564439013967871 17.925608866873340
7 1 10 -0.48999999999999999 20.811489601727345 48.316466442767869 19.101638965173340
8 1 9 -0.63000000000000000 21.361255338427341 46.355758414567873 17.914511984873339
9 1 8 -1.0000000000000000E-002 20.727895422127343 47.691409607167870 20.457747986873340
10 1 3 8.9999999999999997E-002 21.779368768727345 47.435173055767869 20.840942243473339
11 1 3 8.9999999999999997E-002 20.230666354927344 48.415315704167874 21.196930774973339
12 1 3 8.9999999999999997E-002 20.106042460827343 46.727155182367873 20.411126344873338
13 1 8 -0.27000000000000002 21.440079202427341 47.601058922667875 15.244064764273340
14 1 3 8.9999999999999997E-002 21.373752719627344 48.210561138567869 14.286441598873340
15 1 3 8.9999999999999997E-002 22.472547738727343 47.126745228067868 15.336962043673340
16 1 3 8.9999999999999997E-002 20.642451314227344 46.784232908567873 15.227309628873339
17 2 7 -0.17999999999999999 22.450417253327345 49.626608111867874 16.895569199373341
18 2 2 8.9999999999999997E-002 22.359280119527345 49.960300429567873 17.988808675873340
19 2 2 8.9999999999999997E-002 23.403642292027342 48.994989323867870 16.763757655173340
20 2 5 -0.10000000000000001 22.638663139527345 51.007629491367872 15.965023520873340
21 2 4 0.95999999999999996 21.526847115127346 52.183815471767872 16.409929305273341
22 2 10 -0.48999999999999999 20.868294078427343 51.850708632467871 17.632167493273339
23 2 9 -0.63000000000000000 21.303915798127342 53.207895125967873 15.760656617773339
.
.
.
14288 10 3 8.9999999999999997E-002 52.869834549927347 23.968732724467870 59.978864738973343
14289 1 11 1.2170000000000001 35.250000000000000 33.876359447479246 34.600458110809328
14290 1 11 1.2170000000000001 35.250000000000000 32.000359447479248 37.200458110809329
14291 1 12 -1.2170000000000001 35.250000000000000 33.876359447479246 37.822458110809329
14292 1 11 1.2170000000000001 35.250000000000000 33.876359447479246 39.800458110809323
.
.
.
14460 1 11 1.2170000000000001 41.750000000000000 45.134359447479248 39.800458110809323
14461 1 12 -1.2170000000000001 41.750000000000000 43.258359447479251 40.422458110809330
14462 1 11 1.2170000000000001 41.750000000000000 43.258359447479251 42.400458110809325