3
0
mirror of https://github.com/triqs/dft_tools synced 2025-05-01 12:44:59 +02:00

[doc] updates to CSC NiO example with VASP

This commit is contained in:
the-hampel 2025-02-20 15:01:16 +01:00
parent 511589c0d5
commit 45db76f559
9 changed files with 26 additions and 37 deletions

View File

@ -8,7 +8,7 @@ The VASP interface relies on new options introduced since version 5.4.x In
particular, a new INCAR-option `LOCPROJ particular, a new INCAR-option `LOCPROJ
<https://cms.mpi.univie.ac.at/wiki/index.php/LOCPROJ>`_, the new `LORBIT` modes <https://cms.mpi.univie.ac.at/wiki/index.php/LOCPROJ>`_, the new `LORBIT` modes
13 and 14 have been added, and the new `ICHARG` mode 5 for charge 13 and 14 have been added, and the new `ICHARG` mode 5 for charge
self-consistent DFT+DMFT calculations have been added. The VASP interface for charge self-consistent calculations is officially supported as of VASP version 6.5.0 (see `VASP ICHARG=5 documentation <https://www.vasp.at/wiki/index.php/ICHARG>`_). It is highly recommended to compile VASP with hdf5 support enabled (`-DVASP_HDF5`) to enable features of the interface. This allows to use the interface while symmetries are switched on in VASP, and enables spin-polarized feedback in charge self-consistent calculations to VASP. self-consistent DFT+DMFT calculations have been added. The VASP interface for charge self-consistent calculations is officially supported as of VASP version 6.5.0 (see `VASP ICHARG=5 documentation <https://www.vasp.at/wiki/index.php/ICHARG>`_). It is highly recommended to compile VASP with hdf5 support enabled (`-DVASP_HDF5`) to enable all features of the interface. This allows to use the interface while symmetries are switched on in VASP, and enables spin-polarized feedback in charge self-consistent calculations to VASP.
The VASP interface methodologically builds on the so called projection on The VASP interface methodologically builds on the so called projection on
localized orbitals (PLO) scheme, where the resulting KS states from DFT are localized orbitals (PLO) scheme, where the resulting KS states from DFT are

View File

@ -188,9 +188,9 @@ To understand the difference please make sure to read `ISTART flag VASP wiki
`NELMIN` ensure that VASP does not terminate after the default number of `NELMIN` ensure that VASP does not terminate after the default number of
iterations of 60. iterations of 60.
The `LSYNCH5` flag is set to `True` to ensure that the VASP writte vaspout.h5 file can be read while VASP is running. Starting from VASP 6.5.0 all communication between VASP and TRIQS is performed through two h5 files: `vaspout.h5 <https://www.vasp.at/wiki/index.php/Vaspout.h5>`_ and `vaspgamma.h5 <https://www.vasp.at/wiki/index.php/Vaspgamma.h5>`_ when VASP is compiled with hdf5 support. The `LSYNCH5 <https://www.vasp.at/wiki/index.php/LSYNCH5>`_ flag is set to `True` to ensure that the `vaspout.h5 <https://www.vasp.at/wiki/index.php/Vaspout.h5>`_ file can be read while VASP is running. Starting from VASP 6.5.0 all communication between VASP and TRIQS is performed through two hdf5 files: `vaspout.h5 <https://www.vasp.at/wiki/index.php/Vaspout.h5>`_ and `vaspgamma.h5 <https://www.vasp.at/wiki/index.php/Vaspgamma.h5>`_ when VASP is compiled with hdf5 support.
For more detailed and fine grained methods to run Vasp in CSC also on clusters see the methods implemented in `solid dmft <https://triqs.github.io/solid_dmft/_ref/dft_managers.html>`_. For more detailed and fine grained methods to run VASP in CSC also on clusters see the methods implemented in `solid dmft <https://triqs.github.io/solid_dmft/_ref/dft_managers.html>`_.
Elk Elk

View File

@ -1,10 +1,8 @@
System = NiO System = NiO
KPAR = 5
# better convergence for small kpt grids # better convergence for small kpt grids
ISMEAR = 2 ISMEAR = 2
SIGMA = 0.05 SIGMA = 0.04
# converge wave functions # converge wave functions
EDIFF = 1.E-7 EDIFF = 1.E-7
@ -12,7 +10,7 @@ NELMIN = 35
# the energy window to optimize projector channels (absolute) # the energy window to optimize projector channels (absolute)
EMIN = -3 EMIN = -3
EMAX = 10 EMAX = 12
LMAXMIX = 6 LMAXMIX = 6

View File

@ -1,14 +1,11 @@
System = NiO System = NiO
KPAR = 5
# better convergence for small kpt grids # better convergence for small kpt grids
ISMEAR = 2 ISMEAR = 2
SIGMA = 0.05 SIGMA = 0.05
# converge wave functions # converge wave functions
EDIFF = 1.E-7 EDIFF = 1.E-7
NELMIN = 35
# the energy window to optimize projector channels (absolute) # the energy window to optimize projector channels (absolute)
EMIN = -3 EMIN = -3
@ -25,7 +22,7 @@ LOCPROJ = "1 : d : Pr
ICHARG = 5 ICHARG = 5
NELM = 1000 NELM = 1000
NELMIN = 1000 NELMIN = 1000
NELMDL = -1 NELMDL = -2
IMIX=1 IMIX=1
BMIX=0.5 BMIX=0.5
AMIX=0.02 AMIX=0.02

