[gmx-users] Generate many random configurations

Justin Lemkul jalemkul at vt.edu
Thu Mar 6 14:30:44 CET 2014



On 3/6/14, 8:18 AM, rankinb wrote:
> I have figured out to accomplish what I want by writing a bash script.
> However, one thing I am still struggling with is determining how to
> concatenate the resulting configurations.  There are two possible solutions:
> 1) concatenate multiple .gro files that have been generated at the end or 2)
> concatenate after each iteration.  I like the idea of the second option.
> Does anyone have any suggestions as to how to do this?
>

I think option (1) would be much faster and cleaner, involving no intermediate 
files and cutting out a lot of steps.  If you have conf.*.gro, where each has an 
index for the 1000 steps (e.g. conf.0.gro, conf.1.gro, ...), then a simple:

cat `ls -rt conf.*.gro` > full.gro

is all you need.  With option (2), you have to do something like:

if [ $i -eq 0 ]
then
	# do no concatenation
	mv conf.0.gro full.gro
else
	cat full.gro conf.$i.gro > tmp.gro
	rm full.gro
	mv tmp.gro full.gro
fi

The if-structure is within the loop and is executed every cycle.  I imagine for 
1000 iterations, that might slow down a fair bit, especially when full.gro 
starts to get large and you are using it in a concatenation step many times.

Note that I haven't tested that script snippet, so don't just accept it blindly :)

-Justin

-- 
==================================================

Justin A. Lemkul, Ph.D.
Ruth L. Kirschstein NRSA Postdoctoral Fellow

Department of Pharmaceutical Sciences
School of Pharmacy
Health Sciences Facility II, Room 601
University of Maryland, Baltimore
20 Penn St.
Baltimore, MD 21201

jalemkul at outerbanks.umaryland.edu | (410) 706-7441
http://mackerell.umaryland.edu/~jalemkul

==================================================


More information about the gromacs.org_gmx-users mailing list