Skip to content
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

spin polarized calculation with DFPT workflow #226

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7f68971
Bugfix in ui when nband is different for the different spin channel
nscolonna Jun 13, 2024
3165ac6
Implement "get_number_of_spins" in ui calculator. Remove
nscolonna Jun 13, 2024
fdcfb55
Remove ipdb call
nscolonna Jun 13, 2024
3b67084
Add tutorial_6: KCP calculation for a FM system (CrI3)
nscolonna Jun 14, 2024
ea0584e
makes the robot happy (not the human)
nscolonna Jun 14, 2024
b30c9f3
Add a first draft of the documentation for tutorial_6
nscolonna Jun 14, 2024
7e63acd
Add output of koopmans for tutorial_6 (needed for referencing in the
nscolonna Jun 14, 2024
03a84da
and the band structure plot
nscolonna Jun 14, 2024
3df5b35
correct typo
nscolonna Jun 14, 2024
be794c1
Small changes in the input file of cri3.json
nscolonna Jun 14, 2024
00e51bf
Merge branch 'bugfix_ui_nspin2' of github.com:epfl-theos/koopmans int…
nscolonna Jun 14, 2024
d0a1505
wrong reference to line numbers in rst file
nscolonna Jun 14, 2024
a633d3d
formatting
nscolonna Jun 14, 2024
ad83ba3
pep8 compliant
nscolonna Jun 14, 2024
ea29c3e
Set locale to en_US.utf8. Avoid crash when make the docsif your local…
nscolonna Jun 17, 2024
1999f5b
Fix typo in json file for tutorial_6
nscolonna Jun 17, 2024
d714f82
Update tutorial_6 deocumentation and input (to avoid warning about the
nscolonna Jun 17, 2024
cc57a26
Test on locale settings on the github actions
nscolonna Jun 17, 2024
fea52f3
another try for locale
nscolonna Jun 17, 2024
9e0279c
check locale on the server
nscolonna Jun 17, 2024
1c5dca5
Trying with c.utf8
nscolonna Jun 17, 2024
78856f8
Uppercase
nscolonna Jun 17, 2024
673d6e8
set-up different folder for spin-polarized kcw calculations
nscolonna Jun 17, 2024
a4c8ce5
Merge branch 'master' into kcw_nspin2
nscolonna Jun 18, 2024
7b4f3ce
Missing f in print statement
nscolonna Jun 18, 2024
1517d9a
remove ipdb
nscolonna Jun 18, 2024
6fe6bbd
correct counting of the wannier functions
nscolonna Jun 18, 2024
0198aa2
Implementation of the logic for nspin=2 calculation with the DFPT
nscolonna Jun 19, 2024
ed3c4d6
pep8 compliant
nscolonna Jun 19, 2024
2518dba
more
nscolonna Jun 19, 2024
def9e59
Remove hard coded set up ot tot_magnetization
nscolonna Jun 25, 2024
a573a59
rename kc_wann to kcw
nscolonna Jul 2, 2024
8b5166f
Add basic documentation for kcw subblock
nscolonna Jul 2, 2024
9bb66a6
remove wrong documentation related to the kcw subblock
nscolonna Jul 2, 2024
dbb2ee1
renaming kcw subsubblocks to mirror the kcw.x input file
nscolonna Jul 2, 2024
af627e6
title underline too short
nscolonna Jul 2, 2024
245e375
Bug fix in projwfc calculator when nspin=2 due to missing atom.tag. A…
nscolonna Sep 6, 2024
cc5f991
Merge branch 'bugfix_pdos_nspin2_afm' into kcw_nspin2
nscolonna Sep 11, 2024
195b8ea
Missing spin suffix when symlinking U rotation matrices
nscolonna Sep 11, 2024
fd8fe7e
Merge branch 'master' into kcw_nspin2
elinscott Oct 15, 2024
4cdc47f
Remove debugging locale command in gh workflow
elinscott Oct 25, 2024
7df3918
WIP
elinscott Oct 29, 2024
b3c03a3
Bugfixes; CrI3 now runs
elinscott Nov 20, 2024
dd10185
Updated QE version to include bugfix to magtot
elinscott Nov 20, 2024
73442cf
Made sure band structure plotting works for spin polarized systems
elinscott Nov 22, 2024
991832c
Removed erroneously included old output file
elinscott Nov 22, 2024
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 docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

# isort: off
import locale

locale.setlocale(locale.LC_ALL, 'C.UTF-8') # noqa
# isort: on

Expand Down
6 changes: 6 additions & 0 deletions docs/input_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ The kcp subblock
~~~~~~~~~~~~~~~~
This subblock contains keywords specific to ``kcp.x``, a modified version of ``cp.x`` for performing Koopmans calculations. In addition to `the keywords associated with cp.x <https://www.quantum-espresso.org/Doc/INPUT_CP.html>`_ there are several new keywords associated with the Koopmans implementation in ``kcp.x``. Non-experts will never need to change these.


The kcw subblock
~~~~~~~~~~~~~~~~
This subblock contains keywords specific to ``kcw.x`` (see the `list of valid kcw.x keywords <https://www.quantum-espresso.org/Doc/INPUT_KCW.html>`_). Non-experts will never need to change these keywords.


The ui subblock
~~~~~~~~~~~~~~~
This subblock controls the unfolding and interpolation procedure for generating band structures and densities of states from Γ-only supercell calculations.
Expand Down
2 changes: 1 addition & 1 deletion quantum_espresso/q-e
Submodule q-e updated from b4c5e8 to edb08f
15 changes: 5 additions & 10 deletions src/koopmans/calculators/_koopmans_ham.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class KoopmansHamCalculator(KCWannCalculator, KoopmansHam, ReturnsBandStructure,
ext_in = '.khi'
ext_out = '.kho'

def __init__(self, atoms: Atoms, alphas: Optional[List[int]] = None, *args, **kwargs):
def __init__(self, atoms: Atoms, alphas: Optional[List[float]] = None, *args, **kwargs):
# Define the valid settings
self.parameters = settings.KoopmansHamSettingsDict()

Expand All @@ -39,15 +39,10 @@ def __init__(self, atoms: Atoms, alphas: Optional[List[int]] = None, *args, **kw
self.alphas = alphas

def write_alphas(self):
# self.alphas is a list of alpha values indexed by spin index and then band index. Meanwhile, kcw.x takes a
# single file for the alphas (rather than splitting between filled/empty) and does not have two columns for
# spin up then spin down
assert self.alphas is not None, 'You have not provided screening parameters to this calculator'
if not len(self.alphas) == 1:
raise NotImplementedError('`KoopmansHamCalculator` yet to be implemented for spin-polarized systems')
[alphas] = self.alphas
filling = [True for _ in range(len(alphas))]
utils.write_alpha_file(self.directory, alphas, filling)
# self.alphas is a list of alpha values indexed by band index. Meanwhile, kcw.x takes a
# single file for the alphas (rather than splitting between filled/empty)
fake_filling = [True for _ in self.alphas]
utils.write_alpha_file(self.directory, self.alphas, fake_filling)

def _pre_calculate(self):
super()._pre_calculate()
Expand Down
4 changes: 2 additions & 2 deletions src/koopmans/settings/_koopmans_ham.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from ase.dft.kpoints import BandPath
from ase.io.espresso import kch_keys

from ._utils import SettingsDict, kc_wann_defaults
from ._utils import SettingsDict, kcw_defaults


class KoopmansHamSettingsDict(SettingsDict):
def __init__(self, **kwargs) -> None:
super().__init__(valid=[k for block in kch_keys.values() for k in block],
defaults={'calculation': 'ham', 'do_bands': True, 'use_ws_distance': True, 'write_hr': True,
'l_alpha_corr': False, **kc_wann_defaults},
'l_alpha_corr': False, **kcw_defaults},
are_paths=['outdir', 'pseudo_dir'],
**kwargs)

Expand Down
4 changes: 2 additions & 2 deletions src/koopmans/settings/_koopmans_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

from ase.io.espresso import kcs_keys

from ._utils import SettingsDict, kc_wann_defaults
from ._utils import SettingsDict, kcw_defaults


class KoopmansScreenSettingsDict(SettingsDict):
def __init__(self, **kwargs) -> None:
super().__init__(valid=[k for block in kcs_keys.values() for k in block],
defaults={'calculation': 'screen', 'tr2': 1.0e-18, 'nmix': 4, 'niter': 33,
'check_spread': True, **kc_wann_defaults},
'check_spread': True, **kcw_defaults},
are_paths=['outdir', 'pseudo_dir'],
** kwargs)

Expand Down
18 changes: 9 additions & 9 deletions src/koopmans/settings/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ def __setitem__(self, key: str, value: Any) -> None:
return super().__setitem__(key, value) # type: ignore


kc_wann_defaults = {'outdir': 'TMP',
'kcw_iverbosity': 1,
'kcw_at_ks': False,
'homo_only': False,
'read_unitary_matrix': True,
'lrpa': False,
'check_ks': True,
'have_empty': True,
'has_disentangle': True}
kcw_defaults = {'outdir': 'TMP',
'kcw_iverbosity': 1,
'kcw_at_ks': False,
'homo_only': False,
'read_unitary_matrix': True,
'lrpa': False,
'check_ks': True,
'have_empty': True,
'has_disentangle': True}
4 changes: 2 additions & 2 deletions src/koopmans/settings/_wann2kc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from ase.io.espresso import w2kcw_keys

from ._utils import SettingsDict, kc_wann_defaults
from ._utils import SettingsDict, kcw_defaults


class Wann2KCSettingsDict(SettingsDict):
Expand All @@ -17,7 +17,7 @@ def __init__(self, **kwargs) -> None:
flattened_kwargs[k] = v

super().__init__(valid=[k for block in w2kcw_keys.values() for k in block],
defaults={'calculation': 'wann2kcw', **kc_wann_defaults},
defaults={'calculation': 'wann2kcw', **kcw_defaults},
are_paths=['outdir', 'pseudo_dir'],
**flattened_kwargs)

Expand Down
2 changes: 1 addition & 1 deletion src/koopmans/settings/_wann2kcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Wann2KCPSettingsDict(SettingsDict):
def __init__(self, **kwargs) -> None:
super().__init__(valid=['outdir', 'prefix', 'seedname', 'wan_mode', 'spin_component',
'gamma_trick', 'print_rho', 'wannier_plot', 'wannier_plot_list'],
defaults={'outdir': 'TMP', 'prefix': 'kc', 'seedname': 'wann',
defaults={'outdir': 'TMP', 'prefix': 'kc', 'seedname': 'wannier90',
'wan_mode': 'wannier2kcp'},
are_paths=['outdir'],
**kwargs)
Expand Down
Loading
Loading