pyiron / pyiron_atomistics

pyiron_atomistics - an integrated development environment (IDE) for atomistic simulation in computational materials science.
https://pyiron-atomistics.readthedocs.io
BSD 3-Clause "New" or "Revised" License
43 stars 15 forks source link

pyscal cna can't handle monoclinic boxes #247

Open pmrv opened 3 years ago

pmrv commented 3 years ago

I've had to set up a slightly weird structure of bcc Fe, like this

a0 = 2.87
a = np.array([a0, 0, 0])
b = np.array([0, a0, 0])
c = np.array([0, 0, a0])
s = pr.create.structure.atoms(['Fe', 'Fe'], positions=[ [0, 0, 0], a ], cell = [a + b, a - b, (a + b + c)/2], pbc=True)

and pyscal reports their crystal structure as 'other' even though Ovito gets it right on the exact same structure.

Not sure if we're not passing critical information to pyscal or it generally can't handle this, but I can't dig deeper right now.

liamhuber commented 3 years ago

Snippet has an error: 3xa. I am 99.999% sure this is not why you are having trouble, but please confirm 😜

pmrv commented 3 years ago

Snippet has an error: 3xa. I am 99.999% sure this is not why you are having trouble, but please confirm stuck_out_tongue_winking_eye

Ah, yeah, that's the part I typed manually for the issue. ;) Fixed.

pmrv commented 3 years ago

Interestingly it works with this incantation

pr.create.structure.atoms(['Fe', 'Fe', 'Fe'], positions=[ [0, 0, 0], (a+b-c)/2, a+b-c ], cell = [b - c, a - c, (a + b + c)/2], pbc=True)

Maybe it's a weird edge case.

(Don't ask why I want this kind of boxes, dislocations are hard >.<)

EDIT: Was a fluke, also broken.

pmrv commented 3 years ago

If I see this correctly, this might be the problem

https://github.com/srmnitc/pyscal/blob/c8f1855dcac60affa51c414a35998c8f97e75c93/src/pyscal/formats/ase.py#L10

Supposedly check_triclinic should be True, but it's not set in read_inputfile and we cannot pass it when we call that function.

@srmnitc Am I missing something?

srmnitc commented 3 years ago

@pmrv This could be the issue, I will take a look and update you.

srmnitc commented 3 years ago

@pmrv I found the issue, but you are not going to like to so much :sweat_smile: Pyscal follows LAMMPS closely in terms of triclinic boxes. LAMMPS has the restriction that the box vectors need to form a complete right hand basis. That is why the boxes do not work. You can convert the boxes and that should work. We could also do that within pyscal, I just did not think of it yet! I am planning to work on a major update of code soon, so I will add this too. I raised an issue just to keep track. It will take a bit of time though (still trying to get my thesis out of the way!)

pmrv commented 3 years ago

@pmrv I found the issue, but you are not going to like to so much sweat_smile Pyscal follows LAMMPS closely in terms of triclinic boxes. LAMMPS has the restriction that the box vectors need to form a complete right hand basis. That is why the boxes do not work. You can convert the boxes and that should work. We could also do that within pyscal, I just did not think of it yet! I am planning to work on a major update of code soon, so I will add this too. I raised an issue just to keep track. It will take a bit of time though (still trying to get my thesis out of the way!)

Thanks for checking it out it quickly. The link to lammps is very useful, I'll try that and update the issue if it works. If it does I imagine we could also do the box conversion in pyiron. It's an issue that also came up before with "too triclinic" boxes when running lammps simulations.