sisl
sisl copied to clipboard
Pdb parser not working?
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 :)
I never did test it thoroughly. There are probably some keywords in the file format that is missing. The pdb specification is huge.
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?
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.