def update_stress_tensor(i, line): if line.startswith(" Computing"): try: stresslines = [lines[i + j] for j in range(3, 6)] raw_stress_tensor = [ float(j) for j in "".join(stresslines).split() ] except: stresslines = [lines[i + j] for j in range(5, 8)] raw_stress_tensor = [ float(j) for j in "".join(stresslines).split() ] stress_tensor_kbar = np.array(raw_stress_tensor).reshape( (3, 6))[:, 3:6] cuds_entity = sim.get(oclass=QE.StressTensor) if cuds_entity: cuds_entity[0].tensor2 = stress_tensor_kbar cuds_entity[0].unit = "kbar" else: sim.add( QE.StressTensor(tensor2=stress_tensor_kbar, unit="kbar"))
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) sim.add(q) q.add(QE.Mode(number = 3)) q.add(QE.Mode(number = 2)) q.add(QE.Mode(number = 1)) sim2 = QE.Simulation() fd = QE.Cell() sim2.add(fd) fd.add(QE.Volume(value = 33, unit = "au^3")) sim2.add(QE.TotalEnergy(value = -432, unit = "Ry"))