def _get_smat_cell(cell, options): s_mat = np.array([int(x) for x in options.s_mat.split()]) s_mat = _get_matrix(s_mat) if s_mat is False: sys.stderr.write("Supercell matrix is not correctly set.\n") return False else: if options.is_verbose: print "Transform cell using supercell matrix:" print s_mat return get_supercell(cell, s_mat)
def transform_cell(cell, options, is_shift=True): if options.shift and is_shift: set_shift(cell, options) if options.t_mat: cell = _get_tmat_cell(cell, options) if options.is_r2h: if options.is_verbose: print "Transform cell by transformation matrix of rhombohedral to hexagonal:" print np.array(r2h) cell = get_supercell(cell, r2h) if options.s_mat: cell = _get_smat_cell(cell, options) return cell
import numpy as np import cogue import cogue.calculator.vasp as vasp from cogue.crystal.point_defect import PointDefect from cogue.crystal.supercell import get_supercell symbols = ['Cu'] * 4 lattice = [[3.61, 0, 0], [0, 3.61, 0], [0, 0, 3.61]] # Orthorhombic points=np.transpose([[0.0, 0.0, 0.0], [0.0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]]) cell = cogue.cell(lattice=lattice, points=points, symbols=symbols) supercell = get_supercell(cell, np.diag([2, 2, 2])) vacancy_cell = PointDefect(supercell) vacancy_cell.set_point_vacancy(3) # To use get_cell restricts the cell to be an object of Cell but not CellBuilder vasp.write_poscar(vacancy_cell)