Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

top_includes in the function minimize() does not work #5

Open
RlyehAD opened this issue Nov 1, 2021 · 3 comments
Open

top_includes in the function minimize() does not work #5

RlyehAD opened this issue Nov 1, 2021 · 3 comments

Comments

@RlyehAD
Copy link

RlyehAD commented Nov 1, 2021

In md.py, there's a function for energy minimization called minimize(). The three necessary args of it are struct, top and top_includes. The comments there suggest that top_includes is a list of dirs in which .itp ff files are searched. Assuming it's a list of str of path to the dirs, it does not make sense at line 215 where the list is input to another function called data_tofile () so the itp files can be copied to the temporary dir with .gro and .top files. However, according to the code in data_tofile(), the input should be a single file otherwise the error "expected either Dataset, ndarray or file path as src" is raised.

The error can be repeated by running the following code in the test dir with a terminal:

python

import os
import proto_md 

struct = "../sample/SpaceWarping/Struct/1PRT.gro"  
struct = os.path.abspath(struct) 

top = "../sample/SpaceWarping/Top/1PRT.top"
top = os.path.abspath(top)

top_includes = "../sample/SpaceWarping/Top"
top_includes = os.path.abspath(top_includes)

os.path.isdir(top_includes) #This will return True

proto_md.md.minimize(struct=struct, top=top, top_includes=[top_includes]) 
@anabiman
Copy link
Collaborator

anabiman commented Nov 7, 2021

Please post the error returned from running the code snippet.

@RlyehAD
Copy link
Author

RlyehAD commented Nov 8, 2021

Hi, the error returned is

Traceback (most recent call last): 
 File "<stdin>", line 1, in <module>           
 File "/home/******/miniconda3/envs/mmic/lib/python3.9/site-packages/proto_md/md.py", line 215, in minimize                                                                                                          data_tofile(i, dirname=dirname)      
 File "/home/******/miniconda3/envs/mmic/lib/python3.9/site-packages/proto_md/util/util.py", line 94, in data_tofile       
 raise TypeError(       
 TypeError: expected either Dataset, ndarray or file path as src  

@anabiman
Copy link
Collaborator

anabiman commented Nov 8, 2021

top_includes should be a list of files to include for the topology and not the dir. In the docstrings for data_tofile, you'll notice that fid can be None only when dealing with the h5py datasets. In other words, if your itp files are h5py datasets, then your code should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants