mirror of
https://github.com/triqs/dft_tools
synced 2025-01-02 17:45:47 +01:00
Added 'type_of_ion' list to class Poscar
A list 'type_of_ion' mapping ion index to their types is added to class Poscar. A corresponding test is also added.
This commit is contained in:
parent
529c7bc9d5
commit
0cec37f3fc
@ -173,7 +173,11 @@ class Poscar:
|
|||||||
|
|
||||||
# Read atomic positions
|
# Read atomic positions
|
||||||
self.q_types = []
|
self.q_types = []
|
||||||
|
self.type_of_ion = []
|
||||||
for it in xrange(self.ntypes):
|
for it in xrange(self.ntypes):
|
||||||
|
# Array mapping ion index to type
|
||||||
|
self.type_of_ion += self.nions[it] * [it]
|
||||||
|
|
||||||
q_at_it = np.zeros((self.nions[it], 3))
|
q_at_it = np.zeros((self.nions[it], 3))
|
||||||
for iq in xrange(self.nions[it]):
|
for iq in xrange(self.nions[it]):
|
||||||
sline = readline_remove_comments()
|
sline = readline_remove_comments()
|
||||||
|
28
python/converters/vasp/test/_vaspio/POSCAR.complex
Normal file
28
python/converters/vasp/test/_vaspio/POSCAR.complex
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
NdNiO3
|
||||||
|
1.0
|
||||||
|
5.3871197701 0.0000000000 0.0000000000
|
||||||
|
0.0000000000 5.3826699257 0.0000000000
|
||||||
|
0.0000000000 0.0000000000 7.6093997955
|
||||||
|
Nd Ni O
|
||||||
|
4 4 12
|
||||||
|
Direct
|
||||||
|
0.995800018 0.035000000 0.250000000
|
||||||
|
0.004199982 0.964999974 0.750000000
|
||||||
|
0.495800018 0.465000004 0.750000000
|
||||||
|
0.504199982 0.535000026 0.250000000
|
||||||
|
0.500000000 0.000000000 0.000000000
|
||||||
|
0.000000000 0.500000000 0.000000000
|
||||||
|
0.500000000 0.000000000 0.500000000
|
||||||
|
0.000000000 0.500000000 0.500000000
|
||||||
|
0.069300003 0.489699990 0.250000000
|
||||||
|
0.930700004 0.510300040 0.750000000
|
||||||
|
0.569299996 0.010300010 0.750000000
|
||||||
|
0.430700004 0.989699960 0.250000000
|
||||||
|
0.716600001 0.287099987 0.039500002
|
||||||
|
0.283399999 0.712900043 0.960500002
|
||||||
|
0.216600001 0.212900013 0.960500002
|
||||||
|
0.783399999 0.787099957 0.039500002
|
||||||
|
0.283399999 0.712900043 0.539499998
|
||||||
|
0.716600001 0.287099987 0.460500002
|
||||||
|
0.783399999 0.787099957 0.460500002
|
||||||
|
0.216600001 0.212900013 0.539499998
|
@ -18,6 +18,7 @@ class TestPoscar(mytest.MyTestCase):
|
|||||||
|
|
||||||
Scenarios:
|
Scenarios:
|
||||||
- correct POSCAR file
|
- correct POSCAR file
|
||||||
|
- check 'type_of_ion' array for a complex POSCAR file
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Scenario 1
|
# Scenario 1
|
||||||
@ -41,3 +42,12 @@ class TestPoscar(mytest.MyTestCase):
|
|||||||
expected = 'POSCAR.example.out'
|
expected = 'POSCAR.example.out'
|
||||||
self.assertFileEqual(testout, expected)
|
self.assertFileEqual(testout, expected)
|
||||||
|
|
||||||
|
# Scenario 2
|
||||||
|
def test_type_of_ion(self):
|
||||||
|
filename = 'POSCAR.complex'
|
||||||
|
poscar = Poscar()
|
||||||
|
poscar.from_file(vasp_dir='./', poscar_filename=filename)
|
||||||
|
|
||||||
|
test_types = 4 * [0] + 4 * [1] + 12 * [2]
|
||||||
|
self.assertListEqual(test_types, poscar.type_of_ion)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user