[gmx-users] Generate many random configurations

Tsjerk Wassenaar tsjerkw at gmail.com
Thu Mar 6 15:41:04 CET 2014


Hey :)

2.:

for ((i=0; i<$n; i++))
do
  genbox ... -o tmp.gro
  cat tmp.gro >> total.gro
  rm tmp.gro
done

That will not be slower, and it requires less disk space.

Cheers,

Tsjerk


On Thu, Mar 6, 2014 at 2:29 PM, Justin Lemkul <jalemkul at vt.edu> wrote:

>
>
> 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
>
> ==================================================
>
> --
> Gromacs Users mailing list
>
> * Please search the archive at http://www.gromacs.org/
> Support/Mailing_Lists/GMX-Users_List before posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> send a mail to gmx-users-request at gromacs.org.
>



-- 
Tsjerk A. Wassenaar, Ph.D.


More information about the gromacs.org_gmx-users mailing list