JaGeo / LobsterPy

Package to perform automatic bonding analysis with the program Lobster in the field of computational materials science and quantum chemistry
https://jageo.github.io/LobsterPy/
BSD 3-Clause "New" or "Revised" License
74 stars 28 forks source link

My confusion on different basis sets involved in one lobster computation. #304

Closed hongyi-zhao closed 2 months ago

hongyi-zhao commented 3 months ago

According to the description here:

For example if Cd element has two basis sets, aka, 4d 5s and 4d 5s 5p, thus following files are created:

INCAR.lobsterpy-0
INCAR.lobsterpy-1
lobsterin.lobsterpy-0
lobsterin.lobsterpy-1

I have the following confusion:

  1. Is the number of these basis sets unrelated to the type of POTCAR used? For example, for the Cd element, the following POTCARs are available on my machine:
    
    $ ls ~/Public/hpc/vasp/pot/potcar/POT_PAW_PBE_64/Cd* -R
    /home/werner/Public/hpc/vasp/pot/potcar/POT_PAW_PBE_64/Cd:
    POTCAR  PSCTR

/home/werner/Public/hpc/vasp/pot/potcar/POT_PAW_PBE_64/Cd_GW: POTCAR PSCTR

/home/werner/Public/hpc/vasp/pot/potcar/POT_PAW_PBE_64/Cd_sv_GW: POTCAR PSCTR



2. In a specific study, should I choose which basis set for calculation and analysis, or do I have to perform calculations and analyses on all of them?
3. Is the current implementation of lobster applicable to all `POTCAR` types of the latest version of vasp? For example, those I listed above.

Regards,
Zhao
hongyi-zhao commented 3 months ago

I will try to answer my above questions as follows:

  1. The number of basis sets available for an element is related to the type of POTCAR used. In my case, for the Cd element, I have multiple POTCARs available on my machine, such as Cd, Cd_GW, and Cd_sv_GW. Each of these POTCARs represents a different basis set for the Cd element. Additionally, the PSCTR files associated with each POTCAR can provide further information on the specific settings and parameters used in the basis set.

