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

Check if badly ordered StructureData is translated into POSCAR correctly #34

Closed
DropD opened this issue Oct 12, 2017 · 1 comment · Fixed by #64
Closed

Check if badly ordered StructureData is translated into POSCAR correctly #34

DropD opened this issue Oct 12, 2017 · 1 comment · Fixed by #64

Comments

@DropD
Copy link
Contributor

DropD commented Oct 12, 2017

POSCAR does not allow for example [Ti, O, Ti, O], instead the species have to be together as i [Ti, Ti, O, O].

@DropD DropD changed the title Check if badly ordered StructureData is traslated ito POSCAR correctly Check if badly ordered StructureData is translated into POSCAR correctly Oct 22, 2017
@DropD DropD added this to the Import Phonondb milestone Nov 6, 2017
@DropD
Copy link
Contributor Author

DropD commented Nov 7, 2017

Findings:

  1. unsorted structure data is by default translated to unsorted pmg / ase structure
  2. unsorted pmg / ase structures are written to unsorted POSCAR
  3. unsorted pmg structures can be sorted in place using the sort() method

The following snippet will lead to well formed POSCAR:

from pymatgen.io.vasp.inputs import Poscar
from aiida.orm import DataFactory

unsorted_st = DataFactory('structure')()
unsorted_st.append_atom(..., symbol='As')
unsorted_st.append_atom(..., symbol='In')
unsorted_st.append_atom(..., symbol='As')
unsorted_st.append_atom(..., symbol='In')

pmg_st = unsorted_st.get_pymatgen()
pmg_st.sort()
pmg_poscar = Poscar(pmg_st)
print pmg_poscar.get_string()

>>>
In2 As2
1.0
1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
In As
2 2
direct
0.000000 0.500000 0.000000 In
0.500000 0.000000 0.000000 In
0.000000 0.000000 0.000000 As
0.000000 0.000000 0.500000 As

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.

1 participant