Re: Calculate energy of a residue using NAMD energy

From: Peter Freddolino (petefred_at_umich.edu)
Date: Mon Feb 05 2018 - 00:42:43 CST

Hi Monika,
namdenergy is typically going to run through the whole trajectory that is
loaded. Your best bets would be either to load the trajectory in one frame
at a time and do all of the needed operations on that frame before deleting
it and loading the next one, OR to more directly use namd by writing an
appropriate config file for doing each water-protein pair interaction (you
could use the one produced by namdenergy as a template).
Best,
Peter

On Fri, Feb 2, 2018 at 2:05 AM, Monika Madhavi <monikamadhavi_at_gmail.com>
wrote:

> Hi Peter,
>
> Thank you very much. The code works and I get the output but then the
> output is not in the format I expected. In my code I have to two nested
> loops; one around the number of frames and the the other around the number
> of sites in the protein. I need to;
>
> for each frame (nframes),
> for each site (nsites),
> select the site atoms ($sel1)
> select a particular water molecule at the site ($sel2)
> calculate interaction potential energy
> write the value to a file
>
> I expected an output file of the format,
> frame 0 site 0 energy
> frame 0 site 1 energy
> .
> .
> frame 0 site nsites-1 energy
> frame 1 site 1 energy
> .
> .
> frame nframes site nsites energy
>
> But what I get is
> {frame 0 site 0 energy} {frame 1 site 0 energy} ...........{frame
> nframes-1 site 0 energy}
> .
> .
> {frame 0 site nsites-1 energy} {frame 1 site nsites-1
> energy}........{{frame nframes-1 site nsites-1 energy} }
>
> and this pattern multiplied by the number of frames loaded and those
> values are identical to the first chunk of values.
>
> So is it possible to limit namdenergy to calculate the energy only for the
> given atomselections, only at a given frame? And I need to use a different
> atom selection and a different frame at the next instance.
>
> Thanks.
> Monika
>
>
> On Fri, Feb 2, 2018 at 2:59 PM, Peter Freddolino <petefred_at_umich.edu>
> wrote:
>
>> In that case, you'd need to use two selections as arguments to -sel, to
>> specify the two groups that you want to calculate interactions between.
>> (eg, -sel $watsel $protsel)
>> Best,
>> Peter
>>
>> On Thu, Feb 1, 2018 at 11:51 PM, Monika Madhavi <monikamadhavi_at_gmail.com>
>> wrote:
>>
>>> Hi Peter,
>>>
>>> Thanks a lot. Yes I was an idiot. I did run with rigid water. What I
>>> want to calculate is the potential energy of a water molecule at a
>>> particular distance from a protein (more specifically, at a hydrogen
>>> bonding site).
>>>
>>> Best,
>>> Monika
>>>
>>> On Fri, Feb 2, 2018 at 1:59 PM, Peter Freddolino <petefred_at_umich.edu>
>>> wrote:
>>>
>>>> Hi Monika,
>>>> If you ran with rigid water, and you're just calculating the energy of
>>>> a single water molecule alone, it ought to be zero. All of the nonbonded
>>>> interactions are exclusions, and all of the internal interactions are zero
>>>> by definition.
>>>> Are you looking for its interaction with the surrounding system? What
>>>> is the energy that you're trying to calculate?
>>>> Thanks,
>>>> Peter
>>>>
>>>>
>>>> On Thu, Feb 1, 2018 at 7:08 PM, Monika Madhavi <monikamadhavi_at_gmail.com
>>>> > wrote:
>>>>
>>>>> Hi Onur,
>>>>>
>>>>> Thank you very much for your suggestion. Actually it worked. In the
>>>>> cluster I loaded both NAMD and VMD modules (earlier I had only VMD loaded)
>>>>> and the script worked.
>>>>>
>>>>> However, now I have a different problem. As I mentioned earlier, my
>>>>> task is to calculate the total energy of a water molecule at a particular
>>>>> frame. So this is the tcl code I used in vmd to do this.
>>>>>
>>>>> package require namdenergy
>>>>> set mol [mol new mypsf.psf type psf waitfor all]
>>>>> mol addfile mydcd.dcd type dcd first 0 last -1 waitfor all molid $mol
>>>>> set nf [molinfo $mol get numframes]
>>>>> for {set frm 0} {$frm < $nf} {incr frm} {
>>>>> set sel [atomselect $mol "index $indo $indh1 $indh2" frame $frm]
>>>>> set totalE [namdenergy -all -sel $sel -par "myparameterfile.inp"]
>>>>> puts $output $totalE
>>>>>
>>>>> In the output file, value of all the calculated energies are zero.
>>>>> This is the same if -bond or -elec is used as the energy type.
>>>>>
>>>>> Thank you.
>>>>> Best,
>>>>> Monika
>>>>>
>>>>> On Thu, Feb 1, 2018 at 10:06 PM, Onur Serçinoğlu <onursercin_at_gmail.com
>>>>> > wrote:
>>>>>
>>>>>> Hi Monika,
>>>>>>
>>>>>> *couldn't execute "": no such file or directory*
>>>>>>
>>>>>> I'm not 100% sure, but could it be that namdenergy can't locate the
>>>>>> namd2 executable? After all, the plugin utilizes namd2 exe to calculate the
>>>>>> energy of a given residue and you need to provide the path to the
>>>>>> executable if namd2 isn't in the executable search path of your system.
>>>>>>
>>>>>> When calling namdenergy, try this:
>>>>>>
>>>>>> namdenergy -all -sel $sel -par myparameterfile.inp -exe
>>>>>> pathtothenamd2exe
>>>>>>
>>>>>> Replace pathtothenamd2exe with the full path of namd2 exe in the
>>>>>> remove server.
>>>>>>
>>>>>> Best,
>>>>>> Onur
>>>>>>
>>>>>> 2018-02-01 2:25 GMT+03:00 Monika Madhavi <monikamadhavi_at_gmail.com>:
>>>>>>
>>>>>>> Hi Peter,
>>>>>>>
>>>>>>> I am using VMD installed on the cluster so I have no idea whether
>>>>>>> they have installed the latest version. I used the syntax given in the link
>>>>>>> you sent but, that's the error I get. May be I should first try the script
>>>>>>> with VMD on my personal computer so that I can track the error.
>>>>>>>
>>>>>>> Thanks anyway.
>>>>>>> Best,
>>>>>>> Monika
>>>>>>>
>>>>>>> On Wed, Jan 31, 2018 at 12:51 PM, Peter Freddolino <
>>>>>>> petefred_at_umich.edu> wrote:
>>>>>>>
>>>>>>>> Dear Monika,
>>>>>>>> namdenergy is a proper vmd plugin. Is there any reason that you're
>>>>>>>> trying to use an old downloaded version rather than using the package that
>>>>>>>> comes with vmd?
>>>>>>>> package require namdenergy
>>>>>>>> should make the text interface available. See
>>>>>>>> http://www.ks.uiuc.edu/Research/vmd/plugins/namdenergy/ for how to
>>>>>>>> use it.
>>>>>>>> Best,
>>>>>>>> Peter
>>>>>>>>
>>>>>>>> On Mon, Jan 29, 2018 at 10:22 PM, Monika Madhavi <
>>>>>>>> monikamadhavi_at_gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Dear all,
>>>>>>>>>
>>>>>>>>> I want to calculate the total energy of a specific residue (a
>>>>>>>>> water molecule) at each frame. It is suggested that this can be done using
>>>>>>>>> NAMD energy plugin. However, I would like to do the job through a script
>>>>>>>>> because my trajectory is in a remote server.
>>>>>>>>>
>>>>>>>>> I tried the following.
>>>>>>>>> obtained the code in this link and created a .tcl file called
>>>>>>>>> namdenergy.tcl in the folder where I have my script.
>>>>>>>>> http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/att-7
>>>>>>>>> 277/namdenergy.tcl
>>>>>>>>>
>>>>>>>>> Then I wrote a different tcl script with
>>>>>>>>> source namdenergy.tcl
>>>>>>>>> namd energy -all -sel $sel -par myparameterfile.inp
>>>>>>>>>
>>>>>>>>> Here I specified the parameter file because my parameter file is
>>>>>>>>> different from the common charmm parameter file. However, I am getting the
>>>>>>>>> following error
>>>>>>>>>
>>>>>>>>> invalid command name "::FinderTool::find"
>>>>>>>>>
>>>>>>>>> I would be grateful for a guidence to correctly use the namd
>>>>>>>>> energy to calculate energies of some selected atomselections.
>>>>>>>>>
>>>>>>>>> Thank you.
>>>>>>>>> Best,
>>>>>>>>> Monika
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> W.A.Monika Madhavi
>>>>>>>>> Lecturer (Probation),
>>>>>>>>> Department of Physics,
>>>>>>>>> University of Colombo.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> W.A.Monika Madhavi
>>>>>>> Lecturer (Probation),
>>>>>>> Department of Physics,
>>>>>>> University of Colombo.
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> W.A.Monika Madhavi
>>>>> Lecturer (Probation),
>>>>> Department of Physics,
>>>>> University of Colombo.
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> W.A.Monika Madhavi
>>> Lecturer (Probation),
>>> Department of Physics,
>>> University of Colombo.
>>>
>>
>>
>
>
> --
> W.A.Monika Madhavi
> Lecturer (Probation),
> Department of Physics,
> University of Colombo.
>

This archive was generated by hypermail 2.1.6 : Tue Dec 31 2019 - 23:19:40 CST