From 0d0fd0afac96790d2d0eaaa98439e635e60930ce Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 30 Sep 2010 21:24:52 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4913 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- examples/README | 1 + src/Makefile | 2 +- tools/python/neb1.py | 54 ++++++++++++++++++++++++++++++++++++++++++++ tools/python/neb2.py | 31 +++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100755 tools/python/neb1.py create mode 100755 tools/python/neb2.py diff --git a/examples/README b/examples/README index 0af97f5d38..e476df30f4 100644 --- a/examples/README +++ b/examples/README @@ -39,6 +39,7 @@ melt: rapid melt of 3d LJ system micelle: self-assembly of small lipid-like molecules into 2d bilayers min: energy minimization of 2d LJ melt msst: MSST shock dynamics +neb: nudged elastic band (NEB) calculation for barrier finding nemd: non-equilibrium MD of 2d sheared system obstacle: flow around two voids in a 2d channel peptide: dynamics of a small solvated peptide chain (5-mer) diff --git a/src/Makefile b/src/Makefile index 7b32442c39..686d4a53d7 100755 --- a/src/Makefile +++ b/src/Makefile @@ -14,7 +14,7 @@ OBJ = $(SRC:.cpp=.o) # Package variables PACKAGE = asphere class2 colloid dipole dsmc gpu granular \ - kspace manybody meam molecule opt peri poems prd reax shock xtc + kspace manybody meam molecule opt peri poems reax replica shock xtc PACKUSER = user-ackland user-atc user-cd-eam user-cg-cmm user-eff \ user-ewaldn user-imd user-smd diff --git a/tools/python/neb1.py b/tools/python/neb1.py new file mode 100755 index 0000000000..065f511e2e --- /dev/null +++ b/tools/python/neb1.py @@ -0,0 +1,54 @@ +#!/usr/local/bin/python + +# combine multiple NEB dump files into 1 dump file +# Syntax: neb1.py dfinal itype dfile1 dfile2 ... +# dfinal = new combined dump file +# itype = atoms of this type are added to each snapshot +# dfile1, dfile2, ... = NEB output dump files from each replica + +# assumes all N input files have same # of snapshots +# for each snapshot time: +# all dfile1 atoms are added to dfinal +# only atoms of itype in dfile2,...,dfileN are added to dfinal + +import sys,os +from dump import dump +if not globals().has_key("argv"): argv = sys.argv + +if len(argv) < 5: + print "Syntax: neb1.py dfinal itype dfile1 dfile2 ..." + sys.exit() + +dfinal = argv[1] +itype = int(argv[2]) +files = argv[3:] + +tstr = "$type == %d" % itype + +ntotal = 0 +d = [] +for file in files: + one = dump(file) + one.sort() + if d: + one.aselect.test(tstr) + nnew = one.snaps[0].nselect + idvec = range(ntotal+1,ntotal+nnew+1) + one.setv("id",idvec) + ntotal += one.snaps[0].nselect + d.append(one) + +if os.path.exists(dfinal): os.remove(dfinal) + +times = d[0].time() +for time in times: + d[0].tselect.one(time) + i = d[0].findtime(time) + hold = d[0].snaps[i].nselect + d[0].snaps[i].nselect = ntotal + d[0].write(dfinal,1,1) + d[0].snaps[i].nselec = hold + for one in d[1:]: + one.tselect.one(time) + one.aselect.test(tstr) + one.write(dfinal,0,1) diff --git a/tools/python/neb2.py b/tools/python/neb2.py new file mode 100755 index 0000000000..3cf6de09e1 --- /dev/null +++ b/tools/python/neb2.py @@ -0,0 +1,31 @@ +#!/usr/local/bin/python + +# combine final snapshots from multiple NEB dump files into 1 dump file +# Syntax: neb2.py dfinal dfile1 dfile2 ... +# dfinal = new combined dump file +# dfile1, dfile2, ... = NEB output dump files from each replica, +# in correct order + +# for M replicas, final snapshots are renumbered in final file from 1 to M + +import sys,os +from dump import dump +if not globals().has_key("argv"): argv = sys.argv + +if len(argv) < 5: + print "Syntax: neb2.py dfinal dfile1 dfile2 ..." + sys.exit() + +dfinal = argv[1] +files = argv[2:] + +if os.path.exists(dfinal): os.remove(dfinal) + +n = 1 +for file in files: + one = dump(file) + t = one.time() + one.tselect.one(t[-1]) + one.snaps[-1].time = n + one.write(dfinal,1,1) + n += 1