View File

@ -13,17 +13,11 @@ warnings.filterwarnings("ignore", category=FutureWarning)
filename = 'vasp' filename = 'vasp'
beta = 5.0 beta = 5.0
mesh = MeshImFreq(beta=beta, S='Fermion', n_iw=1000) mesh = MeshImFreq(beta=beta, S='Fermion', n_iw=500)
SK = SumkDFT(hdf_file = filename+'.h5', use_dft_blocks = False, mesh=mesh) SK = SumkDFT(hdf_file = filename+'.h5', use_dft_blocks = False, mesh=mesh)
# We analyze the block structure of the Hamiltonian
Sigma = SK.block_structure.create_gf(mesh=mesh)
SK.put_Sigma([Sigma])
# Setup CTQMC Solver # Setup CTQMC Solver
n_orb = SK.corr_shells[0]['dim'] n_orb = SK.corr_shells[0]['dim']
spin_names = ['up','down'] spin_names = ['up','down']
@ -56,7 +50,7 @@ SK.chemical_potential = mpi.bcast(SK.chemical_potential)
if block_structure: if block_structure:
SK.block_structure = block_structure SK.block_structure = block_structure
else: else:
G = SK.extract_G_loc() G = SK.extract_G_loc(transform_to_solver_blocks=False, with_Sigma=False)
SK.analyse_block_structure_from_gf(G, threshold = 1e-3) SK.analyse_block_structure_from_gf(G, threshold = 1e-3)
SK.put_Sigma(Sigma_imp = [Sigma_iw]) SK.put_Sigma(Sigma_imp = [Sigma_iw])

View File

@ -29,7 +29,7 @@ for orb in orbs:
gf = gf + G_latt['up'][iO,iO] gf = gf + G_latt['up'][iO,iO]
tm.set_G_iw(gf) tm.set_G_iw(gf)
tm.omega =LinearOmegaMesh(omega_min=-20, omega_max=20, n_points=201) tm.omega =LinearOmegaMesh(omega_min=-20, omega_max=20, n_points=201)
tm.alpha_mesh = LogAlphaMesh(alpha_min=0.01, alpha_max=20000, n_points=60) tm.alpha_mesh = LogAlphaMesh(alpha_min=0.01, alpha_max=20000, n_points=30)
tm.set_error(1.e-3) tm.set_error(1.e-3)
result=tm.run() result=tm.run()

View File

@ -67,8 +67,8 @@ p = {}
p["max_time"] = -1 p["max_time"] = -1
p["random_name"] = "" p["random_name"] = ""
p["length_cycle"] = 400 p["length_cycle"] = 400
p["n_warmup_cycles"] = 3000 p["n_warmup_cycles"] = 2000
p["n_cycles"] = 20000 p["n_cycles"] = 80000
p["fit_max_moment"] = 4 p["fit_max_moment"] = 4
p["fit_min_w"] = 20 p["fit_min_w"] = 20
p["fit_max_w"] = 30 p["fit_max_w"] = 30
@ -84,15 +84,15 @@ n_iterations = 10
iteration_offset = 0 iteration_offset = 0
if mpi.is_master_node(): if mpi.is_master_node():
with HDFArchive(filename+'.h5', 'a') as ar: with HDFArchive(filename+'.h5', 'a') as ar:
if not 'DMFT_results' in ar: if 'DMFT_results' not in ar:
ar.create_group('DMFT_results') ar.create_group('DMFT_results')
if not 'Iterations' in ar['DMFT_results']: if 'Iterations' not in ar['DMFT_results']:
ar['DMFT_results'].create_group('Iterations') ar['DMFT_results'].create_group('Iterations')
if not 'DMFT_input' in ar: if 'DMFT_input' not in ar:
ar.create_group('DMFT_input') ar.create_group('DMFT_input')
if not 'Iterations' in ar['DMFT_input']: if 'Iterations' not in ar['DMFT_input']:
ar['DMFT_input'].create_group('Iterations') ar['DMFT_input'].create_group('Iterations')
if not 'code_versions' in ar['DMFT_input']: if 'code_versions' not in ar['DMFT_input']:
ar['DMFT_input'].create_group('code_versions') ar['DMFT_input'].create_group('code_versions')
ar['DMFT_input']['code_versions']["triqs_version"] = triqs_version.version ar['DMFT_input']['code_versions']["triqs_version"] = triqs_version.version
ar['DMFT_input']['code_versions']["triqs_git"] = triqs_version.git_hash ar['DMFT_input']['code_versions']["triqs_git"] = triqs_version.git_hash

View File

