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

Pdb parser not working? #189

Open
pfebrer opened this issue Mar 28, 2020 · 3 comments
Open

Pdb parser not working? #189

pfebrer opened this issue Mar 28, 2020 · 3 comments

Comments

@pfebrer
Copy link
Contributor

pfebrer commented Mar 28, 2020

Describe the bug
I can't read pdb files and when I write geometries in pdb format visualization softwares are not able to understand it.

Is this a known issue? Is it happening only to me?
Reproducable code

sisl.get_sile("SOMEGEOMETRY.pdb").read_geometry() # Fails
sisl.get_sile("SOMEGEOMETRY.*").read_geometry().write("test.pdb")
# Does not fail but visualization softwares do not understand it.

Here is the exact pdb geometry that I tried to load: 2pix.zip

If it is a real issue, not something that I'm missing, I would like to fix it because it is important for the blender support project :)

@zerothi
Copy link
Owner

zerothi commented Mar 28, 2020

I never did test it thoroughly. There are probably some keywords in the file format that is missing.
The pdb specification is huge.

@pfebrer
Copy link
Contributor Author

pfebrer commented Mar 28, 2020

The pdb specification is huge.

Yes, I thought so too hahah.

This brings me to the next point. Since you already implemented fromASE and toASE methods in Geometry, do you think it would make sense to try to fallback to reading with ASE in case the parser is not implemented? Or this should be done by the user?

@pfebrer
Copy link
Contributor Author

pfebrer commented Mar 28, 2020

do you think it would make sense to try to fallback to reading with ASE in case the parser is not implemented?

For example, having an UnknownSile class to which filepaths without known extension would fall. And this class would have a read_geometry method as simple as:

class UnknownSile(...):
     def read_geometry(self):
         try:
              from ase.io import read as ASEread
              return sisl.Geometry.fromASE(ASEread(self.file))
         except Exception:
              return None

I think this would be the less intrusive thing to do and it could be useful.

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

No branches or pull requests

2 participants