[AMBER-Developers] Two fixes for mdout_analyzer.py

From: Shiji Zhao <shijiz.uci.edu>
Date: Wed, 30 Jun 2021 15:21:46 -0700

Hi all,

I encountered this error while using mdout_analyzer.py recently:

Traceback (most recent call last):
  File "/Users/shijizhao/Downloads/amber-bin/bin/mdout_analyzer.py", line
59, in <module>
    mdout += MdoutClass(f)
NameError: name 'mdout' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File
"/Users/shijizhao/Downloads/amber-bin/lib/python3.8/site-packages/mdoutanalyzer/mdout.py",
line 221, in get_data
    self.data[term].add_value(float(term_val))
KeyError: 'NSTEP'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/shijizhao/Downloads/amber-bin/bin/mdout_analyzer.py", line
61, in <module>
    mdout = MdoutClass(f)
  File
"/Users/shijizhao/Downloads/amber-bin/lib/python3.8/site-packages/mdoutanalyzer/mdout.py",
line 87, in __init__
    self.get_data()
  File
"/Users/shijizhao/Downloads/amber-bin/lib/python3.8/site-packages/mdoutanalyzer/mdout.py",
line 223, in get_data
    self.data[term] = np.zeros(self.num_terms).view(DataSet)
TypeError: 'float' object cannot be interpreted as an integer

This error never occurred while I was using Amber18, so I guess it may have
something to do with the latest python version. After briefly analyzing the
source code of mdout_analyzer.py, I hereby propose 2 changes that fix
mdout_analyzer.py.


   - Change line 73 of mdoutanalyzer/mdout.py to: self.num_terms =
   self.num_steps / self.properties['ntpr'] + 1
   - Change line 226 of mdoutanalyzer/widgets.py to: fig.draw()


Let me know what you think.
_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Wed Jun 30 2021 - 15:30:02 PDT
Custom Search