On the other hand, the detailed basis sets information can also be found in the Atomic configuration part from the OUTCAR file, as shown below:

 POTCAR:    PAW_PBE Cd 06Sep2000                  
 POTCAR:    PAW_PBE F 08Apr2002                   
 POTCAR:    PAW_PBE Cd 06Sep2000                  
   SHA256 =  8b7ca71966beae5276c8bb910adb3ecc013a3354c27473914c94cd54c83be4f7 Cd/POTCAR             
   COPYR  = (c) Copyright 06Sep2000 Georg Kresse                                                    
   COPYR  = This file is part of the software VASP. Any use, copying, and all other rights are regul
   COPYR  = If you do not have a valid VASP license, you may not use, copy or distribute this file. 
   VRHFIN =Cd : s2 d10                                                                              
   LEXCH  = PE                                                                                      
   EATOM  =  1293.1815 eV,   95.0462 Ry                                                             

   TITEL  = PAW_PBE Cd 06Sep2000                                                                    
   LULTRA =        F    use ultrasoft PP ?                                                          
   IUNSCR =        1    unscreen: 0-lin 1-nonlin 2-no                                               
   RPACOR =    2.000    partial core radius                                                         
   POMASS =  112.411; ZVAL   =   12.000    mass and valenz                                          
   RCORE  =    2.300    outmost cutoff radius                                                       
   RWIGS  =    2.980; RWIGS  =    1.577    wigner-seitz radius (au A)                               
   ENMAX  =  274.336; ENMIN  =  205.752 eV                                                          
   RCLOC  =    2.054    cutoff for local pot                                                        
   LCOR   =        T    correct aug charges                                                         
   LPAW   =        T    paw PP                                                                      
   EAUG   =  456.106                                                                                
   DEXC   =    0.000                                                                                
   RMAX   =    2.358    core radius for proj-oper                                                   
   RAUG   =    1.300    factor for augmentation sphere                                              
   RDEP   =    2.450    radius for radial grids                                                     
   RDEPT  =    1.955    core radius for aug-charge                                                  

   Atomic configuration                                                                             
   12 entries                                                                                       
     n  l   j            E        occ.                                                              
     1  0  0.50    -26519.7817   2.0000                                                             
     2  0  0.50     -3936.9612   2.0000                                                             
     2  1  1.50     -3532.2230   6.0000                                                             
     3  0  0.50      -733.7908   2.0000                                                             
     3  1  1.50      -601.0792   6.0000                                                             
     3  2  2.50      -393.5307  10.0000                                                             
     4  0  0.50      -105.8977   2.0000                                                             
     4  1  1.50       -66.9488   6.0000                                                             
     4  2  2.50       -11.7331  10.0000                                                             
     5  0  0.50        -5.6592   2.0000                                                             
     5  1  0.50        -1.3606   0.0000                                                             
     4  3  2.50        -1.3606   0.0000                                                             
   Description                                                                                      
     l       E           TYP  RCUT    TYP  RCUT                                                     
     2    -11.7331479     23  2.300                                                                 
     2    -13.0937305     23  2.300                                                                 
     0     -5.6591502     23  2.300                                                                 
     0     -1.5561433     23  2.300                                                                 
     1     -2.7211652     23  2.300                                                                 
     1      8.3548275     23  2.300                                                                 
  local pseudopotential read in
  partial core-charges read in
  partial kinetic energy density read in
  atomic valenz-charges read in
  non local Contribution for L=           2  read in
    real space projection operators read in
  non local Contribution for L=           2  read in
    real space projection operators read in
  non local Contribution for L=           0  read in
    real space projection operators read in
  non local Contribution for L=           0  read in
    real space projection operators read in
  non local Contribution for L=           1  read in
    real space projection operators read in
  non local Contribution for L=           1  read in
    real space projection operators read in
    PAW grid and wavefunctions read in

   number of l-projection  operators is LMAX  =           6
   number of lm-projection operators is LMMAX =          18

 POTCAR:    PAW_PBE F 08Apr2002                   
   SHA256 =  53c630871ac675939349fc2b976745ee17808dedc90b5bdde026bc81f0faf456 F/POTCAR              
   COPYR  = (c) Copyright 08Apr2002 Georg Kresse                                                    
   COPYR  = This file is part of the software VASP. Any use, copying, and all other rights are regul
   COPYR  = If you do not have a valid VASP license, you may not use, copy or distribute this file. 
   VRHFIN =F: s2p5                                                                                  
   LEXCH  = PE                                                                                      
   EATOM  =   659.6475 eV,   48.4827 Ry                                                             

   TITEL  = PAW_PBE F 08Apr2002                                                                     
   LULTRA =        F    use ultrasoft PP ?                                                          
   IUNSCR =        1    unscreen: 0-lin 1-nonlin 2-no                                               
   RPACOR =    1.200    partial core radius                                                         
   POMASS =   18.998; ZVAL   =    7.000    mass and valenz                                          
   RCORE  =    1.520    outmost cutoff radius                                                       
   RWIGS  =    1.500; RWIGS  =    0.794    wigner-seitz radius (au A)                               
   ENMAX  =  400.000; ENMIN  =  300.000 eV                                                          
   ICORE  =        2    local potential                                                             
   LCOR   =        T    correct aug charges                                                         
   LPAW   =        T    paw PP                                                                      
   EAUG   =  613.614                                                                                
   RMAX   =    1.555    core radius for proj-oper                                                   
   RAUG   =    1.300    factor for augmentation sphere                                              
   RDEP   =    1.539    radius for radial grids                                                     
   RDEPT  =    1.299    core radius for aug-charge                                                  

   Atomic configuration                                                                             
    4 entries                                                                                       
     n  l   j            E        occ.                                                              
     1  0  0.50      -663.3661   2.0000                                                             
     2  0  0.50       -29.8995   2.0000                                                             
     2  1  0.50       -11.1114   5.0000                                                             
     3  2  1.50       -10.8847   0.0000                                                             
   Description                                                                                      
     l       E           TYP  RCUT    TYP  RCUT                                                     
     0    -29.8995018     23  1.200                                                                 
     0     -9.5240782     23  1.200                                                                 
     1    -11.1113914     23  1.520                                                                 
     1      1.3605826     23  1.520                                                                 
     2    -10.8846608      7  1.500                                                                 
  local pseudopotential read in
  partial core-charges read in
  partial kinetic energy density read in
  atomic valenz-charges read in
  non local Contribution for L=           0  read in
    real space projection operators read in
  non local Contribution for L=           0  read in
    real space projection operators read in
  non local Contribution for L=           1  read in
    real space projection operators read in
  non local Contribution for L=           1  read in
    real space projection operators read in
    PAW grid and wavefunctions read in

   number of l-projection  operators is LMAX  =           4
   number of lm-projection operators is LMMAX =           8
  1. In a specific study, one should choose a specific basis set for his/her calculations and analysis based on the requirements of the specific study. It is not necessary to perform calculations and analyses on all available basis sets. Selecting the appropriate basis set involves considering factors such as computational accuracy, efficiency, and the properties under investigation in the corrresponding research.

  2. I tried the following method, and it seems that pymatgen does not fully support it so far:

$ cat create_and_test_potcar.py 
from pymatgen.io.vasp.inputs import Potcar, PotcarSingle
import os

# Specify the required elements
potcar_symbols = ["Cd_GW", "F"]

# Specify the POTCAR functional
functional = "PBE_64"  # Ensure using the correct functional set

