From: Paweł Kędzierski (pawel.kedzierski_at_pwr.edu.pl)
Date: Thu Jan 16 2020 - 03:36:20 CST

W dniu 15.01.2020 o 20:23, Ackad, Edward pisze:
> Hi all,
> I'm trying to write a python script with minimal dependencies and that
> uses namdEneriy to calculate the energy of a dcd file. Is there a
> better way than externally calling vmd to load the psf+dcd and call
> namdEnergy from within vmd?
Have a look at the NAMD input script generated by NAMD Energy plugin and
generate something similar in your Python code. It's minimalistic and
the keywords are human readable, but of course you may find their
description in NAMD User Guide in case of doubts. Then, run NAMD from
Python. You will depend on NAMD only and also it will be much easier to
debug than Python->VMD->plugin->NAMD approach. You will need also to
parse the namd output yourself but this should be as easy as:

for line in open('Eint.log'):
     if line.startswith('ENERGY:'):
         energy = float(line.split()[13]) # POTENTIAL
         ...

HTH,
Pawel
>
> Thanks!
> Eddie
>
> --
> _________________________________________________________
> Edward Ackad, Ph.D <http://www.siue.edu/%7Eeackad>
> Associate Professor of Physics
> Computational Nanophotonics
> Southern Illinois University Edwardsville
> (618) 650-2390