A simple scf job

Import Driver from QEpy

[1]:
from qepy.driver import Driver

Try to initialize the parallel

[2]:
try:
    from mpi4py import MPI
    comm=MPI.COMM_WORLD
except:
    comm=None

NOTE: Without mpi4py, the QEpy still can parallel running, but you cannot control the parallel. If you want to run a different job, you have to restart the script or the jupyter kernel.

Initialize a QEpy driver

[3]:
driver=Driver('qe_in.in', comm=comm, logfile='tmp.out')

Run a scf

[4]:
driver.scf()
[4]:
-552.934773888678
[5]:
driver.check_convergence()
[5]:
True
[6]:
driver.get_scf_error()
[6]:
2.5688306913268367e-09
[7]:
driver.get_scf_steps()
[7]:
27
[8]:
driver.get_energy() # Ry
[8]:
-552.934773888678
[9]:
driver.get_forces() # Ry/au
[9]:
array([[-8.35134989e-03,  3.16389945e-08,  1.39021417e-07],
       [ 7.84463365e-03, -1.17617192e-07,  3.65640610e-08],
       [ 7.84832955e-03,  2.96113726e-08, -1.83683263e-07],
       [-7.34161332e-03,  5.63668249e-08,  8.09778434e-09]])
[10]:
driver.get_stress() # Ry/bohr**3
[10]:
array([[ 6.13985501e-07, -6.33438474e-12,  8.53306052e-11],
       [-6.33438474e-12, -2.56059016e-03, -1.62509152e-10],
       [ 8.53306052e-11, -1.62509152e-10, -2.56118400e-03]])

Get the output from QE

[11]:
print(''.join(driver.get_output()[-20:]))

     convergence has been achieved in  27 iterations

     Forces acting on atoms (cartesian axes, Ry/au):

     atom    1 type  1   force =    -0.00835135    0.00000003    0.00000014
     atom    2 type  1   force =     0.00784463   -0.00000012    0.00000004
     atom    3 type  1   force =     0.00784833    0.00000003   -0.00000018
     atom    4 type  1   force =    -0.00734161    0.00000006    0.00000001

     Total force =     0.015709     Total SCF correction =     0.000095


     Computing stress (Cartesian axis) and pressure

          total   stress  (Ry/bohr**3)                   (kbar)     P=     -251.12
   0.00000061  -0.00000000   0.00000000            0.09       -0.00        0.00
  -0.00000000  -0.00256059  -0.00000000           -0.00     -376.68       -0.00
   0.00000000  -0.00000000  -0.00256118            0.00       -0.00     -376.76


Stop the driver before you run another different job

[12]:
driver.stop()