@ -73,8 +73,8 @@ def dmft_cycle():
p["max_time"] = -1 p["max_time"] = -1
p["random_name"] = "" p["random_name"] = ""
p["length_cycle"] = 400 p["length_cycle"] = 400
p["n_warmup_cycles"] = 3000 p["n_warmup_cycles"] = 2000
p["n_cycles"] = 20000 p["n_cycles"] = 80000
p["fit_max_moment"] = 4 p["fit_max_moment"] = 4
p["fit_min_w"] = 20 p["fit_min_w"] = 20
p["fit_max_w"] = 30 p["fit_max_w"] = 30
@ -90,15 +90,15 @@ def dmft_cycle():
iteration_offset = 0 iteration_offset = 0
if mpi.is_master_node(): if mpi.is_master_node():
with HDFArchive(filename+'.h5', 'a') as ar: with HDFArchive(filename+'.h5', 'a') as ar:
if not 'DMFT_results' in ar: if 'DMFT_results' not in ar:
ar.create_group('DMFT_results') ar.create_group('DMFT_results')
if not 'Iterations' in ar['DMFT_results']: if 'Iterations' not in ar['DMFT_results']:
ar['DMFT_results'].create_group('Iterations') ar['DMFT_results'].create_group('Iterations')
if not 'DMFT_input' in ar: if 'DMFT_input' not in ar:
ar.create_group('DMFT_input') ar.create_group('DMFT_input')
if not 'Iterations' in ar['DMFT_input']: if 'Iterations' not in ar['DMFT_input']:
ar['DMFT_input'].create_group('Iterations') ar['DMFT_input'].create_group('Iterations')
if not 'code_versions' in ar['DMFT_input']: if not 'code_versions' not in ar['DMFT_input']:
ar['DMFT_input'].create_group('code_versions') ar['DMFT_input'].create_group('code_versions')
ar['DMFT_input']['code_versions']["triqs_version"] = triqs_version.version ar['DMFT_input']['code_versions']["triqs_version"] = triqs_version.version
ar['DMFT_input']['code_versions']["triqs_git"] = triqs_version.git_hash ar['DMFT_input']['code_versions']["triqs_git"] = triqs_version.git_hash
@ -182,7 +182,7 @@ def dmft_cycle():
SK.chemical_potential = SK.calc_mu(precision=0.000001) SK.chemical_potential = SK.calc_mu(precision=0.000001)
if mpi.is_master_node(): if mpi.is_master_node():
print('calculating GAMMA') print('calculating charge density update')
SK.calc_density_correction(dm_type='vasp') SK.calc_density_correction(dm_type='vasp')
if mpi.is_master_node(): if mpi.is_master_node():

View File

@ -95,7 +95,7 @@ In this part we will perform charge self-consistent DMFT calculations. To do so
which makes VASP wait after each step of its iterative diagonalization until the file vasp.lock is created. It then reads the update of the charge density in the file `GAMMA` or `vaspgamma.h5` if VASP is compiled with hdf5 support. We change the mixing here to stabilize the updating, which can be problem for charge ordered systems. Vasp is terminated by an external script after a desired amount of steps, such that we deactivate all automatic stoping criterion by setting the number of steps to a very high number. which makes VASP wait after each step of its iterative diagonalization until the file vasp.lock is created. It then reads the update of the charge density in the file `GAMMA` or `vaspgamma.h5` if VASP is compiled with hdf5 support. We change the mixing here to stabilize the updating, which can be problem for charge ordered systems. Vasp is terminated by an external script after a desired amount of steps, such that we deactivate all automatic stoping criterion by setting the number of steps to a very high number.
We take the respective converged DFT and DMFT calculations from before as a starting point. I.e., we copy the `WAVECAR` and `nio.h5` together with the other :program:`VASP` input files (copy INCAR.CSC here) and :file:`plo.cfg` in a new directory. We use a script called :program:`vasp_dmft` to invoke :program:`VASP` in the background and start the DMFT calculation together with :program:`plovasp` and the converter. This script assumes that the dmft sript contains a function `dmft_cycle()` and also the conversion from text files to the h5 file. Additionally we have to add a few lines to calculate the density correction and calculate the correlation energy. We adapt the script straightforwardly (for a working example see :ref:`nio_csc.py`). The most important new lines are:: We take the respective converged DFT and DMFT calculations from before as a starting point. I.e., we copy the `WAVECAR`, `CHGCAR`, and `vasp.h5` together with the other :program:`VASP` input files (copy INCAR.CSC here) and :file:`plo.cfg` in a new directory. We use a script called :program:`vasp_dmft` to invoke :program:`VASP` in the background and start the DMFT calculation together with :program:`plovasp` and the converter. This script assumes that the dmft sript contains a function `dmft_cycle()` and also the conversion from text files to the h5 file. Additionally we have to add a few lines to calculate the density correction and calculate the correlation energy. We adapt the script straightforwardly (for a working example see :ref:`nio_csc.py`). The most important new lines are::
SK.chemical_potential = SK.calc_mu( precision = 0.000001 ) SK.chemical_potential = SK.calc_mu( precision = 0.000001 )
SK.calc_density_correction(dm_type='vasp') SK.calc_density_correction(dm_type='vasp')