Closed RMeli closed 4 years ago
Hi, can you please check the memory?
There is no limitation for this method. May be it’s another bug.
Hi, thank you for the fast reply! I didn't mention the memory because it remains constant during the execution; that's why I opened a new issue instead of appending to #1495.
Thanks. I will investigate this as soon as I could. Cheers.
FYI, this is not urgent/critical. Thanks!
hi @RMeli, it turns out that pytraj
uses a function call capture_stdout
to capture cpptraj
stdout. That function only allows to have 500 calls (Now I know this thanks to you).
Can you please patch that function (below) and try again? thanks.
from contextlib import contextmanager
class Dummy:
def __enter__(self):
return self
def __exit__(self):
return
def read(self):
return ""
@contextmanager
def mock_capture():
yield Dummy(), ""
pt.analysis.c_action.capture_stdout = mock_capture
# INSERT YOUR CODE HERE
@hainm I'll take a closer look at this tomorrow, but could you put here for posterity what info pytraj needs from stdout? Then let's add it to https://github.com/Amber-MD/cpptraj/issues/177 or create a cpptraj issue for it and I'll try to work on it tomorrow.
but could you put here for posterity what info pytraj needs from stdout?
Thanks @drroe. Currently pytraj does not have any specific need from cpptraj. The capture_stdout
was added so cpptraj's stdout/stderr can be displayed in Jupyter notebook (it does not know how to display the ones from C++).
So cpptraj does not need to do anything. Cheers.
@hainm The patch works on the simple example. I'll test it on my main pipeline soon. Thank you for the help!
This workaround seems to work as expected, thanks.
We can close the case now. Thanks @RMeli again.
I'm trying to compute the LIE for many different trajectories and the execution stops after 500 calls. Is there a limit on the number of LIE calls I'm not aware of?
This is the code that reproduces the problem (the trajectory contains a protein-ligand complex):
import pytraj as pt import numpy as np n = 0 while True: traj = pt.iterload("traj.nc", "traj.parm7") LIE = pt.analysis.energy_analysis.lie(traj, mask=":LIG",frame_indices=np.random.randint(0,5000,5)) print(n) n += 1
Should be fixed in #1573. I've run the code 1000 times without any issue. :D
I'm trying to compute the LIE for many different trajectories and the execution stops after 500 calls. Is there a limit on the number of LIE calls I'm not aware of?
This is the code that reproduces the problem (the trajectory contains a protein-ligand complex):