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]
82.8kiB [00:00, 782kiB/s]
230kiB [00:00, 1.14MiB/s]
767kiB [00:00, 2.92MiB/s]
2.89MiB [00:00, 9.79MiB/s]
3.89MiB [00:00, 9.30MiB/s]
4.85MiB [00:00, 8.66MiB/s]
5.75MiB [00:00, 7.61MiB/s]
6.68MiB [00:00, 7.80MiB/s]
7.54MiB [00:01, 7.58MiB/s]
8.37MiB [00:01, 7.73MiB/s]
9.17MiB [00:01, 7.62MiB/s]
9.98MiB [00:01, 6.93MiB/s]
10.7MiB [00:01, 7.04MiB/s]
11.5MiB [00:01, 7.11MiB/s]
12.5MiB [00:01, 6.89MiB/s]
13.3MiB [00:01, 6.85MiB/s]
14.0MiB [00:01, 6.78MiB/s]
15.2MiB [00:02, 7.96MiB/s]
16.0MiB [00:02, 7.76MiB/s]
16.9MiB [00:02, 7.02MiB/s]
17.7MiB [00:02, 7.06MiB/s]
18.5MiB [00:02, 7.21MiB/s]
19.2MiB [00:02, 7.09MiB/s]
20.0MiB [00:02, 7.17MiB/s]
20.9MiB [00:02, 7.10MiB/s]
21.9MiB [00:03, 7.87MiB/s]
22.8MiB [00:03, 7.75MiB/s]
23.6MiB [00:03, 7.44MiB/s]
24.3MiB [00:03, 6.99MiB/s]
25.3MiB [00:03, 7.26MiB/s]
26.1MiB [00:03, 7.28MiB/s]
26.9MiB [00:03, 7.56MiB/s]
27.8MiB [00:03, 7.10MiB/s]
28.7MiB [00:03, 7.38MiB/s]
29.4MiB [00:04, 7.34MiB/s]
30.2MiB [00:04, 7.38MiB/s]
31.0MiB [00:04, 7.33MiB/s]
31.7MiB [00:04, 7.15MiB/s]
32.5MiB [00:04, 7.06MiB/s]
33.2MiB [00:04, 7.00MiB/s]
34.1MiB [00:04, 7.39MiB/s]
34.9MiB [00:04, 6.57MiB/s]
36.0MiB [00:04, 7.71MiB/s]
36.8MiB [00:05, 7.63MiB/s]
37.7MiB [00:05, 7.61MiB/s]
38.5MiB [00:05, 6.98MiB/s]
39.2MiB [00:05, 6.97MiB/s]
40.0MiB [00:05, 6.99MiB/s]
40.8MiB [00:05, 6.90MiB/s]
41.6MiB [00:05, 6.88MiB/s]
42.7MiB [00:05, 7.79MiB/s]
43.5MiB [00:05, 7.76MiB/s]
44.3MiB [00:06, 7.67MiB/s]
45.1MiB [00:06, 6.84MiB/s]
45.9MiB [00:06, 6.97MiB/s]
46.7MiB [00:06, 7.04MiB/s]
47.4MiB [00:06, 6.91MiB/s]
48.2MiB [00:06, 7.25MiB/s]
Validating md5 checksums of ONCVPSP-PBEsol-FR-PDv0.4...
Checksum test: OK
Installation completed successfully in 8.19 [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
import abipy.abilab as abilab
import abipy.flowtk as 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.471 seconds)