Skip to content

Converge a Workflow Parameter

1. Introduction

Converge any numeric parameter in the input of a single-unit workflow, such as degauss, and get the converged value for use in another notebook.

2. Open the notebook

In JupyterLite, the notebook is made/workflows/convergence.ipynb, entry 1.2.2 "Any parameter convergence (Plane-wave cutoff example)" 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from datetime import datetime
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"

# 4. Convergence parameter
# Common parameters to converge:
# - ecutwfc: wavefunction cutoff (most important) — start ~20 Ry, increment 5-10 Ry
# - ecutrho: charge density cutoff — start 4×ecutwfc, increment 20-40 Ry
# - degauss: smearing width (metals) — start 0.001 Ry, increment 0.002 Ry
# Advanced (workflow-specific):
# - ecutfock: Fock exchange cutoff (HSE) — start ~80 Ry, increment 20 Ry
# - tr2_ph: phonon self-consistency threshold — start 1e-12, decrease by 10×
# - num_band: number of bands (GW) — start 8, increment 2-4
# - ecut_corr: correlation cutoff (GW) — start 5 Ry, increment 1 Ry

PARAMETER_NAME = "ecutwfc" # adjust to desired parameter in the input template
PARAMETER_INITIAL = 20
PARAMETER_INCREMENT = 5
INPUT_NAME = None  # if provided, targets a specific input file by name (e.g. "pw_scf.in", "INCAR") only

# 5. Convergence result
# Common results to monitor:
# - total_energy: standard baseline
# - total_force: for relaxations/phonons
# - fermi_energy: for metals, work function calculations
# - pressure: for equation of state, elastic constants
RESULT_NAME = "total_energy" # adjust to desired result in the output template
RESULT_INITIAL = 0
TOLERANCE = 1e-4 # for comparison

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

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

WORKFLOW_SEARCH_TERM names the single-unit workflow whose input holds the parameter. PARAMETER_NAME is the converged parameter, changed from PARAMETER_INITIAL in steps of PARAMETER_INCREMENT; the comments list common choices. INPUT_NAME restricts the substitution to one input file, such as pw_scf.in. RESULT_NAME is the monitored result and TOLERANCE its convergence threshold; 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, plots the monitored result against the parameter, and prints the converged value, converged_value, for use in another notebook.

5. Interactive JupyterLite notebook

The interactive JupyterLite notebook for converging a workflow parameter can be accessed below.

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