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

Saving isolated molecules to a file results a file that cannot be read #47

Closed
tjjarvinen opened this issue May 22, 2024 · 2 comments · Fixed by #48
Closed

Saving isolated molecules to a file results a file that cannot be read #47

tjjarvinen opened this issue May 22, 2024 · 2 comments · Fixed by #48

Comments

@tjjarvinen
Copy link
Contributor

If you create isolated molecule with AtomsBase and save it using ExtXYZ and try to load the file

Here is a Working example:

using AtomsBase
using ExtXYZ
using Unitful

hydrogen = isolated_system([
        :H => [0, 0, 0.]u"Å",
        :H => [0, 0, 1.]u"Å"
])

ExtXYZ.save("example.xyz", hydrogen)

ExtXYZ.load("example.xyz")   # results in error

The saved file reads

2
pbc=[F, F, F] Lattice="inf 0.00000000 0.00000000 0.00000000 inf 0.00000000 0.00000000 0.00000000 inf" Properties=species:S:1:pos:R:3:velocities:R:3:Z:I:1
H         0.00000000       0.00000000       0.00000000         0.00000000       0.00000000       0.00000000          1
H         0.00000000       0.00000000       1.00000000         0.00000000       0.00000000       0.00000000          1

If you remove the lattice and pbc information from the file, then it works as intended.

So, one fix would be to check, if structure has infinite bounding box, and if yes then just remove cell information from the save.

@jameskermode
Copy link
Member

I'll take a look. In my opinion keeping pbc=[F, F, F] but omitting the infinite lattice would be the best option, since this would then encode the open bounday conditions explictly rather than implicitly, but I don't remember right now if this is possible with the upstream extxyz library.

@jameskermode
Copy link
Member

Could you take a look at #48? The test is not passing because of a unit conversion problem when comparing the read-in infinite lattice with the original one - if either @tjjarvinen or @mfherbst could advise on what I am doing wrong there that would be much appreciated.

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

Successfully merging a pull request may close this issue.

2 participants