Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Issue with NAMD IDWS fep? #435

@danielguion

Description

@danielguion

Hello,

Thank you for creating this.

I tried to run with my_idws.fep file from NAMD. I usually use parsefep but I was looking to give alchemlyb a try.

I run into this error:

(base) MASK Desktop % python3 mbar.py
Warning on use of the timeseries module: If the inherent timescales of the system are long compared to those being analyzed, this statistical inefficiency may be an underestimate.  The estimate presumes the use of many statistically independent samples.  Tests should be performed to assess whether this condition is satisfied.   Be cautious in the interpretation of the data.

****** PyMBAR will use 64-bit JAX! *******
* JAX is currently set to 32-bit bitsize *
* which is its default.                  *
*                                        *
* PyMBAR requires 64-bit mode and WILL   *
* enable JAX's 64-bit mode when called.  *
*                                        *
* This MAY cause problems with other     *
* Uses of JAX in the same code.          *
******************************************

/opt/homebrew/Caskroom/miniforge/base/lib/python3.12/site-packages/alchemlyb/parsing/namd.py:306: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.
  u_nk = pd.concat([u_nk, tempDF], sort=False)
Parsed u_nk shape: (206002, 101)
2025-07-28 19:06:34.082 | DEBUG    | alchemlyb.preprocessing.subsampling:equilibrium_detection:609 - Running equilibration detection.
2025-07-28 19:06:34.269 | DEBUG    | alchemlyb.preprocessing.subsampling:equilibrium_detection:611 - Start index: 94.
2025-07-28 19:06:34.269 | DEBUG    | alchemlyb.preprocessing.subsampling:equilibrium_detection:612 - Statistical inefficiency: 2.43.
2025-07-28 19:06:34.271 | DEBUG    | alchemlyb.preprocessing.subsampling:equilibrium_detection:618 - Number of uncorrelated samples: 1609.
Decorrelated u_nk shape: (1609, 101)
2025-07-28 19:06:34.271 | INFO     | alchemlyb.workflows.base:__init__:50 - Alchemlyb Version: f2.4.1
2025-07-28 19:06:34.271 | INFO     | alchemlyb.workflows.base:__init__:51 - Set Temperature to 310.0 K.
2025-07-28 19:06:34.271 | INFO     | alchemlyb.workflows.base:__init__:53 - Set Software to NAMD.

Workflow result:
Empty DataFrame
Columns: []
Index: []
MBAR estimation failed or returned empty results.
(base) Daniel@MacBook-Pro-4 Desktop % 

Am I do something wrong:

import pandas as pd
from alchemlyb.parsing.namd import extract_u_nk
from alchemlyb.preprocessing.subsampling import decorrelate_u_nk
from alchemlyb.workflows.base import WorkflowBase
from alchemlyb.visualisation import plot_mbar_overlap_matrix
import matplotlib.pyplot as plt

filename = 'my_idws.fep'
T = 310.0 

u_nk = extract_u_nk(filename, T=T)
print("Parsed u_nk shape:", u_nk.shape)

u_nk_decor = decorrelate_u_nk(u_nk, method='dE', remove_burnin=True)
print("Decorrelated u_nk shape:", u_nk_decor.shape)

workflow = WorkflowBase(units='kcal/mol', software='NAMD', T=T)
workflow.u_nk_list = [u_nk_decor]

workflow.estimate(estimators=['MBAR'])

print("\nresult:")
print(workflow.result)

if not workflow.result.empty and 'MBAR' in workflow.result.index:
    dG = workflow.result.loc['MBAR', 'ΔG']
    ddG = workflow.result.loc['MBAR', 'dΔG']

    print(f"\nΔG (MBAR) = {dG:.3f} ± {ddG:.3f} kcal/mol")

    try:
        mbar_estimator = workflow.result_objects['MBAR']
        if hasattr(mbar_estimator, 'overlap_matrix'):
            ax = plot_mbar_overlap_matrix(mbar_estimator.overlap_matrix)
            ax.set_title('MBAR Overlap Matrix')
            plt.tight_layout()
            plt.show()
    except Exception as e:
        print("Could not plot overlap matrix:", e)
else:
    print("MBAR estimation failed or returned empty results.")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions