From: Ajasja Ljubetič (ajasja.ljubetic_at_gmail.com)
Date: Thu Mar 30 2017 - 02:54:05 CDT

Actually there is an existing package exactly for this purpose:

https://github.com/radakb/pynamd

You would do:

import pynamd

log = pynamd.NamdLog("00001.log", "00002.log")
#info contains information about time-steps, temperatures etc...log.info

log.info['TEMP']log.info['TS']

Best,
Ajasja
On 30 March 2017 at 09:18, Ashar Malik <asharjm_at_gmail.com> wrote:

> I think there is a way in which you can export the plot value to file -
> but I use another way. I take the output file from my simulation and my
> hardcoded python script to get all the values out which I can process
> later.
>
> Script::
>
> #!/usr/bin/python
>
> import sys,os
>
> a_ = sys.argv[1]
>
> if a_.split('.')[-1] != 'log':
> raise TypeError('Hardcoded to work for NAMD style log files. File should
> be an MD stdout - with a .log extension')
> if os.path.isfile(a_.split('.log')[0] + '_energy.dat'):
> raise ValueError('Previous run left some files - you sure you know what
> you are doing :: delete that and retry')
>
> g_ = open(a_.split('.log')[0] + '_energy.dat','a')
>
> count_T = 0
> with open(a_,'r') as f_:
> for line in f_:
> if line[0:6] == "ETITLE":
> count_T += 1
> if count_T == 1:
> g_.write(line)
> if line[0:6] == "ENERGY":
> g_.write(line)
>
> g_.close()
>
> This will generate a file with just numbers of interest. It will be a
> formatted file with all values extracted from the log.
>
> You can then couple the above script with something like this::
>
> d = np.genfromtxt(a_.split('.log')[0] + '_energy.dat',skip_header=1,
> usecols=[1,???])
>
> replacing the ??? with your column of interest.
>
> e.g from the file created if you are looking for temperature - it would be
> column 12 ---
>
> d would then be a 2 column array - with the first holding step values and
> second holding your variable of interest.
>
> The script takes an input - so make it an executable with chmod
>
> and run it like this
>
> ./script_file_name md.log
>
> The export function from the plot maybe easier but this is what I did when
> I had to do it.
>
> Let me know if this doesn't work. Hope this helps.
>
> Best,
> /A
>
>
>
>
> On Thu, Mar 30, 2017 at 7:21 PM, Monika Madhavi <monikamadhavi_at_gmail.com>
> wrote:
>
>> Dear all,
>>
>> I know I can plot the properties of the system with time using "NAMD
>> plot" in VMD. I want to know is it possible to extract data points of these
>> plots from the log file (e.g temperature values with the time step) using
>> VMD. I would be grateful for any help.
>>
>> Thank you.
>> Best regards,
>> Monika
>>
>> --
>> W.A.Monika Madhavi
>> Lecturer (Probation),
>> Department of Physics,
>> University of Colombo.
>>
>
>
>
> --
> Best,
> /A
>