np.set_printoptions(linewidth=100) #These files are too large to store in the examples directory lobster_path = r'C:\Users\lansf\Documents\Data\PROBE_PDOS\lobster_files' GAS_DOSCAR = os.path.join(lobster_path, gas + '/DOSCAR.lobster') GAS_CONTCAR = os.path.join(lobster_path, gas + '/CONTCAR') ADSORBATE_DOSCAR = os.path.join(lobster_path, 'surfaces_noW/'+surface + '+'\ + adsorbate + '/DOSCAR.lobster') ADSORBATE_CONTCAR = os.path.join(lobster_path, 'surfaces_noW/'+surface + '+'\ + adsorbate + '/CONTCAR') ####################################################################################### # Generate VASP_DOS objects # ------------------------- # # VASP_DOS objects for both the gas (vacuum) and the adsorbate+surface system GAS_PDOS = VASP_DOS(GAS_DOSCAR) REFERENCE_PDOS = VASP_DOS(ADSORBATE_DOSCAR) ####################################################################################### # Get adsorbate and site indices and initialize PDOS_OVERLAP object # ----------------------------------------------------------------- # # This method utilizes two VASP_DOS objects, a gas and an adsorption system. # It uses the adosorbtion system (REFERENCE_PDOS) to map gas molecular orbitals # to adsorbate molecular orbitals. It then calculates the adsorption site # atomic orbital energy overlaps with the adsorbate molecular orbital energies. reference_indices, site_indices = get_adsorbate_indices(GAS_CONTCAR\ , ADSORBATE_CONTCAR) #Initialize Coordination object. Repeat is necessary so it doesn't count itself NO_overlap = PDOS_OVERLAP(GAS_PDOS, REFERENCE_PDOS, reference_indices\ , site_indices, min_occupation=1\
gas = 'CO' adsorbate='CO' surface = 'Pt111' set_figure_settings('paper') np.set_printoptions(linewidth=100) example_path = r'C:\Users\lansf\Documents\Data\PROBE_PDOS\vasp_dos_files' lobster_path = r'C:\Users\lansf\Documents\Data\PROBE_PDOS\lobster_files' GAS_DOSCAR = os.path.join(lobster_path, gas + '/DOSCAR.lobster') GAS_CONTCAR = os.path.join(lobster_path, gas + '/CONTCAR') ADSORBATE_DOSCAR = os.path.join(lobster_path, 'surfaces_noW/'+surface + '+'\ + adsorbate + '/DOSCAR.lobster') ADSORBATE_CONTCAR = os.path.join(lobster_path, 'surfaces_noW/'+surface + '+'\ + adsorbate + '/CONTCAR') BULK_DOSCAR = os.path.join(example_path,'Pt_nano/Pt147/DOSCAR') # VASP_DOS objects for both the gas (vacuum) and the adsorbate+surface system GAS_PDOS = VASP_DOS(GAS_DOSCAR) REFERENCE_PDOS = VASP_DOS(ADSORBATE_DOSCAR) BULK_PDOS = VASP_DOS(BULK_DOSCAR) # Get adsorbate and site indices and initialize PDOS_OVERLAP object adsorbate_indices, site_indices = get_adsorbate_indices(GAS_CONTCAR\ , ADSORBATE_CONTCAR) #Initialize Coordination object. Repeat is necessary so it doesn't count itself CO_overlap = PDOS_OVERLAP(GAS_PDOS, REFERENCE_PDOS, adsorbate_indices\ , site_indices, min_occupation=1.5\ , upshift=0.5, energy_weight=3) CO_overlap.optimize_energy_shift(bound=[-10, 10], reset=True) GCNList = [] four_sigma_list = [] one_pi_list = []
import matplotlib.pyplot as plt from pdos_overlap.vasp_dos import get_example_data from pdos_overlap.vasp_dos import VASP_DOS from pdos_overlap.plotting_tools import set_figure_settings ####################################################################################### # Load DOSCAR file # ---------------- # # First we will, get the example data, load a DOSCAR file and use it to # instantiate a VASP_DOS object. set_figure_settings('paper') example_path = get_example_data() DOSCAR = os.path.join(example_path, 'C2H4/DOSCAR') PDOS = VASP_DOS(DOSCAR) ####################################################################################### # Obtain projected density # ------------------------ # # We get the site and spin orbital projected density. We sum the individual # spin orbital densities to get energy sub-level site projected densities. orbitals, projected_density = PDOS.get_site_dos(atom_indices=np.arange(-6,0)\ , orbital_list=['s', 'p', 'd']\ , sum_density = True) ####################################################################################### # Plot projected density # ----------------------
occupied_band_list = [] unoccupied_band_list = [] filling_list = [] second_moment_list = [] bond_energy_list = [] #DOSCAR_files, CONTCAR_files = get_all_VASP_files(\ # r'C:\Users\lansf\Documents\Data\PROBE_PDOS\lobster_files\nanoparticles_noW') DOSCAR_files, CONTCAR_files = get_all_VASP_files(\ r'C:\Users\lansf\Documents\Data\PROBE_PDOS\vasp_dos_files/Pt_nano') for DOSCAR, CONTCAR in zip(DOSCAR_files, CONTCAR_files): indices, GCNs, atom_types = get_geometric_data(CONTCAR) GCNList += GCNs.tolist() atom_type += atom_types.tolist() # read and return densityofstates object PDOS = VASP_DOS(DOSCAR, add_p2s=True) for atom_index in indices: band_center = PDOS.get_band_center(atom_index, ['s','d']\ , sum_density=True) - PDOS.e_fermi occupied_band_center = PDOS.get_band_center(atom_index, ['s','d']\ , sum_density=True, max_energy=PDOS.e_fermi) - PDOS.e_fermi unoccupied_band_center = PDOS.get_band_center(atom_index, ['s','d']\ , sum_density=True, min_energy=PDOS.e_fermi) - PDOS.e_fermi band_width = PDOS.get_center_width(PDOS.e_fermi, atom_index, ['s','d']\ , sum_density=True) second_moment = PDOS.get_second_moment(atom_index, ['s','d']\ , sum_density=True) bond_energy = PDOS.get_bond_energy(atom_index, ['s','d']\ , sum_density=True)
import os from pdos_overlap.vasp_dos import get_example_data from pdos_overlap.vasp_dos import VASP_DOS from pdos_overlap.plotting_tools import set_figure_settings ####################################################################################### # Load DOSCAR file # ---------------- # # First we will, get the example data, load a DOSCAR file and use it to # instantiate a VASP_DOS object. set_figure_settings('paper') example_path = get_example_data() DOSCAR = os.path.join(example_path, 'C2H4/DOSCAR') PDOS = VASP_DOS(DOSCAR) ####################################################################################### # Calculate and print band centers # -------------------------------- # # This method uses the the site and spin orbital projected density. It sums the # spin orbital densities to get energy sub-level band centers. orbitals = [ key for key in PDOS.orbital_dictionary.keys() if 's' in key or 'p' in key ] band_centers = PDOS.get_band_center([0], orbital_list=orbitals\ , max_energy=PDOS.e_fermi, sum_spin=False)