Skip to content

Converge the K-Grid for the Total Energy

1. Introduction

Find the converged k-grid for the total energy of a material, for use in another notebook.

2. Open the notebook

In JupyterLite, the notebook is made/workflows/total_energy_convergence.ipynb, entry 1.2.1 "K-point convergence" of made/workflows/Introduction.ipynb.

3. Set the parameters

Cell 1.2 holds the material, workflow, convergence and compute parameters:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from datetime import datetime
from mat3ra.esse.models.workflow.subworkflow.convergence.enum_options import ConvergenceParameterNameEnum
from mat3ra.ide.compute import QueueName

# 1. Organization / account selection
ORGANIZATION_NAME = None

# 2. Material parameters
FOLDER = "../uploads"
MATERIAL_NAME = "Silicon"

# 3. Workflow parameters
APPLICATION_NAME = "espresso"
WORKFLOW_SEARCH_TERM = "total_energy.json"
MY_WORKFLOW_NAME = "Total Energy Convergence"

# 4. Convergence parameters
KGRID_CONVERGENCE_TYPE = ConvergenceParameterNameEnum.N_k  # N_k, N_k_nonuniform, or N_k_nonuniform_2D
UNIFORM_KGRID_INITIAL = 1
NON_UNIFORM_KGRID_INITIAL = [2, 2, 1]
KGRID_INCREMENT = 1

RESULT_INITIAL = 0
TOLERANCE = 1e-3

# 5. Compute parameters
CLUSTER_NAME = None
QUEUE_NAME = QueueName.D
PPN = 1

# 6. Job naming
RUN_LABEL = datetime.now().strftime("%Y-%m-%d %H:%M")
POLL_INTERVAL = 30

KGRID_CONVERGENCE_TYPE is the converged parameter: N_k increases a uniform grid starting from UNIFORM_KGRID_INITIAL, while N_k_nonuniform and N_k_nonuniform_2D start from NON_UNIFORM_KGRID_INITIAL and pass the reciprocal vector ratios of the material to the loop. KGRID_INCREMENT is the step of each iteration. The loop stops when the relative change of the total energy falls below TOLERANCE; RESULT_INITIAL is the value the first iteration is compared with.

The overview explains the account, material, workflow, compute and job parameters.

4. Run and read the result

Run the notebook with Run > Run All and log in when it asks, as in Authentication in JupyterLite.

After the job finishes, section 8 prints the convergence series and plots the total energy against the k-grid parameter. Cell 8.2 prints the converged k-grid, converged_kgrid, to be set as SCF_KGRID in another notebook.

5. Interactive JupyterLite notebook

The interactive JupyterLite notebook for converging the k-grid of the total energy can be accessed below.

Reciprocal Space Grid Convergence Study adds a k-point convergence to a workflow in the web interface.