Si = QE.Element(name = "Si")
SiPseudo = QE.PSEUDOPOTENTIAL(path = "Si.pbe-n-kjpaw_psl.1.0.0.UPF")
Si1 = QE.Atom()
celldm1 = QE.Celldm1(value = 5.43070, unit = "au")

# Adds pseudopotential and atoms to the element
# Describes element's mass
# Adds atoms and cell parameters to the cell
# Positions the atoms
Si.add(SiPseudo, Si1)
Si.add(QE.Mass(value = 28.085, unit = "amu"))
SiParams = QE.CellParams(tensor2 = [[0.5, 0.5, 0.],
                                      [0.5, 0., 0.5],
                                      [0., 0.5, 0.5]], unit = "")
SiCell.add(Si1, SiParams)
Si1.add(QE.Position(vector = (0, 0, 0), unit = ""))
SiCell.add(celldm1)

# Specifies the values of the cell parameters


# Adds cell and element to simulation
sim.add(SiCell)
sim.add(Si)
sim.add(k)
sim.add(QE.Pressure(value = 100, unit = "kbar"))
sim.add(QE.StressTensor(tensor2 = np.zeros((3, 3)), unit = "kbar"))
root = ""
SiCell.add(QE.Volume(value = 22, unit = "au^3"))
sim.add(QE.TotalEnergy(value = -434, unit = "Ry"))
q = QE.QPoint(vector = (0, 0, 0), unit = "", calculate = True)
O.add(QE.Mass(value = 15.999, unit = "amu"))
Ba.add(QE.Mass(value = 137.327, unit = "amu"))
Ti.add(QE.Mass(value = 47.867, unit = "amu"))

O.add(QE.PSEUDOPOTENTIAL(path = "O.pbe-n-kjpaw_psl.1.0.0.UPF"))
Ba.add(QE.PSEUDOPOTENTIAL(path = "Ba.pbe-spn-kjpaw_psl.1.0.0.UPF"))
Ti.add(QE.PSEUDOPOTENTIAL(path = "Ti.pbe-spn-kjpaw_psl.1.0.0.UPF"))

O1 = O.add(QE.Atom())
O2 = O.add(QE.Atom())
O3 = O.add(QE.Atom())
Ba1 = Ba.add(QE.Atom())
Ti1 = Ti.add(QE.Atom())

O1.add(QE.Position(vector = [0.5, 0.5, 0.], unit = ""))
O2.add(QE.Position(vector = [0.5, 0., 0.5], unit = ""))
O3.add(QE.Position(vector = [0., 0.5, 0.5], unit = ""))
Ba1.add(QE.Position(vector = [0., 0., 0.], unit = ""))
Ti1.add(QE.Position(vector = [0.5, 0.5, 0.5], unit = ""))

cell.add(O1, O2, O3, Ba1, Ti1)

kpoints = QE.K_POINTS(vector6 = (4, 4, 4, 0, 0, 0), unit = "automatic")

sim.add(cell, O, Ba, Ti, kpoints)

paramdict = {
        'CONTROL': {
            'calculation': 'scf',
            'restart_mode': 'from_scratch',