From 45db76f55952994fc8e82c9bbc3581bf7e6d30c0 Mon Sep 17 00:00:00 2001 From: the-hampel Date: Thu, 20 Feb 2025 15:01:16 +0100 Subject: [PATCH] [doc] updates to CSC NiO example with VASP --- doc/guide/conv_vasp.rst | 2 +- doc/guide/dftdmft_selfcons.rst | 4 ++-- doc/tutorials/nio_csc_vasp/INCAR | 6 ++---- doc/tutorials/nio_csc_vasp/INCAR.CSC | 5 +---- .../nio_csc_vasp/NiO_local_lattice_GF.py | 10 ++-------- doc/tutorials/nio_csc_vasp/maxent.py | 4 ++-- doc/tutorials/nio_csc_vasp/nio.py | 14 +++++++------- doc/tutorials/nio_csc_vasp/nio_csc.py | 16 ++++++++-------- doc/tutorials/nio_csc_vasp/nio_csc.rst | 2 +- 9 files changed, 26 insertions(+), 37 deletions(-) diff --git a/doc/guide/conv_vasp.rst b/doc/guide/conv_vasp.rst index 4c5a6484..4dd6d6d4 100644 --- a/doc/guide/conv_vasp.rst +++ b/doc/guide/conv_vasp.rst @@ -8,7 +8,7 @@ The VASP interface relies on new options introduced since version 5.4.x In particular, a new INCAR-option `LOCPROJ `_, the new `LORBIT` modes 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 `_). 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 `_). 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 localized orbitals (PLO) scheme, where the resulting KS states from DFT are diff --git a/doc/guide/dftdmft_selfcons.rst b/doc/guide/dftdmft_selfcons.rst index 87d5619f..eb9f31b7 100644 --- a/doc/guide/dftdmft_selfcons.rst +++ b/doc/guide/dftdmft_selfcons.rst @@ -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 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 `_ and `vaspgamma.h5 `_ when VASP is compiled with hdf5 support. +The `LSYNCH5 `_ flag is set to `True` to ensure that the `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 `_ and `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 `_. +For more detailed and fine grained methods to run VASP in CSC also on clusters see the methods implemented in `solid dmft `_. Elk diff --git a/doc/tutorials/nio_csc_vasp/INCAR b/doc/tutorials/nio_csc_vasp/INCAR index 88915820..a37a9a45 100644 --- a/doc/tutorials/nio_csc_vasp/INCAR +++ b/doc/tutorials/nio_csc_vasp/INCAR @@ -1,10 +1,8 @@ System = NiO -KPAR = 5 - # better convergence for small kpt grids ISMEAR = 2 -SIGMA = 0.05 +SIGMA = 0.04 # converge wave functions EDIFF = 1.E-7 @@ -12,7 +10,7 @@ NELMIN = 35 # the energy window to optimize projector channels (absolute) EMIN = -3 -EMAX = 10 +EMAX = 12 LMAXMIX = 6 diff --git a/doc/tutorials/nio_csc_vasp/INCAR.CSC b/doc/tutorials/nio_csc_vasp/INCAR.CSC index b96f0f11..6bf57a78 100644 --- a/doc/tutorials/nio_csc_vasp/INCAR.CSC +++ b/doc/tutorials/nio_csc_vasp/INCAR.CSC @@ -1,14 +1,11 @@ System = NiO -KPAR = 5 - # better convergence for small kpt grids ISMEAR = 2 SIGMA = 0.05 # converge wave functions EDIFF = 1.E-7 -NELMIN = 35 # the energy window to optimize projector channels (absolute) EMIN = -3 @@ -25,7 +22,7 @@ LOCPROJ = "1 : d : Pr ICHARG = 5 NELM = 1000 NELMIN = 1000 -NELMDL = -1 +NELMDL = -2 IMIX=1 BMIX=0.5 AMIX=0.02 diff --git a/doc/tutorials/nio_csc_vasp/NiO_local_lattice_GF.py b/doc/tutorials/nio_csc_vasp/NiO_local_lattice_GF.py index 6a5544c2..86b96732 100644 --- a/doc/tutorials/nio_csc_vasp/NiO_local_lattice_GF.py +++ b/doc/tutorials/nio_csc_vasp/NiO_local_lattice_GF.py @@ -13,17 +13,11 @@ warnings.filterwarnings("ignore", category=FutureWarning) filename = 'vasp' 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) -# We analyze the block structure of the Hamiltonian -Sigma = SK.block_structure.create_gf(mesh=mesh) - -SK.put_Sigma([Sigma]) - - # Setup CTQMC Solver n_orb = SK.corr_shells[0]['dim'] spin_names = ['up','down'] @@ -56,7 +50,7 @@ SK.chemical_potential = mpi.bcast(SK.chemical_potential) if block_structure: SK.block_structure = block_structure 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.put_Sigma(Sigma_imp = [Sigma_iw]) diff --git a/doc/tutorials/nio_csc_vasp/maxent.py b/doc/tutorials/nio_csc_vasp/maxent.py index f98ae283..4f2b6b99 100644 --- a/doc/tutorials/nio_csc_vasp/maxent.py +++ b/doc/tutorials/nio_csc_vasp/maxent.py @@ -29,12 +29,12 @@ for orb in orbs: gf = gf + G_latt['up'][iO,iO] tm.set_G_iw(gf) 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) result=tm.run() result.get_A_out('LineFitAnalyzer') - + if 'iteration_count' in ar['DMFT_results']: iteration_offset = ar['DMFT_results']['iteration_count']+1 for oo in orb: diff --git a/doc/tutorials/nio_csc_vasp/nio.py b/doc/tutorials/nio_csc_vasp/nio.py index f7a2df47..66c7eaae 100644 --- a/doc/tutorials/nio_csc_vasp/nio.py +++ b/doc/tutorials/nio_csc_vasp/nio.py @@ -67,8 +67,8 @@ p = {} p["max_time"] = -1 p["random_name"] = "" p["length_cycle"] = 400 -p["n_warmup_cycles"] = 3000 -p["n_cycles"] = 20000 +p["n_warmup_cycles"] = 2000 +p["n_cycles"] = 80000 p["fit_max_moment"] = 4 p["fit_min_w"] = 20 p["fit_max_w"] = 30 @@ -84,15 +84,15 @@ n_iterations = 10 iteration_offset = 0 if mpi.is_master_node(): with HDFArchive(filename+'.h5', 'a') as ar: - if not 'DMFT_results' in ar: + if 'DMFT_results' not in ar: 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') - if not 'DMFT_input' in ar: + if 'DMFT_input' not in ar: 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') - 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']['code_versions']["triqs_version"] = triqs_version.version ar['DMFT_input']['code_versions']["triqs_git"] = triqs_version.git_hash diff --git a/doc/tutorials/nio_csc_vasp/nio_csc.py b/doc/tutorials/nio_csc_vasp/nio_csc.py index 5c16fb03..b1c77e70 100644 --- a/doc/tutorials/nio_csc_vasp/nio_csc.py +++ b/doc/tutorials/nio_csc_vasp/nio_csc.py @@ -73,8 +73,8 @@ def dmft_cycle(): p["max_time"] = -1 p["random_name"] = "" p["length_cycle"] = 400 - p["n_warmup_cycles"] = 3000 - p["n_cycles"] = 20000 + p["n_warmup_cycles"] = 2000 + p["n_cycles"] = 80000 p["fit_max_moment"] = 4 p["fit_min_w"] = 20 p["fit_max_w"] = 30 @@ -90,15 +90,15 @@ def dmft_cycle(): iteration_offset = 0 if mpi.is_master_node(): with HDFArchive(filename+'.h5', 'a') as ar: - if not 'DMFT_results' in ar: + if 'DMFT_results' not in ar: 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') - if not 'DMFT_input' in ar: + if 'DMFT_input' not in ar: 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') - 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']['code_versions']["triqs_version"] = triqs_version.version 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) if mpi.is_master_node(): - print('calculating GAMMA') + print('calculating charge density update') SK.calc_density_correction(dm_type='vasp') if mpi.is_master_node(): diff --git a/doc/tutorials/nio_csc_vasp/nio_csc.rst b/doc/tutorials/nio_csc_vasp/nio_csc.rst index 186d958a..33df496f 100644 --- a/doc/tutorials/nio_csc_vasp/nio_csc.rst +++ b/doc/tutorials/nio_csc_vasp/nio_csc.rst @@ -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. -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.calc_density_correction(dm_type='vasp')