[gmx-users] question

jkrieger at mrc-lmb.cam.ac.uk jkrieger at mrc-lmb.cam.ac.uk
Tue Jan 21 13:04:59 CET 2014


Here is my python script as promised:

# select filenames for reading and writing
fr = open('chainA_T78-waters_index.ndx','r')
fw = open('chainA_T78-waters_counts.xvg','w')

line = fr.readline()
t = line.split('_')[-1].split()[0]
c = 0

for line in fr:
    if line.find('[') == -1:
        c += len(line.split())
    else:
        fw.write(t + ' ' + str(c) + '\n')
        t = line.split('_')[-1].split()[0]
        c = 0

fw.write(t + ' ' + str(c) + '\n')

fr.close()
fw.close()

It reads in a file from g_select that looks as follows
[ chain_A_T78_waters_0.000 ]
45170 45172 55565 55566 55567 217685 217686 217688 217689 217690 217709
217710 217711 355868 355870
380249 380250 380251
[ chain_A_T78_waters_2.000 ]
55565 55566 55567 217686 217688 217689 217690 217709 217710 217711 289964
355868 355870 380249 380250
380251
[ chain_A_T78_waters_4.000 ]
45170 45171 45172 55565 55566 55567 217688 217689 217690 217709 217710
217711 355869 367615 380249
380250 380251

and write out a file with counts that looks like this that xmgrace can read
0.000 18
2.000 16
4.000 17

Best wishes
James

> I have no experience with g_rdf but that looks like it might work if you
> only want the average number. Anyhow I'm writing the script to count my
> g_select output now and I'll send it to you soon. This script should allow
> the number to be plotted over time.
>
> Best wishes
> James
>
>> Dear Jkrieger
>>
>> Thanks for your attention.
>>
>> I have index file containing 2 group which are my interest.
>>
>> Unfortunately, I am beginner in scripting and I have no long time.
>> I should do this analysis as soon as possible. Please if you write such
>> a
>> script, send me it.
>>
>> Is g_rdf -cn appropriate for my case?
>>
>> Best wishes
>> --
>> 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.
>>
>
>
> --
> 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.
>




More information about the gromacs.org_gmx-users mailing list