question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AMBER dVdl convert to pandas error

See original GitHub issue

Hello all,

I’m having trouble forming my pandas data frame using the Amber parser in alchemlyb. I’m still new to python programming and I’m not sure where I might have done wrong in the python script. I really appreciate guidance on handling this error. I have also attached the code I’m using below.

Thanks.

from pathlib import Path

import pandas as pd

from alchemtest import Bunch
import alchemlyb
from alchemlyb.parsing import amber
from alchemlyb.estimators import TI

from alchemlyb.parsing.amber import extract_dHdl

#extract data

def load_ligandsolvated():
    """Load the Amber solvated dataset.

    Returns
    -------
    data : Bunch
        Dictionary-like object, the interesting attributes are:

        - 'data' : the data files by alchemical leg

    """

    module_path = Path(__file__).parent
    data = {'charge': list(map(str, module_path.glob('decharge/*/md7.out'))),
            'vdw': list(map(str, module_path.glob('vdw_bonded/*/md7.out')))}

    return Bunch(data=data)


dataset = load_ligandsolvated()

#print(dataset)

dHdl_coul = alchemlyb.concat([amber.extract_dHdl(filename, T=300)
                      for filename in dataset['data']['charge']])

Traceback (most recent call last): File “/home/srg/senal/Documents/Project-GQuad/MD/130mM/1-2-1/1-2-1Intercalated_Bottom/ReRun-2/TI/cuda/TI-3/ligands/ti_est.py”, line 37, in <module> dHdl_coul = alchemlyb.concat([amber.extract_dHdl(filename, T=300) File “/home/srg/senal/Documents/Project-GQuad/MD/130mM/1-2-1/1-2-1Intercalated_Bottom/ReRun-2/TI/cuda/TI-3/ligands/ti_est.py”, line 37, in <listcomp> dHdl_coul = alchemlyb.concat([amber.extract_dHdl(filename, T=300) File “/home/srg/senal/.local/lib/python3.9/site-packages/alchemlyb/parsing/init.py”, line 11, in wrapper dataframe = func(outfile, T, *args, **kwargs) File “/home/srg/senal/.local/lib/python3.9/site-packages/alchemlyb/parsing/amber.py”, line 390, in extract_dHdl df = convert_to_pandas(file_datum) File “/home/srg/senal/.local/lib/python3.9/site-packages/alchemlyb/parsing/amber.py”, line 36, in convert_to_pandas frame_time = file_datum.t0 + (frame_index + 1) * file_datum.dt * 1000 TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘float’

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DrDomenicoMarsoncommented, Nov 14, 2022

Hi, I’ll have a look at it right now! Just a quick comment about the “two TI regions specified at the beginning of the simulation”.

It’s true indeed that amber saves the two TI regions (and it did so also before amber18, as far as I remember), but if you look at the file, especially at the end of the file, where the averages over the last N time-steps are reported, DV/DL values (the only value read by alchemlyb) and their RMS fluctuations are perfectly equal between TI region 1 and 2.

If you search in the AMBER mailing list you can find some better explanation on why values are reported like that, but I can’t remember where precisely.

PS: from your output file it seems you are printing values in the output file every 1 ps, and not 10 ps as you previously stated, as you have dt=1 fs and print every ntpr=1000 time-steps (it’s not a problem for us, I just wanted to point it out just so you can be sure of what you are doing).

0reactions
xiki-tempulacommented, Nov 14, 2022

The PR is merged to the master. Doing pip install git+ssh://git@github.com:alchemistry/alchemlyb.git should give you the alchemlyb with the fix. Please feel free to reopen this issue if there are other problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error while using Arrow library to convert spark dataframe to ...
I am trying to convert a spark data frame to pandas data frame by enabling these two flags 'spark.sql.execution.arrow.pyspark.enabled' ...
Read more >
Convert between PySpark and pandas DataFrames
Learn how to use convert Apache Spark DataFrames to and from pandas DataFrames using Apache Arrow in Databricks.
Read more >
pandas.to_numeric — pandas 1.5.2 documentation
Convert argument to a numeric type. ... As this behaviour is separate from the core conversion to numeric values, any errors raised during...
Read more >
Convert PySpark DataFrame to Pandas - Spark by {Examples}
Convert PySpark Dataframe to Pandas DataFrame​​ PySpark DataFrame provides a method toPandas() to convert it to Python Pandas DataFrame. toPandas ...
Read more >
wordlist ranked - Massachusetts Institute of Technology
... community within states area want v o phone dvd shipping reserved subject ... archives newsletter points knowledge magazine error camera girl currently ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found