Lammps delete_atoms

Hi,

I am trying to keep below atom IDs in below range and delete rest and then need to get a new data file:
435890 to 435935,
435954 435955 435956

I used below script .
But I don’t think it works.
Please advice

log atom.delete
units real
newton off
neigh_modify delay 5 every 1 one 2500
boundary p p p
atom_style full
bond_style harmonic
angle_style harmonic
dihedral_style opls
special_bonds lj 0.0 0.0 0.5
pair_style lj/cut 12.0
#kspace_style pppm 1.0e-4

read_data old.data

Group atoms with IDs from 435890 to 435935

group group1 id 435890:435935

Group atoms with specific IDs

group group2 id 435954 435955 435956

Combine into one group to keep

group keep_atoms union group1 group2

Group all atoms

group all_atoms type > 0 # avoids the error; selects all atoms with a type > 0

Subtract keep_atoms from all_atoms

group delete_atoms subtract all_atoms keep_atoms

Delete the unwanted atoms

delete_atoms group delete_atoms compress yes bond yes mol yes

Dump

restart 2 restart.1 restart.2
dump 8 all custom 25000 new.dump id type xs ys zs ix iy iz mol
dump_modify 8 sort id

Write cleaned data file

write_data New.data

run 200
~

Why do you think so?

It does not completely create the new data file.I am unable figure out the issue

I don’t understand what you mean. Please elaborate and be more specific.

When I ran the script,the data file is created but it has coefficients but does not have atoms,bonds,angles and dihedrals.The data file is in complete.

…and while you are at it, please also have a look at Please Read This First: Guidelines and Suggestions for posting LAMMPS questions
and follow the recommendations for how to format message and which information to provide.
Your post is hard to read because of just cut-n-paste and not properly formatting it and lots of important information is missing.

This is impossible to debug from remote without being able to reproduce it and seeing what output your get. There could be warnings you are ignoring or errors.

I would suggest you start by writing out the new data file without deleting any atoms and see if that contains everything that is needed.
Then you can test with deleting just a few atoms and check if that is doing as expected and then grow from that.

This whole thing is something that should be straightforward to resolve on your own.
Just don’t try to do all at once, but build your skills in steps.

It may be helpful to start with some of the examples that LAMMPS provides, e.g. the peptide example.

Please also note that this is often helped by visualization. E.g. you can check which are the atoms you are deleting or hide them to see what should remain.

I visualized and selected the atoms need to delete.Also I checked the input data file it seems fine.
Below is the lammps out file;
LAMMPS (2 Aug 2023 - Update 4)
using 1 OpenMP thread(s) per MPI task
using multi-threaded neighbor list subroutines
Reading data file …
orthogonal box = (-95.8406 -95.8406 -95.8406) to (95.8406 95.8406 95.8406)
4 by 4 by 5 MPI processor grid
WARNING: Pair style lj/cut/coul/long/gpu in data file differs from currently defined pair style lj/cut/omp (src/read_data.cpp:701)
reading atoms …
557192 atoms
scanning bonds …
4 = max bonds/atom
scanning angles …
14 = max angles/atom
scanning dihedrals …
34 = max dihedrals/atom
reading bonds …
589034 bonds
reading angles …
1037028 angles
reading dihedrals …
1640748 dihedrals
Finding 1-2 1-3 1-4 neighbors …
special bond factors lj: 0 0 0.5
special bond factors coul: 0 0 0
4 = max # of 1-2 neighbors
8 = max # of 1-3 neighbors
18 = max # of 1-4 neighbors
22 = max # of special neighbors
special bonds CPU = 2.797 seconds
read_data CPU = 12.385 seconds
46 atoms in group group1
3 atoms in group group2
49 atoms in group keep_atoms
557192 atoms in group all_atoms
557143 atoms in group delete_atoms
WARNING: Ignoring ‘compress yes’ for molecular system (src/delete_atoms.cpp:140)
Deleted 557192 atoms, new total = 0
Deleted 589034 bonds, new total = 0
Deleted 1037028 angles, new total = 0
Deleted 1640748 dihedrals, new total = 0
System init for write_data …
Generated 78 of 78 mixed pair_coeff terms from geometric mixing rule
Last active /omp style is dihedral_style opls/omp
Neighbor list info …
update: every = 1 steps, delay = 5 steps, check = yes
max neighbors/atom: 2500, page size: 100000
master list distance cutoff = 14
ghost atom cutoff = 14
binsize = 7, bins = 28 28 28
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut/omp, perpetual
attributes: half, newton off, omp
pair build: half/bin/newtoff/omp
stencil: full/bin/3d
bin: standard
WARNING: No fixes with time integration, atoms won’t move (src/verlet.cpp:60)
Generated 78 of 78 mixed pair_coeff terms from geometric mixing rule
Last active /omp style is dihedral_style opls/omp
Setting up Verlet run …
Unit style : real
Current step : 0
Time step : 1
Per MPI rank memory allocation (min/avg/max) = 23.99 | 23.99 | 23.99 Mbytes
Step Temp E_pair E_mol TotEng Press
0 0 0 0 0 0
200 0 0 0 0 0
Loop time of 0.311586 on 80 procs for 200 steps with 0 atoms

Performance: 55.458 ns/day, 0.433 hours/ns, 641.876 timesteps/s, 0.000 atom-step/s
98.3% CPU use with 80 MPI tasks x 1 OpenMP threads

MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total

Pair | 0.00010459 | 0.00011821 | 0.00016127 | 0.0 | 0.04
Bond | 0.00028302 | 0.00031099 | 0.00035167 | 0.0 | 0.10
Neigh | 0.0027903 | 0.0029363 | 0.0033696 | 0.2 | 0.94
Comm | 0.0020293 | 0.0022588 | 0.0024115 | 0.2 | 0.72
Output | 0.30528 | 0.30578 | 0.30591 | 0.0 | 98.14
Modify | 0.00011572 | 0.0001329 | 0.00023253 | 0.0 | 0.04
Other | | 5.114e-05 | | | 0.02

Nlocal: 0 ave 0 max 0 min
Histogram: 80 0 0 0 0 0 0 0 0 0
Nghost: 0 ave 0 max 0 min
Histogram: 80 0 0 0 0 0 0 0 0 0
Neighs: 0 ave 0 max 0 min
Histogram: 80 0 0 0 0 0 0 0 0 0

Total # of neighbors = 0
Neighbor list builds = 100
Dangerous builds = 0
Total wall time: 0:00:13

Check your group definitions. You are deleting all but 49 atoms. Is that what you want?

Beyond that, my previous assessment and recommendation applies. You should be able to sort this out on your own, if you do it in a careful, systematic, and methodical way.

Yes i need to keep 49 atoms and delete rest

Then it should be easy to debug this.

49 atoms are so few, it could be done manually with a decent text editor.

Thanks