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

Support reading molecule through MDAnalysis? #11

Open
xiki-tempula opened this issue Mar 28, 2021 · 2 comments
Open

Support reading molecule through MDAnalysis? #11

xiki-tempula opened this issue Mar 28, 2021 · 2 comments

Comments

@xiki-tempula
Copy link

Currently, the ASE is used for loading coordinate, box size and element information. I wonder if it is possible to load the data through MDAnalysis.Universe?
The coordinate, cell, atom type can be accessed via

>>> from MDAnalysis import Universe
>>> from MDAnalysis.tests.datafiles import CRD
>>> u = Universe(CRD)
>>> u.dimensions
array([0., 0., 0., 0., 0., 0.], dtype=float32)
>>> u.atoms.positions
array([[-11.921,  26.307,  10.41 ],
       [-11.447,  26.741,   9.595],
       [-12.44 ,  27.042,  10.926],
       ...,
       [-12.616,  28.099,  21.258],
       [-13.786,  28.568,  21.198],
       [-12.417,  26.877,  21.494]], dtype=float32)
>>> u.atoms.types
array(['N', 'H', 'H', ..., 'C', 'O', 'O'], dtype=object)
@lauri-codes
Copy link
Contributor

Hi @xiki-tempula,

The slightly inconvenient method would be to use MDAnalysis.Universe to fill the input tree manually, or first convert it into an ase.Atoms object and use create_cell/create_coords.

It should be extremely simple to also add support for MDAnalysis.Universe in the create_cell/create_coords methods. Do you think you could create a pull request for this implementation? I would be glad to include it.

@xiki-tempula
Copy link
Author

@lauri-codes I will give it a try. I wonder how should one pass elements to pycp2k?

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