Skip to content

Z2pack with elk #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 57 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
68d843e
Add files via upload
euclidmenot2 Mar 24, 2021
3d2c61f
Update runElkWorks.py
euclidmenot2 Mar 24, 2021
6402d6d
Delete examples/fp/elk/Bi2Se3 directory
euclidmenot2 Mar 25, 2021
b6e3840
Add files via upload
euclidmenot2 Mar 25, 2021
f228661
Add files via upload
euclidmenot2 Mar 25, 2021
4919d39
Update CHANGE.log
euclidmenot2 Mar 25, 2021
1997eaf
Update kpoint.py
euclidmenot2 Mar 25, 2021
f766a56
Update runElk.py
euclidmenot2 Mar 25, 2021
b71c942
Update kpoint.py
euclidmenot2 Mar 25, 2021
f59423d
Update clean.sh
euclidmenot2 Mar 25, 2021
a127d07
Update kpoint.py
euclidmenot2 Mar 25, 2021
9c4feca
Update kpoint.py
euclidmenot2 Mar 25, 2021
4e6fb9e
Update kpoint.py
euclidmenot2 Mar 25, 2021
c218d47
Update kpoint.py
euclidmenot2 Mar 25, 2021
4232f5a
Update kpoint.py
euclidmenot2 Mar 25, 2021
4198153
Update kpoint.py
euclidmenot2 Mar 25, 2021
1eaff59
Update runElk.py
euclidmenot2 Mar 25, 2021
6298fcc
Add files via upload
euclidmenot2 Mar 25, 2021
62f7fbd
Add files via upload
euclidmenot2 Mar 25, 2021
07c1a25
Add files via upload
euclidmenot2 Mar 25, 2021
5f34e92
Delete tests/elk/ground directory
euclidmenot2 Mar 25, 2021
772fd95
Add files via upload
euclidmenot2 Mar 25, 2021
079a099
Delete tests/samples/elk/ground directory
euclidmenot2 Mar 25, 2021
84967e0
Add files via upload
euclidmenot2 Mar 25, 2021
49e3059
Create elk.in
euclidmenot2 Mar 26, 2021
6d47a10
Add files via upload
euclidmenot2 Mar 26, 2021
705b8fe
Create INFO.OUT
euclidmenot2 Mar 26, 2021
f40b1fe
Add files via upload
euclidmenot2 Mar 26, 2021
dec40e8
Create runElk.py
euclidmenot2 Mar 26, 2021
0e4dc34
Add files via upload
euclidmenot2 Mar 26, 2021
198d955
Delete runElk.py
euclidmenot2 Mar 26, 2021
0476f08
Add files via upload
euclidmenot2 Mar 26, 2021
4c82af1
Create run.py
euclidmenot2 Mar 26, 2021
9bfb3f0
Delete elk.in
euclidmenot2 Mar 26, 2021
21e7891
Delete elkWannBands.in
euclidmenot2 Mar 26, 2021
4d6e517
Create clean.sh
euclidmenot2 Mar 26, 2021
b6aeb26
Delete runElk.py
euclidmenot2 Mar 26, 2021
c001020
Delete run.py
euclidmenot2 Mar 26, 2021
9fccdf3
Delete clean.sh
euclidmenot2 Mar 26, 2021
1395e67
Create elk.in
euclidmenot2 Mar 26, 2021
9eef620
Add files via upload
euclidmenot2 Mar 26, 2021
2c5c401
Create elk.in
euclidmenot2 Mar 26, 2021
e5850b0
Add files via upload
euclidmenot2 Mar 26, 2021
ea8f845
Add files via upload
euclidmenot2 Mar 26, 2021
c4cfe3e
Delete tests/samples/elk directory
euclidmenot2 Mar 26, 2021
cda4e5d
Update test_fp_kpoint.py
euclidmenot2 Mar 26, 2021
af3c53d
Add files via upload
euclidmenot2 Mar 26, 2021
530ea39
Add files via upload
euclidmenot2 Mar 26, 2021
d043f46
Add files via upload
euclidmenot2 Mar 26, 2021
7339c6d
Add files via upload
euclidmenot2 Mar 26, 2021
efcef5e
Add files via upload
euclidmenot2 Mar 26, 2021
febdb8b
Add files via upload
euclidmenot2 Mar 26, 2021
f7f8a68
Add files via upload
euclidmenot2 Mar 26, 2021
836b379
Update run.py
euclidmenot2 Mar 26, 2021
6b1bd5c
Update run.py
euclidmenot2 Mar 26, 2021
237f477
Add files via upload
euclidmenot2 Apr 5, 2021
284b57c
Update test_fp_kpoint.py
euclidmenot2 Apr 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGE.log
Original file line number Diff line number Diff line change
@@ -4,3 +4,4 @@
- Added fp.kpoint.wannier90_nnkpts and fp.kpoint.wannier90_full
- In fp.System's input_files, and file_names, it is now required that the input is a list of strings (previously, a single string was also allowed).
- Default saving is now JSON (change due to fsc.iohelper). Quiet loading doesn't ignore when the file ending is absent or serializer is not set.
- Elk first principles (http://elk.sourceforge.net/) example files are included, and an additional function in kpoints.py was added to allow Z2pack to interface with Elk
68 changes: 68 additions & 0 deletions examples/fp/elk/Bi/input/elk.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
tasks
0

highq
.true.

spinorb
.true.

epsband
1.e-8

primcell
.false.

nempty
10

autoswidth
.true.

lmirep
.true.

sppath
'/home-2/[email protected]/Z2pack/elk-6.8.4/species/'

ngridk
6 6 6



! Atomic positions generated by spacegroup version 1.2.01
! Hermann-Mauguin symbol : R-3m:H
! Hall symbol : -R 3 2"
! Schoenflies symbol : D3d^5
! space group number : 166:H
! lattice constants (a,b,c) : 8.590712580 8.590712580 22.41597726
! angles in degrees (bc,ac,ab) : 90.00000000 90.00000000 120.0000000
! number of conventional unit cells : 1 1 1
! reduction to primitive cell : T
! Wyckoff positions :
! species : 1, Bi
! 0.000000000 0.000000000 0.2338900000

scale
1.0

scale1
1.0

scale2
1.0

scale3
1.0

avec
4.295356290 7.439775331 0.000000000
8.590712580 0.000000000 0.000000000
0.8881784197E-15 4.959850221 -7.471992420

atoms
1 : nspecies
'Bi.in' : spfname
2 : natoms; atpos, bfcmt below
0.46778000 0.26611000 0.29833000 0.00000000 0.00000000 0.00000000
-0.46778000 -0.26611000 -0.29833000 0.00000000 0.00000000 0.00000000
86 changes: 86 additions & 0 deletions examples/fp/elk/Bi/input/elkWannBands.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
tasks
1
550

reducek
0

highq
.true.

spinorb
.true.

epsband
1.e-8

primcell
.false.

nempty
10

autoswidth
.true.

lmirep
.true.

sppath
'/home-2/[email protected]/Z2pack/elk-6.8.4/species/'


idxw90
1-29

num_iter
0

maxscl
1

! Atomic positions generated by spacegroup version 1.2.01
! Hermann-Mauguin symbol : R-3m:H
! Hall symbol : -R 3 2"
! Schoenflies symbol : D3d^5
! space group number : 166:H
! lattice constants (a,b,c) : 8.590712580 8.590712580 22.41597726
! angles in degrees (bc,ac,ab) : 90.00000000 90.00000000 120.0000000
! number of conventional unit cells : 1 1 1
! reduction to primitive cell : T
! Wyckoff positions :
! species : 1, Bi
! 0.000000000 0.000000000 0.2338900000

scale
1.0

scale1
1.0

scale2
1.0

scale3
1.0

avec
4.295356290 7.439775331 0.000000000
8.590712580 0.000000000 0.000000000
0.8881784197E-15 4.959850221 -7.471992420

atoms
1 : nspecies
'Bi.in' : spfname
2 : natoms; atpos, bfcmt below
0.46778000 0.26611000 0.29833000 0.00000000 0.00000000 0.00000000
-0.46778000 -0.26611000 -0.29833000 0.00000000 0.00000000 0.00000000



xlwin
postproc_setup : true
begin projections
random
end projections
shell_list 1
75 changes: 75 additions & 0 deletions examples/fp/elk/Bi/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# -*- coding: utf-8 -*-
'''
run.py can be used to interface ELK and Z2Pack. To use, change elkdir to your location of elk.
Wannier90 is run by Elk in library mode. Check http://elk.sourceforge.net/ for installation
instructions.
'''
import os
import shutil
import subprocess

import matplotlib.pyplot as plt
import z2pack

# Edit the paths to your Elk and Wannier90 here
elkdir = '$HOME/Z2pack/elk-6.8.4/src/elk'

# creating the results folder, running the SCF calculation if needed
if not os.path.exists('./plots'):
os.mkdir('./plots')
if not os.path.exists('./results'):
os.mkdir('./results')
if not os.path.exists('./ground'):
os.makedirs('./ground')
print("Running the ground state calculation")
#do initial ground-state calculation in the ground folder using elk.in in the input folder
shutil.copyfile('input/elk.in', 'ground/elk.in')
subprocess.call(elkdir + ' >& elkWannier.log', shell=True, cwd='./ground')

# Collecting the files for the surface calculation
# The k-point nearest neighbors list/kpoints string is appended to the .in file,
# starting on the last line, and there can be no extra lines in between the shell_list
# and the nnkpts lines. The nnkpts line should be added directly to the end of elkWannBands.in
# automatically by Z2pack during the surface calculation (becomes build/elk.in).
input_files = [
'ground/' + name for name in [
"elk.in", "STATE.OUT", "INFO.OUT", "GEOMETRY.OUT", "LINENGY.OUT",
"DTOTENERGY.OUT", "EFERMI.OUT", "EIGVAL.OUT", "EQATOMS.OUT",
"EVALCORE.OUT", "EVALFV.OUT", "EVALSV.OUT", "EVECFV.OUT", "EVECSV.OUT",
"FERMIDOS.OUT", "GAP.OUT", "GEOMETRY.OUT", "IADIST.OUT", "LATTICE.OUT",
"KPOINTS.OUT", "MOMENT.OUT", "MOMENTM.OUT", "OCCSV.OUT", "RMSDVS.OUT",
"SYMCRYS.OUT", "SYMLAT.OUT", "SYMSITE.OUT", "TOTENERGY.OUT"
]
]

# Note that this ensures that elkWannBands.in is used
# rather than what was used for the Ground state calculation.
shutil.copyfile('input/elkWannBands.in', 'ground/elk.in')

# Create the Z2Pack system.
system = z2pack.fp.System(
input_files=input_files,
kpt_fct=z2pack.fp.kpoint.elk,
kpt_path="elk.in",
command=elkdir + ' >& elk.log',
mmn_path='wannier.mmn'
)

# Run the WCC calculations
result_0 = z2pack.surface.run(
system=system,
surface=lambda s, t: [0, s / 2, t],
save_file='./results/res_0.json',
load=True
)

print(
'Z2 topological invariant at kx = 0: {0}'.format(
z2pack.invariant.z2(result_0)
)
)

# Plot the WCC
fig, ax = plt.subplots(1, 1, sharey=True, figsize=(9, 5))
z2pack.plot.wcc(result_0, axis=ax)
plt.savefig('plots/plot.pdf', bbox_inches='tight')
2 changes: 2 additions & 0 deletions examples/fp/elk/Bi2Se3/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
rm -rf ground build results plots
91 changes: 91 additions & 0 deletions examples/fp/elk/Bi2Se3/input/elk.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
tasks
0
20

highq
.true.

spinorb
.true.

epsband
1.e-8

primcell
.false.

nempty
10

autoswidth
.true.

lmirep
.true.

sppath
'/home-2/[email protected]/Z2pack2/elk-6.8.4/species/'

ngridk
12 12 5

idxw90
1-112

xlwin
postproc_setup : true
begin projections
random
end projections

plot1d
4 400
0.677219 0.322781 0.500000 :B
0.000000 0.000000 0.500000 :Z
0.000000 0.000000 0.000000 :gamma
0.67721904 0.33860952 0.33860952 :X

! Atomic positions generated by spacegroup version 1.2.01
! Hermann-Mauguin symbol : R-3m:R
! Hall symbol : -P 3* 2
! Schoenflies symbol : D3d^5
! space group number : 166:R
! lattice constants (a,b,c) : 18.59302275 18.59302275 18.59302275
! angles in degrees (bc,ac,ab) : 24.40000000 24.40000000 24.40000000
! number of conventional unit cells : 1 1 1
! reduction to primitive cell : T
! Wyckoff positions :
! species : 1, Bi
! 0.3990000000 0.3990000000 0.3990000000
! species : 2, Se
! 0.000000000 0.000000000 0.000000000
! 0.7940000000 0.7940000000 0.7940000000

scale
1.0

scale1
1.0

scale2
1.0

scale3
1.0

avec
1.660660727 -3.660906252 -6.752286776
1.660660727 -7.680860062 0.000000000
18.59302275 0.000000000 0.000000000

atoms
2 : nspecies
'Bi.in' : spfname
2 : natoms; atpos, bfcmt below
0.10100000 0.10100000 0.19700000 0.00000000 0.00000000 0.00000000
-0.10100000 -0.10100000 -0.19700000 0.00000000 0.00000000 0.00000000
'Se.in' : spfname
3 : natoms; atpos, bfcmt below
0.50000000 0.50000000 0.00000000 0.00000000 0.00000000 0.00000000
-0.29400000 -0.29400000 0.38200000 0.00000000 0.00000000 0.00000000
0.29400000 0.29400000 -0.38200000 0.00000000 0.00000000 0.00000000
Loading