Note
Go to the end to download the full example code.
Spin spirals in iron with GBT

Full Formula (Fe1)
Reduced Formula: Fe
abc : 2.551940 2.551940 2.551940
angles: 60.000000 60.000000 60.000000
pbc : True True True
Sites (1)
# SP a b c
--- ---- --- --- ---
0 Fe 0 0 0
natom 1
ntypat 1
typat 1
znucl 26
xred 0.0000000000 0.0000000000 0.0000000000
acell 1.0 1.0 1.0
rprim
0.0000000000 3.4100000000 3.4100000000
3.4100000000 0.0000000000 3.4100000000
3.4100000000 3.4100000000 0.0000000000
Downloading repository from: https://github.com/PseudoDojo/ONCVPSP-PBEsol-FR-PDv0.4/archive/refs/heads/master.zip ...
Installing ONCVPSP-PBEsol-FR-PDv0.4 in: /home/runner/.abinit/pseudos/ONCVPSP-PBEsol-FR-PDv0.4
0.00iB [00:00, ?iB/s]
734kiB [00:00, 6.95MiB/s]
1.51MiB [00:00, 6.91MiB/s]
2.24MiB [00:00, 6.67MiB/s]
2.98MiB [00:00, 6.51MiB/s]
3.66MiB [00:00, 6.05MiB/s]
4.49MiB [00:00, 6.60MiB/s]
5.30MiB [00:00, 7.04MiB/s]
6.05MiB [00:00, 6.19MiB/s]
6.80MiB [00:01, 6.49MiB/s]
7.65MiB [00:01, 6.88MiB/s]
8.38MiB [00:01, 6.74MiB/s]
9.09MiB [00:01, 6.34MiB/s]
9.87MiB [00:01, 6.31MiB/s]
10.6MiB [00:01, 6.24MiB/s]
11.4MiB [00:01, 6.50MiB/s]
12.1MiB [00:01, 6.49MiB/s]
12.9MiB [00:01, 6.60MiB/s]
13.7MiB [00:02, 6.66MiB/s]
14.5MiB [00:02, 7.08MiB/s]
15.3MiB [00:02, 6.19MiB/s]
16.3MiB [00:02, 7.24MiB/s]
17.1MiB [00:02, 7.06MiB/s]
17.9MiB [00:02, 6.70MiB/s]
18.6MiB [00:02, 6.46MiB/s]
19.3MiB [00:02, 6.29MiB/s]
20.0MiB [00:03, 6.30MiB/s]
20.9MiB [00:03, 6.37MiB/s]
21.6MiB [00:03, 6.47MiB/s]
22.4MiB [00:03, 6.42MiB/s]
23.2MiB [00:03, 6.76MiB/s]
23.9MiB [00:03, 6.82MiB/s]
24.7MiB [00:03, 6.50MiB/s]
25.5MiB [00:03, 6.46MiB/s]
26.3MiB [00:04, 6.57MiB/s]
27.0MiB [00:04, 6.45MiB/s]
28.0MiB [00:04, 7.05MiB/s]
28.7MiB [00:04, 7.10MiB/s]
29.5MiB [00:04, 7.01MiB/s]
30.2MiB [00:04, 6.77MiB/s]
30.9MiB [00:04, 6.51MiB/s]
31.6MiB [00:04, 6.32MiB/s]
32.3MiB [00:04, 6.25MiB/s]
33.2MiB [00:05, 6.34MiB/s]
33.9MiB [00:05, 6.47MiB/s]
34.8MiB [00:05, 7.04MiB/s]
35.5MiB [00:05, 6.98MiB/s]
36.2MiB [00:05, 7.00MiB/s]
36.9MiB [00:05, 6.13MiB/s]
37.7MiB [00:05, 6.29MiB/s]
38.4MiB [00:05, 6.38MiB/s]
39.1MiB [00:05, 6.32MiB/s]
40.0MiB [00:06, 6.50MiB/s]
40.8MiB [00:06, 6.41MiB/s]
41.6MiB [00:06, 6.32MiB/s]
42.4MiB [00:06, 6.80MiB/s]
43.3MiB [00:06, 7.23MiB/s]
44.1MiB [00:06, 6.87MiB/s]
44.8MiB [00:06, 6.69MiB/s]
45.6MiB [00:06, 6.41MiB/s]
46.3MiB [00:07, 6.34MiB/s]
47.1MiB [00:07, 6.42MiB/s]
47.8MiB [00:07, 6.38MiB/s]
48.2MiB [00:07, 6.61MiB/s]
Validating md5 checksums of ONCVPSP-PBEsol-FR-PDv0.4...
Checksum test: OK
Installation completed successfully in 8.46 [s]
K-path contains 1 lines. Number of k-points in each line: [11]
Idx Frac_coords Name ds Vert
----- ------------------------------- ------ -------- ------
0 0.0000000, 0.0000000, 0.0000000 G 0.174098 *
1 0.0500000, 0.0000000, 0.0500000 0.174098
2 0.1000000, 0.0000000, 0.1000000 0.174098
3 0.1500000, 0.0000000, 0.1500000 0.174098
4 0.2000000, 0.0000000, 0.2000000 0.174098
5 0.2500000, 0.0000000, 0.2500000 0.174098
6 0.3000000, 0.0000000, 0.3000000 0.174098
7 0.3500000, 0.0000000, 0.3500000 0.174098
8 0.4000000, 0.0000000, 0.4000000 0.174098
9 0.4500000, 0.0000000, 0.4500000 0.174098
10 0.5000000, 0.0000000, 0.5000000 X
import os
import sys
from abipy import abilab, flowtk
def build_flow(options):
# Working directory (default is the name of the script with '.py' removed and "run_" replaced by "flow_")
if not options.workdir:
options.workdir = os.path.basename(sys.argv[0]).replace(".py", "").replace("run_", "flow_")
# Fe in bcc structure.
structure = abilab.Structure.from_abistring("""
natom 1
ntypat 1
typat 1
znucl 26
xred 0.0000000000 0.0000000000 0.0000000000
acell 1.0 1.0 1.0
rprim
4.2302629971 0.0000000000 2.4423434801
1.4100876657 3.9883302019 2.4423434801
0.0000000000 0.0000000000 4.8846869602
""")
# gamma-iron. fcc structure with Cu lattice parameters
a = 6.82
# a = 6.833
structure = abilab.Structure.fcc(a, ["Fe"], units="bohr")
print(structure)
print(structure.abi_string)
# Use relativistic NC PBEsol pseudos from pseudodojo v0.4.
from abipy.flowtk.psrepos import get_oncvpsp_pseudos
pseudos = get_oncvpsp_pseudos(xc_name="PBEsol", version="0.4", relativity_type="FR")
scf_input = abilab.AbinitInput(structure=structure, pseudos=pseudos)
connect = False
scf_input.set_vars(
# SPIN
nspinor=2,
nspden=4,
so_psp=0,
spinat=[4.0, 0.0, 0.0],
ixc=7, # Use LDA instead of PBEsol
ecut=30,
nband=24,
nline=12, # To facilitate convergence.
nstep=100, # Maximal number of SCF cycles
toldfe=1e-6,
nsym=1, # Disable spatial symmetries
occopt=7,
tsmear=0.01,
paral_kgb=0,
prtwf=-1 if connect else 1,
)
# Create the Flow.
flow = flowtk.Flow(options.workdir, manager=options.manager)
# Define q-path. Two modes are available
# If qnames is None, a standardized path is automatically generated from the structure
# else the labels are taken from qnames.
qnames = None
qnames = ["G", "X"]
line_density = 10
# This to show how to perform convergence studies.
# Here we compute E(q) for different ngkpt
ngkpt_list = [
(2, 2, 2),
# (4, 4, 4),
]
from abipy.flowtk.gs_works import SpinSpiralWork
for ngkpt in ngkpt_list:
new_input = scf_input.deepcopy()
new_input.set_kmesh(ngkpt=ngkpt, shiftk=[0.0, 0.0, 0.0], kptopt=4)
work = SpinSpiralWork.from_scf_input(new_input, qnames=qnames, line_density=line_density, connect=connect)
flow.register_work(work)
return flow
# This block generates the thumbnails in the AbiPy gallery.
# You can safely REMOVE this part if you are using this script for production runs.
if os.getenv("READTHEDOCS", False):
__name__ = None
import tempfile
options = flowtk.build_flow_main_parser().parse_args(["-w", tempfile.mkdtemp()])
build_flow(options).graphviz_imshow()
@flowtk.flow_main
def main(options):
"""
This is our main function that will be invoked by the script.
flow_main is a decorator implementing the command line interface.
Command line args are stored in `options`.
"""
return build_flow(options)
if __name__ == "__main__":
sys.exit(main())
Total running time of the script: (0 minutes 8.730 seconds)