Testing arguments of Unfolding

This commit is contained in:
Atsushi Togo 2015-11-16 22:51:58 +09:00
parent 931e4c9dbd
commit 024b08fa16
2 changed files with 11 additions and 11 deletions

View File

@ -40,10 +40,11 @@ from phonopy.structure.cells import get_supercell
class Unfolding:
def __init__(self,
phonon,
supercell_matrix):
self._phonon = phonon
self._supercell_matrix = supercell_matrix
self._comm_points = get_commensurate_points(supercell_matrix)
primitive):
self._phohon = phonon
smat = np.linalg.inv(primitive.get_primitive_matrix())
self._supercell_matrix = np.rint(smat).astype('intc')
self._comm_points = get_commensurate_points(self._supercell_matrix)
self._translations = None
self._set_translations()

View File

@ -2,7 +2,7 @@ import unittest
import numpy as np
from phonopy.interface.phonopy_yaml import phonopyYaml
from phonopy.structure.cells import get_supercell
from phonopy.unfolding.unfolding import Unfolding
from phonopy.unfolding import Unfolding
from phonopy import Phonopy
from phonopy.interface.vasp import read_vasp
from phonopy.file_IO import parse_FORCE_SETS, parse_BORN
@ -13,7 +13,6 @@ from phonopy.structure.atoms import PhonopyAtoms
class TestUnfolding(unittest.TestCase):
def setUp(self):
filename = "POSCAR.yaml"
self._cell = read_vasp("POSCAR")
print(PhonopyAtoms(atoms=self._cell))
@ -24,12 +23,12 @@ class TestUnfolding(unittest.TestCase):
smat = np.diag([2, 2, 2])
pmat = [[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]]
phonon = self._get_phonon(smat, pmat)
supercell_matrix = np.rint(
np.dot(np.linalg.inv(pmat), smat)).astype('intc')
unfolding = Unfolding(phonon, supercell_matrix)
unfolding = Unfolding(phonon, phonon.get_primitive())
print(unfolding.get_translations())
print(unfolding.get_commensurate_points())
for i, p in enumerate(unfolding.get_translations()):
print("%d %s" % (i + 1, p))
for i, p in enumerate(unfolding.get_commensurate_points()):
print("%d %s" % (i + 1, p))
## The following lines are for writing translations into POSCAR.
# translations = unfolding.get_translations()