# Print the POTCAR file path for each element
for symbol in potcar_symbols:
    try:
        # Create PotcarSingle object for the symbol and functional
        potcar_single = PotcarSingle.from_symbol_and_functional(symbol, functional)
        if potcar_single:
            functional_dir_dict = potcar_single.functional_dir
            if functional in functional_dir_dict:
                functional_dir = functional_dir_dict[functional]
                potcar_path = os.path.join(functional_dir, symbol, "POTCAR")
                print(f"{symbol} POTCAR created successfully.")
                print(f"Element: {potcar_single.element}")
                print(f"Symbol: {potcar_single.symbol}")
                print(f"Functional: {potcar_single.functional}")
                print(f"Number of electrons: {potcar_single.nelectrons}")
                print(f"Potential type: {potcar_single.potential_type}")
                print(f"POTCAR file path: {potcar_path}")
            else:
                print(f"Functional {functional} not found in directory dictionary.")
        else:
            print(f"POTCAR file for {symbol} with functional {functional} not found.")
    except Exception as e:
        print(f"Error occurred for symbol {symbol}: {e}")

# Create Potcar object
try:
    potcar = Potcar(potcar_symbols, functional)
    # Write the Potcar to a file
    potcar.write_file("POTCAR")
    # Read the generated POTCAR file
    potcar_read = Potcar.from_file("POTCAR")
    # Print POTCAR information
    # print(potcar_read)
except Exception as e:
    print(f"Error occurred while creating or reading POTCAR: {e}")
$ python create_and_test_potcar.py 
Cd_GW POTCAR created successfully.
Element: Cd
Symbol: Cd_GW
Functional: PBE
Number of electrons: 12.0
Potential type: PAW
POTCAR file path: POT_PAW_PBE_64/Cd_GW/POTCAR
F POTCAR created successfully.
Element: F
Symbol: F
Functional: PBE
Number of electrons: 7.0
Potential type: PAW
POTCAR file path: POT_PAW_PBE_64/F/POTCAR

$ lobsterpy create-inputs --overwrite
/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/pymatgen/io/lobster/inputs.py:642: UserWarning: These POTCARs are not compatible with Lobster up to version 4.1.0.
 The keywords SHA256 and COPYR cannot be handled by Lobster 
 and will lead to wrong results.
  warnings.warn(
Traceback (most recent call last):
  File "/home/werner/.pyenv/versions/datasci/bin/lobsterpy", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/lobsterpy/cli.py", line 33, in main
    run(args)
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/lobsterpy/cli.py", line 987, in run
    list_basis_dict = Lobsterin.get_all_possible_basis_functions(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/pymatgen/io/lobster/inputs.py", line 401, in get_all_possible_basis_functions
    max_basis = Lobsterin.get_basis(
                ^^^^^^^^^^^^^^^^^^^^
  File "/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/pymatgen/io/lobster/inputs.py", line 376, in get_basis
    raise ValueError(
ValueError: Missing basis information for POTCAR symbol: Cd_GW. Please provide the basis manually.

If there are any deficiencies or errors in my understanding above, please point them out, and feel free to correct and supplement them.

JaGeo commented 3 months ago

These basis sets have been developed for the PBE_54 POTCARs.

hongyi-zhao commented 3 months ago

These basis sets have been developed for the PBE_54 POTCARs.

Therefore, this should be a feature of the corresponding pymatgen package that has not yet been implemented and needs to be enhanced.

So, what I want to know is whether lobster itself already fully supports any type of POTCAR and basis sets implemented in VASP?

JaGeo commented 3 months ago

@hongyi-zhao For this, you need to check the LOBSTER manual or LOBSTER itself.

JaGeo commented 3 months ago

If you are interested in running LOBSTER with newer POTCARs and want some more information on this and how the code here and in pymatgen works, please feel free to write me an email and then we can talk about a collaboration.

hongyi-zhao commented 3 months ago

@hongyi-zhao For this, you need to check the LOBSTER manual or LOBSTER itself.

I checked the release notes of the latest version of lobster-5.1.0 and did not find any information regarding whether it supports the latest version of VASP POTCAR. Therefore, this should be further discussed and confirmed with the lobster development team.

However, based on the following description in CHANGELOG.pdf shipped with lobster-5.1.0, we can reasonably infer that the latest version of lobster supports the latest POTCAR specifications:

image

hongyi-zhao commented 3 months ago

If you are interested in running LOBSTER with newer POTCARs and want some more information on this and how the code here and in pymatgen works, please feel free to write me an email and then we can talk about a collaboration.

In my group, there are also several graduate students and researchers conducting collaborative research. We can communicate appropriately to see if there is an opportunity to arrange further research work.

JaGeo commented 3 months ago

As said, we support PBE_54 and only the standard POTCARs used in the LOBSTER input set in pymatgen. We can surely document this more clearly.

hongyi-zhao commented 3 months ago

Agreed.

JaGeo commented 3 months ago

You can check out the yaml files here: https://github.com/materialsproject/pymatgen/tree/master/pymatgen/io/lobster/lobster_basis

hongyi-zhao commented 3 months ago

I have noticed these files.

JaGeo commented 3 months ago

I realized I haven't answered your 2nd question fully:

JaGeo commented 2 months ago

Closing this as well