git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1691 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
26
tools/python/dumpsort.py
Executable file
26
tools/python/dumpsort.py
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/local/bin/python
|
||||
|
||||
# Script: dumpsort.py
|
||||
# Purpose: sort the snapshots in a LAMMPS dump file by atom ID
|
||||
# Syntax: dumpsort.py oldfile N newfile
|
||||
# oldfile = old LAMMPS dump file in native LAMMPS format
|
||||
# N = column # for atom ID (usually 1)
|
||||
# newfile = new sorted LAMMPS dump file
|
||||
# Author: Steve Plimpton (Sandia), sjplimp at sandia.gov
|
||||
|
||||
import sys,os
|
||||
path = os.environ["LAMMPS_PYTHON_TOOLS"]
|
||||
sys.path.append(path)
|
||||
from dump import dump
|
||||
|
||||
if len(sys.argv) != 4:
|
||||
raise StandardError, "Syntax: dumpsort.py oldfile N newfile"
|
||||
|
||||
oldfile = sys.argv[1]
|
||||
ncolumn = int(sys.argv[2])
|
||||
newfile = sys.argv[3]
|
||||
|
||||
d = dump(oldfile)
|
||||
d.map(ncolumn,"id")
|
||||
d.sort()
|
||||
d.write(newfile)
|
||||
Reference in New Issue
Block a user