├── .gitignore ├── Examples ├── 1D │ ├── NanoRibbon_BN │ │ ├── Model_Scaling │ │ │ ├── README │ │ │ ├── Scaling.png │ │ │ ├── alpha.10 │ │ │ │ ├── Plot │ │ │ │ │ ├── README │ │ │ │ │ ├── in_V │ │ │ │ │ ├── in_rho │ │ │ │ │ └── plot.py │ │ │ │ ├── Reference │ │ │ │ │ └── out │ │ │ │ ├── in │ │ │ │ └── plot_eps.py │ │ │ ├── alpha.15 │ │ │ │ └── in │ │ │ ├── alpha.20 │ │ │ │ └── in │ │ │ ├── alpha.30 │ │ │ │ └── in │ │ │ ├── alpha.6 │ │ │ │ ├── Plot │ │ │ │ │ ├── README │ │ │ │ │ ├── V_r.npy │ │ │ │ │ ├── in_V │ │ │ │ │ ├── in_rho │ │ │ │ │ ├── plavg_a1.plot │ │ │ │ │ └── plot.py │ │ │ │ ├── Reference │ │ │ │ │ └── out │ │ │ │ ├── in │ │ │ │ ├── out │ │ │ │ └── plot_eps.py │ │ │ ├── alpha.8 │ │ │ │ ├── Plot │ │ │ │ │ ├── README │ │ │ │ │ ├── in_V │ │ │ │ │ ├── in_rho │ │ │ │ │ └── plot.py │ │ │ │ ├── Reference │ │ │ │ │ └── out │ │ │ │ ├── in │ │ │ │ └── plot_eps.py │ │ │ └── plot_fit.py │ │ ├── PA_0p │ │ │ ├── Fig_V_0p.png │ │ │ ├── README │ │ │ ├── Reference │ │ │ │ └── Fig_V_0p.png │ │ │ ├── plavg_0_a3.plot │ │ │ ├── plavg_p_a3.plot │ │ │ └── plot_DV0p.py │ │ ├── PA_q0 │ │ │ ├── README │ │ │ ├── Reference │ │ │ │ └── Fig_V_q0.png │ │ │ ├── plavg_0_a1.plot │ │ │ ├── plavg_q_a1.plot │ │ │ └── plot_DVq0.py │ │ ├── QE_inputs │ │ │ ├── B.pbe-nc.UPF │ │ │ ├── H.pbe-mt_fhi.UPF │ │ │ ├── N.pbe-nc.UPF │ │ │ └── in │ │ └── README │ └── Wire_samples │ │ ├── Circular_cross-section │ │ ├── Disk_profile.png │ │ ├── README │ │ ├── in │ │ └── plot_eps.py │ │ └── Hexagonal_cross-section │ │ ├── README │ │ ├── Wire_profile.png │ │ ├── in │ │ ├── plot_eps.py │ │ └── vertices ├── 2D │ └── MoS2 │ │ ├── Model_Scaling │ │ ├── README │ │ ├── Scaling.png │ │ ├── alpha.10 │ │ │ └── in │ │ ├── alpha.20 │ │ │ └── in │ │ ├── alpha.4 │ │ │ ├── Plot │ │ │ │ ├── README │ │ │ │ ├── in_V │ │ │ │ └── in_rho │ │ │ ├── in │ │ │ └── plot_eps.py │ │ ├── alpha.40 │ │ │ └── in │ │ ├── alpha.5 │ │ │ ├── Plot │ │ │ │ ├── README │ │ │ │ ├── in_V │ │ │ │ └── in_rho │ │ │ ├── Reference │ │ │ │ └── out │ │ │ ├── in │ │ │ └── plot_eps.py │ │ ├── alpha.6 │ │ │ ├── Plot │ │ │ │ ├── README │ │ │ │ ├── in_V │ │ │ │ ├── in_rho │ │ │ │ └── plavg_a3.plot │ │ │ ├── Reference │ │ │ │ ├── Eps_profile.png │ │ │ │ └── out │ │ │ ├── in │ │ │ └── plot_eps.py │ │ ├── alpha.60 │ │ │ └── in │ │ ├── alpha.8 │ │ │ ├── Plot │ │ │ │ ├── README │ │ │ │ ├── in_V │ │ │ │ ├── in_rho │ │ │ │ └── plot.py │ │ │ ├── Reference │ │ │ │ └── out │ │ │ ├── in │ │ │ └── plot_eps.py │ │ ├── alpha.80 │ │ │ └── in │ │ ├── alpha.9 │ │ │ └── in │ │ └── plot_fit.py │ │ ├── PA_0p │ │ ├── README │ │ ├── Reference │ │ │ └── Fig_V_0p.png │ │ ├── plavg_0_a3.plot │ │ ├── plavg_p_a3.plot │ │ └── plot_DV0p.py │ │ ├── PA_q0 │ │ ├── README │ │ ├── Reference │ │ │ └── Fig_V_q0.png │ │ ├── plavg_0_a3.plot │ │ ├── plavg_a3.plot │ │ ├── plavg_q_a3.plot │ │ └── plot_DVq0.py │ │ ├── QE_input │ │ ├── Mo.pz-spn-kjpaw_psl.0.3.0.UPF │ │ ├── S.pz-n-kjpaw_psl.0.1.UPF │ │ └── in │ │ └── README ├── 3D │ └── Diamond │ │ ├── Model_Scaling │ │ ├── 4x4x4 │ │ │ ├── Plot │ │ │ │ ├── README │ │ │ │ ├── V_r.npy │ │ │ │ ├── in_V │ │ │ │ ├── in_rho │ │ │ │ ├── plavg_a1.plot │ │ │ │ └── rho_r.npy │ │ │ ├── Reference │ │ │ │ └── out │ │ │ ├── in │ │ │ └── out │ │ ├── 5x5x5 │ │ │ ├── Plot │ │ │ │ ├── README │ │ │ │ ├── in_V │ │ │ │ └── in_rho │ │ │ ├── Reference │ │ │ │ └── out │ │ │ └── in │ │ ├── 6x6x6 │ │ │ ├── Plot │ │ │ │ ├── README │ │ │ │ ├── in_V │ │ │ │ └── in_rho │ │ │ ├── Reference │ │ │ │ └── out │ │ │ └── in │ │ ├── E_iso.png │ │ ├── README │ │ └── plot_fit.py │ │ ├── PA_0p │ │ ├── Fig_V_0p.png │ │ ├── README │ │ ├── plavg_0_a1.plot │ │ ├── plavg_p_a1.plot │ │ └── plot_DV0p.py │ │ ├── PA_q0 │ │ ├── Fig_V_q0.png │ │ ├── README │ │ ├── plavg_0_a1.plot │ │ ├── plavg_q_a1.plot │ │ └── plot_DVq0.py │ │ ├── QE_input │ │ ├── C.UPF │ │ └── in_4x4x4 │ │ └── README ├── Fit_gaussian │ ├── README │ ├── in │ └── wfn.cube └── README ├── GaussianFit ├── README ├── g_fit.py └── in ├── LICENSE ├── LICENSE.txt ├── PoissonSolver ├── MV_1D_cy │ ├── README │ ├── matvec1D.c │ ├── matvec1D.pyx │ └── setup.py ├── MV_2D_cy │ ├── README │ ├── matvec2D.c │ ├── matvec2D.pyx │ └── setup.py ├── PS_3D_cy │ ├── README │ ├── ps3d.c │ ├── ps3d.pyx │ └── setup.py ├── PS_main.py ├── README ├── Solver.py ├── __init__.py ├── classes.py └── construct_eps.py ├── PotentialAlignment ├── README ├── Utilities │ ├── README │ ├── __init__.py │ ├── input │ └── plavg.py ├── dV_0p.py ├── dV_mD.py ├── in_dV_0p └── in_dV_mD ├── README.md ├── README.txt ├── UserGuide.pdf ├── clean.py ├── coffee.py └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/README: -------------------------------------------------------------------------------- 1 | This folder computes E^{lat} for a B vacancy in 2 | a BN nanoribbon in the -1 charge state. 3 | 4 | The lattice correction term, E^{lat}, is given by 5 | (Eqn. 4 in the CoFFEE paper): 6 | E^{lat} = E^{iso,m}- E^{per,m} 7 | 8 | To obtain the isolated model energy for this system, 9 | the model periodic energy is computed for several supercell sizes. 10 | These values are then fit with a third order polynomial as 11 | shown in Fig. 8 (e) in the CoFFEE paper. This polynomial 12 | has the form: 13 | p(\alpha) = f_0 + f_1/\alpha + f_2/\alpha^2 + f_3/\alpha^3 14 | 15 | where \alpha denotes the supercell dimension: 16 | \alpha x 2.31\alpha x \alpha. 17 | The polynomial extrapolation, 1/\alpha -> 0, gives 18 | the E^{iso,m}. 19 | The lattice parameter is 4.74 bohr. The cell 20 | dimensions for \alpha = 6 are: 21 | 28.44, 65.6964 and 28.44 along x, y and z 22 | directions respectively. 23 | 24 | Note that computing this term for large supercell sizes 25 | can be time consuming. The users can make use of the 26 | MPI parallelization of this code. 27 | 28 | We provide the sample input files for the 29 | various supercell sizes in folders alpha.*. 30 | To understand how this example works, the model 31 | energy can be computed for a few small supercell sizes. 32 | We provide the results for the larger supercell sizes and 33 | a script to plot the polynomial. 34 | 35 | To run this example, perform the following steps: 36 | 1. Go to the folders alpha.6 and run the following command: 37 | python3 path_to_coffee_folder/coffee.py in > out 38 | 2. Go to the folders alpha.8 and run the following command: 39 | python3 path_to_coffee_folder/coffee.py in > out 40 | 3. Go to the folders alpha.10 and run the following command: 41 | python3 path_to_coffee_folder/coffee.py in > out 42 | 43 | (Feel free to run the other supercell sizes as well) 44 | To run the code in parallel: 45 | mpirun -np 12 python3 your_path_to_CoFFEE/coffee.py in > out 46 | 47 | The model total energy is printed in the out files. 48 | The following command will show this energy: 49 | grep ! out 50 | The dielectric profile, model potential and 51 | model charge density are written out in numpy 52 | save files. Instruction on how to plot these is provided 53 | in the Plot folder within the alpha.* folders 54 | 55 | For this example, the model energies should be: 56 | 6x14x6: 1.4569 eV 57 | 8x18.66x8: 1.5899 eV 58 | 10x23.33x10: 1.6507 eV 59 | 60 | 15x34.99x15: 0.529 eV 61 | 20x46.66x20: 0.588 eV 62 | 30x69.99x30: 0.618 eV 63 | 64 | Use plot_fit.py to compute the fifth order polynomial fit 65 | and extrapolation to obtain E^{iso,m} for these values. 66 | E^{iso,m} is computed to be 1.88 eV 67 | 68 | The corrections, are then given by: 69 | (E^{iso,m}- E^{per,m}) 70 | 6x14x6: 0.423 eV 71 | 8x18.66x8: 0.291 eV 72 | 10x23.33x10: 0.229 eV 73 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/Scaling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/1D/NanoRibbon_BN/Model_Scaling/Scaling.png -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.10/Plot/README: -------------------------------------------------------------------------------- 1 | The planar average of the model potential 2 | along a given direction can be plotted using in_V. 3 | Link V_r.npy to this directory: ln -s ../V_r.npy . 4 | 5 | The planar average of the model charge 6 | along a given direction can be plotted using input 7 | in_rho to plavg.py 8 | Link V_r.npy to this directory: ln -s ../rho_r.npy . 9 | 10 | To run plavg.py: 11 | your_path/CoFFEE/PotentialAlignment/Utilities/plavg.py input 12 | 13 | This produces a file plavg_(direction).plot which you could 14 | plot using a software of your choice. 15 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.10/Plot/in_V: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = V_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = 1.0 6 | cell_dim = 47.4 7 | / 8 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.10/Plot/in_rho: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = rho_r.npy 3 | file_type = python 4 | plt_dir = a3 5 | factor = 1.0 6 | cell_dim = 47.4 7 | / 8 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.10/Plot/plot.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | A = np.loadtxt("plavg_a3.plot") 5 | plt.plot(A[:,0],A[:,1]) 6 | plt.show() 7 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.10/Reference/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | CELL PARAMETERS: 6 | Cell dimensions (bohr): 47.243, 109.450,47.400 7 | Lattice vectors (normalized): 8 | a1: 1.000, 0.000, 0.000 9 | a2: 0.000, 1.000, 0.000 10 | a3: 0.000, 0.000, 1.000 11 | Plane-wave energy cut-off (Ry): 16.000 12 | 13 | GAUSSIAN_PARAMETERS: 14 | ('Total charge:', -1) 15 | Center of the gaussian (in crystal units): 16 | (0.5, 0.14967758285031457, 0.5) 17 | Gaussian width (bohr): 18 | 1.89034 19 | 20 | 21 | DIELECTRIC PARAMETERS 22 | ('Profile:', 'Ribbon') 23 | Epsilon tensor inside the material: 24 | [[ 2.94 0. 0. ] 25 | [ 0. 12. 0. ] 26 | [ 0. 0. 12. ]] 27 | Gaussian profile is along x 28 | ('Center of the gaussian (bohr):', 23.621452057) 29 | ('Width of the gaussian (bohr):', 1.0) 30 | Slab profile along y 31 | ('Center of the slab along y (bohr):', 17.96054782) 32 | ('Width of the slab along y (bohr):', 26.01508) 33 | 34 | 35 | Grid: 63, 141, 63 36 | Volume: 245092.819 37 | ! Total Energy (eV): 1.6507 38 | Execution time: 2415.83 s 39 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.10/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.0 0.0 0.0 5 | 0.0 1.0 0.0 6 | 0.0 0.0 1.0 7 | 8 | Cell_dimensions bohr 9 | 47.242904115801814 109.449973 47.4 10 | 11 | Ecut=8.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Ribbon 15 | C_x = 23.621452057 bohr 16 | Gauss_amp_a1 = 2.94 17 | Gauss_amp_a2 = 12.0 18 | Gauss_amp_a3 = 12.0 19 | Sigma = 0.85868842 20 | Gauss_along_x = True 21 | Gauss_along_y = False 22 | C_y = 17.96054782 23 | W_y = 26.01508 bohr 24 | Smoothness = 0.37 bohr 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89034 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.14967758285031457 32 | Centre_a3 = 0.5 33 | / 34 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.10/plot_eps.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys, string 3 | import numpy as np 4 | import pickle 5 | import matplotlib.pyplot as plt 6 | import matplotlib.colors as colors 7 | import matplotlib.path as mplPath 8 | import matplotlib.patches as mpatches 9 | import matplotlib.gridspec as gridspec 10 | 11 | 12 | celldm1 = 47.242904115801814*0.52918 13 | celldm2 = 109.449973*0.52918 14 | 15 | eps_xy_a1 = np.load("eps_xy_a1.npy") 16 | eps_xy_a2 = np.load("eps_xy_a2.npy") 17 | eps_xy_a3 = np.load("eps_xy_a3.npy") 18 | a1_dim, a2_dim = np.shape(eps_xy_a1)[0], np.shape(eps_xy_a1)[1] 19 | fig, axarr = plt.subplots(1,3,figsize = (18,5)) 20 | map_c = 'summer' 21 | a1 = np.arange(0,celldm1,celldm1/a1_dim) 22 | a2 = np.arange(0,celldm2,celldm2/a2_dim) 23 | h_map = axarr[0].pcolor(a2,a1,eps_xy_a1,cmap=map_c) 24 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[0]) 25 | cb.ax.tick_params(labelsize=22) 26 | h_map = axarr[1].pcolor(a2,a1,eps_xy_a2,cmap=map_c) 27 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[1]) 28 | cb.ax.tick_params(labelsize=20) 29 | h_map = axarr[2].pcolor(a2,a1,eps_xy_a3,cmap=map_c) 30 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[2]) 31 | cb.ax.tick_params(labelsize=22) 32 | 33 | for i in range(3): 34 | axarr[i].set_xlabel(r"$y (\AA)$",fontsize = 30) 35 | axarr[i].set_ylabel(r"$x (\AA)$",fontsize = 30) 36 | axarr[i].set_ylim(0,celldm1-celldm1/a1_dim) 37 | axarr[i].set_xlim(0,celldm2-celldm2/a2_dim) 38 | axarr[i].tick_params(labelsize=22,width=1.8) 39 | 40 | axarr[0].set_title(r"Dielectric profile along a$_1$/x",fontsize = 22) 41 | axarr[1].set_title(r"Dielectric profile along a$_2$/y",fontsize = 22) 42 | axarr[2].set_title(r"Dielectric profile along a$_3$/z",fontsize = 22) 43 | plt.tight_layout() 44 | plt.savefig("Ribbon_profile.png",dpi = 400) 45 | plt.show() 46 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.15/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.0 0.0 0.0 5 | 0.0 1.0 0.0 6 | 0.0 0.0 1.0 7 | 8 | Cell_dimensions bohr 9 | 70.864356173702724 164.15150258336908 71.1 10 | 11 | Ecut=8.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Ribbon 15 | C_x = 35.43217808685136 bohr 16 | Gauss_amp_a1 = 2.94 17 | Gauss_amp_a2 = 12.0 18 | Gauss_amp_a3 = 12.0 19 | Sigma = 0.85868842 20 | Gauss_along_x = True 21 | Gauss_along_y = False 22 | C_y = 17.96054782 23 | W_y = 26.01508 bohr 24 | Smoothness = 0.37 bohr 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89034 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.09978505523354304 32 | Centre_a3 = 0.5 33 | / 34 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.20/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.0 0.0 0.0 5 | 0.0 1.0 0.0 6 | 0.0 0.0 1.0 7 | 8 | Cell_dimensions bohr 9 | 94.48580823160363 218.899946 94.8 10 | 11 | Ecut=8.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Ribbon 15 | C_x = 47.242904114 bohr 16 | Gauss_amp_a1 = 2.94 17 | Gauss_amp_a2 = 12.00 18 | Gauss_amp_a3 = 12.00 19 | Sigma = 0.85868842 20 | Gauss_along_x = True 21 | Gauss_along_y = False 22 | C_y = 17.96054782 23 | W_y = 26.01508 bohr 24 | Smoothness = 0.37 bohr 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89034 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.07483879142515729 32 | Centre_a3 = 0.5 33 | / 34 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.30/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.0 0.0 0.0 5 | 0.0 1.0 0.0 6 | 0.0 0.0 1.0 7 | 8 | Cell_dimensions bohr 9 | 141.72871234740543 328.349919 142.2 10 | 11 | Ecut=8.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Ribbon 15 | C_x = 70.864356171 bohr 16 | Gauss_amp_a1 = 2.94 17 | Gauss_amp_a2 = 12 18 | Gauss_amp_a3 = 12 19 | Sigma = 0.85868842 20 | Gauss_along_x = True 21 | Gauss_along_y = False 22 | C_y = 17.96054782 23 | W_y = 26.01508 bohr 24 | Smoothness = 0.37 bohr 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89034 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.04989252761677153 32 | Centre_a3 = 0.5 33 | / 34 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.6/Plot/README: -------------------------------------------------------------------------------- 1 | The planar average of the model potential 2 | along a given direction can be plotted using in_V. 3 | Link V_r.npy to this directory: ln -s ../V_r.npy . 4 | 5 | The planar average of the model charge 6 | along a given direction can be plotted using input 7 | in_rho to plavg.py 8 | Link V_r.npy to this directory: ln -s ../rho_r.npy . 9 | 10 | To run plavg.py: 11 | python3 your_path/CoFFEE/PotentialAlignment/Utilities/plavg.py input 12 | 13 | This produces a file plavg_(direction).plot which you could 14 | plot using a software of your choice. 15 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.6/Plot/V_r.npy: -------------------------------------------------------------------------------- 1 | ../V_r.npy -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.6/Plot/in_V: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = V_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = 1.0 6 | cell_dim = 28.34574 7 | / 8 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.6/Plot/in_rho: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = rho_r.npy 3 | file_type = python 4 | plt_dir = a3 5 | factor = 1.0 6 | cell_dim = 28.345742469481085 7 | / 8 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.6/Plot/plavg_a1.plot: -------------------------------------------------------------------------------- 1 | 0.000 0.20271823 2 | 0.727 0.20246506 3 | 1.454 0.19880996 4 | 2.180 0.19173855 5 | 2.907 0.18126572 6 | 3.634 0.16737536 7 | 4.361 0.15008415 8 | 5.088 0.12937361 9 | 5.815 0.10526311 10 | 6.541 0.07773137 11 | 7.268 0.04680414 12 | 7.995 0.01246634 13 | 8.722 -0.02520936 14 | 9.449 -0.06611634 15 | 10.175 -0.10982725 16 | 10.902 -0.15546759 17 | 11.629 -0.20103063 18 | 12.356 -0.24219815 19 | 13.083 -0.27126139 20 | 13.809 -0.28569786 21 | 14.536 -0.28953249 22 | 15.263 -0.28431138 23 | 15.990 -0.26714292 24 | 16.717 -0.23517611 25 | 17.444 -0.19340043 26 | 18.170 -0.14821517 27 | 18.897 -0.10308100 28 | 19.624 -0.05986046 29 | 20.351 -0.01946456 30 | 21.078 0.01772013 31 | 21.804 0.05154825 32 | 22.531 0.08198376 33 | 23.258 0.10900707 34 | 23.985 0.13262537 35 | 24.712 0.15282841 36 | 25.438 0.16962714 37 | 26.165 0.18301067 38 | 26.892 0.19299086 39 | 27.619 0.19955582 40 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.6/Plot/plot.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | A = np.loadtxt("plavg_a3.plot") 5 | plt.plot(A[:,0],A[:,1]) 6 | plt.show() 7 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.6/Reference/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | CELL PARAMETERS: 6 | Cell dimensions (bohr): 28.3457424695 28.3457424695 28.3457424695 7 | Lattice vectors (normalized): 8 | a1: [ 1. 0. 0.] 9 | a2: [ 0. 1. 0.] 10 | a3: [ 0. 0. 1.] 11 | Plane-wave energy cut-off (Ry): 16.0 12 | 13 | GAUSSIAN_PARAMETERS: 14 | Total charge: -1 15 | Center of the gaussian (in crystal units): 16 | 0.5 0.249427 0.5 17 | Gaussian width (bohr): 18 | 1.89034 19 | 20 | 21 | DIELECTRIC PARAMETERS 22 | Profile: Ribbon 23 | Epsilon tensor inside the material: 24 | [[ 2.94 0. 0. ] 25 | [ 0. 12. 0. ] 26 | [ 0. 0. 12. ]] 27 | Gaussian profile is along x 28 | Center of the gaussian (bohr): 14.1728712347 29 | Width of the gaussian (bohr): 1.0 30 | Slab profile along y 31 | Center of the slab along y (bohr): 17.96054782 32 | Width of the slab along y (bohr): 26.015 33 | 34 | 35 | Grid: 39 85 39 36 | Volume: 52947.6129875 37 | ! Total Energy (eV): 1.4569 38 | Execution time: 99.06 s 39 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.6/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.0 0.0 0.0 5 | 0.0 1.0 0.0 6 | 0.0 0.0 1.0 7 | 8 | Cell_dimensions bohr 9 | 28.345742469481085 65.6793667152 28.44 10 | 11 | Ecut=8.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Ribbon 15 | C_x = 14.172871 bohr 16 | Gauss_amp_a1 = 2.94 17 | Gauss_amp_a2 = 12.0 18 | Gauss_amp_a3 = 12.0 19 | Sigma = 0.85868842 20 | Gauss_along_x = True 21 | Gauss_along_y = False 22 | C_y = 17.96054782 23 | W_y = 26.0150 bohr 24 | Smoothness = 0.37 bohr 25 | Plot_eps = True 26 | / 27 | 28 | &GAUSSIAN_PARAMETERS: 29 | Total_charge = -1 30 | Sigma = 1.89034 31 | Centre_a1 = 0.5 32 | Centre_a2 = 0.249427 33 | Centre_a3 = 0.5 34 | / 35 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.6/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | Running on 4 processor(s) 6 | CELL PARAMETERS: 7 | Cell dimensions (bohr): 28.346, 65.679,28.440 8 | Lattice vectors (normalized): 9 | a1: 1.000, 0.000, 0.000 10 | a2: 0.000, 1.000, 0.000 11 | a3: 0.000, 0.000, 1.000 12 | Plane-wave energy cut-off (Ry): 16.000 13 | 14 | GAUSSIAN_PARAMETERS: 15 | Total charge: -1 16 | Center of the gaussian (in crystal units): 17 | 0.5 0.249427 0.5 18 | Gaussian width (bohr): 19 | 1.89034 20 | 21 | 22 | DIELECTRIC PARAMETERS 23 | Profile: Ribbon 24 | Epsilon tensor inside the material: 25 | [[ 2.94 0. 0. ] 26 | [ 0. 12. 0. ] 27 | [ 0. 0. 12. ]] 28 | Gaussian profile is along x 29 | Center of the gaussian (bohr): 14.172871 30 | Width of the gaussian (bohr): 1.0 31 | Slab profile along y 32 | Center of the slab along y (bohr): 17.96054782 33 | Width of the slab along y (bohr): 26.015 34 | 35 | 36 | Grid: 39, 85, 39 37 | Volume: 52947.613 38 | ! Total Energy (eV): 1.4569 39 | Execution time: 91.25 s 40 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.6/plot_eps.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys, string 3 | import numpy as np 4 | import pickle 5 | import matplotlib.pyplot as plt 6 | import matplotlib.colors as colors 7 | import matplotlib.path as mplPath 8 | import matplotlib.patches as mpatches 9 | import matplotlib.gridspec as gridspec 10 | 11 | celldm1 = 28.345742469481085*0.52918 12 | celldm2 = 65.6793667152*0.52918 13 | 14 | eps_xy_a1 = np.load("eps_xy_a1.npy") 15 | eps_xy_a2 = np.load("eps_xy_a2.npy") 16 | eps_xy_a3 = np.load("eps_xy_a3.npy") 17 | a1_dim, a2_dim = np.shape(eps_xy_a1)[0], np.shape(eps_xy_a1)[1] 18 | fig, axarr = plt.subplots(1,3,figsize = (18,5)) 19 | map_c = 'summer' 20 | a1 = np.arange(0,celldm1,celldm1/a1_dim) 21 | a2 = np.arange(0,celldm2,celldm2/a2_dim) 22 | h_map = axarr[0].pcolor(a2,a1,eps_xy_a1,cmap=map_c) 23 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[0]) 24 | cb.ax.tick_params(labelsize=22) 25 | h_map = axarr[1].pcolor(a2,a1,eps_xy_a2,cmap=map_c) 26 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[1]) 27 | cb.ax.tick_params(labelsize=20) 28 | h_map = axarr[2].pcolor(a2,a1,eps_xy_a3,cmap=map_c) 29 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[2]) 30 | cb.ax.tick_params(labelsize=22) 31 | 32 | for i in range(3): 33 | axarr[i].set_xlabel(r"$y (\AA)$",fontsize = 30) 34 | axarr[i].set_ylabel(r"$x (\AA)$",fontsize = 30) 35 | axarr[i].set_ylim(0,celldm1-celldm1/a1_dim) 36 | axarr[i].set_xlim(0,celldm2-celldm2/a2_dim) 37 | axarr[i].tick_params(labelsize=22,width=1.8) 38 | 39 | axarr[0].set_title(r"Dielectric profile along a$_1$/x",fontsize = 22) 40 | axarr[1].set_title(r"Dielectric profile along a$_2$/y",fontsize = 22) 41 | axarr[2].set_title(r"Dielectric profile along a$_3$/z",fontsize = 22) 42 | plt.tight_layout() 43 | plt.savefig("Ribbon_profile.png",dpi = 400) 44 | plt.show() 45 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.8/Plot/README: -------------------------------------------------------------------------------- 1 | The planar average of the model potential 2 | along a given direction can be plotted using in_V. 3 | Link V_r.npy to this directory: ln -s ../V_r.npy . 4 | 5 | The planar average of the model charge 6 | along a given direction can be plotted using input 7 | in_rho to plavg.py 8 | Link V_r.npy to this directory: ln -s ../rho_r.npy . 9 | 10 | To run plavg.py: 11 | your_path/CoFFEE/PotentialAlignment/Utilities/plavg.py input 12 | 13 | This produces a file plavg_(direction).plot which you could 14 | plot using a software of your choice. 15 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.8/Plot/in_V: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = V_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = 1.0 6 | cell_dim = 37.92 7 | / 8 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.8/Plot/in_rho: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = rho_r.npy 3 | file_type = python 4 | plt_dir = a3 5 | factor = 1.0 6 | cell_dim = 37.92 7 | / 8 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.8/Plot/plot.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | A = np.loadtxt("plavg_a3.plot") 5 | plt.plot(A[:,0],A[:,1]) 6 | plt.show() 7 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.8/Reference/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | CELL PARAMETERS: 6 | Cell dimensions (bohr): 37.794, 88.480,37.920 7 | Lattice vectors (normalized): 8 | a1: 1.000, 0.000, 0.000 9 | a2: 0.000, 1.000, 0.000 10 | a3: 0.000, 0.000, 1.000 11 | Plane-wave energy cut-off (Ry): 16.000 12 | 13 | GAUSSIAN_PARAMETERS: 14 | ('Total charge:', -1) 15 | Center of the gaussian (in crystal units): 16 | (0.5, 0.18515153030823003, 0.5) 17 | Gaussian width (bohr): 18 | 1.89034 19 | 20 | 21 | DIELECTRIC PARAMETERS 22 | ('Profile:', 'Ribbon') 23 | Epsilon tensor inside the material: 24 | [[ 2.94 0. 0. ] 25 | [ 0. 12. 0. ] 26 | [ 0. 0. 12. ]] 27 | Gaussian profile is along x 28 | ('Center of the gaussian (bohr):', 18.897161646320722) 29 | ('Width of the gaussian (bohr):', 1.0) 30 | Slab profile along y 31 | ('Center of the slab along y (bohr):', 17.96054782) 32 | ('Width of the slab along y (bohr):', 26.01508) 33 | 34 | 35 | Grid: 51, 115, 51 36 | Volume: 126806.062 37 | ! Total Energy (eV): 1.5899 38 | Execution time: 821.66 s 39 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.8/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.0 0.0 0.0 5 | 0.0 1.0 0.0 6 | 0.0 0.0 1.0 7 | 8 | Cell_dimensions bohr 9 | 37.794323292641444 88.48 37.92 10 | 11 | Ecut=8.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Ribbon 15 | C_x = 18.897161646320722 bohr 16 | Gauss_amp_a1 = 2.94 17 | Gauss_amp_a2 = 12.0 18 | Gauss_amp_a3 = 12.0 19 | Sigma = 0.85868842 20 | Gauss_along_x = True 21 | Gauss_along_y = False 22 | C_y = 17.96054782 23 | W_y = 26.01508 24 | Smoothness = 0.37 bohr 25 | Plot_eps = True 26 | / 27 | 28 | &GAUSSIAN_PARAMETERS: 29 | Total_charge = -1 30 | Sigma = 1.89034 31 | Centre_a1 = 0.5 32 | Centre_a2 = 0.18515153030823003 33 | Centre_a3 = 0.5 34 | / 35 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/alpha.8/plot_eps.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys, string 3 | import numpy as np 4 | import pickle 5 | import matplotlib.pyplot as plt 6 | import matplotlib.colors as colors 7 | import matplotlib.path as mplPath 8 | import matplotlib.patches as mpatches 9 | import matplotlib.gridspec as gridspec 10 | 11 | 12 | celldm1 = 37.794323292641444*0.52918 13 | celldm2 = 88.48*0.52918 14 | 15 | eps_xy_a1 = np.load("eps_xy_a1.npy") 16 | eps_xy_a2 = np.load("eps_xy_a2.npy") 17 | eps_xy_a3 = np.load("eps_xy_a3.npy") 18 | a1_dim, a2_dim = np.shape(eps_xy_a1)[0], np.shape(eps_xy_a1)[1] 19 | fig, axarr = plt.subplots(1,3,figsize = (18,5)) 20 | map_c = 'summer' 21 | a1 = np.arange(0,celldm1,celldm1/a1_dim) 22 | a2 = np.arange(0,celldm2,celldm2/a2_dim) 23 | h_map = axarr[0].pcolor(a2,a1,eps_xy_a1,cmap=map_c) 24 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[0]) 25 | cb.ax.tick_params(labelsize=22) 26 | h_map = axarr[1].pcolor(a2,a1,eps_xy_a2,cmap=map_c) 27 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[1]) 28 | cb.ax.tick_params(labelsize=20) 29 | h_map = axarr[2].pcolor(a2,a1,eps_xy_a3,cmap=map_c) 30 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[2]) 31 | cb.ax.tick_params(labelsize=22) 32 | 33 | for i in range(3): 34 | axarr[i].set_xlabel(r"$y (\AA)$",fontsize = 30) 35 | axarr[i].set_ylabel(r"$x (\AA)$",fontsize = 30) 36 | axarr[i].set_ylim(0,celldm1-celldm1/a1_dim) 37 | axarr[i].set_xlim(0,celldm2-celldm2/a2_dim) 38 | axarr[i].tick_params(labelsize=22,width=1.8) 39 | 40 | axarr[0].set_title(r"Dielectric profile along a$_1$/x",fontsize = 22) 41 | axarr[1].set_title(r"Dielectric profile along a$_2$/y",fontsize = 22) 42 | axarr[2].set_title(r"Dielectric profile along a$_3$/z",fontsize = 22) 43 | plt.tight_layout() 44 | plt.savefig("Ribbon_profile.png",dpi = 400) 45 | plt.show() 46 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/Model_Scaling/plot_fit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys,string 4 | import matplotlib.pyplot as plt 5 | from matplotlib.ticker import AutoMinorLocator 6 | import matplotlib.gridspec as gridspec 7 | import numpy as np 8 | 9 | fig, ax = plt.subplots() 10 | 11 | # Values of alpha: 12 | alpha = np.array([6,8,10,15,20,30]) 13 | 14 | # Corresponding model energies: 15 | En = np.array([1.457,1.589,1.651,1.7403,1.7882,1.8158]) 16 | 17 | one_alpha = 1./alpha 18 | 19 | # Compute the fifth-order polynomial fit 20 | P = np.polyfit(one_alpha,En,3) 21 | print("Polynomial coefficients:", P) 22 | print("Isolated model energy: %2.3f"%( P[3])) 23 | 24 | En_f = [] 25 | one_alpha_f = np.arange(0.,0.27,0.004) 26 | for x in one_alpha_f: 27 | En_f.append(P[3] + P[2]*x + P[1]*x**2 + P[0]*x**3) 28 | 29 | # Scatter the model energy values 30 | ax.scatter(one_alpha,En,lw = 2.,color = 'navy',marker='o',s=280) 31 | 32 | # Plot the fitting polynomial 33 | ax.plot(one_alpha_f,En_f,lw = 3.8,color = 'red') 34 | ax.set_xlim(0,0.18) 35 | ax.set_ylim(1.4,2.0) 36 | ax.set_xlabel(r"$1/\alpha$",fontsize = 40) 37 | ax.set_ylabel(r"$\mathrm{E}_{-1}^{\mathrm{m,per}} \mathrm{(eV)}$",fontsize = 40) 38 | ax.set_xticks(np.arange(0.0,0.18,0.04)) 39 | ax.tick_params(labelsize=26,width=2.5,length=6) 40 | plt.tight_layout() 41 | plt.savefig("Scaling") 42 | plt.show() 43 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_0p/Fig_V_0p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/1D/NanoRibbon_BN/PA_0p/Fig_V_0p.png -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_0p/README: -------------------------------------------------------------------------------- 1 | This folder shows you how to compute the 2 | potential alignment term, \Delta V_{0/p} (Eqn. 2 3 | in the CoFFEE paper) 4 | 5 | It involves comparing the planar averaged DFT 6 | potentials between the neutral and pristine cells, 7 | -q(V_0 - V_p), far from the defect site. 8 | 9 | Complete details on the DFT calculations are 10 | provided in the paper. 11 | We provide the planar averaged V_p and V_0 12 | potentials computed using Quantum Espresso for the 6x6x6 13 | super cell in the files: 14 | plavg_p_a3.plot and plavg_0_a3.plot 15 | These can be generated from your DFT calculation by 16 | writing the DFT potentials into a cube/xsf format. 17 | The cube/xsf file can then be planar averaged using 18 | the utility plavg.py, located in the path: 19 | path_to_CoFFEE_folder/PotentialAlignment/Utilities/ 20 | The details on how to run this script is provided in 21 | the same folder. 22 | 23 | Use the script plot_DV0p.py to plot this difference 24 | and find the value far from the defect site. 25 | 26 | This term is small as well, about 0.01 eV 27 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_0p/Reference/Fig_V_0p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/1D/NanoRibbon_BN/PA_0p/Reference/Fig_V_0p.png -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_0p/plavg_0_a3.plot: -------------------------------------------------------------------------------- 1 | 0.000 -3.96814870 2 | 0.177 -3.92044762 3 | 0.354 -3.96925488 4 | 0.531 -4.16415086 5 | 0.709 -4.22815962 6 | 0.886 -3.87180109 7 | 1.063 -3.01150589 8 | 1.240 -1.98400949 9 | 1.417 -1.13605990 10 | 1.594 -0.54322489 11 | 1.772 -0.14725117 12 | 1.949 0.13690334 13 | 2.126 0.34485251 14 | 2.303 0.49532830 15 | 2.480 0.60550043 16 | 2.657 0.68501206 17 | 2.835 0.74342954 18 | 3.012 0.78549764 19 | 3.189 0.81652390 20 | 3.366 0.83885056 21 | 3.543 0.85534405 22 | 3.720 0.86724080 23 | 3.898 0.87598787 24 | 4.075 0.88236599 25 | 4.252 0.88697409 26 | 4.429 0.89042549 27 | 4.606 0.89281955 28 | 4.783 0.89471451 29 | 4.961 0.89593156 30 | 5.138 0.89699178 31 | 5.315 0.89759099 32 | 5.492 0.89819529 33 | 5.669 0.89848070 34 | 5.846 0.89882688 35 | 6.023 0.89896248 36 | 6.201 0.89915431 37 | 6.378 0.89922778 38 | 6.555 0.89932137 39 | 6.732 0.89937706 40 | 6.909 0.89940484 41 | 7.086 0.89946282 42 | 7.264 0.89944622 43 | 7.441 0.89951237 44 | 7.618 0.89946775 45 | 7.795 0.89954008 46 | 7.972 0.89948116 47 | 8.149 0.89955371 48 | 8.327 0.89949243 49 | 8.504 0.89955775 50 | 8.681 0.89950409 51 | 8.858 0.89955534 52 | 9.035 0.89951688 53 | 9.212 0.89954884 54 | 9.390 0.89953035 55 | 9.567 0.89954033 56 | 9.744 0.89954352 57 | 9.921 0.89953150 58 | 10.098 0.89955498 59 | 10.275 0.89952313 60 | 10.452 0.89956315 61 | 10.630 0.89951703 62 | 10.807 0.89956809 63 | 10.984 0.89951426 64 | 11.161 0.89956942 65 | 11.338 0.89951514 66 | 11.515 0.89956708 67 | 11.693 0.89951941 68 | 11.870 0.89956148 69 | 12.047 0.89952651 70 | 12.224 0.89955354 71 | 12.401 0.89953550 72 | 12.578 0.89954422 73 | 12.756 0.89954515 74 | 12.933 0.89953474 75 | 13.110 0.89955436 76 | 13.287 0.89952639 77 | 13.464 0.89956181 78 | 13.641 0.89952012 79 | 13.819 0.89956671 80 | 13.996 0.89951677 81 | 14.173 0.89956843 82 | 14.350 0.89951678 83 | 14.527 0.89956671 84 | 14.704 0.89952013 85 | 14.882 0.89956183 86 | 15.059 0.89952641 87 | 15.236 0.89955437 88 | 15.413 0.89953477 89 | 15.590 0.89954517 90 | 15.767 0.89954425 91 | 15.944 0.89953552 92 | 16.122 0.89955356 93 | 16.299 0.89952654 94 | 16.476 0.89956152 95 | 16.653 0.89951945 96 | 16.830 0.89956712 97 | 17.007 0.89951518 98 | 17.185 0.89956947 99 | 17.362 0.89951430 100 | 17.539 0.89956814 101 | 17.716 0.89951707 102 | 17.893 0.89956321 103 | 18.070 0.89952319 104 | 18.248 0.89955504 105 | 18.425 0.89953157 106 | 18.602 0.89954358 107 | 18.779 0.89954039 108 | 18.956 0.89953042 109 | 19.133 0.89954891 110 | 19.311 0.89951695 111 | 19.488 0.89955541 112 | 19.665 0.89950418 113 | 19.842 0.89955783 114 | 20.019 0.89949251 115 | 20.196 0.89955379 116 | 20.374 0.89948125 117 | 20.551 0.89954017 118 | 20.728 0.89946784 119 | 20.905 0.89951246 120 | 21.082 0.89944633 121 | 21.259 0.89946292 122 | 21.436 0.89940494 123 | 21.614 0.89937717 124 | 21.791 0.89932147 125 | 21.968 0.89922788 126 | 22.145 0.89915441 127 | 22.322 0.89896260 128 | 22.499 0.89882698 129 | 22.677 0.89848082 130 | 22.854 0.89819540 131 | 23.031 0.89759112 132 | 23.208 0.89699190 133 | 23.385 0.89593169 134 | 23.562 0.89471464 135 | 23.740 0.89281969 136 | 23.917 0.89042561 137 | 24.094 0.88697421 138 | 24.271 0.88236613 139 | 24.448 0.87598802 140 | 24.625 0.86724096 141 | 24.803 0.85534422 142 | 24.980 0.83885072 143 | 25.157 0.81652408 144 | 25.334 0.78549779 145 | 25.511 0.74342964 146 | 25.688 0.68501222 147 | 25.866 0.60550058 148 | 26.043 0.49532848 149 | 26.220 0.34485264 150 | 26.397 0.13690353 151 | 26.574 -0.14725107 152 | 26.751 -0.54322467 153 | 26.928 -1.13605974 154 | 27.106 -1.98400945 155 | 27.283 -3.01150615 156 | 27.460 -3.87180117 157 | 27.637 -4.22815975 158 | 27.814 -4.16415166 159 | 27.991 -3.96925481 160 | 28.169 -3.92044804 161 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_0p/plavg_p_a3.plot: -------------------------------------------------------------------------------- 1 | 0.000 -3.94459918 2 | 0.177 -3.90018846 3 | 0.354 -3.95851651 4 | 0.531 -4.16763272 5 | 0.709 -4.24675059 6 | 0.886 -3.90118536 7 | 1.063 -3.04319479 8 | 1.240 -2.00940274 9 | 1.417 -1.15164017 10 | 1.594 -0.55138358 11 | 1.772 -0.15100578 12 | 1.949 0.13641915 13 | 2.126 0.34680573 14 | 2.303 0.49913654 15 | 2.480 0.61068263 16 | 2.657 0.69123366 17 | 2.835 0.75041978 18 | 3.012 0.79306383 19 | 3.189 0.82451843 20 | 3.366 0.84716017 21 | 3.543 0.86389187 22 | 3.720 0.87595773 23 | 3.898 0.88483767 24 | 4.075 0.89130374 25 | 4.252 0.89598635 26 | 4.429 0.89948126 27 | 4.606 0.90191746 28 | 4.783 0.90383217 29 | 4.961 0.90507310 30 | 5.138 0.90614103 31 | 5.315 0.90675376 32 | 5.492 0.90736023 33 | 5.669 0.90765286 34 | 5.846 0.90799935 35 | 6.023 0.90813811 36 | 6.201 0.90833020 37 | 6.378 0.90840407 38 | 6.555 0.90849866 39 | 6.732 0.90855288 40 | 6.909 0.90858267 41 | 7.086 0.90863790 42 | 7.264 0.90862421 43 | 7.441 0.90868687 44 | 7.618 0.90864565 45 | 7.795 0.90871423 46 | 7.972 0.90865883 47 | 8.149 0.90872777 48 | 8.327 0.90866969 49 | 8.504 0.90873203 50 | 8.681 0.90868083 51 | 8.858 0.90873003 52 | 9.035 0.90869306 53 | 9.212 0.90872399 54 | 9.390 0.90870590 55 | 9.567 0.90871601 56 | 9.744 0.90871854 57 | 9.921 0.90870771 58 | 10.098 0.90872948 59 | 10.275 0.90869967 60 | 10.452 0.90873730 61 | 10.630 0.90869389 62 | 10.807 0.90874210 63 | 10.984 0.90869119 64 | 11.161 0.90874337 65 | 11.338 0.90869197 66 | 11.515 0.90874123 67 | 11.693 0.90869595 68 | 11.870 0.90873600 69 | 12.047 0.90870268 70 | 12.224 0.90872845 71 | 12.401 0.90871117 72 | 12.578 0.90871961 73 | 12.756 0.90872034 74 | 12.933 0.90871063 75 | 13.110 0.90872906 76 | 13.287 0.90870267 77 | 13.464 0.90873616 78 | 13.641 0.90869674 79 | 13.819 0.90874084 80 | 13.996 0.90869358 81 | 14.173 0.90874244 82 | 14.350 0.90869358 83 | 14.527 0.90874084 84 | 14.704 0.90869674 85 | 14.882 0.90873616 86 | 15.059 0.90870267 87 | 15.236 0.90872906 88 | 15.413 0.90871063 89 | 15.590 0.90872034 90 | 15.767 0.90871961 91 | 15.944 0.90871117 92 | 16.122 0.90872845 93 | 16.299 0.90870268 94 | 16.476 0.90873600 95 | 16.653 0.90869595 96 | 16.830 0.90874123 97 | 17.007 0.90869197 98 | 17.185 0.90874337 99 | 17.362 0.90869119 100 | 17.539 0.90874210 101 | 17.716 0.90869389 102 | 17.893 0.90873730 103 | 18.070 0.90869967 104 | 18.248 0.90872948 105 | 18.425 0.90870771 106 | 18.602 0.90871854 107 | 18.779 0.90871601 108 | 18.956 0.90870590 109 | 19.133 0.90872399 110 | 19.311 0.90869306 111 | 19.488 0.90873003 112 | 19.665 0.90868083 113 | 19.842 0.90873203 114 | 20.019 0.90866969 115 | 20.196 0.90872777 116 | 20.374 0.90865883 117 | 20.551 0.90871423 118 | 20.728 0.90864565 119 | 20.905 0.90868687 120 | 21.082 0.90862421 121 | 21.259 0.90863790 122 | 21.436 0.90858267 123 | 21.614 0.90855288 124 | 21.791 0.90849866 125 | 21.968 0.90840407 126 | 22.145 0.90833020 127 | 22.322 0.90813811 128 | 22.499 0.90799935 129 | 22.677 0.90765286 130 | 22.854 0.90736023 131 | 23.031 0.90675376 132 | 23.208 0.90614103 133 | 23.385 0.90507310 134 | 23.562 0.90383217 135 | 23.740 0.90191746 136 | 23.917 0.89948126 137 | 24.094 0.89598635 138 | 24.271 0.89130374 139 | 24.448 0.88483767 140 | 24.625 0.87595773 141 | 24.803 0.86389187 142 | 24.980 0.84716017 143 | 25.157 0.82451843 144 | 25.334 0.79306383 145 | 25.511 0.75041978 146 | 25.688 0.69123366 147 | 25.866 0.61068263 148 | 26.043 0.49913654 149 | 26.220 0.34680573 150 | 26.397 0.13641915 151 | 26.574 -0.15100578 152 | 26.751 -0.55138358 153 | 26.928 -1.15164017 154 | 27.106 -2.00940274 155 | 27.283 -3.04319479 156 | 27.460 -3.90118536 157 | 27.637 -4.24675059 158 | 27.814 -4.16763272 159 | 27.991 -3.95851651 160 | 28.169 -3.90018846 161 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_0p/plot_DV0p.py: -------------------------------------------------------------------------------- 1 | import sys, string 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | 5 | V_0 = np.loadtxt("plavg_0_a3.plot") 6 | V_p = np.loadtxt("plavg_p_a3.plot") 7 | 8 | V_diff = -1*(V_0[:,1] - V_p[:,1]) 9 | 10 | fig, ax = plt.subplots() 11 | 12 | ax.plot(V_0[:,0]*0.52918,V_diff,color = 'k',linewidth = 3.2,label = r"-1(V$_0$ - V$_p$)") 13 | ax.axvline(x = V_0[0,0]*0.52918,color = 'darkorange',linestyle = '--',lw = 3.2,label = "Vacancy pos.") 14 | ax.legend(loc = 0,fontsize = 18) 15 | ax.set_xlim(V_0[0,0]*0.52918-0.1,V_0[-1,0]*0.52918) 16 | ax.set_ylabel("Potential (eV)",fontsize = 25) 17 | ax.set_xlabel(r"$a_1$ ($\AA$)",fontsize = 25) 18 | ax.tick_params(labelsize = 19, width = 2.5,length = 7) 19 | plt.tight_layout() 20 | plt.savefig("Fig_V_0p.png") 21 | print("Value far from defect: %2.4f"%( V_diff[len(V_0)/2])) 22 | plt.show() 23 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_q0/README: -------------------------------------------------------------------------------- 1 | This folder shows you how to compute the 2 | potential alignment term, \Delta V_{q-0/m} (Eqn. 6 3 | in the CoFFEE paper) 4 | 5 | It involves comparing the planar averaged DFT difference 6 | potential between the charged and neutral cells, 7 | (V_q^{DFT} - V_0^{DFT}) with the model potential for the 8 | same super cell, far from the defect position. 9 | 10 | Complete details on the DFT calculations are 11 | provided in the paper. 12 | We provide the planar averaged V_q^{DFT} and V_0^{DFT} 13 | potentials computed using Quantum Espresso for the 6x6x6 14 | super cell in the files: 15 | plavg_q_a1.plot and plavg_0_a1.plot 16 | These can be generated from your DFT calculation by 17 | writing the DFT potentials into a cube/xsf format. 18 | The cube/xsf file can then be planar averaged using 19 | the utility plavg.py, located in the path: 20 | path_to_CoFFEE_folder/PotentialAlignment/Utilities/ 21 | The details on how to run this script is provided in 22 | the same folder. 23 | 24 | We compare the DFT difference potential with the 25 | model potential (far from the defect) computed 26 | in the folder: ../Model_Scaling/alpha.6/Plot/ using 27 | the script plot_DVq0.py. 28 | 29 | You will find that the difference between the potentials, 30 | far from the defect is negligibly small. There is hence 31 | no contribution from this term to the correction. It 32 | is however necessary to always check if this is true. 33 | This term being small indicates that the charged defect has been 34 | modelled well. 35 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_q0/Reference/Fig_V_q0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/1D/NanoRibbon_BN/PA_q0/Reference/Fig_V_q0.png -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_q0/plavg_0_a1.plot: -------------------------------------------------------------------------------- 1 | 0.000 -3.96814870 2 | 0.177 -3.92044762 3 | 0.354 -3.96925488 4 | 0.531 -4.16415086 5 | 0.709 -4.22815962 6 | 0.886 -3.87180109 7 | 1.063 -3.01150589 8 | 1.240 -1.98400949 9 | 1.417 -1.13605990 10 | 1.594 -0.54322489 11 | 1.772 -0.14725117 12 | 1.949 0.13690334 13 | 2.126 0.34485251 14 | 2.303 0.49532830 15 | 2.480 0.60550043 16 | 2.657 0.68501206 17 | 2.835 0.74342954 18 | 3.012 0.78549764 19 | 3.189 0.81652390 20 | 3.366 0.83885056 21 | 3.543 0.85534405 22 | 3.720 0.86724080 23 | 3.898 0.87598787 24 | 4.075 0.88236599 25 | 4.252 0.88697409 26 | 4.429 0.89042549 27 | 4.606 0.89281955 28 | 4.783 0.89471451 29 | 4.961 0.89593156 30 | 5.138 0.89699178 31 | 5.315 0.89759099 32 | 5.492 0.89819529 33 | 5.669 0.89848070 34 | 5.846 0.89882688 35 | 6.023 0.89896248 36 | 6.201 0.89915431 37 | 6.378 0.89922778 38 | 6.555 0.89932137 39 | 6.732 0.89937706 40 | 6.909 0.89940484 41 | 7.086 0.89946282 42 | 7.264 0.89944622 43 | 7.441 0.89951237 44 | 7.618 0.89946775 45 | 7.795 0.89954008 46 | 7.972 0.89948116 47 | 8.149 0.89955371 48 | 8.327 0.89949243 49 | 8.504 0.89955775 50 | 8.681 0.89950409 51 | 8.858 0.89955534 52 | 9.035 0.89951688 53 | 9.212 0.89954884 54 | 9.390 0.89953035 55 | 9.567 0.89954033 56 | 9.744 0.89954352 57 | 9.921 0.89953150 58 | 10.098 0.89955498 59 | 10.275 0.89952313 60 | 10.452 0.89956315 61 | 10.630 0.89951703 62 | 10.807 0.89956809 63 | 10.984 0.89951426 64 | 11.161 0.89956942 65 | 11.338 0.89951514 66 | 11.515 0.89956708 67 | 11.693 0.89951941 68 | 11.870 0.89956148 69 | 12.047 0.89952651 70 | 12.224 0.89955354 71 | 12.401 0.89953550 72 | 12.578 0.89954422 73 | 12.756 0.89954515 74 | 12.933 0.89953474 75 | 13.110 0.89955436 76 | 13.287 0.89952639 77 | 13.464 0.89956181 78 | 13.641 0.89952012 79 | 13.819 0.89956671 80 | 13.996 0.89951677 81 | 14.173 0.89956843 82 | 14.350 0.89951678 83 | 14.527 0.89956671 84 | 14.704 0.89952013 85 | 14.882 0.89956183 86 | 15.059 0.89952641 87 | 15.236 0.89955437 88 | 15.413 0.89953477 89 | 15.590 0.89954517 90 | 15.767 0.89954425 91 | 15.944 0.89953552 92 | 16.122 0.89955356 93 | 16.299 0.89952654 94 | 16.476 0.89956152 95 | 16.653 0.89951945 96 | 16.830 0.89956712 97 | 17.007 0.89951518 98 | 17.185 0.89956947 99 | 17.362 0.89951430 100 | 17.539 0.89956814 101 | 17.716 0.89951707 102 | 17.893 0.89956321 103 | 18.070 0.89952319 104 | 18.248 0.89955504 105 | 18.425 0.89953157 106 | 18.602 0.89954358 107 | 18.779 0.89954039 108 | 18.956 0.89953042 109 | 19.133 0.89954891 110 | 19.311 0.89951695 111 | 19.488 0.89955541 112 | 19.665 0.89950418 113 | 19.842 0.89955783 114 | 20.019 0.89949251 115 | 20.196 0.89955379 116 | 20.374 0.89948125 117 | 20.551 0.89954017 118 | 20.728 0.89946784 119 | 20.905 0.89951246 120 | 21.082 0.89944633 121 | 21.259 0.89946292 122 | 21.436 0.89940494 123 | 21.614 0.89937717 124 | 21.791 0.89932147 125 | 21.968 0.89922788 126 | 22.145 0.89915441 127 | 22.322 0.89896260 128 | 22.499 0.89882698 129 | 22.677 0.89848082 130 | 22.854 0.89819540 131 | 23.031 0.89759112 132 | 23.208 0.89699190 133 | 23.385 0.89593169 134 | 23.562 0.89471464 135 | 23.740 0.89281969 136 | 23.917 0.89042561 137 | 24.094 0.88697421 138 | 24.271 0.88236613 139 | 24.448 0.87598802 140 | 24.625 0.86724096 141 | 24.803 0.85534422 142 | 24.980 0.83885072 143 | 25.157 0.81652408 144 | 25.334 0.78549779 145 | 25.511 0.74342964 146 | 25.688 0.68501222 147 | 25.866 0.60550058 148 | 26.043 0.49532848 149 | 26.220 0.34485264 150 | 26.397 0.13690353 151 | 26.574 -0.14725107 152 | 26.751 -0.54322467 153 | 26.928 -1.13605974 154 | 27.106 -1.98400945 155 | 27.283 -3.01150615 156 | 27.460 -3.87180117 157 | 27.637 -4.22815975 158 | 27.814 -4.16415166 159 | 27.991 -3.96925481 160 | 28.169 -3.92044804 161 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_q0/plavg_q_a1.plot: -------------------------------------------------------------------------------- 1 | 0.000 -3.66271237 2 | 0.177 -3.61602145 3 | 0.354 -3.66755248 4 | 0.531 -3.86623435 5 | 0.709 -3.93457930 6 | 0.886 -3.58292993 7 | 1.063 -2.72775726 8 | 1.240 -1.70589661 9 | 1.417 -0.86418518 10 | 1.594 -0.27824281 11 | 1.772 0.11016525 12 | 1.949 0.38609865 13 | 2.126 0.58521596 14 | 2.303 0.72631296 15 | 2.480 0.82663452 16 | 2.657 0.89590273 17 | 2.835 0.94376343 18 | 3.012 0.97503485 19 | 3.189 0.99509326 20 | 3.366 1.00634156 21 | 3.543 1.01169852 22 | 3.720 1.01244596 23 | 3.898 1.01006999 24 | 4.075 1.00538290 25 | 4.252 0.99901056 26 | 4.429 0.99158877 27 | 4.606 0.98323516 28 | 4.783 0.97452273 29 | 4.961 0.96528578 30 | 5.138 0.95605483 31 | 5.315 0.94653410 32 | 5.492 0.93719593 33 | 5.669 0.92772188 34 | 5.846 0.91849564 35 | 6.023 0.90924903 36 | 6.201 0.90025210 37 | 6.378 0.89133150 38 | 6.555 0.88262806 39 | 6.732 0.87408495 40 | 6.909 0.86571298 41 | 7.086 0.85757110 42 | 7.264 0.84955520 43 | 7.441 0.84182320 44 | 7.618 0.83418182 45 | 7.795 0.82685888 46 | 7.972 0.81960677 47 | 8.149 0.81268830 48 | 8.327 0.80583816 49 | 8.504 0.79931706 50 | 8.681 0.79287918 51 | 8.858 0.78674907 52 | 9.035 0.78073122 53 | 9.212 0.77498700 54 | 9.390 0.76939448 55 | 9.567 0.76403323 56 | 9.744 0.75886782 57 | 9.921 0.75389001 58 | 10.098 0.74914992 59 | 10.275 0.74455749 60 | 10.452 0.74023965 61 | 10.630 0.73603825 62 | 10.807 0.73213665 63 | 10.984 0.72833298 64 | 11.161 0.72484086 65 | 11.338 0.72144218 66 | 11.515 0.71835228 67 | 11.693 0.71536553 68 | 11.870 0.71267116 69 | 12.047 0.71010237 70 | 12.224 0.70779849 71 | 12.401 0.70565218 72 | 12.578 0.70373529 73 | 12.756 0.70201315 74 | 12.933 0.70048253 75 | 13.110 0.69918458 76 | 13.287 0.69804184 77 | 13.464 0.69716514 78 | 13.641 0.69641394 79 | 13.819 0.69595387 80 | 13.996 0.69559998 81 | 14.173 0.69555009 82 | 14.350 0.69559999 83 | 14.527 0.69595387 84 | 14.704 0.69641395 85 | 14.882 0.69716514 86 | 15.059 0.69804185 87 | 15.236 0.69918458 88 | 15.413 0.70048253 89 | 15.590 0.70201314 90 | 15.767 0.70373529 91 | 15.944 0.70565218 92 | 16.122 0.70779849 93 | 16.299 0.71010235 94 | 16.476 0.71267116 95 | 16.653 0.71536553 96 | 16.830 0.71835228 97 | 17.007 0.72144217 98 | 17.185 0.72484086 99 | 17.362 0.72833298 100 | 17.539 0.73213664 101 | 17.716 0.73603824 102 | 17.893 0.74023962 103 | 18.070 0.74455749 104 | 18.248 0.74914991 105 | 18.425 0.75388998 106 | 18.602 0.75886781 107 | 18.779 0.76403322 108 | 18.956 0.76939447 109 | 19.133 0.77498697 110 | 19.311 0.78073119 111 | 19.488 0.78674906 112 | 19.665 0.79287917 113 | 19.842 0.79931705 114 | 20.019 0.80583813 115 | 20.196 0.81268826 116 | 20.374 0.81960673 117 | 20.551 0.82685886 118 | 20.728 0.83418183 119 | 20.905 0.84182319 120 | 21.082 0.84955523 121 | 21.259 0.85757109 122 | 21.436 0.86571295 123 | 21.614 0.87408493 124 | 21.791 0.88262805 125 | 21.968 0.89133140 126 | 22.145 0.90025205 127 | 22.322 0.90924904 128 | 22.499 0.91849561 129 | 22.677 0.92772184 130 | 22.854 0.93719587 131 | 23.031 0.94653406 132 | 23.208 0.95605482 133 | 23.385 0.96528575 134 | 23.562 0.97452273 135 | 23.740 0.98323512 136 | 23.917 0.99158876 137 | 24.094 0.99901056 138 | 24.271 1.00538291 139 | 24.448 1.01007001 140 | 24.625 1.01244591 141 | 24.803 1.01169845 142 | 24.980 1.00634149 143 | 25.157 0.99509330 144 | 25.334 0.97503479 145 | 25.511 0.94376340 146 | 25.688 0.89590274 147 | 25.866 0.82663449 148 | 26.043 0.72631295 149 | 26.220 0.58521596 150 | 26.397 0.38609868 151 | 26.574 0.11016534 152 | 26.751 -0.27824266 153 | 26.928 -0.86418489 154 | 27.106 -1.70589626 155 | 27.283 -2.72775602 156 | 27.460 -3.58292897 157 | 27.637 -3.93457946 158 | 27.814 -3.86623586 159 | 27.991 -3.66755353 160 | 28.169 -3.61602259 161 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/PA_q0/plot_DVq0.py: -------------------------------------------------------------------------------- 1 | import sys, string 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | 5 | V_0 = np.loadtxt("plavg_0_a1.plot") 6 | V_q = np.loadtxt("plavg_q_a1.plot") 7 | V_m = np.loadtxt("../Model_Scaling/alpha.6/Plot/plavg_a1.plot") 8 | 9 | V_diff = -1*(V_q[:,1] - V_0[:,1]) 10 | V_diff = np.concatenate((V_diff[len(V_diff)/2: len(V_diff)],V_diff[0:len(V_diff)/2])) 11 | 12 | fig, ax = plt.subplots() 13 | 14 | ax.plot(V_0[:,0]*0.52918,V_diff,color = 'k',linewidth = 3.8,label = "DFT diff.") 15 | ax.plot(V_m[:,0]*0.52918,V_m[:,1],color = 'r',lw = 3.8,linestyle = '--',label = "Model") 16 | ax.axvline(x = V_0[int(len(V_0)*0.5),0]*0.52918,color = 'darkorange',linestyle = '--',lw = 3.8,label = "Vacancy pos.") 17 | ax.legend(loc = 0,fontsize = 18) 18 | ax.set_xlim(V_0[0,0]*0.52918,V_0[-1,0]*0.52918) 19 | ax.set_ylabel("Potential (eV)",fontsize = 25) 20 | ax.set_xlabel(r"$a_1$ ($\AA$)",fontsize = 25) 21 | ax.set_ylim(-0.6,0.5) 22 | ax.tick_params(labelsize = 19, width = 2.5,length = 7) 23 | plt.tight_layout() 24 | plt.savefig("Fig_V_q0.png") 25 | plt.show() 26 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/QE_inputs/in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = "relax", 3 | prefix = BN, 4 | pseudo_dir = ".", 5 | outdir = ".", 6 | verbosity = 'high' 7 | / 8 | &SYSTEM 9 | ibrav = 0, 10 | celldm(1) = 4.74 11 | nat = 139 12 | ntyp = 6 13 | ecutwfc = 70, 14 | nosym = .TRUE., 15 | occupations= 'smearing', 16 | smearing = 'gaussian', 17 | degauss = 0.001, 18 | nspin = 2, 19 | starting_magnetization(3)= -0.3956, 20 | starting_magnetization(4)= 0.3066, 21 | starting_magnetization(5)= 0.097, 22 | tot_charge = -1 23 | / 24 | &ELECTRONS 25 | conv_thr = 1.D-9, 26 | mixing_beta = 0.7D0, 27 | / 28 | &IONS 29 | ion_dynamics='bfgs', 30 | / 31 | &CELL 32 | cell_dynamics='bfgs' 33 | press=0.0, 34 | / 35 | CELL_PARAMETERS {alat} 36 | 10.000000000 0.0000000 0.0 37 | 0.0000 23.33 0.0 38 | 0.0000 0.0000000 10.0 39 | 40 | ATOMIC_SPECIES 41 | B 10.811 B.pbe-nc.UPF 42 | N 14.0067 N.pbe-nc.UPF 43 | N1 14.0067 N.pbe-nc.UPF 44 | N2 14.0067 N.pbe-nc.UPF 45 | N3 14.0067 N.pbe-nc.UPF 46 | H 1.00 H.pbe-mt_fhi.UPF 47 | 48 | ATOMIC_POSITIONS (angstrom) 49 | H 1.241337923 2.620429423 -0.000000056 50 | N 1.242511320 3.627447200 0.000000450 51 | B -0.004369940 4.325519466 0.000000695 52 | B 1.250866192 6.498011945 0.000000253 53 | N -0.008255141 5.776374643 0.000001077 54 | N 1.242412154 7.948352313 0.000000520 55 | B -0.002442031 8.674875137 0.000000565 56 | B 1.257658958 10.848372182 -0.000000214 57 | N -0.003837217 10.127280733 0.000000474 58 | N 1.253028376 12.304012147 -0.000000528 59 | B 0.005122052 13.024570072 -0.000000235 60 | B 1.261441339 15.201241316 -0.000000041 61 | N 0.001352264 14.484883415 -0.000000140 62 | H 1.257087702 16.396972975 0.000000366 63 | H 3.747842804 2.610046570 -0.000001929 64 | N 3.750752516 3.617422020 -0.000003290 65 | B 2.503010651 4.318471649 -0.000001363 66 | B 3.759007018 6.494368823 -0.000001967 67 | N 2.496304724 5.768749790 -0.000001309 68 | N 3.738646434 7.943205779 -0.000001648 69 | B 2.502708987 8.672980271 -0.000000663 70 | B 3.769828323 10.846441062 -0.000001607 71 | N 2.501292987 10.126296628 -0.000000797 72 | N 3.761088836 12.305087635 -0.000001487 73 | B 2.515726021 13.021883445 -0.000000849 74 | B 3.770229650 15.199563976 -0.000000084 75 | N 2.509659483 14.483895225 -0.000000385 76 | H 3.764066136 16.395651064 0.000000168 77 | H 6.272437782 2.610359825 -0.000002176 78 | N 6.268069263 3.617489494 -0.000002527 79 | B 5.012743523 4.310845456 -0.000003091 80 | B 6.279056434 6.489224898 -0.000000314 81 | N 5.000653654 5.755871207 -0.000002628 82 | N1 6.150608345 7.885097699 0.000005507 83 | B 5.010153333 8.687415851 0.000000089 84 | B 6.301988565 10.816200420 -0.000001886 85 | N 5.005645688 10.133042823 -0.000001895 86 | N 6.272703634 12.304747879 -0.000000747 87 | B 5.027701834 13.016787498 -0.000000766 88 | B 6.274741785 15.202908072 0.000000401 89 | N 5.018972670 14.484187105 -0.000000043 90 | H 6.269779789 16.399821772 0.000000327 91 | H 8.788045667 2.616565263 -0.000000167 92 | N 8.784016661 3.623574785 -0.000000817 93 | B 7.526196008 4.320822548 -0.000001963 94 | B 8.768090676 6.519617780 -0.000000993 95 | N 7.525435363 5.760219078 -0.000002024 96 | N2 8.860034741 7.918511851 -0.000001073 97 | B 8.759810106 10.821969076 -0.000000326 98 | N3 7.532306848 10.154532648 -0.000002780 99 | N 8.783287588 12.309687542 0.000000958 100 | B 7.527525914 13.017951963 0.000000400 101 | B 8.777813172 15.205075616 0.000000917 102 | N 7.526297670 14.488751581 0.000000823 103 | H 8.779696659 16.402089134 0.000000502 104 | H 11.295250322 2.622767391 -0.000000601 105 | N 11.295745040 3.630029280 0.000000407 106 | B 10.035080873 4.327455924 -0.000000045 107 | B 11.286417847 6.503912367 0.000001097 108 | N 10.042361518 5.771180509 0.000000104 109 | N 11.306131912 7.950129809 0.000001283 110 | B 10.025131140 8.684682702 0.000000318 111 | B 11.283300878 10.849133790 0.000001503 112 | N 10.049584803 10.137114792 0.000000719 113 | N 11.293471785 12.309526047 0.000001776 114 | B 10.028403919 13.021884600 0.000001480 115 | B 11.284445828 15.204401186 0.000000853 116 | N 10.035170851 14.489482783 0.000001304 117 | H 11.290347624 16.400883667 0.000000370 118 | H 13.802293890 2.624675828 0.000000038 119 | N 13.803725548 3.631834111 0.000000747 120 | B 12.544318150 4.326721156 0.000001033 121 | B 13.796459444 6.501033589 0.000001497 122 | N 12.550473987 5.775509199 0.000001759 123 | N 13.805301274 7.950688886 0.000001644 124 | B 12.542985134 8.675354355 0.000001627 125 | B 13.793373430 10.849019255 0.000001059 126 | N 12.550992300 10.128910941 0.000001684 127 | N 13.799351361 12.304976682 0.000000867 128 | B 12.538118558 13.024734947 0.000001232 129 | B 13.792684624 15.202820655 0.000000215 130 | N 12.544069758 14.487216243 0.000000837 131 | H 13.798380238 16.398548893 -0.000000158 132 | H 16.307969518 2.627600715 -0.000000126 133 | N 16.309892132 3.634563787 -0.000000165 134 | B 15.052320474 4.326871369 0.000000469 135 | B 16.305124741 6.502755050 0.000000428 136 | N 15.056499167 5.777926238 0.000000849 137 | N 16.309453179 7.953046328 0.000000284 138 | B 15.050451207 8.675252718 0.000000804 139 | B 16.302737650 10.849745053 0.000000077 140 | N 15.054600581 10.127514077 0.000000527 141 | N 16.306254309 12.303815987 -0.000000087 142 | B 15.047145670 13.023839879 0.000000233 143 | B 16.301377841 15.201485705 -0.000000093 144 | N 15.051316575 14.484254916 0.000000037 145 | H 16.305382307 16.396971050 -0.000000099 146 | H 18.813438047 2.629724059 0.000000016 147 | N 18.814004537 3.636543327 0.000000204 148 | B 17.559398725 4.329212459 0.000000089 149 | B 18.812483985 6.504664148 0.000000240 150 | N 17.562121466 5.780807445 0.000000221 151 | N 18.814669000 7.954531011 0.000000364 152 | B 17.559014703 8.676928700 0.000000200 153 | B 18.812121661 10.851635159 -0.000000025 154 | N 17.560927005 10.128606284 -0.000000003 155 | N 18.813486152 12.305070688 -0.000000037 156 | B 17.556770203 13.024844008 -0.000000097 157 | B 18.811215418 15.202330893 -0.000000045 158 | N 17.559195703 14.484181154 -0.000000101 159 | H 18.812635305 16.397916463 -0.000000003 160 | H 21.319132145 2.630212021 -0.000000010 161 | N 21.317606819 3.637125929 -0.000000119 162 | B 20.065229815 4.330214362 0.000000117 163 | B 21.319678471 6.503502588 -0.000000011 164 | N 20.066078335 5.781723270 0.000000152 165 | N 21.319116608 7.953501311 -0.000000043 166 | B 20.066841931 8.677605701 0.000000167 167 | B 21.321694249 10.851642425 -0.000000036 168 | N 20.067052931 10.129308283 0.000000032 169 | N 21.320922223 12.305427296 -0.000000023 170 | B 20.066832109 13.025951690 -0.000000012 171 | B 21.322292289 15.202945405 -0.000000022 172 | N 20.067195750 14.485141395 -0.000000023 173 | H 21.320219642 16.398568654 -0.000000018 174 | H 23.821692300 2.627372246 -0.000000043 175 | N 23.821542244 3.634158128 0.000000323 176 | B 22.572084835 4.329037587 0.000000027 177 | B 23.826910243 6.501875438 0.000000581 178 | N 22.570875216 5.780147651 0.000000027 179 | N 23.823205159 7.951918214 0.000000390 180 | B 22.573938341 8.676353169 0.000000028 181 | B 23.830996758 10.850878859 0.000000195 182 | N 22.573602800 10.128410281 -0.000000001 183 | N 23.828829939 12.305210041 -0.000000043 184 | B 22.577312057 13.025814309 -0.000000049 185 | B 23.833914971 15.202567435 -0.000000041 186 | N 22.575739241 14.485440177 -0.000000041 187 | H 23.831095383 16.398426270 0.000000002 188 | 189 | K_POINTS gamma 190 | -------------------------------------------------------------------------------- /Examples/1D/NanoRibbon_BN/README: -------------------------------------------------------------------------------- 1 | Welcome to the BN nanoribbon test system. 2 | 3 | This example studies a B vacancy in a BN nanoribbon in the -1 charge 4 | state. The complete electrostatic correction for this system 5 | involves computing the following terms 6 | (see Eqn 2 and Eqn 3 in CoFFEE paper): 7 | 8 | 1. Lattice correction term: E^{lat}, obtained from the 9 | model calculations. 10 | The details on computing E^{lat} are provided in 11 | the folder Model_Scaling/ 12 | 2. Potential alignment term: -\Delta V_{q/0}, Eqn 5 13 | in the paper. 14 | The details on computing this term are provided in 15 | the folder PA_q0/ 16 | 3. Potential alignment term: -q\Delta V_{0/p}, Eqn 2 17 | in the paper. 18 | The details on computing this term are provided in 19 | the folder PA_0p/ 20 | 21 | Complete correction for the 6x14x6 super cell, 22 | E_corr = E^{lat} + (-\Delta V_{q/0}) + (-q\Delta V_{0/p}) 23 | E_corr = 0.423 + 0.0 + 0.01 eV 24 | E_corr = 0.433 eV 25 | 26 | Uncorrected formation energy: 8.94 eV 27 | Corrected formation energy: 9.373 eV 28 | 29 | The QE_input/ directory provides the 30 | Quantum Espresso input file for the alpha = 10 31 | super cell calculation with a B 32 | vacancy in the -1 charged state. 33 | We also provide the pseudopotentials. 34 | -------------------------------------------------------------------------------- /Examples/1D/Wire_samples/Circular_cross-section/Disk_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/1D/Wire_samples/Circular_cross-section/Disk_profile.png -------------------------------------------------------------------------------- /Examples/1D/Wire_samples/Circular_cross-section/README: -------------------------------------------------------------------------------- 1 | This example shows how to construct a 2 | dielectric profile for a wire with a 3 | circular cross-section. Periodicity 4 | assumed in the z direction. 5 | A circular cross-section with the 6 | edges smoothened can be constructed 7 | using the Smoothness parameter. 8 | 9 | Run coffee.py with the given input file, in, 10 | and visualize the epsilon profile using 11 | plot_eps.py: 12 | 13 | $path_to_coffee_folder/coffee.py in 14 | $python plot_eps.py 15 | 16 | Note that this is a fictitious system 17 | to demonstrate how the profile can 18 | be constructed. 19 | -------------------------------------------------------------------------------- /Examples/1D/Wire_samples/Circular_cross-section/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.0 0.0 0.0 5 | 0.0 1.0 0.0 6 | 0.0 0.0 1.0 7 | 8 | Cell_dimensions bohr 9 | 37.794 37.794 34.806806 10 | 11 | Ecut=5.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Wire 15 | Epsilon1_a1 = 7.34 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 7.34 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 8.73 20 | Epsilon2_a3 = 1.0 21 | Circle = True 22 | Radius = 8.0 23 | c_a1 = 0.5 24 | c_a2 = 0.5 25 | Smoothness = 2.0 26 | / 27 | 28 | &GAUSSIAN_PARAMETERS: 29 | Total_charge = -1 30 | Sigma = 2.4 31 | Centre_a1 = 0.5 32 | Centre_a2 = 0.779089 33 | Centre_a3 = 0.5 34 | / 35 | -------------------------------------------------------------------------------- /Examples/1D/Wire_samples/Circular_cross-section/plot_eps.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys, string 3 | import numpy as np 4 | import pickle 5 | import matplotlib.pyplot as plt 6 | import matplotlib.colors as colors 7 | import matplotlib.path as mplPath 8 | import matplotlib.patches as mpatches 9 | import matplotlib.gridspec as gridspec 10 | 11 | celldm1 = 37.7945*0.52918 12 | celldm2 = 37.794*0.52918 13 | 14 | eps_xy_a1 = np.load("eps_xy_a1.npy") 15 | eps_xy_a2 = np.load("eps_xy_a2.npy") 16 | eps_xy_a3 = np.load("eps_xy_a3.npy") 17 | a1_dim, a2_dim = np.shape(eps_xy_a1)[0], np.shape(eps_xy_a1)[1] 18 | fig, axarr = plt.subplots(1,3,figsize = (18,5)) 19 | map_c = 'summer' 20 | a1 = np.arange(0,celldm1,celldm1/a1_dim) 21 | a2 = np.arange(0,celldm2,celldm2/a2_dim) 22 | h_map = axarr[0].pcolor(a2,a1,eps_xy_a1,cmap=map_c) 23 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[0]) 24 | cb.ax.tick_params(labelsize=22) 25 | h_map = axarr[1].pcolor(a2,a1,eps_xy_a2,cmap=map_c) 26 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[1]) 27 | cb.ax.tick_params(labelsize=20) 28 | h_map = axarr[2].pcolor(a2,a1,eps_xy_a3,cmap=map_c) 29 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[2]) 30 | cb.ax.tick_params(labelsize=22) 31 | 32 | for i in range(3): 33 | axarr[i].set_xlabel(r"$y (\AA)$",fontsize = 30) 34 | axarr[i].set_ylabel(r"$x (\AA)$",fontsize = 30) 35 | axarr[i].set_ylim(0,celldm1-celldm1/a1_dim) 36 | axarr[i].set_xlim(0,celldm2-celldm2/a2_dim) 37 | axarr[i].tick_params(labelsize=22,width=1.8) 38 | 39 | axarr[0].set_title(r"Dielectric profile along a$_1$/x",fontsize = 22) 40 | axarr[1].set_title(r"Dielectric profile along a$_2$/y",fontsize = 22) 41 | axarr[2].set_title(r"Dielectric profile along a$_3$/z",fontsize = 22) 42 | plt.tight_layout() 43 | plt.savefig("Disk_profile.png",dpi = 400) 44 | plt.show() 45 | -------------------------------------------------------------------------------- /Examples/1D/Wire_samples/Hexagonal_cross-section/README: -------------------------------------------------------------------------------- 1 | This example shows how to construct a 2 | dielectric profile for a wire with a 3 | hexagonal cross-section. Periodicity 4 | assumed in the z direction. 5 | The edges of the nanowire are read 6 | from the vertices file supplied in the input. 7 | 8 | Run coffee.py with the given input file, in, 9 | and visualize the epsilon profile using 10 | plot_eps.py: 11 | 12 | $path_to_coffee_folder/coffee.py in 13 | $python plot_eps.py 14 | 15 | Note that this is a fictitious system 16 | to demonstrate how the profile can 17 | be constructed. 18 | -------------------------------------------------------------------------------- /Examples/1D/Wire_samples/Hexagonal_cross-section/Wire_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/1D/Wire_samples/Hexagonal_cross-section/Wire_profile.png -------------------------------------------------------------------------------- /Examples/1D/Wire_samples/Hexagonal_cross-section/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.0 0.0 0.0 5 | 0.0 1.0 0.0 6 | 0.0 0.0 1.0 7 | 8 | Cell_dimensions bohr 9 | 37.794 37.794 34.806806 10 | 11 | Ecut=5.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Wire 15 | Epsilon1_a1 = 7.34 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 7.34 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 8.73 20 | Epsilon2_a3 = 1.0 21 | Vertices_file = vertices 22 | / 23 | 24 | &GAUSSIAN_PARAMETERS: 25 | Total_charge = -1 26 | Sigma = 2.4 27 | Centre_a1 = 0.5 28 | Centre_a2 = 0.779089 29 | Centre_a3 = 0.5 30 | / 31 | -------------------------------------------------------------------------------- /Examples/1D/Wire_samples/Hexagonal_cross-section/plot_eps.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys, string 3 | import numpy as np 4 | import pickle 5 | import matplotlib.pyplot as plt 6 | import matplotlib.colors as colors 7 | import matplotlib.path as mplPath 8 | import matplotlib.patches as mpatches 9 | import matplotlib.gridspec as gridspec 10 | 11 | celldm1 = 37.7945*0.52918 12 | celldm2 = 37.794*0.52918 13 | 14 | eps_xy_a1 = np.load("eps_xy_a1.npy") 15 | eps_xy_a2 = np.load("eps_xy_a2.npy") 16 | eps_xy_a3 = np.load("eps_xy_a3.npy") 17 | a1_dim, a2_dim = np.shape(eps_xy_a1)[0], np.shape(eps_xy_a1)[1] 18 | fig, axarr = plt.subplots(1,3,figsize = (18,5)) 19 | map_c = 'summer' 20 | a1 = np.arange(0,celldm1,celldm1/a1_dim) 21 | a2 = np.arange(0,celldm2,celldm2/a2_dim) 22 | h_map = axarr[0].pcolor(a2,a1,eps_xy_a1,cmap=map_c) 23 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[0]) 24 | cb.ax.tick_params(labelsize=22) 25 | h_map = axarr[1].pcolor(a2,a1,eps_xy_a2,cmap=map_c) 26 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[1]) 27 | cb.ax.tick_params(labelsize=20) 28 | h_map = axarr[2].pcolor(a2,a1,eps_xy_a3,cmap=map_c) 29 | cb = fig.colorbar(h_map,shrink=0.9,ax = axarr[2]) 30 | cb.ax.tick_params(labelsize=22) 31 | 32 | for i in range(3): 33 | axarr[i].set_xlabel(r"$y (\AA)$",fontsize = 30) 34 | axarr[i].set_ylabel(r"$x (\AA)$",fontsize = 30) 35 | axarr[i].set_ylim(0,celldm1-celldm1/a1_dim) 36 | axarr[i].set_xlim(0,celldm2-celldm2/a2_dim) 37 | axarr[i].tick_params(labelsize=22,width=1.8) 38 | 39 | axarr[0].set_title(r"Dielectric profile along a$_1$/x",fontsize = 22) 40 | axarr[1].set_title(r"Dielectric profile along a$_2$/y",fontsize = 22) 41 | axarr[2].set_title(r"Dielectric profile along a$_3$/z",fontsize = 22) 42 | plt.tight_layout() 43 | plt.savefig("Wire_profile.png",dpi = 400) 44 | plt.show() 45 | -------------------------------------------------------------------------------- /Examples/1D/Wire_samples/Hexagonal_cross-section/vertices: -------------------------------------------------------------------------------- 1 | vertices_pos 2 | 6 3 | 11.346075 31.976134 4 | 26.448208 31.976155 5 | 33.999423 18.897327 6 | 26.448187 5.818191 7 | 11.346038 5.818247 8 | 3.794900 18.897011 9 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/README: -------------------------------------------------------------------------------- 1 | This folder computes E^{lat} for a S vacancy in 2 | monolayer MoS2 in the -1 charge state. 3 | 4 | The lattice correction term, E^{lat}, is given by 5 | (Eqn. 3 in the CoFFEE paper): 6 | E^{lat} = E^{iso,m}- E^{per,m} 7 | 8 | To obtain the isolated model energy for this system, 9 | the model periodic energy is computed for several supercell sizes. 10 | These values are then fit with a fifth order polynomial as 11 | shown in Fig. 6 (c) in the CoFFEE paper. This polynomial 12 | has the form: 13 | p(\alpha) = f_0 + f_1/\alpha + f_2/\alpha^2 + f_3/\alpha^3 + 14 | f_4/\alpha^4 + f_5/\alpha^5 15 | where \alpha denotes the supercell dimension: \alpha x \alpha x \alpha. 16 | The polynomial extrapolation, 1/\alpha -> 0, gives 17 | the E^{iso,m}. 18 | 19 | Note that computing this term for large supercell sizes 20 | can be time consuming. The users can make use of the 21 | MPI parallelization of this code. To run in 22 | parallel, prepend with the mpirun command. 23 | 24 | We provide the sample input files for the 25 | various supercell sizes in folders alpha.*. 26 | To understand how this example works, the model 27 | energy can be computed for a few small supercell sizes. 28 | We provide the results for the larger supercell sizes and 29 | a script to plot the polynomial. 30 | 31 | To run this example, perform the following steps: 32 | 1. Go to the folders alpha.4 and run the following command: 33 | path_to_coffee_folder/coffee.py in > out 34 | 2. Go to the folders alpha.5 and run the following command: 35 | path_to_coffee_folder/coffee.py in > out 36 | 3. Go to the folders alpha.6 and run the following command: 37 | path_to_coffee_folder/coffee.py in > out 38 | 4. Go to the folders alpha.8 and run the following command: 39 | path_to_coffee_folder/coffee.py in > out 40 | 41 | (Feel free to run the other supercell sizes as well) 42 | 43 | The model total energy is printed in the out files. 44 | The following command will show this energy: 45 | grep ! out 46 | The dielectric profile, model potential and 47 | model charge density are written out in numpy 48 | save files. Instruction on how to plot these is provided 49 | in the Plot folder within the alpha.* folders 50 | 51 | For this example, the model energies should be: 52 | 4x4x4: 0.421 eV 53 | 5x5x5: 0.463 eV 54 | 6x6x6: 0.488 eV 55 | 8x8x8: 0.516 eV 56 | 57 | 10x10x10: 0.529 eV 58 | 20x20x20: 0.558 eV 59 | 40x40x40: 0.588 eV 60 | 80x80x80: 0.618 eV 61 | 62 | Use plot_fit.py to compute the fifth order polynomial fit 63 | and extrapolation to obtain E^{iso,m} for these values. 64 | E^{iso,m} is computed to be 0.66 eV 65 | 66 | The corrections, are then given by: 67 | (E^{iso,m}- E^{per,m}) 68 | 4x4x4: 0.239 eV 69 | 5x5x5: 0.197 eV 70 | 6x6x6: 0.172 eV 71 | 8x8x8: 0.144 eV 72 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/Scaling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/2D/MoS2/Model_Scaling/Scaling.png -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.10/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 0.500000 -0.8660254037844386 0.0000000 5 | 0.500000 0.8660254037844386 0.000000 6 | 0.000000 0.000000 1.000000 7 | 8 | Cell_dimensions bohr 9 | 59.06 59.06 59.06 10 | 11 | Ecut=15.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Slab 15 | Epsilon1_a1 = 15.0 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 15.0 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 2.0 20 | Epsilon2_a3 = 1.0 21 | Width = 11.40454 bohr 22 | Centre = 5.70226 bohr 23 | Smoothness = 0.37807 bohr 24 | Plot_eps = True 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89035 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.5 32 | Centre_a3 = 0.09655875 33 | / 34 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.20/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 0.500000 -0.8660254037844386 0.0000000 5 | 0.500000 0.8660254037844386 0.000000 6 | 0.000000 0.000000 1.000000 7 | 8 | Cell_dimensions bohr 9 | 118.12 118.12 118.12 10 | 11 | Ecut=15.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Slab 15 | Epsilon1_a1 = 15.0 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 15.0 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 2.0 20 | Epsilon2_a3 = 1.0 21 | Width = 11.40454 bohr 22 | Centre = 5.70226 bohr 23 | Smoothness = 0.37807 bohr 24 | Plot_eps = True 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89035 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.5 32 | Centre_a3 = 0.048279375 33 | / 34 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.4/Plot/README: -------------------------------------------------------------------------------- 1 | The planar average of the model potential 2 | along a given direction can be plotted using in_V. 3 | Link the V_r.npy file using: 4 | $ln -s ../V_r.npy . 5 | 6 | The planar average of the model charge 7 | along a given direction can be plotted using input 8 | in_rho to plavg.py 9 | Link the rho_r.npy file using: 10 | $ln -s ../rho_r.npy . 11 | 12 | To run plavg.py: 13 | $your_path_to_CoFFEE/PotentialAlignment/Utilities/plavg.py input 14 | 15 | This produces a two column file plavg_(direction).plot which you could 16 | plot using a software of your choice. 17 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.4/Plot/in_V: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = ../V_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = None 6 | cell_dim = 23.624 7 | / 8 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.4/Plot/in_rho: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = ../rho_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = None 6 | cell_dim = 23.624 7 | / 8 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.4/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 0.500000 -0.8660254037844386 0.0000000 5 | 0.500000 0.8660254037844386 0.000000 6 | 0.000000 0.000000 1.000000 7 | 8 | Cell_dimensions bohr 9 | 23.624 23.624 23.624 10 | 11 | Ecut=15.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Slab 15 | Epsilon1_a1 = 15.0 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 15.0 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 2.0 20 | Epsilon2_a3 = 1.0 21 | Width = 11.40454 bohr 22 | Centre = 5.70226 bohr 23 | Smoothness = 0.37807 bohr 24 | Plot_eps = True 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89035 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.5 32 | Centre_a3 = 0.1931175 33 | / 34 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.4/plot_eps.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | a = 23.624*0.52918 5 | eps1 = np.load("epsZ_a1.npy") 6 | eps2 = np.load("epsZ_a2.npy") 7 | eps3 = np.load("epsZ_a3.npy") 8 | Z = np.linspace(0.,a,len(eps1)) 9 | 10 | fig, ax = plt.subplots() 11 | plt.plot(Z,eps1,lw = 3.8,color = 'k',label = "Along a1") 12 | plt.plot(Z,eps2,lw = 3.8,color = 'red',linestyle = '--',label = "Along a2") 13 | plt.plot(Z,eps3,lw = 3.8,color = 'green',label = "Along a3") 14 | plt.legend(fontsize = 22) 15 | plt.xlim(0,a) 16 | ax.set_ylabel(r"$\varepsilon(z)$",fontsize = 32) 17 | ax.set_xlabel(r"$z$ ($\AA$)",fontsize = 32) 18 | ax.tick_params(labelsize = 19, width = 2.5,length = 7) 19 | plt.tight_layout() 20 | plt.savefig("Eps_profile.png") 21 | plt.show() 22 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.40/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 0.500000 -0.8660254037844386 0.0000000 5 | 0.500000 0.8660254037844386 0.000000 6 | 0.000000 0.000000 1.000000 7 | 8 | Cell_dimensions bohr 9 | 236.24 236.24 236.24 10 | 11 | Ecut=15.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Slab 15 | Epsilon1_a1 = 15.0 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 15.0 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 2.0 20 | Epsilon2_a3 = 1.0 21 | Width = 11.40454 bohr 22 | Centre = 5.70226 bohr 23 | Smoothness = 0.37807 bohr 24 | Plot_eps = True 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89035 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.5 32 | Centre_a3 = 0.0241396875 33 | / 34 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.5/Plot/README: -------------------------------------------------------------------------------- 1 | The planar average of the model potential 2 | along a given direction can be plotted using in_V. 3 | Link the V_r.npy file using: 4 | $ln -s ../V_r.npy . 5 | 6 | The planar average of the model charge 7 | along a given direction can be plotted using input 8 | in_rho to plavg.py 9 | Link the rho_r.npy file using: 10 | $ln -s ../rho_r.npy . 11 | 12 | To run plavg.py: 13 | $your_path_to_CoFFEE/PotentialAlignment/Utilities/plavg.py input 14 | 15 | This produces a two column file plavg_(direction).plot which you could 16 | plot using a software of your choice. 17 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.5/Plot/in_V: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = ../V_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = None 6 | cell_dim = 29.53 7 | / 8 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.5/Plot/in_rho: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = ../rho_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = None 6 | cell_dim = 29.53 7 | / 8 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.5/Reference/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | CELL PARAMETERS: 6 | Cell dimensions (bohr): 29.530, 29.530,29.530 7 | Lattice vectors (normalized): 8 | a1: 0.500, -0.866, 0.000 9 | a2: 0.500, 0.866, 0.000 10 | a3: 0.000, 0.000, 1.000 11 | Plane-wave energy cut-off (Ry): 30.000 12 | 13 | GAUSSIAN_PARAMETERS: 14 | ('Total charge:', -1) 15 | Center of the gaussian (in crystal units): 16 | (0.5, 0.5, 0.1931175) 17 | Gaussian width (bohr): 18 | 1.89035 19 | 20 | 21 | DIELECTRIC PARAMETERS 22 | ('Profile:', 'Slab') 23 | Epsilon tensor inside the material: 24 | [[ 15. 0. 0.] 25 | [ 0. 15. 0.] 26 | [ 0. 0. 2.]] 27 | Epsilon tensor outside the material: 28 | [[ 1. 0. 0.] 29 | [ 0. 1. 0.] 30 | [ 0. 0. 1.]] 31 | ('Slab width (bohr):', 11.40454) 32 | ('Slab center (bohr):', 5.70226) 33 | ('Smoothness parameter (bohr):', 0.37807) 34 | 35 | 36 | Grid: 47, 47, 53 37 | Volume: 22300.827 38 | ! Total Energy (eV): 0.4627 39 | Execution time: 2.92 s 40 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.5/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 0.500000 -0.8660254037844386 0.0000000 5 | 0.500000 0.8660254037844386 0.000000 6 | 0.000000 0.000000 1.000000 7 | 8 | Cell_dimensions bohr 9 | 29.53 29.53 29.53 10 | 11 | Ecut=15.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Slab 15 | Epsilon1_a1 = 15.0 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 15.0 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 2.0 20 | Epsilon2_a3 = 1.0 21 | Width = 11.40454 bohr 22 | Centre = 5.70226 bohr 23 | Smoothness = 0.37807 bohr 24 | Plot_eps = True 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89035 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.5 32 | Centre_a3 = 0.1931175 33 | / 34 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.5/plot_eps.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | a = 29.53*0.52918 5 | eps1 = np.load("epsZ_a1.npy") 6 | eps2 = np.load("epsZ_a2.npy") 7 | eps3 = np.load("epsZ_a3.npy") 8 | Z = np.linspace(0.,a,len(eps1)) 9 | 10 | fig, ax = plt.subplots() 11 | plt.plot(Z,eps1,lw = 3.8,color = 'k',label = "Along a1") 12 | plt.plot(Z,eps2,lw = 3.8,color = 'red',linestyle = '--',label = "Along a2") 13 | plt.plot(Z,eps3,lw = 3.8,color = 'green',label = "Along a3") 14 | plt.legend(fontsize = 22) 15 | plt.xlim(0,a) 16 | ax.set_ylabel(r"$\varepsilon(z)$",fontsize = 32) 17 | ax.set_xlabel(r"$z$ ($\AA$)",fontsize = 32) 18 | ax.tick_params(labelsize = 19, width = 2.5,length = 7) 19 | plt.tight_layout() 20 | plt.savefig("Eps_profile.png") 21 | plt.show() 22 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.6/Plot/README: -------------------------------------------------------------------------------- 1 | The planar average of the model potential 2 | along a given direction can be plotted using in_V. 3 | Link the V_r.npy file using: 4 | $ln -s ../V_r.npy . 5 | 6 | The planar average of the model charge 7 | along a given direction can be plotted using input 8 | in_rho to plavg.py 9 | Link the rho_r.npy file using: 10 | $ln -s ../rho_r.npy . 11 | 12 | To run plavg.py: 13 | $your_path_to_CoFFEE/PotentialAlignment/Utilities/plavg.py input 14 | 15 | This produces a two column file plavg_(direction).plot which you could 16 | plot using a software of your choice. 17 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.6/Plot/in_V: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = V_r.npy 3 | file_type = python 4 | plt_dir = a3 5 | factor = None 6 | cell_dim = 35.436 7 | / 8 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.6/Plot/in_rho: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = rho_r.npy 3 | file_type = python 4 | plt_dir = a3 5 | factor = None 6 | cell_dim = 35.436 7 | / 8 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.6/Plot/plavg_a3.plot: -------------------------------------------------------------------------------- 1 | 0.000 -0.22236098 2 | 0.365 -0.24833898 3 | 0.731 -0.26930504 4 | 1.096 -0.28981049 5 | 1.461 -0.31064314 6 | 1.827 -0.33177611 7 | 2.192 -0.35302623 8 | 2.557 -0.37418207 9 | 2.923 -0.39494712 10 | 3.288 -0.41495748 11 | 3.653 -0.43378398 12 | 4.019 -0.45093626 13 | 4.384 -0.46590878 14 | 4.749 -0.47818854 15 | 5.114 -0.48733006 16 | 5.480 -0.49295957 17 | 5.845 -0.49485385 18 | 6.210 -0.49291952 19 | 6.576 -0.48725067 20 | 6.941 -0.47806839 21 | 7.306 -0.46575006 22 | 7.672 -0.45073597 23 | 8.037 -0.43354601 24 | 8.402 -0.41467697 25 | 8.768 -0.39463009 26 | 9.133 -0.37382119 27 | 9.498 -0.35263048 28 | 9.864 -0.33133452 29 | 10.229 -0.31016924 30 | 10.594 -0.28928790 31 | 10.960 -0.26877781 32 | 11.325 -0.24810687 33 | 11.690 -0.22346993 34 | 12.056 -0.19052537 35 | 12.421 -0.15414315 36 | 12.786 -0.11864456 37 | 13.152 -0.08424209 38 | 13.517 -0.05106975 39 | 13.882 -0.01904075 40 | 14.247 0.01177466 41 | 14.613 0.04143122 42 | 14.978 0.06988260 43 | 15.343 0.09716800 44 | 15.709 0.12325311 45 | 16.074 0.14816825 46 | 16.439 0.17188621 47 | 16.805 0.19443164 48 | 17.170 0.21578200 49 | 17.535 0.23595808 50 | 17.901 0.25494059 51 | 18.266 0.27274754 52 | 18.631 0.28936206 53 | 18.997 0.30480004 54 | 19.362 0.31904645 55 | 19.727 0.33211558 56 | 20.093 0.34399383 57 | 20.458 0.35469419 58 | 20.823 0.36420423 59 | 21.189 0.37253587 60 | 21.554 0.37967766 61 | 21.919 0.38564064 62 | 22.284 0.39041414 63 | 22.650 0.39400847 64 | 23.015 0.39641365 65 | 23.380 0.39763936 66 | 23.746 0.39767619 67 | 24.111 0.39653328 68 | 24.476 0.39420173 69 | 24.842 0.39069020 70 | 25.207 0.38599026 71 | 25.572 0.38011011 72 | 25.938 0.37304176 73 | 26.303 0.36479300 74 | 26.668 0.35535623 75 | 27.034 0.34473887 76 | 27.399 0.33293368 77 | 27.764 0.31994772 78 | 28.130 0.30577414 79 | 28.495 0.29041957 80 | 28.860 0.27387763 81 | 29.226 0.25615447 82 | 29.591 0.23724420 83 | 29.956 0.21715242 84 | 30.322 0.19587390 85 | 30.687 0.17341344 86 | 31.052 0.14976680 87 | 31.417 0.12493756 88 | 31.783 0.09892298 89 | 32.148 0.07172475 90 | 32.513 0.04334274 91 | 32.879 0.01377516 92 | 33.244 -0.01697277 93 | 33.609 -0.04890995 94 | 33.975 -0.08201811 95 | 34.340 -0.11632418 96 | 34.705 -0.15176648 97 | 35.071 -0.18822138 98 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.6/Reference/Eps_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/2D/MoS2/Model_Scaling/alpha.6/Reference/Eps_profile.png -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.6/Reference/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | CELL PARAMETERS: 6 | Cell dimensions (bohr): 35.436, 35.436,35.436 7 | Lattice vectors (normalized): 8 | a1: 0.500, -0.866, 0.000 9 | a2: 0.500, 0.866, 0.000 10 | a3: 0.000, 0.000, 1.000 11 | Plane-wave energy cut-off (Ry): 70.000 12 | 13 | GAUSSIAN_PARAMETERS: 14 | ('Total charge:', -1) 15 | Center of the gaussian (in crystal units): 16 | (0.5, 0.5, 0.158854) 17 | Gaussian width (bohr): 18 | 1.89035 19 | 20 | 21 | DIELECTRIC PARAMETERS 22 | ('Profile:', 'Slab') 23 | Epsilon tensor inside the material: 24 | [[ 15. 0. 0.] 25 | [ 0. 15. 0.] 26 | [ 0. 0. 2.]] 27 | Epsilon tensor outside the material: 28 | [[ 1. 0. 0.] 29 | [ 0. 1. 0.] 30 | [ 0. 0. 1.]] 31 | ('Slab width (bohr):', 11.40454) 32 | ('Slab center (bohr):', 5.70226) 33 | ('Smoothness parameter (bohr):', 0.37807) 34 | 35 | 36 | Grid: 83, 83, 97 37 | Volume: 38535.829 38 | ! Total Energy (eV): 0.4887 39 | Execution time: 17.27 s 40 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.6/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 0.500000 -0.8660254037844386 0.0000000 5 | 0.500000 0.8660254037844386 0.000000 6 | 0.000000 0.000000 1.000000 7 | 8 | Cell_dimensions bohr 9 | 35.436 35.436 35.436 10 | 11 | Ecut=34.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Slab 15 | Epsilon1_a1 = 15.0 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 15.0 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 2.0 20 | Epsilon2_a3 = 1.0 21 | Width = 11.40454 bohr 22 | Centre = 5.70226 bohr 23 | Smoothness = 0.37807 bohr 24 | Plot_eps = True 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89035 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.5 32 | Centre_a3 = 0.158854 33 | / 34 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.6/plot_eps.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | a = 35.436*0.52918 5 | eps1 = np.load("epsZ_a1.npy") 6 | eps2 = np.load("epsZ_a2.npy") 7 | eps3 = np.load("epsZ_a3.npy") 8 | Z = np.linspace(0.,a,len(eps1)) 9 | 10 | fig, ax = plt.subplots() 11 | plt.plot(Z,eps1,lw = 3.8,color = 'k',label = "Along a1") 12 | plt.plot(Z,eps2,lw = 3.8,color = 'red',linestyle = '--',label = "Along a2") 13 | plt.plot(Z,eps3,lw = 3.8,color = 'green',label = "Along a3") 14 | plt.legend(fontsize = 22) 15 | plt.xlim(0,a) 16 | ax.set_ylabel(r"$\varepsilon(z)$",fontsize = 32) 17 | ax.set_xlabel(r"$z$ ($\AA$)",fontsize = 32) 18 | ax.tick_params(labelsize = 19, width = 2.5,length = 7) 19 | plt.tight_layout() 20 | plt.savefig("Eps_profile.png") 21 | plt.show() 22 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.60/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 0.500000 -0.8660254037844386 0.0000000 5 | 0.500000 0.8660254037844386 0.000000 6 | 0.000000 0.000000 1.000000 7 | 8 | Cell_dimensions bohr 9 | 354.36 354.36 354.36 10 | 11 | Ecut=15.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Slab 15 | Epsilon1_a1 = 15.0 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 15.0 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 2.0 20 | Epsilon2_a3 = 1.0 21 | Width = 11.40454 bohr 22 | Centre = 5.70226 bohr 23 | Smoothness = 0.37807 bohr 24 | Plot_eps = True 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89035 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.5 32 | Centre_a3 = 0.016093125 33 | / 34 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.8/Plot/README: -------------------------------------------------------------------------------- 1 | The planar average of the model potential 2 | along a given direction can be plotted using in_V. 3 | Link the V_r.npy file using: 4 | $ln -s ../V_r.npy . 5 | 6 | The planar average of the model charge 7 | along a given direction can be plotted using input 8 | in_rho to plavg.py 9 | Link the rho_r.npy file using: 10 | $ln -s ../rho_r.npy . 11 | 12 | To run plavg.py: 13 | $your_path_to_CoFFEE/PotentialAlignment/Utilities/plavg.py input 14 | 15 | This produces a two column file plavg_(direction).plot which you could 16 | plot using a software of your choice. 17 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.8/Plot/in_V: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = V_r.npy 3 | file_type = python 4 | plt_dir = a3 5 | factor = None 6 | cell_dim = 47.248 7 | / 8 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.8/Plot/in_rho: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = rho_r.npy 3 | file_type = python 4 | plt_dir = a3 5 | factor = None 6 | cell_dim = 47.248 7 | / 8 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.8/Plot/plot.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | A = np.loadtxt("plavg_a3.plot") 5 | plt.plot(A[:,0],A[:,1]) 6 | plt.show() 7 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.8/Reference/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | CELL PARAMETERS: 6 | Cell dimensions (bohr): 47.248, 47.248,47.248 7 | Lattice vectors (normalized): 8 | a1: 0.500, -0.866, 0.000 9 | a2: 0.500, 0.866, 0.000 10 | a3: 0.000, 0.000, 1.000 11 | Plane-wave energy cut-off (Ry): 30.000 12 | 13 | GAUSSIAN_PARAMETERS: 14 | ('Total charge:', -1) 15 | Center of the gaussian (in crystal units): 16 | (0.5, 0.5, 0.1206984) 17 | Gaussian width (bohr): 18 | 1.89035 19 | 20 | 21 | DIELECTRIC PARAMETERS 22 | ('Profile:', 'Slab') 23 | Epsilon tensor inside the material: 24 | [[ 15. 0. 0.] 25 | [ 0. 15. 0.] 26 | [ 0. 0. 2.]] 27 | Epsilon tensor outside the material: 28 | [[ 1. 0. 0.] 29 | [ 0. 1. 0.] 30 | [ 0. 0. 1.]] 31 | ('Slab width (bohr):', 11.40454) 32 | ('Slab center (bohr):', 5.70226) 33 | ('Smoothness parameter (bohr):', 0.37807) 34 | 35 | 36 | Grid: 73, 73, 85 37 | Volume: 91344.188 38 | ! Total Energy (eV): 0.5160 39 | Execution time: 15.22 s 40 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.8/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 0.500000 -0.8660254037844386 0.0000000 5 | 0.500000 0.8660254037844386 0.000000 6 | 0.000000 0.000000 1.000000 7 | 8 | Cell_dimensions bohr 9 | 47.248 47.248 47.248 10 | 11 | Ecut=15.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Slab 15 | Epsilon1_a1 = 15.0 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 15.0 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 2.0 20 | Epsilon2_a3 = 1.0 21 | Width = 11.40454 bohr 22 | Centre = 5.70226 bohr 23 | Smoothness = 0.37807 bohr 24 | Plot_eps = True 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89035 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.5 32 | Centre_a3 = 0.1206984 33 | / 34 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.8/plot_eps.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | a = 47.248*0.52918 5 | eps1 = np.load("epsZ_a1.npy") 6 | eps2 = np.load("epsZ_a2.npy") 7 | eps3 = np.load("epsZ_a3.npy") 8 | Z = np.linspace(0.,a,len(eps1)) 9 | 10 | fig, ax = plt.subplots() 11 | plt.plot(Z,eps1,lw = 3.8,color = 'k',label = "Along a1") 12 | plt.plot(Z,eps2,lw = 3.8,color = 'red',linestyle = '--',label = "Along a2") 13 | plt.plot(Z,eps3,lw = 3.8,color = 'green',label = "Along a3") 14 | plt.legend(fontsize = 22) 15 | plt.xlim(0,a) 16 | ax.set_ylabel(r"$\varepsilon(z)$",fontsize = 32) 17 | ax.set_xlabel(r"$z$ ($\AA$)",fontsize = 32) 18 | ax.tick_params(labelsize = 19, width = 2.5,length = 7) 19 | plt.tight_layout() 20 | plt.savefig("Eps_profile.png") 21 | plt.show() 22 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.80/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 0.500000 -0.8660254037844386 0.0000000 5 | 0.500000 0.8660254037844386 0.000000 6 | 0.000000 0.000000 1.000000 7 | 8 | Cell_dimensions bohr 9 | 472.48 472.48 472.48 10 | 11 | Ecut=15.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Slab 15 | Epsilon1_a1 = 15.0 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 15.0 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 2.0 20 | Epsilon2_a3 = 1.0 21 | Width = 11.40454 bohr 22 | Centre = 5.70226 bohr 23 | Smoothness = 0.37807 bohr 24 | Plot_eps = True 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89035 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.5 32 | Centre_a3 = 0.01206984375 33 | / 34 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/alpha.9/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 0.500000 -0.8660254037844386 0.0000000 5 | 0.500000 0.8660254037844386 0.000000 6 | 0.000000 0.000000 1.000000 7 | 8 | Cell_dimensions bohr 9 | 53.154 53.154 53.154 10 | 11 | Ecut=15.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Slab 15 | Epsilon1_a1 = 15.0 16 | Epsilon2_a1 = 1.0 17 | Epsilon1_a2 = 15.0 18 | Epsilon2_a2 = 1.0 19 | Epsilon1_a3 = 2.0 20 | Epsilon2_a3 = 1.0 21 | Width = 11.40454 bohr 22 | Centre = 5.70226 bohr 23 | Smoothness = 0.37807 bohr 24 | Plot_eps = True 25 | / 26 | 27 | &GAUSSIAN_PARAMETERS: 28 | Total_charge = -1 29 | Sigma = 1.89035 30 | Centre_a1 = 0.5 31 | Centre_a2 = 0.5 32 | Centre_a3 = 0.1072875 33 | / 34 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/Model_Scaling/plot_fit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys,string 3 | import matplotlib.pyplot as plt 4 | from matplotlib.ticker import AutoMinorLocator 5 | import matplotlib.gridspec as gridspec 6 | import numpy as np 7 | 8 | fig, ax = plt.subplots() 9 | 10 | # Values of alpha: 11 | alpha = np.array([4,5,6,8,10,20,40,80]) 12 | 13 | # Corresponding model energies: 14 | En = np.array([0.421,0.464,0.490,0.516,0.529,0.555,0.588,0.618]) 15 | 16 | one_alpha = 1./alpha 17 | 18 | # Compute the fifth-order polynomial fit 19 | P = np.polyfit(one_alpha,En,5) 20 | print("Polynomial coefficients:", P) 21 | print("Isolated model energy: %2.3f"%( P[5])) 22 | 23 | En_f = [] 24 | one_alpha_f = np.arange(0.,0.27,0.004) 25 | for x in one_alpha_f: 26 | En_f.append(P[5] + P[4]*x + P[3]*x**2 + P[2]*x**3 + P[1]*x**4 + P[0]*x**5) 27 | 28 | # Scatter the model energy values 29 | ax.scatter(one_alpha,En,lw = 2.,color = 'navy',marker='o',s=280) 30 | 31 | # Plot the fitting polynomial 32 | ax.plot(one_alpha_f,En_f,lw = 3.8,color = 'navy') 33 | ax.set_xlim(0,0.27) 34 | ax.set_ylim(0.4,0.8) 35 | ax.set_xlabel(r"$1/\alpha$",fontsize = 40) 36 | ax.set_ylabel(r"$\mathrm{E}_{-1}^{\mathrm{m,per}} \mathrm{(eV)}$",fontsize = 40) 37 | ax.set_yticks(np.arange(0.4,0.82,0.1)) 38 | ax.tick_params(labelsize=26,width=2.5,length=6) 39 | plt.tight_layout() 40 | plt.savefig("Scaling") 41 | plt.show() 42 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_0p/README: -------------------------------------------------------------------------------- 1 | This folder shows you how to compute the 2 | potential alignment term, \Delta V_{0/p} (Eqn. 2 3 | in the CoFFEE paper) 4 | 5 | It involves comparing the planar averaged DFT 6 | potentials between the neutral and pristine cells, 7 | -q(V_0 - V_p), far from the defect site. 8 | 9 | Complete details on the DFT calculations are 10 | provided in the paper. 11 | We provide the planar averaged V_p and V_0 12 | potentials computed using Quantum Espresso for the 6x6x6 13 | super cell in the files: 14 | plavg_p_a3.plot and plavg_0_a3.plot 15 | These can be generated from your DFT calculation by 16 | writing the DFT potentials into a cube/xsf format. 17 | The cube/xsf file can then be planar averaged using 18 | the utility plavg.py, located in the path: 19 | path_to_CoFFEE_folder/PotentialAlignment/Utilities/ 20 | The details on how to run this script is provided in 21 | the same folder. 22 | 23 | Use the script plot_DV0p.py to plot this difference 24 | and find the value far from the defect site. 25 | 26 | This term is small as well, about 0.04 eV 27 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_0p/Reference/Fig_V_0p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/2D/MoS2/PA_0p/Reference/Fig_V_0p.png -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_0p/plavg_0_a3.plot: -------------------------------------------------------------------------------- 1 | 0.000 4.83612733 2 | 0.138 4.67625577 3 | 0.276 4.47439641 4 | 0.415 4.22049798 5 | 0.553 3.90055605 6 | 0.691 3.49945684 7 | 0.829 2.99661672 8 | 0.967 2.39821471 9 | 1.105 1.71217430 10 | 1.244 0.84117134 11 | 1.382 -0.37534692 12 | 1.520 -2.06189334 13 | 1.658 -4.23341897 14 | 1.796 -6.77287834 15 | 1.934 -9.46226338 16 | 2.073 -12.04675939 17 | 2.211 -14.30025179 18 | 2.349 -16.07030608 19 | 2.487 -17.28637319 20 | 2.625 -17.93680523 21 | 2.764 -18.03337117 22 | 2.902 -17.58793514 23 | 3.040 -16.61409154 24 | 3.178 -15.15402733 25 | 3.316 -13.31311446 26 | 3.454 -11.27966990 27 | 3.593 -9.31097644 28 | 3.731 -7.68547835 29 | 3.869 -6.63725915 30 | 4.007 -6.29862208 31 | 4.145 -6.68009628 32 | 4.283 -7.70814758 33 | 4.422 -9.30457411 34 | 4.560 -11.46141600 35 | 4.698 -14.20788411 36 | 4.836 -17.45760773 37 | 4.974 -20.98526251 38 | 5.113 -24.45882264 39 | 5.251 -27.50777714 40 | 5.389 -29.80869777 41 | 5.527 -31.12214720 42 | 5.665 -31.31324150 43 | 5.803 -30.36173126 44 | 5.942 -28.36555523 45 | 6.080 -25.53027691 46 | 6.218 -22.15432798 47 | 6.356 -18.59863334 48 | 6.494 -15.21889556 49 | 6.632 -12.27837553 50 | 6.771 -9.91344939 51 | 6.909 -8.11966709 52 | 7.047 -6.87748277 53 | 7.185 -6.24434864 54 | 7.323 -6.30002453 55 | 7.462 -7.06732898 56 | 7.600 -8.45592091 57 | 7.738 -10.26580122 58 | 7.876 -12.23238719 59 | 8.014 -14.09217431 60 | 8.152 -15.63575631 61 | 8.291 -16.73466858 62 | 8.429 -17.33045282 63 | 8.567 -17.40443199 64 | 8.705 -16.94565153 65 | 8.843 -15.94134755 66 | 8.981 -14.39106178 67 | 9.120 -12.34093416 68 | 9.258 -9.91126150 69 | 9.396 -7.30143798 70 | 9.534 -4.75590983 71 | 9.672 -2.50633417 72 | 9.810 -0.70420897 73 | 9.949 0.62151699 74 | 10.087 1.56296119 75 | 10.225 2.27395256 76 | 10.363 2.88102535 77 | 10.501 3.40364244 78 | 10.640 3.82419999 79 | 10.778 4.15948114 80 | 10.916 4.42579099 81 | 11.054 4.63745679 82 | 11.192 4.80515874 83 | 11.330 4.93825059 84 | 11.469 5.04358544 85 | 11.607 5.12715170 86 | 11.745 5.19326513 87 | 11.883 5.24573428 88 | 12.021 5.28725042 89 | 12.159 5.32023246 90 | 12.298 5.34634259 91 | 12.436 5.36711394 92 | 12.574 5.38356913 93 | 12.712 5.39668069 94 | 12.850 5.40707527 95 | 12.989 5.41537322 96 | 13.127 5.42195867 97 | 13.265 5.42722608 98 | 13.403 5.43141240 99 | 13.541 5.43476598 100 | 13.679 5.43743651 101 | 13.818 5.43957824 102 | 13.956 5.44128904 103 | 14.094 5.44266153 104 | 14.232 5.44376418 105 | 14.370 5.44464708 106 | 14.508 5.44536210 107 | 14.647 5.44593142 108 | 14.785 5.44640016 109 | 14.923 5.44676847 110 | 15.061 5.44707911 111 | 15.199 5.44731896 112 | 15.338 5.44752930 113 | 15.476 5.44768523 114 | 15.614 5.44783066 115 | 15.752 5.44793328 116 | 15.890 5.44803693 117 | 16.028 5.44810440 118 | 16.167 5.44818207 119 | 16.305 5.44822652 120 | 16.443 5.44828699 121 | 16.581 5.44831565 122 | 16.719 5.44836522 123 | 16.857 5.44838439 124 | 16.996 5.44842633 125 | 17.134 5.44843952 126 | 17.272 5.44847672 127 | 17.410 5.44848546 128 | 17.548 5.44851950 129 | 17.687 5.44852601 130 | 17.825 5.44855730 131 | 17.963 5.44856206 132 | 18.101 5.44859216 133 | 18.239 5.44859598 134 | 18.377 5.44862436 135 | 18.516 5.44862808 136 | 18.654 5.44865589 137 | 18.792 5.44865918 138 | 18.930 5.44868576 139 | 19.068 5.44868951 140 | 19.206 5.44871539 141 | 19.345 5.44871925 142 | 19.483 5.44874407 143 | 19.621 5.44874925 144 | 19.759 5.44877297 145 | 19.897 5.44877804 146 | 20.036 5.44880081 147 | 20.174 5.44880741 148 | 20.312 5.44882894 149 | 20.450 5.44883645 150 | 20.588 5.44885722 151 | 20.726 5.44886573 152 | 20.865 5.44888490 153 | 21.003 5.44889437 154 | 21.141 5.44891278 155 | 21.279 5.44892368 156 | 21.417 5.44894050 157 | 21.555 5.44895200 158 | 21.694 5.44896804 159 | 21.832 5.44898131 160 | 21.970 5.44899564 161 | 22.108 5.44901017 162 | 22.246 5.44902364 163 | 22.385 5.44903915 164 | 22.523 5.44905117 165 | 22.661 5.44906768 166 | 22.799 5.44907877 167 | 22.937 5.44909629 168 | 23.075 5.44910665 169 | 23.214 5.44912512 170 | 23.352 5.44913398 171 | 23.490 5.44915415 172 | 23.628 5.44916149 173 | 23.766 5.44918255 174 | 23.904 5.44918938 175 | 24.043 5.44921124 176 | 24.181 5.44921671 177 | 24.319 5.44923913 178 | 24.457 5.44924441 179 | 24.595 5.44926737 180 | 24.734 5.44927200 181 | 24.872 5.44929608 182 | 25.010 5.44929983 183 | 25.148 5.44932376 184 | 25.286 5.44932744 185 | 25.424 5.44935193 186 | 25.563 5.44935528 187 | 25.701 5.44937995 188 | 25.839 5.44938292 189 | 25.977 5.44940804 190 | 26.115 5.44941062 191 | 26.253 5.44943556 192 | 26.392 5.44943855 193 | 26.530 5.44946337 194 | 26.668 5.44946594 195 | 26.806 5.44949086 196 | 26.944 5.44949346 197 | 27.082 5.44951767 198 | 27.221 5.44952105 199 | 27.359 5.44954413 200 | 27.497 5.44954766 201 | 27.635 5.44957038 202 | 27.773 5.44957479 203 | 27.912 5.44959608 204 | 28.050 5.44960048 205 | 28.188 5.44962045 206 | 28.326 5.44962487 207 | 28.464 5.44964379 208 | 28.602 5.44964831 209 | 28.741 5.44966467 210 | 28.879 5.44966921 211 | 29.017 5.44968208 212 | 29.155 5.44968598 213 | 29.293 5.44969531 214 | 29.431 5.44969692 215 | 29.570 5.44970106 216 | 29.708 5.44969911 217 | 29.846 5.44969567 218 | 29.984 5.44968795 219 | 30.122 5.44967324 220 | 30.261 5.44965613 221 | 30.399 5.44962538 222 | 30.537 5.44959309 223 | 30.675 5.44953903 224 | 30.813 5.44948104 225 | 30.951 5.44939204 226 | 31.090 5.44929507 227 | 31.228 5.44915249 228 | 31.366 5.44899366 229 | 31.504 5.44876941 230 | 31.642 5.44851347 231 | 31.780 5.44816325 232 | 31.919 5.44775577 233 | 32.057 5.44721004 234 | 32.195 5.44656457 235 | 32.333 5.44571628 236 | 32.471 5.44469734 237 | 32.610 5.44337579 238 | 32.748 5.44177141 239 | 32.886 5.43970912 240 | 33.024 5.43718234 241 | 33.162 5.43395615 242 | 33.300 5.42997402 243 | 33.439 5.42491147 244 | 33.577 5.41862975 245 | 33.715 5.41066465 246 | 33.853 5.40073755 247 | 33.991 5.38816909 248 | 34.129 5.37244978 249 | 34.268 5.35256284 250 | 34.406 5.32762527 251 | 34.544 5.29608848 252 | 34.682 5.25645823 253 | 34.820 5.20634180 254 | 34.959 5.14326790 255 | 35.097 5.06351681 256 | 35.235 4.96307270 257 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_0p/plavg_p_a3.plot: -------------------------------------------------------------------------------- 1 | 0.000 4.87459160 2 | 0.138 4.71486626 3 | 0.276 4.51317114 4 | 0.415 4.25945531 5 | 0.553 3.93971528 6 | 0.691 3.53884056 7 | 0.829 3.03624077 8 | 0.967 2.43809688 9 | 1.105 1.75232774 10 | 1.244 0.88160689 11 | 1.382 -0.33462815 12 | 1.520 -2.02089183 13 | 1.658 -4.19215989 14 | 1.796 -6.73138844 15 | 1.934 -9.42061312 16 | 2.073 -12.00503631 17 | 2.211 -14.25854009 18 | 2.349 -16.02877177 19 | 2.487 -17.24512626 20 | 2.625 -17.89601139 21 | 2.764 -17.99324125 22 | 2.902 -17.54857791 23 | 3.040 -16.57564732 24 | 3.178 -15.11659443 25 | 3.316 -13.27676319 26 | 3.454 -11.24443744 27 | 3.593 -9.27685245 28 | 3.731 -7.65242859 29 | 3.869 -6.60520366 30 | 4.007 -6.26746219 31 | 4.145 -6.64969261 32 | 4.283 -7.67836160 33 | 4.422 -9.27525464 34 | 4.560 -11.43240082 35 | 4.698 -14.17902964 36 | 4.836 -17.42877382 37 | 4.974 -20.95636914 38 | 5.113 -24.42982550 39 | 5.251 -27.47875904 40 | 5.389 -29.77983429 41 | 5.527 -31.09391351 42 | 5.665 -31.28610099 43 | 5.803 -30.33632092 44 | 5.942 -28.34252875 45 | 6.080 -25.51046903 46 | 6.218 -22.13853388 47 | 6.356 -18.58798448 48 | 6.494 -15.21493883 49 | 6.632 -12.28322951 50 | 6.771 -9.92984086 51 | 6.909 -8.14999052 52 | 7.047 -6.92544116 53 | 7.185 -6.31782054 54 | 7.323 -6.41129747 55 | 7.462 -7.23092112 56 | 7.600 -8.68491573 57 | 7.738 -10.56841723 58 | 7.876 -12.60993027 59 | 8.014 -14.53889159 60 | 8.152 -16.14030263 61 | 8.291 -17.28229607 62 | 8.429 -17.90498823 63 | 8.567 -17.98936795 64 | 8.705 -17.52434634 65 | 8.843 -16.49691028 66 | 8.981 -14.90679892 67 | 9.120 -12.80160393 68 | 9.258 -10.30521322 69 | 9.396 -7.62286067 70 | 9.534 -5.00611011 71 | 9.672 -2.69334972 72 | 9.810 -0.84050468 73 | 9.949 0.52256989 74 | 10.087 1.49056709 75 | 10.225 2.22166197 76 | 10.363 2.84596853 77 | 10.501 3.38348103 78 | 10.640 3.81606927 79 | 10.778 4.16098122 80 | 10.916 4.43497433 81 | 11.054 4.65277630 82 | 11.192 4.82536618 83 | 11.330 4.96235836 84 | 11.469 5.07079800 85 | 11.607 5.15684248 86 | 11.745 5.22492943 87 | 11.883 5.27897535 88 | 12.021 5.32174636 89 | 12.159 5.35573032 90 | 12.298 5.38264059 91 | 12.436 5.40405054 92 | 12.574 5.42101458 93 | 12.712 5.43453204 94 | 12.850 5.44524925 95 | 12.989 5.45380453 96 | 13.127 5.46059533 97 | 13.265 5.46602448 98 | 13.403 5.47033733 99 | 13.541 5.47379242 100 | 13.679 5.47654055 101 | 13.818 5.47874293 102 | 13.956 5.48050015 103 | 14.094 5.48190781 104 | 14.232 5.48303505 105 | 14.370 5.48393582 106 | 14.508 5.48466305 107 | 14.647 5.48523953 108 | 14.785 5.48571081 109 | 14.923 5.48607967 110 | 15.061 5.48638793 111 | 15.199 5.48662219 112 | 15.338 5.48682661 113 | 15.476 5.48697484 114 | 15.614 5.48711084 115 | 15.752 5.48720346 116 | 15.890 5.48729661 117 | 16.028 5.48735360 118 | 16.167 5.48742007 119 | 16.305 5.48745105 120 | 16.443 5.48749990 121 | 16.581 5.48751544 122 | 16.719 5.48755277 123 | 16.857 5.48755944 124 | 16.996 5.48758793 125 | 17.134 5.48758730 126 | 17.272 5.48761155 127 | 17.410 5.48760794 128 | 17.548 5.48762789 129 | 17.687 5.48762006 130 | 17.825 5.48763904 131 | 17.963 5.48762950 132 | 18.101 5.48764741 133 | 18.239 5.48763576 134 | 18.377 5.48765327 135 | 18.516 5.48764291 136 | 18.654 5.48765702 137 | 18.792 5.48764441 138 | 18.930 5.48765829 139 | 19.068 5.48764831 140 | 19.206 5.48766138 141 | 19.345 5.48765119 142 | 19.483 5.48766340 143 | 19.621 5.48765172 144 | 19.759 5.48766323 145 | 19.897 5.48765543 146 | 20.036 5.48766605 147 | 20.174 5.48765817 148 | 20.312 5.48766368 149 | 20.450 5.48765863 150 | 20.588 5.48766623 151 | 20.726 5.48766077 152 | 20.865 5.48766750 153 | 21.003 5.48766263 154 | 21.141 5.48766887 155 | 21.279 5.48766233 156 | 21.417 5.48766929 157 | 21.555 5.48766515 158 | 21.694 5.48766824 159 | 21.832 5.48766643 160 | 21.970 5.48766963 161 | 22.108 5.48766999 162 | 22.246 5.48767067 163 | 22.385 5.48767047 164 | 22.523 5.48766899 165 | 22.661 5.48767302 166 | 22.799 5.48766892 167 | 22.937 5.48767424 168 | 23.075 5.48766845 169 | 23.214 5.48767645 170 | 23.352 5.48767040 171 | 23.490 5.48767514 172 | 23.628 5.48767049 173 | 23.766 5.48767748 174 | 23.904 5.48767174 175 | 24.043 5.48767979 176 | 24.181 5.48767293 177 | 24.319 5.48767830 178 | 24.457 5.48767112 179 | 24.595 5.48768195 180 | 24.734 5.48766983 181 | 24.872 5.48768213 182 | 25.010 5.48766970 183 | 25.148 5.48768102 184 | 25.286 5.48767170 185 | 25.424 5.48768535 186 | 25.563 5.48767294 187 | 25.701 5.48768429 188 | 25.839 5.48767328 189 | 25.977 5.48768425 190 | 26.115 5.48767479 191 | 26.253 5.48768311 192 | 26.392 5.48767456 193 | 26.530 5.48768339 194 | 26.668 5.48767322 195 | 26.806 5.48768366 196 | 26.944 5.48767364 197 | 27.082 5.48768314 198 | 27.221 5.48767370 199 | 27.359 5.48768387 200 | 27.497 5.48767193 201 | 27.635 5.48768223 202 | 27.773 5.48767365 203 | 27.912 5.48768194 204 | 28.050 5.48767272 205 | 28.188 5.48767838 206 | 28.326 5.48766869 207 | 28.464 5.48767424 208 | 28.602 5.48766548 209 | 28.741 5.48766737 210 | 28.879 5.48765742 211 | 29.017 5.48765973 212 | 29.155 5.48764816 213 | 29.293 5.48764422 214 | 29.431 5.48763188 215 | 29.570 5.48762276 216 | 29.708 5.48760832 217 | 29.846 5.48759009 218 | 29.984 5.48756850 219 | 30.122 5.48754064 220 | 30.261 5.48751199 221 | 30.399 5.48746750 222 | 30.537 5.48742249 223 | 30.675 5.48735360 224 | 30.813 5.48728375 225 | 30.951 5.48718219 226 | 31.090 5.48707323 227 | 31.228 5.48691800 228 | 31.366 5.48674701 229 | 31.504 5.48651198 230 | 31.642 5.48624505 231 | 31.780 5.48588346 232 | 31.919 5.48546535 233 | 32.057 5.48491076 234 | 32.195 5.48425609 235 | 32.333 5.48339953 236 | 32.471 5.48237365 237 | 32.610 5.48104601 238 | 32.748 5.47943633 239 | 32.886 5.47737080 240 | 33.024 5.47484312 241 | 33.162 5.47161796 242 | 33.300 5.46764029 243 | 33.439 5.46258365 244 | 33.577 5.45631260 245 | 33.715 5.44836204 246 | 33.853 5.43845310 247 | 33.991 5.42590797 248 | 34.129 5.41021772 249 | 34.268 5.39036836 250 | 34.406 5.36547385 251 | 34.544 5.33398938 252 | 34.682 5.29442215 253 | 34.820 5.24437935 254 | 34.959 5.18139155 255 | 35.097 5.10173772 256 | 35.235 5.00140725 257 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_0p/plot_DV0p.py: -------------------------------------------------------------------------------- 1 | import sys, string 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | 5 | V_0 = np.loadtxt("plavg_0_a3.plot") 6 | V_p = np.loadtxt("plavg_p_a3.plot") 7 | 8 | V_diff = -1*(V_0[:,1] - V_p[:,1]) 9 | 10 | fig, ax = plt.subplots() 11 | 12 | ax.plot(V_0[:,0]*0.52918,V_diff,color = 'k',linewidth = 3.2,label = r"-1(V$_0$ - V$_p$)") 13 | ax.axvline(x = V_0[int(len(V_0)*0.241863),0]*0.52918,color = 'darkorange',linestyle = '--',lw = 3.2,label = "Vacancy pos.") 14 | ax.legend(loc = 0,fontsize = 18) 15 | ax.set_xlim(V_0[0,0]*0.52918,V_0[-1,0]*0.52918) 16 | ax.set_ylabel("Potential (eV)",fontsize = 25) 17 | ax.set_xlabel(r"$a_1$ ($\AA$)",fontsize = 25) 18 | ax.tick_params(labelsize = 19, width = 2.5,length = 7) 19 | plt.tight_layout() 20 | plt.savefig("Fig_V_0p.png") 21 | print("Value far from the defect: %2.3f" %( V_diff[int(len(V_0)*0.75)])) 22 | plt.show() 23 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_q0/README: -------------------------------------------------------------------------------- 1 | This folder shows you how to compute the 2 | potential alignment term, \Delta V_{q-0/m} (Eqn. 6 3 | in the CoFFEE paper) 4 | 5 | It involves comparing the planar averaged DFT difference 6 | potential between the charged and neutral cells, 7 | (V_q^{DFT} - V_0^{DFT}) with the model potential for the 8 | same super cell, far from the defect position. 9 | 10 | Complete details on the DFT calculations are 11 | provided in the paper. 12 | We provide the planar averaged V_q^{DFT} and V_0^{DFT} 13 | potentials computed using Quantum Espresso for the 6x6x6 14 | super cell in the files: 15 | plavg_q_a1.plot and plavg_0_a1.plot 16 | These can be generated from your DFT calculation by 17 | writing the DFT potentials into a cube/xsf format. 18 | The cube/xsf file can then be planar averaged using 19 | the utility plavg.py, located in the path: 20 | path_to_CoFFEE_folder/PotentialAlignment/Utilities/ 21 | The details on how to run this script is provided in 22 | the same folder. 23 | 24 | We compare the DFT difference potential with the 25 | model potential (far from the defect) computed 26 | in the folder: ../Model_Scaling/alpha.6/Plot/ using 27 | the script plot_DVq0.py. 28 | 29 | You will find that the difference between the potentials, 30 | far from the defect is negligibly small. There is hence 31 | no contribution from this term to the correction. It 32 | is however necessary to always check if this is true. 33 | This term being small indicates that the charged defect has been 34 | modelled well. 35 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_q0/Reference/Fig_V_q0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/2D/MoS2/PA_q0/Reference/Fig_V_q0.png -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_q0/plavg_0_a3.plot: -------------------------------------------------------------------------------- 1 | 0.000 4.83612733 2 | 0.138 4.67625577 3 | 0.276 4.47439641 4 | 0.415 4.22049798 5 | 0.553 3.90055605 6 | 0.691 3.49945684 7 | 0.829 2.99661672 8 | 0.967 2.39821471 9 | 1.105 1.71217430 10 | 1.244 0.84117134 11 | 1.382 -0.37534692 12 | 1.520 -2.06189334 13 | 1.658 -4.23341897 14 | 1.796 -6.77287834 15 | 1.934 -9.46226338 16 | 2.073 -12.04675939 17 | 2.211 -14.30025179 18 | 2.349 -16.07030608 19 | 2.487 -17.28637319 20 | 2.625 -17.93680523 21 | 2.764 -18.03337117 22 | 2.902 -17.58793514 23 | 3.040 -16.61409154 24 | 3.178 -15.15402733 25 | 3.316 -13.31311446 26 | 3.454 -11.27966990 27 | 3.593 -9.31097644 28 | 3.731 -7.68547835 29 | 3.869 -6.63725915 30 | 4.007 -6.29862208 31 | 4.145 -6.68009628 32 | 4.283 -7.70814758 33 | 4.422 -9.30457411 34 | 4.560 -11.46141600 35 | 4.698 -14.20788411 36 | 4.836 -17.45760773 37 | 4.974 -20.98526251 38 | 5.113 -24.45882264 39 | 5.251 -27.50777714 40 | 5.389 -29.80869777 41 | 5.527 -31.12214720 42 | 5.665 -31.31324150 43 | 5.803 -30.36173126 44 | 5.942 -28.36555523 45 | 6.080 -25.53027691 46 | 6.218 -22.15432798 47 | 6.356 -18.59863334 48 | 6.494 -15.21889556 49 | 6.632 -12.27837553 50 | 6.771 -9.91344939 51 | 6.909 -8.11966709 52 | 7.047 -6.87748277 53 | 7.185 -6.24434864 54 | 7.323 -6.30002453 55 | 7.462 -7.06732898 56 | 7.600 -8.45592091 57 | 7.738 -10.26580122 58 | 7.876 -12.23238719 59 | 8.014 -14.09217431 60 | 8.152 -15.63575631 61 | 8.291 -16.73466858 62 | 8.429 -17.33045282 63 | 8.567 -17.40443199 64 | 8.705 -16.94565153 65 | 8.843 -15.94134755 66 | 8.981 -14.39106178 67 | 9.120 -12.34093416 68 | 9.258 -9.91126150 69 | 9.396 -7.30143798 70 | 9.534 -4.75590983 71 | 9.672 -2.50633417 72 | 9.810 -0.70420897 73 | 9.949 0.62151699 74 | 10.087 1.56296119 75 | 10.225 2.27395256 76 | 10.363 2.88102535 77 | 10.501 3.40364244 78 | 10.640 3.82419999 79 | 10.778 4.15948114 80 | 10.916 4.42579099 81 | 11.054 4.63745679 82 | 11.192 4.80515874 83 | 11.330 4.93825059 84 | 11.469 5.04358544 85 | 11.607 5.12715170 86 | 11.745 5.19326513 87 | 11.883 5.24573428 88 | 12.021 5.28725042 89 | 12.159 5.32023246 90 | 12.298 5.34634259 91 | 12.436 5.36711394 92 | 12.574 5.38356913 93 | 12.712 5.39668069 94 | 12.850 5.40707527 95 | 12.989 5.41537322 96 | 13.127 5.42195867 97 | 13.265 5.42722608 98 | 13.403 5.43141240 99 | 13.541 5.43476598 100 | 13.679 5.43743651 101 | 13.818 5.43957824 102 | 13.956 5.44128904 103 | 14.094 5.44266153 104 | 14.232 5.44376418 105 | 14.370 5.44464708 106 | 14.508 5.44536210 107 | 14.647 5.44593142 108 | 14.785 5.44640016 109 | 14.923 5.44676847 110 | 15.061 5.44707911 111 | 15.199 5.44731896 112 | 15.338 5.44752930 113 | 15.476 5.44768523 114 | 15.614 5.44783066 115 | 15.752 5.44793328 116 | 15.890 5.44803693 117 | 16.028 5.44810440 118 | 16.167 5.44818207 119 | 16.305 5.44822652 120 | 16.443 5.44828699 121 | 16.581 5.44831565 122 | 16.719 5.44836522 123 | 16.857 5.44838439 124 | 16.996 5.44842633 125 | 17.134 5.44843952 126 | 17.272 5.44847672 127 | 17.410 5.44848546 128 | 17.548 5.44851950 129 | 17.687 5.44852601 130 | 17.825 5.44855730 131 | 17.963 5.44856206 132 | 18.101 5.44859216 133 | 18.239 5.44859598 134 | 18.377 5.44862436 135 | 18.516 5.44862808 136 | 18.654 5.44865589 137 | 18.792 5.44865918 138 | 18.930 5.44868576 139 | 19.068 5.44868951 140 | 19.206 5.44871539 141 | 19.345 5.44871925 142 | 19.483 5.44874407 143 | 19.621 5.44874925 144 | 19.759 5.44877297 145 | 19.897 5.44877804 146 | 20.036 5.44880081 147 | 20.174 5.44880741 148 | 20.312 5.44882894 149 | 20.450 5.44883645 150 | 20.588 5.44885722 151 | 20.726 5.44886573 152 | 20.865 5.44888490 153 | 21.003 5.44889437 154 | 21.141 5.44891278 155 | 21.279 5.44892368 156 | 21.417 5.44894050 157 | 21.555 5.44895200 158 | 21.694 5.44896804 159 | 21.832 5.44898131 160 | 21.970 5.44899564 161 | 22.108 5.44901017 162 | 22.246 5.44902364 163 | 22.385 5.44903915 164 | 22.523 5.44905117 165 | 22.661 5.44906768 166 | 22.799 5.44907877 167 | 22.937 5.44909629 168 | 23.075 5.44910665 169 | 23.214 5.44912512 170 | 23.352 5.44913398 171 | 23.490 5.44915415 172 | 23.628 5.44916149 173 | 23.766 5.44918255 174 | 23.904 5.44918938 175 | 24.043 5.44921124 176 | 24.181 5.44921671 177 | 24.319 5.44923913 178 | 24.457 5.44924441 179 | 24.595 5.44926737 180 | 24.734 5.44927200 181 | 24.872 5.44929608 182 | 25.010 5.44929983 183 | 25.148 5.44932376 184 | 25.286 5.44932744 185 | 25.424 5.44935193 186 | 25.563 5.44935528 187 | 25.701 5.44937995 188 | 25.839 5.44938292 189 | 25.977 5.44940804 190 | 26.115 5.44941062 191 | 26.253 5.44943556 192 | 26.392 5.44943855 193 | 26.530 5.44946337 194 | 26.668 5.44946594 195 | 26.806 5.44949086 196 | 26.944 5.44949346 197 | 27.082 5.44951767 198 | 27.221 5.44952105 199 | 27.359 5.44954413 200 | 27.497 5.44954766 201 | 27.635 5.44957038 202 | 27.773 5.44957479 203 | 27.912 5.44959608 204 | 28.050 5.44960048 205 | 28.188 5.44962045 206 | 28.326 5.44962487 207 | 28.464 5.44964379 208 | 28.602 5.44964831 209 | 28.741 5.44966467 210 | 28.879 5.44966921 211 | 29.017 5.44968208 212 | 29.155 5.44968598 213 | 29.293 5.44969531 214 | 29.431 5.44969692 215 | 29.570 5.44970106 216 | 29.708 5.44969911 217 | 29.846 5.44969567 218 | 29.984 5.44968795 219 | 30.122 5.44967324 220 | 30.261 5.44965613 221 | 30.399 5.44962538 222 | 30.537 5.44959309 223 | 30.675 5.44953903 224 | 30.813 5.44948104 225 | 30.951 5.44939204 226 | 31.090 5.44929507 227 | 31.228 5.44915249 228 | 31.366 5.44899366 229 | 31.504 5.44876941 230 | 31.642 5.44851347 231 | 31.780 5.44816325 232 | 31.919 5.44775577 233 | 32.057 5.44721004 234 | 32.195 5.44656457 235 | 32.333 5.44571628 236 | 32.471 5.44469734 237 | 32.610 5.44337579 238 | 32.748 5.44177141 239 | 32.886 5.43970912 240 | 33.024 5.43718234 241 | 33.162 5.43395615 242 | 33.300 5.42997402 243 | 33.439 5.42491147 244 | 33.577 5.41862975 245 | 33.715 5.41066465 246 | 33.853 5.40073755 247 | 33.991 5.38816909 248 | 34.129 5.37244978 249 | 34.268 5.35256284 250 | 34.406 5.32762527 251 | 34.544 5.29608848 252 | 34.682 5.25645823 253 | 34.820 5.20634180 254 | 34.959 5.14326790 255 | 35.097 5.06351681 256 | 35.235 4.96307270 257 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_q0/plavg_a3.plot: -------------------------------------------------------------------------------- 1 | 0.000 5.08091484 2 | 0.138 4.93123420 3 | 0.276 4.73912024 4 | 0.415 4.49447207 5 | 0.553 4.18323990 6 | 0.691 3.79027106 7 | 0.829 3.29494883 8 | 0.967 2.70343490 9 | 1.105 2.02364868 10 | 1.244 1.15827995 11 | 1.382 -0.05319916 12 | 1.520 -1.73525392 13 | 1.658 -3.90278857 14 | 1.796 -6.43869577 15 | 1.934 -9.12492473 16 | 2.073 -11.70660150 17 | 2.211 -13.95757208 18 | 2.349 -15.72537174 19 | 2.487 -16.93942970 20 | 2.625 -17.58808206 21 | 2.764 -17.68314972 22 | 2.902 -17.23640721 23 | 3.040 -16.26151714 24 | 3.178 -14.80061540 25 | 3.316 -12.95903974 26 | 3.454 -10.92505904 27 | 3.593 -8.95590596 28 | 3.731 -7.32996413 29 | 3.869 -6.28126960 30 | 4.007 -5.94208386 31 | 4.145 -6.32289981 32 | 4.283 -7.35017463 33 | 4.422 -8.94570697 34 | 4.560 -11.10154320 35 | 4.698 -13.84691990 36 | 4.836 -17.09549327 37 | 4.974 -20.62194251 38 | 5.113 -24.09432328 39 | 5.251 -27.14218387 40 | 5.389 -29.44220283 41 | 5.527 -30.75511431 42 | 5.665 -30.94606153 43 | 5.803 -29.99486575 44 | 5.942 -27.99936489 45 | 6.080 -25.16504832 46 | 6.218 -21.79016183 47 | 6.356 -18.23549754 48 | 6.494 -14.85665901 49 | 6.632 -11.91683271 50 | 6.771 -9.55240261 51 | 6.909 -7.75893229 52 | 7.047 -6.51691305 53 | 7.185 -5.88384797 54 | 7.323 -5.93954838 55 | 7.462 -6.70689819 56 | 7.600 -8.09560905 57 | 7.738 -9.90574332 58 | 7.876 -11.87276654 59 | 8.014 -13.73320787 60 | 8.152 -15.27769918 61 | 8.291 -16.37777000 62 | 8.429 -16.97495643 63 | 8.567 -17.05058344 64 | 8.705 -16.59367620 65 | 8.843 -15.59141733 66 | 8.981 -14.04338843 67 | 9.120 -11.99571967 68 | 9.258 -9.56875345 69 | 9.396 -6.96193444 70 | 9.534 -4.41976731 71 | 9.672 -2.17397906 72 | 9.810 -0.37612282 73 | 9.949 0.94478892 74 | 10.087 1.88082572 75 | 10.225 2.58578393 76 | 10.363 3.18618001 77 | 10.501 3.70147840 78 | 10.640 4.11409021 79 | 10.778 4.44082820 80 | 10.916 4.69803444 81 | 11.054 4.90008037 82 | 11.192 5.05769786 83 | 11.330 5.18029188 84 | 11.469 5.27476815 85 | 11.607 5.34716682 86 | 11.745 5.40185194 87 | 11.883 5.44267987 88 | 12.021 5.47238543 89 | 12.159 5.49342623 90 | 12.298 5.50750399 91 | 12.436 5.51618279 92 | 12.574 5.52051460 93 | 12.712 5.52149932 94 | 12.850 5.51978716 95 | 12.989 5.51601748 96 | 13.127 5.51059542 97 | 13.265 5.50392770 98 | 13.403 5.49626783 99 | 13.541 5.48787420 100 | 13.679 5.47890718 101 | 13.818 5.46953024 102 | 13.956 5.45985000 103 | 14.094 5.44996342 104 | 14.232 5.43994605 105 | 14.370 5.42985154 106 | 14.508 5.41973686 107 | 14.647 5.40962795 108 | 14.785 5.39957160 109 | 14.923 5.38957200 110 | 15.061 5.37967347 111 | 15.199 5.36986421 112 | 15.338 5.36018674 113 | 15.476 5.35061900 114 | 15.614 5.34120479 115 | 15.752 5.33191265 116 | 15.890 5.32278890 117 | 16.028 5.31379475 118 | 16.167 5.30497808 119 | 16.305 5.29629622 120 | 16.443 5.28779907 121 | 16.581 5.27943809 122 | 16.719 5.27126670 123 | 16.857 5.26323450 124 | 16.996 5.25539449 125 | 17.134 5.24769442 126 | 17.272 5.24018808 127 | 17.410 5.23282312 128 | 17.548 5.22565333 129 | 17.687 5.21862531 130 | 17.825 5.21179280 131 | 17.963 5.20510349 132 | 18.101 5.19860923 133 | 18.239 5.19225923 134 | 18.377 5.18610427 135 | 18.516 5.18009379 136 | 18.654 5.17427818 137 | 18.792 5.16860780 138 | 18.930 5.16313220 139 | 19.068 5.15780235 140 | 19.206 5.15266603 141 | 19.345 5.14767769 142 | 19.483 5.14288028 143 | 19.621 5.13823371 144 | 19.759 5.13377579 145 | 19.897 5.12946998 146 | 20.036 5.12535259 147 | 20.174 5.12138842 148 | 20.312 5.11760964 149 | 20.450 5.11398702 150 | 20.588 5.11054834 151 | 20.726 5.10726728 152 | 20.865 5.10416794 153 | 21.003 5.10122885 154 | 21.141 5.09846898 155 | 21.279 5.09587171 156 | 21.417 5.09345064 157 | 21.555 5.09119554 158 | 21.694 5.08911436 159 | 21.832 5.08720064 160 | 21.970 5.08545887 161 | 22.108 5.08388674 162 | 22.246 5.08248418 163 | 22.385 5.08125454 164 | 22.523 5.08019183 165 | 22.661 5.07930324 166 | 22.799 5.07857963 167 | 22.937 5.07803342 168 | 23.075 5.07764974 169 | 23.214 5.07744450 170 | 23.352 5.07740060 171 | 23.490 5.07753732 172 | 23.628 5.07783254 173 | 23.766 5.07831132 174 | 23.904 5.07894634 175 | 24.043 5.07976654 176 | 24.181 5.08074092 177 | 24.319 5.08190281 178 | 24.457 5.08321692 179 | 24.595 5.08472006 180 | 24.734 5.08637451 181 | 24.872 5.08821911 182 | 25.010 5.09021323 183 | 25.148 5.09239897 184 | 25.286 5.09473366 185 | 25.424 5.09726005 186 | 25.563 5.09993498 187 | 25.701 5.10280224 188 | 25.839 5.10581774 189 | 25.977 5.10902549 190 | 26.115 5.11238101 191 | 26.253 5.11593007 192 | 26.392 5.11962648 193 | 26.530 5.12351548 194 | 26.668 5.12755290 195 | 26.806 5.13178233 196 | 26.944 5.13616035 197 | 27.082 5.14072990 198 | 27.221 5.14544849 199 | 27.359 5.15035782 200 | 27.497 5.15541788 201 | 27.635 5.16066723 202 | 27.773 5.16606750 203 | 27.912 5.17165652 204 | 28.050 5.17739750 205 | 28.188 5.18332523 206 | 28.326 5.18940743 207 | 28.464 5.19567336 208 | 28.602 5.20209637 209 | 28.741 5.20869978 210 | 28.879 5.21546279 211 | 29.017 5.22240337 212 | 29.155 5.22950486 213 | 29.293 5.23678200 214 | 29.431 5.24422109 215 | 29.570 5.25183193 216 | 29.708 5.25960713 217 | 29.846 5.26754832 218 | 29.984 5.27565608 219 | 30.122 5.28392490 220 | 30.261 5.29236009 221 | 30.399 5.30095029 222 | 30.537 5.30970624 223 | 30.675 5.31860783 224 | 30.813 5.32767315 225 | 30.951 5.33687380 226 | 31.090 5.34623184 227 | 31.228 5.35570835 228 | 31.366 5.36533285 229 | 31.504 5.37505382 230 | 31.642 5.38490458 231 | 31.780 5.39482007 232 | 31.919 5.40483538 233 | 32.057 5.41486741 234 | 32.195 5.42495177 235 | 32.333 5.43498198 236 | 32.471 5.44498613 237 | 32.610 5.45482779 238 | 32.748 5.46452186 239 | 32.886 5.47388674 240 | 33.024 5.48290816 241 | 33.162 5.49134305 242 | 33.300 5.49912576 243 | 33.439 5.50592003 244 | 33.577 5.51157375 245 | 33.715 5.51560849 246 | 33.853 5.51772740 247 | 33.991 5.51723194 248 | 34.129 5.51359044 249 | 34.268 5.50576105 250 | 34.406 5.49283135 251 | 34.544 5.47322184 252 | 34.682 5.44540290 253 | 34.820 5.40694309 254 | 34.959 5.35532852 255 | 35.097 5.28679472 256 | 35.235 5.19727565 257 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_q0/plavg_q_a3.plot: -------------------------------------------------------------------------------- 1 | 0.000 5.08091484 2 | 0.138 4.93123420 3 | 0.276 4.73912024 4 | 0.415 4.49447207 5 | 0.553 4.18323990 6 | 0.691 3.79027106 7 | 0.829 3.29494883 8 | 0.967 2.70343490 9 | 1.105 2.02364868 10 | 1.244 1.15827995 11 | 1.382 -0.05319916 12 | 1.520 -1.73525392 13 | 1.658 -3.90278857 14 | 1.796 -6.43869577 15 | 1.934 -9.12492473 16 | 2.073 -11.70660150 17 | 2.211 -13.95757208 18 | 2.349 -15.72537174 19 | 2.487 -16.93942970 20 | 2.625 -17.58808206 21 | 2.764 -17.68314972 22 | 2.902 -17.23640721 23 | 3.040 -16.26151714 24 | 3.178 -14.80061540 25 | 3.316 -12.95903974 26 | 3.454 -10.92505904 27 | 3.593 -8.95590596 28 | 3.731 -7.32996413 29 | 3.869 -6.28126960 30 | 4.007 -5.94208386 31 | 4.145 -6.32289981 32 | 4.283 -7.35017463 33 | 4.422 -8.94570697 34 | 4.560 -11.10154320 35 | 4.698 -13.84691990 36 | 4.836 -17.09549327 37 | 4.974 -20.62194251 38 | 5.113 -24.09432328 39 | 5.251 -27.14218387 40 | 5.389 -29.44220283 41 | 5.527 -30.75511431 42 | 5.665 -30.94606153 43 | 5.803 -29.99486575 44 | 5.942 -27.99936489 45 | 6.080 -25.16504832 46 | 6.218 -21.79016183 47 | 6.356 -18.23549754 48 | 6.494 -14.85665901 49 | 6.632 -11.91683271 50 | 6.771 -9.55240261 51 | 6.909 -7.75893229 52 | 7.047 -6.51691305 53 | 7.185 -5.88384797 54 | 7.323 -5.93954838 55 | 7.462 -6.70689819 56 | 7.600 -8.09560905 57 | 7.738 -9.90574332 58 | 7.876 -11.87276654 59 | 8.014 -13.73320787 60 | 8.152 -15.27769918 61 | 8.291 -16.37777000 62 | 8.429 -16.97495643 63 | 8.567 -17.05058344 64 | 8.705 -16.59367620 65 | 8.843 -15.59141733 66 | 8.981 -14.04338843 67 | 9.120 -11.99571967 68 | 9.258 -9.56875345 69 | 9.396 -6.96193444 70 | 9.534 -4.41976731 71 | 9.672 -2.17397906 72 | 9.810 -0.37612282 73 | 9.949 0.94478892 74 | 10.087 1.88082572 75 | 10.225 2.58578393 76 | 10.363 3.18618001 77 | 10.501 3.70147840 78 | 10.640 4.11409021 79 | 10.778 4.44082820 80 | 10.916 4.69803444 81 | 11.054 4.90008037 82 | 11.192 5.05769786 83 | 11.330 5.18029188 84 | 11.469 5.27476815 85 | 11.607 5.34716682 86 | 11.745 5.40185194 87 | 11.883 5.44267987 88 | 12.021 5.47238543 89 | 12.159 5.49342623 90 | 12.298 5.50750399 91 | 12.436 5.51618279 92 | 12.574 5.52051460 93 | 12.712 5.52149932 94 | 12.850 5.51978716 95 | 12.989 5.51601748 96 | 13.127 5.51059542 97 | 13.265 5.50392770 98 | 13.403 5.49626783 99 | 13.541 5.48787420 100 | 13.679 5.47890718 101 | 13.818 5.46953024 102 | 13.956 5.45985000 103 | 14.094 5.44996342 104 | 14.232 5.43994605 105 | 14.370 5.42985154 106 | 14.508 5.41973686 107 | 14.647 5.40962795 108 | 14.785 5.39957160 109 | 14.923 5.38957200 110 | 15.061 5.37967347 111 | 15.199 5.36986421 112 | 15.338 5.36018674 113 | 15.476 5.35061900 114 | 15.614 5.34120479 115 | 15.752 5.33191265 116 | 15.890 5.32278890 117 | 16.028 5.31379475 118 | 16.167 5.30497808 119 | 16.305 5.29629622 120 | 16.443 5.28779907 121 | 16.581 5.27943809 122 | 16.719 5.27126670 123 | 16.857 5.26323450 124 | 16.996 5.25539449 125 | 17.134 5.24769442 126 | 17.272 5.24018808 127 | 17.410 5.23282312 128 | 17.548 5.22565333 129 | 17.687 5.21862531 130 | 17.825 5.21179280 131 | 17.963 5.20510349 132 | 18.101 5.19860923 133 | 18.239 5.19225923 134 | 18.377 5.18610427 135 | 18.516 5.18009379 136 | 18.654 5.17427818 137 | 18.792 5.16860780 138 | 18.930 5.16313220 139 | 19.068 5.15780235 140 | 19.206 5.15266603 141 | 19.345 5.14767769 142 | 19.483 5.14288028 143 | 19.621 5.13823371 144 | 19.759 5.13377579 145 | 19.897 5.12946998 146 | 20.036 5.12535259 147 | 20.174 5.12138842 148 | 20.312 5.11760964 149 | 20.450 5.11398702 150 | 20.588 5.11054834 151 | 20.726 5.10726728 152 | 20.865 5.10416794 153 | 21.003 5.10122885 154 | 21.141 5.09846898 155 | 21.279 5.09587171 156 | 21.417 5.09345064 157 | 21.555 5.09119554 158 | 21.694 5.08911436 159 | 21.832 5.08720064 160 | 21.970 5.08545887 161 | 22.108 5.08388674 162 | 22.246 5.08248418 163 | 22.385 5.08125454 164 | 22.523 5.08019183 165 | 22.661 5.07930324 166 | 22.799 5.07857963 167 | 22.937 5.07803342 168 | 23.075 5.07764974 169 | 23.214 5.07744450 170 | 23.352 5.07740060 171 | 23.490 5.07753732 172 | 23.628 5.07783254 173 | 23.766 5.07831132 174 | 23.904 5.07894634 175 | 24.043 5.07976654 176 | 24.181 5.08074092 177 | 24.319 5.08190281 178 | 24.457 5.08321692 179 | 24.595 5.08472006 180 | 24.734 5.08637451 181 | 24.872 5.08821911 182 | 25.010 5.09021323 183 | 25.148 5.09239897 184 | 25.286 5.09473366 185 | 25.424 5.09726005 186 | 25.563 5.09993498 187 | 25.701 5.10280224 188 | 25.839 5.10581774 189 | 25.977 5.10902549 190 | 26.115 5.11238101 191 | 26.253 5.11593007 192 | 26.392 5.11962648 193 | 26.530 5.12351548 194 | 26.668 5.12755290 195 | 26.806 5.13178233 196 | 26.944 5.13616035 197 | 27.082 5.14072990 198 | 27.221 5.14544849 199 | 27.359 5.15035782 200 | 27.497 5.15541788 201 | 27.635 5.16066723 202 | 27.773 5.16606750 203 | 27.912 5.17165652 204 | 28.050 5.17739750 205 | 28.188 5.18332523 206 | 28.326 5.18940743 207 | 28.464 5.19567336 208 | 28.602 5.20209637 209 | 28.741 5.20869978 210 | 28.879 5.21546279 211 | 29.017 5.22240337 212 | 29.155 5.22950486 213 | 29.293 5.23678200 214 | 29.431 5.24422109 215 | 29.570 5.25183193 216 | 29.708 5.25960713 217 | 29.846 5.26754832 218 | 29.984 5.27565608 219 | 30.122 5.28392490 220 | 30.261 5.29236009 221 | 30.399 5.30095029 222 | 30.537 5.30970624 223 | 30.675 5.31860783 224 | 30.813 5.32767315 225 | 30.951 5.33687380 226 | 31.090 5.34623184 227 | 31.228 5.35570835 228 | 31.366 5.36533285 229 | 31.504 5.37505382 230 | 31.642 5.38490458 231 | 31.780 5.39482007 232 | 31.919 5.40483538 233 | 32.057 5.41486741 234 | 32.195 5.42495177 235 | 32.333 5.43498198 236 | 32.471 5.44498613 237 | 32.610 5.45482779 238 | 32.748 5.46452186 239 | 32.886 5.47388674 240 | 33.024 5.48290816 241 | 33.162 5.49134305 242 | 33.300 5.49912576 243 | 33.439 5.50592003 244 | 33.577 5.51157375 245 | 33.715 5.51560849 246 | 33.853 5.51772740 247 | 33.991 5.51723194 248 | 34.129 5.51359044 249 | 34.268 5.50576105 250 | 34.406 5.49283135 251 | 34.544 5.47322184 252 | 34.682 5.44540290 253 | 34.820 5.40694309 254 | 34.959 5.35532852 255 | 35.097 5.28679472 256 | 35.235 5.19727565 257 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/PA_q0/plot_DVq0.py: -------------------------------------------------------------------------------- 1 | import sys, string 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | 5 | V_0 = np.loadtxt("plavg_0_a3.plot") 6 | V_q = np.loadtxt("plavg_q_a3.plot") 7 | V_m = np.loadtxt("../Model_Scaling/alpha.6/Plot/plavg_a3.plot") 8 | 9 | V_diff = -1*(V_q[:,1] - V_0[:,1]) 10 | 11 | fig, ax = plt.subplots() 12 | 13 | ax.plot(V_0[:,0]*0.52918,V_diff,color = 'k',linewidth = 4.3,label = "DFT diff.") 14 | ax.plot(V_m[:,0]*0.52918,V_m[:,1],color = 'r',lw = 4.3,linestyle = '--',label = "Model") 15 | ax.axvline(x = V_0[int(len(V_0)*0.241863),0]*0.52918,color = 'darkorange',linestyle = '--',lw = 3.8,label = "Vacancy pos.") 16 | ax.legend(loc = 0,fontsize = 23) 17 | ax.set_xlim(V_0[0,0]*0.52918,V_0[-1,0]*0.52918) 18 | ax.set_ylabel("Potential (eV)",fontsize = 35) 19 | ax.set_xlabel(r"$a_3$ ($\AA$)",fontsize = 35) 20 | ax.set_ylim(-0.6,0.5) 21 | ax.tick_params(labelsize = 23, width = 2.5,length = 7) 22 | plt.tight_layout() 23 | plt.savefig("Fig_V_q0.png") 24 | plt.show() 25 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/QE_input/in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = "relax", 3 | prefix = "2HMoS2mono", 4 | pseudo_dir = ".", 5 | outdir = ".", 6 | / 7 | &SYSTEM 8 | ibrav = 0, 9 | celldm(1) = 35.373, 10 | nat = 107, 11 | ntyp = 3, 12 | ecutwfc = 50, 13 | ecutrho = 500, 14 | occupations= 'smearing', 15 | smearing = 'gaussian', 16 | degauss = 0.001, 17 | nspin = 2, 18 | starting_magnetization(1)= 0, 19 | starting_magnetization(2)= 0, 20 | starting_magnetization(3)= -0.2, 21 | tot_charge = -1, 22 | / 23 | &ELECTRONS 24 | conv_thr = 1.D-8, 25 | mixing_beta = 0.7D0, 26 | / 27 | &IONS 28 | ion_dynamics='bfgs', 29 | / 30 | &CELL 31 | cell_dynamics='bfgs' 32 | press=0.0, 33 | / 34 | CELL_PARAMETERS {alat} 35 | 0.5 -0.8660254 0 36 | 0.5 0.8660254 0.0 37 | 0.0 0.0 1.0 38 | 39 | ATOMIC_SPECIES 40 | Mo 95.94 Mo.pz-spn-kjpaw_psl.0.3.0.UPF 41 | S 32.065 S.pz-n-kjpaw_psl.0.1.UPF 42 | Mo1 95.94 Mo.pz-spn-kjpaw_psl.0.3.0.UPF 43 | 44 | ATOMIC_POSITIONS (crystal) 45 | Mo -0.055324312 0.055324312 0.160359412 46 | S 0.056325453 0.111402165 0.243102937 47 | S 0.055943545 0.111270495 0.077376102 48 | Mo -0.055162173 0.222225942 0.160324927 49 | S 0.056387612 0.278163586 0.243125206 50 | S 0.055968906 0.277753646 0.077291586 51 | Mo -0.055542233 0.388956728 0.159850351 52 | S 0.055773938 0.444720622 0.242773157 53 | S 0.055669778 0.444294452 0.077010802 54 | Mo -0.056126861 0.555301231 0.159041562 55 | S 0.054779805 0.610962642 0.242335165 56 | S 0.055362623 0.611112788 0.076497312 57 | Mo -0.056361942 0.721559940 0.159333340 58 | S 0.054824289 0.777308342 0.242444220 59 | S 0.055186558 0.777845560 0.076701090 60 | Mo -0.056042712 0.888100145 0.160108159 61 | S 0.055621212 0.944378788 0.242831458 62 | S 0.055420015 0.944579985 0.077249117 63 | Mo 0.111899855 0.056042712 0.160108159 64 | S 0.224218903 0.112884225 0.242547228 65 | S 0.222849906 0.112084283 0.076739471 66 | Mo 0.111981416 0.222658830 0.160140815 67 | S 0.224248719 0.279104388 0.242494284 68 | S 0.222726923 0.278078359 0.076759474 69 | Mo 0.111690175 0.389140757 0.159966597 70 | S 0.223852627 0.445178987 0.242236023 71 | S 0.222148728 0.444253969 0.076347641 72 | Mo 0.110979428 0.555684339 0.159606955 73 | S 0.222480996 0.611278926 0.242132367 74 | S 0.221711922 0.611238688 0.076246199 75 | Mo 0.110804896 0.722216641 0.159489208 76 | S 0.222105701 0.777894299 0.242321789 77 | S 0.221936098 0.778063902 0.076463131 78 | Mo 0.111078640 0.888921360 0.159804713 79 | S 0.222691658 0.945175711 0.242444220 80 | S 0.222154440 0.944813442 0.076701090 81 | Mo 0.278440060 0.056361942 0.159333340 82 | S 0.390559279 0.113905554 0.241152819 83 | S 0.388978850 0.111287173 0.075666986 84 | Mo 0.279606651 0.223892707 0.159098897 85 | S 0.395397299 0.284489759 0.239304794 86 | S 0.389579985 0.279602612 0.074368841 87 | Mo 0.279184641 0.389662874 0.158946678 88 | S 0.394170637 0.446477658 0.240525786 89 | S 0.388236067 0.443677759 0.073342939 90 | Mo 0.277832608 0.555762846 0.158789452 91 | S 0.389542476 0.610457524 0.240783889 92 | S 0.388294656 0.611705344 0.075043803 93 | Mo 0.277605941 0.722394059 0.159204698 94 | S 0.388721074 0.777519004 0.242132367 95 | S 0.388761312 0.778288078 0.076246199 96 | Mo 0.277783359 0.889195104 0.159489208 97 | S 0.389037358 0.945220195 0.242335165 98 | S 0.388887212 0.944637377 0.076497312 99 | Mo 0.444698769 0.056126861 0.159041562 100 | S 0.555677384 0.112504971 0.242019264 101 | S 0.555778643 0.110623189 0.076077121 102 | Mo 0.446211026 0.224287455 0.156834564 103 | S 0.556696781 0.282879689 0.239075349 104 | S 0.556097712 0.276656730 0.072367547 105 | Mo1 0.448803499 0.394002456 0.154628157 106 | S 0.555844574 0.444155426 0.070132098 107 | Mo 0.444692067 0.555307933 0.156443499 108 | S 0.553522342 0.605829363 0.240525786 109 | S 0.556322241 0.611763933 0.073342939 110 | Mo 0.444237154 0.722167392 0.158789452 111 | S 0.554821013 0.776147373 0.242236023 112 | S 0.555746031 0.777851272 0.076347641 113 | Mo 0.444315661 0.889020572 0.159606955 114 | S 0.555279378 0.944226062 0.242773157 115 | S 0.555705548 0.944330222 0.077010802 116 | Mo 0.611043272 0.055542233 0.159850351 117 | S 0.722096569 0.111186805 0.242896406 118 | S 0.722361189 0.110623250 0.077100851 119 | Mo 0.611183395 0.222657262 0.157933899 120 | S 0.721690124 0.278309876 0.241455196 121 | S 0.722760992 0.277239008 0.075700156 122 | Mo1 0.610951698 0.389048302 0.151864012 123 | S 0.717120311 0.443303219 0.239075349 124 | S 0.723343270 0.443902288 0.072367547 125 | Mo1 0.605997544 0.551196501 0.154628157 126 | S 0.715510241 0.604602701 0.239304794 127 | S 0.720397388 0.610420015 0.074368841 128 | Mo 0.610337126 0.720815359 0.158946678 129 | S 0.720895612 0.775751281 0.242494284 130 | S 0.721921641 0.777273077 0.076759474 131 | Mo 0.610859243 0.888309825 0.159966597 132 | S 0.721836414 0.943612388 0.243125206 133 | S 0.722246354 0.944031094 0.077291586 134 | Mo 0.777774058 0.055162173 0.160324927 135 | S 0.889075239 0.110924761 0.243266248 136 | S 0.889097739 0.110902261 0.077500797 137 | Mo 0.777883128 0.222116872 0.159603926 138 | S 0.888813195 0.277903431 0.242896406 139 | S 0.889376750 0.277638811 0.077100851 140 | Mo 0.777342738 0.388816605 0.157933899 141 | S 0.887495029 0.444322616 0.242019264 142 | S 0.889376811 0.444221357 0.076077121 143 | Mo 0.775712545 0.553788974 0.156834564 144 | S 0.886094446 0.609440721 0.241152819 145 | S 0.888712827 0.611021150 0.075666986 146 | Mo 0.776107293 0.720393349 0.159098897 147 | S 0.887115775 0.775781097 0.242547228 148 | S 0.887915717 0.777150094 0.076739471 149 | Mo 0.777341170 0.888018584 0.160140815 150 | S 0.888597835 0.943674547 0.243102937 151 | S 0.888729505 0.944056455 0.077376102 152 | 153 | K_POINTS automatic 154 | 2 2 1 0 0 0 155 | -------------------------------------------------------------------------------- /Examples/2D/MoS2/README: -------------------------------------------------------------------------------- 1 | Welcome to the MoS2 test system. 2 | 3 | This example studies a S vacancy in monolayer MoS2 in the -1 charge 4 | state. The complete electrostatic correction for this system 5 | involves computing the following terms 6 | (see Eqn 2 and Eqn 3 in CoFFEE paper): 7 | 8 | 1. Lattice correction term: E^{lat}, obtained from the 9 | model calculations. 10 | The details on computing E^{lat} are provided in 11 | the folder Model_Scaling/ 12 | 2. Potential alignment term: -\Delta V_{q/0}, Eqn 5 13 | in the paper. 14 | The details on computing this term are provided in 15 | the folder PA_q0/ 16 | 3. Potential alignment term: -q\Delta V_{0/p}, Eqn 2 17 | in the paper. 18 | The details on computing this term are provided in 19 | the folder PA_0p/ 20 | 21 | Complete correction for the 4x4x4 super cell, 22 | E_corr = E^{lat} + (-\Delta V_{q/0}) + (-q\Delta V_{0/p}) 23 | E_corr = 0.172 + 0.0 + 0.04 eV 24 | E_corr = 0.212 eV 25 | 26 | Uncorrected formation energy: 4.438 eV 27 | Corrected formation energy:4.650 eV 28 | 29 | The QE_input/ directory provides the 30 | Quantum Espresso input file for the 6x6x6 31 | super cell calculation with a S 32 | vacancy in the -1 charged state. 33 | We also provide the pseudopotentials. 34 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/4x4x4/Plot/README: -------------------------------------------------------------------------------- 1 | The planar average of the model potential 2 | along a given direction can be plotted using in_V. 3 | Link the V_r.npy file using: 4 | $ln -s ../V_r.npy . 5 | 6 | The planar average of the model charge 7 | along a given direction can be plotted using input 8 | in_rho to plavg.py 9 | Link the rho_r.npy file using: 10 | $ln -s ../rho_r.npy . 11 | 12 | To run plavg.py: 13 | $ python3 your_path_to_CoFFEE/PotentialAlignment/Utilities/plavg.py input 14 | 15 | This produces a two column file plavg_(direction).plot which you could 16 | plot using a software of your choice. 17 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/4x4x4/Plot/V_r.npy: -------------------------------------------------------------------------------- 1 | ../V_r.npy -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/4x4x4/Plot/in_V: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = V_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = None 6 | cell_dim = 26.594331775231996 7 | / 8 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/4x4x4/Plot/in_rho: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = rho_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = None 6 | cell_dim = 26.594331775231996 7 | / 8 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/4x4x4/Plot/plavg_a1.plot: -------------------------------------------------------------------------------- 1 | 0.000 0.16427246 2 | 0.484 0.16427245 3 | 0.967 0.16279659 4 | 1.451 0.15984489 5 | 1.934 0.15541745 6 | 2.418 0.14951446 7 | 2.901 0.14213632 8 | 3.385 0.13328388 9 | 3.868 0.12295885 10 | 4.352 0.11116455 11 | 4.835 0.09790722 12 | 5.319 0.08319813 13 | 5.802 0.06705692 14 | 6.286 0.04951653 15 | 6.769 0.03063024 16 | 7.253 0.01048096 17 | 7.737 -0.01080719 18 | 8.220 -0.03305560 19 | 8.704 -0.05601735 20 | 9.187 -0.07936501 21 | 9.671 -0.10268270 22 | 10.154 -0.12546540 23 | 10.638 -0.14712861 24 | 11.121 -0.16702993 25 | 11.605 -0.18450312 26 | 12.088 -0.19890227 27 | 12.572 -0.20965200 28 | 13.055 -0.21629730 29 | 13.539 -0.21854598 30 | 14.022 -0.21629730 31 | 14.506 -0.20965200 32 | 14.990 -0.19890227 33 | 15.473 -0.18450312 34 | 15.957 -0.16702993 35 | 16.440 -0.14712861 36 | 16.924 -0.12546540 37 | 17.407 -0.10268269 38 | 17.891 -0.07936501 39 | 18.374 -0.05601735 40 | 18.858 -0.03305560 41 | 19.341 -0.01080719 42 | 19.825 0.01048097 43 | 20.308 0.03063024 44 | 20.792 0.04951653 45 | 21.275 0.06705692 46 | 21.759 0.08319814 47 | 22.243 0.09790723 48 | 22.726 0.11116455 49 | 23.210 0.12295885 50 | 23.693 0.13328388 51 | 24.177 0.14213633 52 | 24.660 0.14951447 53 | 25.144 0.15541746 54 | 25.627 0.15984490 55 | 26.111 0.16279659 56 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/4x4x4/Plot/rho_r.npy: -------------------------------------------------------------------------------- 1 | ../rho_r.npy -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/4x4x4/Reference/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | CELL PARAMETERS: 6 | Cell dimensions (bohr): 26.594, 26.594,26.594 7 | Lattice vectors (normalized): 8 | a1: 1.000, 0.000, 0.000 9 | a2: 0.000, 1.000, 0.000 10 | a3: 0.000, 0.000, 1.000 11 | Plane-wave energy cut-off (Ry): 40.000 12 | 13 | GAUSSIAN_PARAMETERS: 14 | ('Total charge:', -2) 15 | Center of the gaussian (in crystal units): 16 | (0.5, 0.5, 0.5) 17 | Gaussian width (bohr): 18 | 2.614 19 | 20 | 21 | DIELECTRIC PARAMETERS 22 | Profile: Bulk 23 | epsilon tensor: 24 | [[ 5.76 0. 0. ] 25 | [ 0. 5.76 0. ] 26 | [ 0. 0. 5.76]] 27 | 28 | 29 | Grid: 55, 55, 55 30 | Volume: 18809.067 31 | ! Total Energy (eV): 1.0744 32 | Execution time: 3.96 s 33 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/4x4x4/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.000000000 0.000000000 0.000000000 5 | 0.000000000 1.000000000 0.000000000 6 | 0.000000000 0.000000000 1.000000000 7 | 8 | Cell_dimensions bohr 9 | 26.594331775231996 26.594331775231996 26.594331775231996 10 | 11 | Ecut=20.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Bulk 15 | Epsilon1_a1 = 5.76 16 | Epsilon1_a2 = 5.76 17 | Epsilon1_a3 = 5.76 18 | / 19 | 20 | &GAUSSIAN_PARAMETERS: 21 | Total_charge = -2 22 | Sigma = 2.614 23 | Centre_a1 = 0.5 24 | Centre_a2 = 0.5 25 | Centre_a3 = 0.5 26 | / 27 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/4x4x4/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | Running on 4 processor(s) 6 | CELL PARAMETERS: 7 | Cell dimensions (bohr): 26.594, 26.594,26.594 8 | Lattice vectors (normalized): 9 | a1: 1.000, 0.000, 0.000 10 | a2: 0.000, 1.000, 0.000 11 | a3: 0.000, 0.000, 1.000 12 | Plane-wave energy cut-off (Ry): 40.000 13 | 14 | GAUSSIAN_PARAMETERS: 15 | Total charge: -2 16 | Center of the gaussian (in crystal units): 17 | 0.5 0.5 0.5 18 | Gaussian width (bohr): 19 | 2.614 20 | 21 | 22 | DIELECTRIC PARAMETERS 23 | Profile: Bulk 24 | epsilon tensor: 25 | [[5.76 0. 0. ] 26 | [0. 5.76 0. ] 27 | [0. 0. 5.76]] 28 | 29 | 30 | Grid: 55, 55, 55 31 | Volume: 18809.067 32 | ! Total Energy (eV): 1.0744 33 | Execution time: 1.86 s 34 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/5x5x5/Plot/README: -------------------------------------------------------------------------------- 1 | The planar average of the model potential 2 | along a given direction can be plotted using in_V. 3 | Link the V_r.npy file using: 4 | $ln -s ../V_r.npy . 5 | 6 | The planar average of the model charge 7 | along a given direction can be plotted using input 8 | in_rho to plavg.py 9 | Link the rho_r.npy file using: 10 | $ln -s ../rho_r.npy . 11 | 12 | To run plavg.py: 13 | $your_path_to_CoFFEE/PotentialAlignment/Utilities/plavg.py input 14 | 15 | This produces a two column file plavg_(direction).plot which you could 16 | plot using a software of your choice. 17 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/5x5x5/Plot/in_V: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = V_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = None 6 | cell_dim = 33.242914719 7 | / 8 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/5x5x5/Plot/in_rho: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = rho_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = None 6 | cell_dim = 33.242914719 7 | / 8 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/5x5x5/Reference/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | CELL PARAMETERS: 6 | Cell dimensions (bohr): 33.243, 33.243,33.243 7 | Lattice vectors (normalized): 8 | a1: 1.000, 0.000, 0.000 9 | a2: 0.000, 1.000, 0.000 10 | a3: 0.000, 0.000, 1.000 11 | Plane-wave energy cut-off (Ry): 40.000 12 | 13 | GAUSSIAN_PARAMETERS: 14 | ('Total charge:', -2) 15 | Center of the gaussian (in crystal units): 16 | (0.5, 0.5, 0.5) 17 | Gaussian width (bohr): 18 | 2.614 19 | 20 | 21 | DIELECTRIC PARAMETERS 22 | Profile: Bulk 23 | epsilon tensor: 24 | [[ 5.76 0. 0. ] 25 | [ 0. 5.76 0. ] 26 | [ 0. 0. 5.76]] 27 | 28 | 29 | Grid: 69, 69, 69 30 | Volume: 36736.458 31 | ! Total Energy (eV): 1.2549 32 | Execution time: 8.02 s 33 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/5x5x5/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.000000000 0.000000000 0.000000000 5 | 0.000000000 1.000000000 0.000000000 6 | 0.000000000 0.000000000 1.000000000 7 | 8 | Cell_dimensions bohr 9 | 33.242914719 33.242914719 33.242914719 10 | 11 | Ecut=20.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Bulk 15 | Epsilon1_a1 = 5.76 16 | Epsilon1_a2 = 5.76 17 | Epsilon1_a3 = 5.76 18 | / 19 | 20 | &GAUSSIAN_PARAMETERS: 21 | Total_charge = -2 22 | Sigma = 2.614 23 | Centre_a1 = 0.5 24 | Centre_a2 = 0.5 25 | Centre_a3 = 0.5 26 | / 27 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/6x6x6/Plot/README: -------------------------------------------------------------------------------- 1 | The planar average of the model potential 2 | along a given direction can be plotted using in_V. 3 | Link the V_r.npy file using: 4 | $ln -s ../V_r.npy . 5 | 6 | The planar average of the model charge 7 | along a given direction can be plotted using input 8 | in_rho to plavg.py 9 | Link the rho_r.npy file using: 10 | $ln -s ../rho_r.npy . 11 | 12 | To run plavg.py: 13 | $your_path_to_CoFFEE/PotentialAlignment/Utilities/plavg.py input 14 | 15 | This produces a two column file plavg_(direction).plot which you could 16 | plot using a software of your choice. 17 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/6x6x6/Plot/in_V: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = V_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = None 6 | cell_dim = 39.89149 7 | / 8 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/6x6x6/Plot/in_rho: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = rho_r.npy 3 | file_type = python 4 | plt_dir = a1 5 | factor = None 6 | cell_dim = 39.89149 7 | / 8 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/6x6x6/Reference/out: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | CoFFEE: Corrections For Formation Energies and 3 | Eigenvalues for charged defect simulations 4 | ######################################################## 5 | CELL PARAMETERS: 6 | Cell dimensions (bohr): 39.891, 39.891,39.891 7 | Lattice vectors (normalized): 8 | a1: 1.000, 0.000, 0.000 9 | a2: 0.000, 1.000, 0.000 10 | a3: 0.000, 0.000, 1.000 11 | Plane-wave energy cut-off (Ry): 40.000 12 | 13 | GAUSSIAN_PARAMETERS: 14 | ('Total charge:', -2) 15 | Center of the gaussian (in crystal units): 16 | (0.5, 0.5, 0.5) 17 | Gaussian width (bohr): 18 | 2.614 19 | 20 | 21 | DIELECTRIC PARAMETERS 22 | Profile: Bulk 23 | epsilon tensor: 24 | [[ 5.76 0. 0. ] 25 | [ 0. 5.76 0. ] 26 | [ 0. 0. 5.76]] 27 | 28 | 29 | Grid: 83, 83, 83 30 | Volume: 63480.564 31 | ! Total Energy (eV): 1.3800 32 | Execution time: 14.15 s 33 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/6x6x6/in: -------------------------------------------------------------------------------- 1 | &CELL_PARAMETERS 2 | 3 | Lattice_Vectors(normalized): 4 | 1.000000000 0.000000000 0.000000000 5 | 0.000000000 1.000000000 0.000000000 6 | 0.000000000 0.000000000 1.000000000 7 | 8 | Cell_dimensions bohr 9 | 39.89149 39.89149 39.89149 10 | 11 | Ecut=20.0 Hartree 12 | / 13 | 14 | &DIELECTRIC_PARAMETERS Bulk 15 | Epsilon1_a1 = 5.76 16 | Epsilon1_a2 = 5.76 17 | Epsilon1_a3 = 5.76 18 | / 19 | 20 | &GAUSSIAN_PARAMETERS: 21 | Total_charge = -2 22 | Sigma = 2.614 23 | Centre_a1 = 0.5 24 | Centre_a2 = 0.5 25 | Centre_a3 = 0.5 26 | / 27 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/E_iso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/3D/Diamond/Model_Scaling/E_iso.png -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/README: -------------------------------------------------------------------------------- 1 | ## C vacancy in Diamond in the -2 charge state. 2 | 3 | The lattice correction term, E_lat, is given by 4 | (Eqn. 3 in the CoFFEE paper): 5 | E^{lat} = E^{iso,m}- E^{per,m} 6 | 7 | To obtain the isolated model energy, the model periodic energy 8 | is computed for three supercell sizes, say 4x4x4, 5x5x5 and 9 | 6x6x6 for this case. These energies are fitted with a polynomial, 10 | of the form Eqn 13 in CoFFEE paper, 11 | p(\Omega) = f_1 + f_2/(\Omega^(1/3)) + f_3/(\Omega), 12 | and extrapolated to infinity to obtain E_m,iso. 13 | See also Fig 4 (c) for the fit. 14 | 15 | Note: Extrapolation is dependent on the Sigma used in the calculation! 16 | 17 | To run this example, perform the following steps: 18 | 1. Go to the folder 4x4x4/ and run the following command: 19 | python3 path_to_coffee_folder/coffee.py in > out 20 | 2. Go to the folder 5x5x5/ and run the following command: 21 | python3 path_to_coffee_folder/coffee.py in > out 22 | 3. Go to the folder 6x6x6/ and run the following command: 23 | python3 path_to_coffee_folder/coffee.py in > out 24 | 25 | The model total energy is printed in the out files. 26 | The following command will show this energy: 27 | grep ! out 28 | 29 | For this example, the model energies should be: 30 | 4x4x4: 1.0744 eV 31 | 5x5x5: 1.2549 eV 32 | 6x6x6: 1.3800 eV 33 | 34 | Use plot_fit.py to compute the polynomial fit and extrapolation 35 | to obtain E^{iso,m} for these values. 36 | E^{iso,m} is computed to be 2.04 eV 37 | 38 | The corrections, for these super cells then are: 39 | (E^{iso,m}- E^{per,m}) 40 | 4x4x4: 0.97 41 | 5x5x5: 0.785 42 | 6x6x6: 0.66 43 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/Model_Scaling/plot_fit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys, string 3 | import numpy as np 4 | import matplotlib.pyplot as plt 5 | 6 | def compute_fit(C_u,L2,L3,L4): 7 | # 8 | # Computes the fitting polynomial. 9 | # C_u takes the 3 model energies 10 | # L2, L3 and L4 are 1/\Omega^{1/3} for the correspoding cells. 11 | # 12 | A = np.array([[ L2, L2**3, 1.], [ L3, L3**3, 1.] , [ L4, L4**3, 1. ] ]) 13 | A_inv = np.linalg.inv(A) 14 | X_u = np.dot(A_inv,C_u) 15 | return X_u 16 | 17 | alat = 6.6486*0.52918 18 | RYD = 13.605698 19 | 20 | # The Model energies go in here: 21 | E_m = np.array([1.07438,1.2549,1.38]) 22 | 23 | # 1/\Omega^{1/3} for 4x4x4, 5x5x5 and 6x6x6 cells. 24 | one_by_V = np.array([1./(4.**3),1/(5.**3),1/(6.**3)]) 25 | one_by_A = (one_by_V)**(1/3.)*(1/alat) 26 | 27 | # Compute the fit: p(\Omega) = f_1 + f_2/(\Omega^(1/3)) + f_3/(\Omega) 28 | X = compute_fit([E_m[0],E_m[1],E_m[2]],one_by_A[0],one_by_A[1],one_by_A[2]) 29 | 30 | # Use the coefficient obtained above to generate the fitting curve 31 | Linv = np.arange(0,0.15,0.005) 32 | Y = [] 33 | for x in Linv: 34 | Y.append(X[0]*x + X[1]*x**3 + X[2]) 35 | 36 | E_m_iso = X[2] 37 | 38 | print("E_m_iso:", X[2]) 39 | print("Fitting parameters (f_1,f_2,f_3):", X[2],X[0],X[1]) 40 | fig,(ax) = plt.subplots() 41 | # Scatter the model energies 42 | ax.scatter(one_by_A, E_m,lw = 2.,color = 'k',marker='o',s=250,label = "Uncorrected") 43 | # Plot the fitted curve 44 | ax.plot(Linv,Y,color = 'r', lw = 3.8) 45 | ax.set_ylabel(r'$\mathrm{E}_{-2}^{\mathrm{m,per}}$ (eV)',fontsize = 32) 46 | ax.set_xlabel(r'$\Omega^{\mathrm{-1/3}}$ ($\AA^{-1}$)',fontsize = 32) 47 | ax.tick_params(labelsize = 24, width = 2.5,length = 7) 48 | ax.set_xticks([0,0.02,0.04,0.06, 0.08]) 49 | ax.set_xlim(0,0.08) 50 | ax.set_ylim(0.8,2.2) 51 | ax.set_title("Sigma = 2.614",fontsize=28) 52 | plt.tight_layout() 53 | plt.savefig("E_iso.png") 54 | plt.show() 55 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/PA_0p/Fig_V_0p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/3D/Diamond/PA_0p/Fig_V_0p.png -------------------------------------------------------------------------------- /Examples/3D/Diamond/PA_0p/README: -------------------------------------------------------------------------------- 1 | This folder shows you how to compute the 2 | potential alignment term, \Delta V_{0/p} (Eqn. 2 3 | in the CoFFEE paper) 4 | 5 | It involves comparing the planar averaged DFT 6 | potentials between the neutral and pristine cells, 7 | -q(V_0 - V_p), far from the defect site. 8 | 9 | Complete details on the DFT calculations are 10 | provided in the paper. 11 | We provide the planar averaged V_p and V_0 12 | potentials computed using Quantum Espresso for the 4x4x4 13 | super cell in the files: 14 | plavg_p_a1.plot and plavg_0_a1.plot 15 | These can be generated from your DFT calculation by 16 | writing the DFT potentials into a cube/xsf format. 17 | The cube/xsf file can then be planar averaged using 18 | the utility plavg.py, located in the path: 19 | path_to_CoFFEE_folder/PotentialAlignment/Utilities/ 20 | The details on how to run this script is provided in 21 | the same folder. 22 | 23 | Use the script plot_DV0p.py to plot this difference 24 | and find the value far from the defect site. 25 | This term is about 0.1 eV 26 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/PA_0p/plavg_0_a1.plot: -------------------------------------------------------------------------------- 1 | 0.000 0.50956218 2 | 0.197 0.85166470 3 | 0.394 1.83343285 4 | 0.591 3.05583184 5 | 0.788 3.75694537 6 | 0.985 3.46824373 7 | 1.182 2.38150740 8 | 1.379 1.21332087 9 | 1.576 0.57492214 10 | 1.773 0.61770439 11 | 1.970 1.33815152 12 | 2.167 2.53899311 13 | 2.364 3.55878876 14 | 2.561 3.72029035 15 | 2.758 2.91642020 16 | 2.955 1.68469056 17 | 3.152 0.77225776 18 | 3.349 0.51586770 19 | 3.546 0.94355523 20 | 3.743 1.98855071 21 | 3.940 3.18857565 22 | 4.137 3.77921478 23 | 4.334 3.36639400 24 | 4.531 2.22493802 25 | 4.728 1.09959931 26 | 4.925 0.54499545 27 | 5.122 0.67342417 28 | 5.319 1.47359839 29 | 5.516 2.69614113 30 | 5.713 3.63771187 31 | 5.910 3.67050497 32 | 6.107 2.77305953 33 | 6.304 1.54507931 34 | 6.501 0.70720041 35 | 6.698 0.53681457 36 | 6.895 1.04994509 37 | 7.092 2.15112131 38 | 7.289 3.31583745 39 | 7.486 3.78970008 40 | 7.683 3.25741372 41 | 7.880 2.07419339 42 | 8.077 1.00109856 43 | 8.274 0.53183060 44 | 8.471 0.74667372 45 | 8.668 1.62410317 46 | 8.865 2.85756841 47 | 9.062 3.71182273 48 | 9.259 3.61739124 49 | 9.456 2.63867399 50 | 9.653 1.42937863 51 | 9.850 0.67297040 52 | 10.047 0.59190983 53 | 10.244 1.19331776 54 | 10.441 2.34617405 55 | 10.638 3.46698238 56 | 10.835 3.82376229 57 | 11.032 3.18330068 58 | 11.229 1.97804474 59 | 11.426 0.97378466 60 | 11.623 0.60254860 61 | 11.820 0.92165247 62 | 12.017 1.89742012 63 | 12.214 3.16858619 64 | 12.411 3.98839870 65 | 12.608 3.84848880 66 | 12.805 2.87983689 67 | 13.002 1.76081124 68 | 13.199 1.11677563 69 | 13.396 1.11677563 70 | 13.593 1.76081124 71 | 13.790 2.87983689 72 | 13.987 3.84848880 73 | 14.184 3.98839870 74 | 14.381 3.16858619 75 | 14.578 1.89742012 76 | 14.775 0.92165247 77 | 14.972 0.60254860 78 | 15.169 0.97378466 79 | 15.366 1.97804474 80 | 15.563 3.18330068 81 | 15.760 3.82376229 82 | 15.957 3.46698238 83 | 16.154 2.34617405 84 | 16.351 1.19331776 85 | 16.548 0.59190983 86 | 16.745 0.67297040 87 | 16.942 1.42937863 88 | 17.139 2.63867399 89 | 17.336 3.61739124 90 | 17.533 3.71182273 91 | 17.730 2.85756841 92 | 17.927 1.62410317 93 | 18.124 0.74667372 94 | 18.321 0.53183060 95 | 18.518 1.00109856 96 | 18.715 2.07419339 97 | 18.912 3.25741372 98 | 19.109 3.78970008 99 | 19.306 3.31583745 100 | 19.503 2.15112131 101 | 19.700 1.04994509 102 | 19.896 0.53681457 103 | 20.093 0.70720041 104 | 20.290 1.54507931 105 | 20.487 2.77305953 106 | 20.684 3.67050497 107 | 20.881 3.63771187 108 | 21.078 2.69614113 109 | 21.275 1.47359839 110 | 21.472 0.67342417 111 | 21.669 0.54499545 112 | 21.866 1.09959931 113 | 22.063 2.22493802 114 | 22.260 3.36639400 115 | 22.457 3.77921478 116 | 22.654 3.18857565 117 | 22.851 1.98855071 118 | 23.048 0.94355523 119 | 23.245 0.51586770 120 | 23.442 0.77225776 121 | 23.639 1.68469056 122 | 23.836 2.91642020 123 | 24.033 3.72029035 124 | 24.230 3.55878876 125 | 24.427 2.53899311 126 | 24.624 1.33815152 127 | 24.821 0.61770439 128 | 25.018 0.57492214 129 | 25.215 1.21332087 130 | 25.412 2.38150740 131 | 25.609 3.46824373 132 | 25.806 3.75694537 133 | 26.003 3.05583184 134 | 26.200 1.83343285 135 | 26.397 0.85166470 136 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/PA_0p/plavg_p_a1.plot: -------------------------------------------------------------------------------- 1 | 0.000 0.56155204 2 | 0.197 0.90365956 3 | 0.394 1.88542130 4 | 0.591 3.10782797 5 | 0.788 3.80894338 6 | 0.985 3.52023235 7 | 1.182 2.43347512 8 | 1.379 1.26527145 9 | 1.576 0.62683592 10 | 1.773 0.66956216 11 | 1.970 1.38995563 12 | 2.167 2.59073147 13 | 2.364 3.61043937 14 | 2.561 3.77183827 15 | 2.758 2.96784950 16 | 2.955 1.73598881 17 | 3.152 0.82341277 18 | 3.349 0.56687455 19 | 3.546 0.99441596 20 | 3.743 2.03927377 21 | 3.940 3.23916617 22 | 4.137 3.82968213 23 | 4.334 3.41673947 24 | 4.531 2.27513757 25 | 4.728 1.14964573 26 | 4.925 0.59483746 27 | 5.122 0.72305253 28 | 5.319 1.52295834 29 | 5.516 2.74518626 30 | 5.713 3.68639390 31 | 5.910 3.71876388 32 | 6.107 2.82082825 33 | 6.304 1.59229265 34 | 6.501 0.75382960 35 | 6.698 0.58284891 36 | 6.895 1.09541305 37 | 7.092 2.19609403 38 | 7.289 3.36037809 39 | 7.486 3.83384041 40 | 7.683 3.30112579 41 | 7.880 2.11741010 42 | 8.077 1.04365712 43 | 8.274 0.57352981 44 | 8.471 0.78728843 45 | 8.668 1.66335872 46 | 8.865 2.89511830 47 | 9.062 3.74726951 48 | 9.259 3.65025728 49 | 9.456 2.66841744 50 | 9.653 1.45547176 51 | 9.850 0.69496865 52 | 10.047 0.60950545 53 | 10.244 1.20629394 54 | 10.441 2.35434028 55 | 10.638 3.47008196 56 | 10.835 3.82138315 57 | 11.032 3.17467895 58 | 11.229 1.96188122 59 | 11.426 0.94773764 60 | 11.623 0.56287621 61 | 11.820 0.86221132 62 | 12.017 1.81006869 63 | 12.214 3.03883044 64 | 12.411 3.79243063 65 | 12.608 3.56705999 66 | 12.805 2.51235005 67 | 13.002 1.32652783 68 | 13.199 0.64686421 69 | 13.396 0.64686421 70 | 13.593 1.32652783 71 | 13.790 2.51235005 72 | 13.987 3.56705999 73 | 14.184 3.79243063 74 | 14.381 3.03883044 75 | 14.578 1.81006869 76 | 14.775 0.86221132 77 | 14.972 0.56287621 78 | 15.169 0.94773764 79 | 15.366 1.96188122 80 | 15.563 3.17467895 81 | 15.760 3.82138315 82 | 15.957 3.47008196 83 | 16.154 2.35434028 84 | 16.351 1.20629394 85 | 16.548 0.60950545 86 | 16.745 0.69496865 87 | 16.942 1.45547176 88 | 17.139 2.66841744 89 | 17.336 3.65025728 90 | 17.533 3.74726951 91 | 17.730 2.89511830 92 | 17.927 1.66335872 93 | 18.124 0.78728843 94 | 18.321 0.57352981 95 | 18.518 1.04365712 96 | 18.715 2.11741010 97 | 18.912 3.30112579 98 | 19.109 3.83384041 99 | 19.306 3.36037809 100 | 19.503 2.19609403 101 | 19.700 1.09541305 102 | 19.896 0.58284891 103 | 20.093 0.75382960 104 | 20.290 1.59229265 105 | 20.487 2.82082825 106 | 20.684 3.71876388 107 | 20.881 3.68639390 108 | 21.078 2.74518626 109 | 21.275 1.52295834 110 | 21.472 0.72305253 111 | 21.669 0.59483746 112 | 21.866 1.14964573 113 | 22.063 2.27513757 114 | 22.260 3.41673947 115 | 22.457 3.82968213 116 | 22.654 3.23916617 117 | 22.851 2.03927377 118 | 23.048 0.99441596 119 | 23.245 0.56687455 120 | 23.442 0.82341277 121 | 23.639 1.73598881 122 | 23.836 2.96784950 123 | 24.033 3.77183827 124 | 24.230 3.61043937 125 | 24.427 2.59073147 126 | 24.624 1.38995563 127 | 24.821 0.66956216 128 | 25.018 0.62683592 129 | 25.215 1.26527145 130 | 25.412 2.43347512 131 | 25.609 3.52023235 132 | 25.806 3.80894338 133 | 26.003 3.10782797 134 | 26.200 1.88542130 135 | 26.397 0.90365956 136 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/PA_0p/plot_DV0p.py: -------------------------------------------------------------------------------- 1 | import sys, string 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | 5 | V_0 = np.loadtxt("plavg_0_a1.plot") 6 | V_p = np.loadtxt("plavg_p_a1.plot") 7 | 8 | V_diff = -2*(V_0[:,1] - V_p[:,1]) 9 | 10 | fig, ax = plt.subplots() 11 | 12 | ax.plot(V_0[:,0]*0.52918,V_diff,color = 'k',linewidth = 3.2,label = r"-2(V$_0$ - V$_p$)") 13 | ax.axvline(x = V_0[int(len(V_0)/2),0]*0.52918,color = 'darkorange',linestyle = '--',lw = 3.2,label = "Vacancy pos.") 14 | ax.legend(loc = 0,fontsize = 18) 15 | ax.set_xlim(V_0[0,0]*0.52918,V_0[-1,0]*0.52918) 16 | ax.set_ylabel("Potential (eV)",fontsize = 25) 17 | ax.set_xlabel(r"$a_1$ ($\AA$)",fontsize = 25) 18 | ax.tick_params(labelsize = 19, width = 2.5,length = 7) 19 | plt.tight_layout() 20 | plt.savefig("Fig_V_0p.png") 21 | print("Value at a1=0:", V_diff[0]) 22 | plt.show() 23 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/PA_q0/Fig_V_q0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/Examples/3D/Diamond/PA_q0/Fig_V_q0.png -------------------------------------------------------------------------------- /Examples/3D/Diamond/PA_q0/README: -------------------------------------------------------------------------------- 1 | This folder shows you how to compute the 2 | potential alignment term, \Delta V_{q/0} (Eqn. 5 3 | in the CoFFEE paper) 4 | 5 | It involves comparing the planar averaged DFT difference 6 | potential between the charged and neutral cells, 7 | (V_q^{DFT} - V_0^{DFT}) with the model potential for the 8 | same super cell, far from the defect position. 9 | 10 | Complete details on the DFT calculations are 11 | provided in the paper. 12 | We provide the planar averaged V_q^{DFT} and V_0^{DFT} 13 | potentials computed using Quantum Espresso for the 4x4x4 14 | super cell in the files: 15 | plavg_q_a1.plot and plavg_0_a1.plot 16 | These can be generated from your DFT calculation by 17 | writing the DFT potentials into a cube/xsf format. 18 | The cube/xsf file can then be planar averaged using 19 | the utility plavg.py, located in the path: 20 | path_to_CoFFEE_folder/PotentialAlignment/Utilities/ 21 | The details on how to run this script is provided in 22 | the same folder. 23 | 24 | We compare the DFT difference potential with the 25 | model potential (far from the defect) computed 26 | in the folder: ../Model_Scaling/4x4x4/Plot/ using 27 | the script plot_DVq0.py. 28 | 29 | You will find that the difference between the potentials, 30 | far from the defect is negligibly small. There is hence 31 | no contribution from this term to the correction. It 32 | is however necessary to always check if this is true. 33 | This term being small indicates that the charged defect has been 34 | modelled well. 35 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/PA_q0/plavg_0_a1.plot: -------------------------------------------------------------------------------- 1 | 0.000 0.50956218 2 | 0.197 0.85166470 3 | 0.394 1.83343285 4 | 0.591 3.05583184 5 | 0.788 3.75694537 6 | 0.985 3.46824373 7 | 1.182 2.38150740 8 | 1.379 1.21332087 9 | 1.576 0.57492214 10 | 1.773 0.61770439 11 | 1.970 1.33815152 12 | 2.167 2.53899311 13 | 2.364 3.55878876 14 | 2.561 3.72029035 15 | 2.758 2.91642020 16 | 2.955 1.68469056 17 | 3.152 0.77225776 18 | 3.349 0.51586770 19 | 3.546 0.94355523 20 | 3.743 1.98855071 21 | 3.940 3.18857565 22 | 4.137 3.77921478 23 | 4.334 3.36639400 24 | 4.531 2.22493802 25 | 4.728 1.09959931 26 | 4.925 0.54499545 27 | 5.122 0.67342417 28 | 5.319 1.47359839 29 | 5.516 2.69614113 30 | 5.713 3.63771187 31 | 5.910 3.67050497 32 | 6.107 2.77305953 33 | 6.304 1.54507931 34 | 6.501 0.70720041 35 | 6.698 0.53681457 36 | 6.895 1.04994509 37 | 7.092 2.15112131 38 | 7.289 3.31583745 39 | 7.486 3.78970008 40 | 7.683 3.25741372 41 | 7.880 2.07419339 42 | 8.077 1.00109856 43 | 8.274 0.53183060 44 | 8.471 0.74667372 45 | 8.668 1.62410317 46 | 8.865 2.85756841 47 | 9.062 3.71182273 48 | 9.259 3.61739124 49 | 9.456 2.63867399 50 | 9.653 1.42937863 51 | 9.850 0.67297040 52 | 10.047 0.59190983 53 | 10.244 1.19331776 54 | 10.441 2.34617405 55 | 10.638 3.46698238 56 | 10.835 3.82376229 57 | 11.032 3.18330068 58 | 11.229 1.97804474 59 | 11.426 0.97378466 60 | 11.623 0.60254860 61 | 11.820 0.92165247 62 | 12.017 1.89742012 63 | 12.214 3.16858619 64 | 12.411 3.98839870 65 | 12.608 3.84848880 66 | 12.805 2.87983689 67 | 13.002 1.76081124 68 | 13.199 1.11677563 69 | 13.396 1.11677563 70 | 13.593 1.76081124 71 | 13.790 2.87983689 72 | 13.987 3.84848880 73 | 14.184 3.98839870 74 | 14.381 3.16858619 75 | 14.578 1.89742012 76 | 14.775 0.92165247 77 | 14.972 0.60254860 78 | 15.169 0.97378466 79 | 15.366 1.97804474 80 | 15.563 3.18330068 81 | 15.760 3.82376229 82 | 15.957 3.46698238 83 | 16.154 2.34617405 84 | 16.351 1.19331776 85 | 16.548 0.59190983 86 | 16.745 0.67297040 87 | 16.942 1.42937863 88 | 17.139 2.63867399 89 | 17.336 3.61739124 90 | 17.533 3.71182273 91 | 17.730 2.85756841 92 | 17.927 1.62410317 93 | 18.124 0.74667372 94 | 18.321 0.53183060 95 | 18.518 1.00109856 96 | 18.715 2.07419339 97 | 18.912 3.25741372 98 | 19.109 3.78970008 99 | 19.306 3.31583745 100 | 19.503 2.15112131 101 | 19.700 1.04994509 102 | 19.896 0.53681457 103 | 20.093 0.70720041 104 | 20.290 1.54507931 105 | 20.487 2.77305953 106 | 20.684 3.67050497 107 | 20.881 3.63771187 108 | 21.078 2.69614113 109 | 21.275 1.47359839 110 | 21.472 0.67342417 111 | 21.669 0.54499545 112 | 21.866 1.09959931 113 | 22.063 2.22493802 114 | 22.260 3.36639400 115 | 22.457 3.77921478 116 | 22.654 3.18857565 117 | 22.851 1.98855071 118 | 23.048 0.94355523 119 | 23.245 0.51586770 120 | 23.442 0.77225776 121 | 23.639 1.68469056 122 | 23.836 2.91642020 123 | 24.033 3.72029035 124 | 24.230 3.55878876 125 | 24.427 2.53899311 126 | 24.624 1.33815152 127 | 24.821 0.61770439 128 | 25.018 0.57492214 129 | 25.215 1.21332087 130 | 25.412 2.38150740 131 | 25.609 3.46824373 132 | 25.806 3.75694537 133 | 26.003 3.05583184 134 | 26.200 1.83343285 135 | 26.397 0.85166470 136 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/PA_q0/plavg_q_a1.plot: -------------------------------------------------------------------------------- 1 | 0.000 0.34838586 2 | 0.197 0.69060569 3 | 0.394 1.67269803 4 | 0.591 2.89563419 5 | 0.788 3.59750972 6 | 0.985 3.30981675 7 | 1.182 2.22440181 8 | 1.379 1.05786135 9 | 1.576 0.42139565 10 | 1.773 0.46635162 11 | 1.970 1.18914003 12 | 2.167 2.39239071 13 | 2.364 3.41467831 14 | 2.561 3.57887052 15 | 2.758 2.77799023 16 | 2.955 1.54966866 17 | 3.152 0.64105689 18 | 3.349 0.38885744 19 | 3.546 0.82094242 20 | 3.743 1.87036427 21 | 3.940 3.07479234 22 | 4.137 3.66989833 23 | 4.334 3.26179251 24 | 4.531 2.12549036 25 | 4.728 1.00582017 26 | 4.925 0.45733256 27 | 5.122 0.59214688 28 | 5.319 1.39868519 29 | 5.516 2.62739478 30 | 5.713 3.57498829 31 | 5.910 3.61388278 32 | 6.107 2.72289299 33 | 6.304 1.50191992 34 | 6.501 0.67167438 35 | 6.698 0.50935080 36 | 6.895 1.03066023 37 | 7.092 2.13985857 38 | 7.289 3.31234253 39 | 7.486 3.79395698 40 | 7.683 3.26966323 41 | 7.880 2.09501717 42 | 8.077 1.03114728 43 | 8.274 0.57160809 44 | 8.471 0.79628429 45 | 8.668 1.68323383 46 | 8.865 2.92565307 47 | 9.062 3.78839207 48 | 9.259 3.70232198 49 | 9.456 2.73224339 50 | 9.653 1.53217695 51 | 9.850 0.78565239 52 | 10.047 0.71491182 53 | 10.244 1.32668840 54 | 10.441 2.48959968 55 | 10.638 3.62003891 56 | 10.835 3.98610263 57 | 11.032 3.35482196 58 | 11.229 2.15880496 59 | 11.426 1.16382418 60 | 11.623 0.80167410 61 | 11.820 1.12921547 62 | 12.017 2.11224150 63 | 12.214 3.38908603 64 | 12.411 4.21297782 65 | 12.608 4.07573243 66 | 12.805 3.10871442 67 | 13.002 1.99057358 68 | 13.199 1.34694169 69 | 13.396 1.34694169 70 | 13.593 1.99057358 71 | 13.790 3.10871442 72 | 13.987 4.07573243 73 | 14.184 4.21297782 74 | 14.381 3.38908603 75 | 14.578 2.11224150 76 | 14.775 1.12921547 77 | 14.972 0.80167410 78 | 15.169 1.16382418 79 | 15.366 2.15880496 80 | 15.563 3.35482196 81 | 15.760 3.98610263 82 | 15.957 3.62003891 83 | 16.154 2.48959968 84 | 16.351 1.32668840 85 | 16.548 0.71491182 86 | 16.745 0.78565239 87 | 16.942 1.53217695 88 | 17.139 2.73224339 89 | 17.336 3.70232198 90 | 17.533 3.78839207 91 | 17.730 2.92565307 92 | 17.927 1.68323383 93 | 18.124 0.79628429 94 | 18.321 0.57160809 95 | 18.518 1.03114728 96 | 18.715 2.09501717 97 | 18.912 3.26966323 98 | 19.109 3.79395698 99 | 19.306 3.31234253 100 | 19.503 2.13985857 101 | 19.700 1.03066023 102 | 19.896 0.50935080 103 | 20.093 0.67167438 104 | 20.290 1.50191992 105 | 20.487 2.72289299 106 | 20.684 3.61388278 107 | 20.881 3.57498829 108 | 21.078 2.62739478 109 | 21.275 1.39868519 110 | 21.472 0.59214688 111 | 21.669 0.45733256 112 | 21.866 1.00582017 113 | 22.063 2.12549036 114 | 22.260 3.26179251 115 | 22.457 3.66989833 116 | 22.654 3.07479234 117 | 22.851 1.87036427 118 | 23.048 0.82094242 119 | 23.245 0.38885744 120 | 23.442 0.64105689 121 | 23.639 1.54966866 122 | 23.836 2.77799023 123 | 24.033 3.57887052 124 | 24.230 3.41467831 125 | 24.427 2.39239071 126 | 24.624 1.18914003 127 | 24.821 0.46635162 128 | 25.018 0.42139565 129 | 25.215 1.05786135 130 | 25.412 2.22440181 131 | 25.609 3.30981675 132 | 25.806 3.59750972 133 | 26.003 2.89563419 134 | 26.200 1.67269803 135 | 26.397 0.69060569 136 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/PA_q0/plot_DVq0.py: -------------------------------------------------------------------------------- 1 | import sys, string 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | 5 | V_0 = np.loadtxt("plavg_0_a1.plot") 6 | V_q = np.loadtxt("plavg_q_a1.plot") 7 | V_m = np.loadtxt("../Model_Scaling/4x4x4/Plot/plavg_a1.plot") 8 | 9 | V_diff = -1*(V_q[:,1] - V_0[:,1]) 10 | 11 | fig, ax = plt.subplots() 12 | 13 | ax.plot(V_0[:,0]*0.52918,V_diff,color = 'k',linewidth = 3.2,label = "DFT diff.") 14 | ax.plot(V_m[:,0]*0.52918,V_m[:,1],color = 'r',lw = 3.2,linestyle = '--',label = "Model") 15 | ax.axvline(x = V_0[int(len(V_0)/2),0]*0.52918,color = 'darkorange',linestyle = '--',lw = 3.2,label = "Vacancy pos.") 16 | ax.legend(loc = 0,fontsize = 18) 17 | ax.set_xlim(V_0[0,0]*0.52918,V_0[-1,0]*0.52918) 18 | ax.set_ylabel("Potential (eV)",fontsize = 25) 19 | ax.set_xlabel(r"$a_1$ ($\AA$)",fontsize = 25) 20 | ax.tick_params(labelsize = 19, width = 2.5,length = 7) 21 | plt.tight_layout() 22 | plt.savefig("Fig_V_q0.png") 23 | plt.show() 24 | -------------------------------------------------------------------------------- /Examples/3D/Diamond/README: -------------------------------------------------------------------------------- 1 | Welcome to the Diamond test system. 2 | 3 | This example studies a C vacancy in Diamond in the -2 charge 4 | state. The complete electrostatic correction for this system 5 | involves computing the following terms 6 | (see Eqn 2, Eqn 3 and Eqn 4 in CoFFEE paper): 7 | 8 | 1. Lattice correction term: E^{lat}, obtained from the 9 | model calculations. 10 | The details on computing E^{lat} are provided in 11 | the folder Model_Scaling/ 12 | 2. Potential alignment term: -\Delta V_{q/0}, Eqn 5 13 | in the paper. 14 | The details on computing this term are provided in 15 | the folder PA_q0/ 16 | 3. Potential alignment term: -q\Delta V_{0/p}, Eqn 2 17 | in the paper. 18 | The details on computing this term are provided in 19 | the folder PA_0p/ 20 | 21 | Complete correction for the 4x4x4 super cell, 22 | E_corr = E^{lat} + (-\Delta V_{q/0}) + (-q\Delta V_{0/p}) 23 | E_corr = 0.97 + 0.0 + 0.1 eV 24 | E_corr = 1.07 eV 25 | 26 | 27 | For the 4x4x4 super cell: 28 | Uncorrected formation energy: 13.189 eV 29 | Corrected formation energy: 14.259 eV 30 | 31 | The QE_input/ directory provides the 32 | Quantum Espresso input file for the 4x4x4 33 | super cell calculation with a C 34 | vacancy in the -2 charged state. 35 | We also provide the carbon pseudopotential. 36 | -------------------------------------------------------------------------------- /Examples/Fit_gaussian/README: -------------------------------------------------------------------------------- 1 | The script g_fit.py fits a Gaussian to the wavefunction 2 | charge density provided in cube/xsf format. 3 | 4 | The output of the script is the width of the 5 | model Gaussian which can be used to determine the 6 | Sigma parameter input to the model calculations using 7 | coffee.py. The script also plots the planar averaged data 8 | and the Gaussian fit to it. 9 | 10 | To run this example run the following: 11 | $python3 ../../GaussianFit/g_fit.py in 12 | 13 | 14 | The script reads input from a file. The input file 15 | has just three parameters: 16 | 17 | file_name = wfn.cube # Name of the cube/xsf file. 18 | file_type = cube # Type of the file: cube/xsf. 19 | plt_dir = a3 # Direction to plot and visualize the fit. 20 | -------------------------------------------------------------------------------- /Examples/Fit_gaussian/in: -------------------------------------------------------------------------------- 1 | file_name = wfn.cube 2 | file_type = cube 3 | plt_dir = a3 4 | -------------------------------------------------------------------------------- /Examples/README: -------------------------------------------------------------------------------- 1 | You can find examples for 1D, 2D and 3D systems here: 2 | 3 | 1D - BN nanoribbon, B vacancy in charge state -1. 4 | 5 | 2D - monolayer of MoS2 with S vacancy, in charge state -1 6 | 7 | 3D - Diamond with a C vacancy in charge state -2. 8 | 9 | The complete results for these systems can be found in the 10 | paper. 11 | 12 | Each directory shows how to perform the corrections on one 13 | super cell of the respective system. 14 | 15 | Fit_gaussian/ directory shows how to fit a Gaussian to 16 | a given cube/xsf file holding the defect wavefunction 17 | charge density. 18 | -------------------------------------------------------------------------------- /GaussianFit/README: -------------------------------------------------------------------------------- 1 | This script g_fit.py fits a Gaussian to the wavefunction 2 | charge density provided in cube/xsf format. 3 | 4 | The output of the script is the width of the 5 | model Gaussian which can be used to determine the 6 | Sigma parameter input to the model calculations using 7 | coffee.py. The script also plots the planar averaged data 8 | and the Gaussian fit to it. For an example, 9 | see Examples/Fit_gaussian/ folder. 10 | 11 | The script reads input from a file. The input file 12 | has just three parameters: 13 | 14 | file_name = wfn.cube # Name of the cube/xsf file. 15 | file_type = cube # Type of the file: cube/xsf. 16 | plt_dir = a3 # Direction to plot and visualize the fit. 17 | -------------------------------------------------------------------------------- /GaussianFit/in: -------------------------------------------------------------------------------- 1 | file_name = wfn.cube 2 | file_type = cube 3 | plt_dir = a3 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2017 Indian Institute of Science, Bangalore 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2017 Indian Institute of Science, Bangalore 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | 3. Neither the name of the copyright holder nor the names of its contributors 14 | may be used to endorse or promote products derived from this software without 15 | specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /PoissonSolver/MV_1D_cy/README: -------------------------------------------------------------------------------- 1 | matvec.pyx contains the Cython code 2 | 3 | Cythonize and generate matvec.so using: 4 | python setup.py build_ext --inplace 5 | 6 | 7 | Possible issue in Mac OS: 8 | "fatal error: 'numpy/arrayobject.h' file not found" 9 | 10 | Fix: 11 | export CFLAGS="-I /usr/local/lib/python3.9/site-packages/numpy/core/include $CFLAGS" 12 | -------------------------------------------------------------------------------- /PoissonSolver/MV_1D_cy/matvec1D.pyx: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | cimport numpy as np 3 | cimport cython 4 | DTYPE = np.complex128 5 | ctypedef np.complex128_t DTYPE_t 6 | @cython.boundscheck(False) 7 | 8 | def matvec1D( 9 | complex[:] V, 10 | int lmax, 11 | int mmax, 12 | complex[:,:] eps_GxGy_a1, 13 | complex[:,:] eps_GxGy_a2, 14 | complex[:,:] eps_GxGy_a3, 15 | double celldm1, 16 | double celldm2, 17 | double celldm3, 18 | int k): 19 | 20 | cdef int l1,m1,j1,l2,m2,im 21 | cdef double tpbco,tpbct,tpbctwo,Gx1,Gy1,Gx2,Gy2,Gz,t1,t2,t3,pi 22 | cdef complex Sum 23 | cdef complex[:] matvec = np.zeros((2*lmax+1)*(2*mmax+1),dtype=complex) 24 | im = 0 25 | pi = 3.1415926535897932384626433832795028 26 | tpbco = 2.*pi/celldm1 27 | tpbctwo = 2.*pi/celldm2 28 | tpbct = 2.*pi/celldm3 29 | for l1 in range(-lmax,lmax+1): 30 | Gx1 = l1*tpbco 31 | for m1 in range(-mmax,mmax+1): 32 | Gy1 = m1*tpbctwo 33 | Sum = 0.0 34 | j1 = 0 35 | for l2 in range(-lmax,lmax+1): 36 | Gx2 = l2*tpbco 37 | for m2 in range(-mmax, mmax+1): 38 | Gy2 = m2*tpbctwo 39 | Gz = k*tpbct 40 | Sum += ( 41 | (Gx2*Gx1) 42 | *eps_GxGy_a1[2*lmax+(l1-l2),2*mmax+(m1-m2)] 43 | + ( Gy2*Gy1) 44 | *eps_GxGy_a2[2*lmax+(l1-l2),2*mmax+(m1-m2)] 45 | + Gz*Gz 46 | *eps_GxGy_a3[2*lmax+(l1-l2),2*mmax+(m1-m2)] 47 | )*V[j1] 48 | j1 = j1+1 49 | matvec[im] = Sum 50 | im = im + 1 51 | return matvec 52 | -------------------------------------------------------------------------------- /PoissonSolver/MV_1D_cy/setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | from distutils.extension import Extension 3 | from Cython.Distutils import build_ext 4 | import os 5 | import numpy 6 | 7 | ext_modules=[ Extension("matvec1D", 8 | ["matvec1D.pyx"], 9 | extra_compile_args = ["-ffast-math"])] 10 | 11 | setup( 12 | name = "matvec1D", 13 | cmdclass = {"build_ext": build_ext}, 14 | ext_modules = ext_modules, 15 | include_dirs = [numpy.get_include()] 16 | ) 17 | 18 | os.system("mv matvec1D*.so matvec1D.so") 19 | -------------------------------------------------------------------------------- /PoissonSolver/MV_2D_cy/README: -------------------------------------------------------------------------------- 1 | matvec2D.pyx contains the Cython code 2 | 3 | Cythonize and generate matvec.so using: 4 | python3 setup.py build_ext --inplace 5 | -------------------------------------------------------------------------------- /PoissonSolver/MV_2D_cy/matvec2D.pyx: -------------------------------------------------------------------------------- 1 | #rom libc.stdlib cimport malloc, free 2 | import numpy as np 3 | cimport numpy as np 4 | cimport cython 5 | @cython.boundscheck(False) # turn of bounds-checking for entire function 6 | def matvec2D(int i,int j,int kmax, double celldm3, double pi, complex[:] epsGz_perp,complex[:] epsGz_ll, double[:] b_1, double[:] b_2, complex[:] V): 7 | cdef double Gz1, Gz2, Gx,Gy,pi2_celldm3 8 | cdef int k_t,k1, k2, j1, p, q, index 9 | cdef complex[:] b_n = np.zeros(2*kmax+1, dtype = complex) 10 | cdef complex Sum 11 | index = 0 12 | Gx = i*b_1[0] + j*b_2[0] 13 | Gy = i*b_1[1] + j*b_2[1] 14 | pi2_celldm3= 2.*pi/celldm3 15 | for k1 in range(-kmax,kmax+1): 16 | Gz1 = k1*pi2_celldm3 17 | Sum = 0. 18 | j1 = 0 19 | for k2 in range(-kmax,kmax+1): 20 | Gz2 = k2*pi2_celldm3 21 | Sum+= (epsGz_perp[2*kmax+(k1-k2)]*Gz2*Gz1 + epsGz_ll[2*kmax+(k1-k2)]*( Gx**2 + Gy**2) )*V[j1] 22 | j1 = j1+1 23 | b_n[index]=Sum 24 | index+=1 25 | return b_n 26 | -------------------------------------------------------------------------------- /PoissonSolver/MV_2D_cy/setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | from distutils.extension import Extension 3 | from Cython.Distutils import build_ext 4 | import numpy, os 5 | 6 | ext_modules=[ Extension("matvec2D", 7 | ["matvec2D.pyx"], 8 | extra_compile_args = ["-ffast-math"])] 9 | 10 | setup( 11 | name = "matvec2D", 12 | cmdclass = {"build_ext": build_ext}, 13 | ext_modules = ext_modules, 14 | include_dirs = [numpy.get_include()] 15 | ) 16 | os.system("mv matvec2D*.so matvec2D.so") 17 | -------------------------------------------------------------------------------- /PoissonSolver/PS_3D_cy/README: -------------------------------------------------------------------------------- 1 | ps3d.pyx contains the Cython code 2 | 3 | Cythonize and generate .so using: 4 | python3 setup.py build_ext --inplace 5 | -------------------------------------------------------------------------------- /PoissonSolver/PS_3D_cy/ps3d.pyx: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | cimport numpy as np 3 | cimport cython 4 | DTYPE = np.complex128 5 | ctypedef np.complex128_t DTYPE_t 6 | @cython.boundscheck(False) 7 | @cython.cdivision(True) 8 | 9 | def PS_3Dg( 10 | double[:,:] B, 11 | complex[:,:,:] rho_G, 12 | double eps1_a1, 13 | double eps1_a2, 14 | double eps1_a3, 15 | int imax, 16 | int jmax, 17 | int kmax): 18 | cdef int i,j,k 19 | cdef double modG,pi,G1,G2,G3 20 | cdef complex[:,:,:] V_G = np.zeros((2*imax+1, 2*jmax+1, 2*kmax+1),dtype=complex) 21 | pi = np.pi 22 | for i in range(-imax, imax+1): 23 | for j in range(-jmax,jmax+1): 24 | for k in range(-kmax,kmax+1): 25 | if i==0 and j==0 and k==0: 26 | V_G[i+imax,j+jmax,k+kmax] = 0.0 27 | else: 28 | G1 = i*B[0,0] + j*B[1,0] + k*B[2,0] 29 | G2 = i*B[0,1] + j*B[1,1] + k*B[2,1] 30 | G3 = i*B[0,2] + j*B[1,2] + k*B[2,2] 31 | modG = eps1_a1*G1**2 + eps1_a2*G2**2 + eps1_a3*G3**2 32 | V_G[i+imax,j+jmax,k+kmax] = ( 33 | 4.0* 34 | pi* 35 | rho_G[i+imax,j+jmax,k+kmax] 36 | / 37 | (modG) 38 | ) 39 | return np.array(V_G) 40 | -------------------------------------------------------------------------------- /PoissonSolver/PS_3D_cy/setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | from distutils.extension import Extension 3 | from Cython.Distutils import build_ext 4 | import numpy, os 5 | 6 | ext_modules=[ Extension("ps3d", 7 | ["ps3d.pyx"], 8 | extra_compile_args = ["-ffast-math"])] 9 | 10 | setup( 11 | name = "ps3d", 12 | cmdclass = {"build_ext": build_ext}, 13 | ext_modules = ext_modules, 14 | include_dirs = [numpy.get_include()] 15 | ) 16 | 17 | os.system("mv ps3d*.so ps3d.so") 18 | -------------------------------------------------------------------------------- /PoissonSolver/README: -------------------------------------------------------------------------------- 1 | This folder contains four scripts: classes.py, Solver.py, 2 | PS_main.py and construct_eps.py 3 | 4 | 5 | classes.py defines the classes: cell, diel_profile and gaussian. 6 | The parameters in the CELL_PARAMETERS section are attributes of the 7 | cell class, the parameters in the DIELECTRIC_PARAMETERS section are 8 | attributes of the diel_profile class and those of the 9 | GAUSSIAN_PARAMETERS section are attributes of the gaussian class. 10 | The classes have a number of functions, which read their 11 | respective sections of the input file, construct the profiles, etc. 12 | 13 | Solver.py chooses the solver based on the dielectric profile 14 | 15 | PS_main.py contains the Poisson solvers for the 1D, 2D and 3D 16 | systems. The matvecs are Cythonized. The Cython code for each 17 | is provided in the directories: MV_1D_cy, MV_2D_cy and MV_3D_cy 18 | 19 | construct_eps.py constructs the epsilon profile in real space, 20 | writes to file and Fourier transforms it. 21 | -------------------------------------------------------------------------------- /PoissonSolver/Solver.py: -------------------------------------------------------------------------------- 1 | from .PS_main import PS_2D, PS_3D,PS_1D,PS_3D_new 2 | 3 | def Solver(cell_s,charge_s,eps_s,imax,jmax,kmax,comm): 4 | if eps_s.Profile == "Slab" or eps_s.Profile == "Gaussian": 5 | # Call the Poisson Solver for slab 6 | V_r = PS_2D(cell_s,charge_s,eps_s,imax,jmax,kmax,comm) 7 | return V_r 8 | elif eps_s.Profile == "Wire" or eps_s.Profile == "Ribbon": 9 | # Call the Poisson Solver for wire 10 | V_r = PS_1D(cell_s,charge_s,eps_s,imax,jmax,kmax,comm) 11 | return V_r 12 | elif eps_s.Profile == "Bulk": 13 | # Call the Poisson Solver for bulk system 14 | V_r = PS_3D_new(cell_s,charge_s,eps_s,imax,jmax,kmax,comm) 15 | return V_r 16 | -------------------------------------------------------------------------------- /PoissonSolver/__init__.py: -------------------------------------------------------------------------------- 1 | from .PS_main import * 2 | from .classes import * 3 | from .Solver import * 4 | from .construct_eps import * 5 | -------------------------------------------------------------------------------- /PoissonSolver/construct_eps.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | def construct_eps(cell_s,eps_s,imax,jmax,kmax): 3 | if eps_s.Profile == "Slab" or eps_s.Profile == "Gaussian": 4 | # Construct epsilon profile and fourier transform 5 | eps_s.construct_epsZ(cell_s,2*kmax) 6 | eps_s.FFT(2*imax,2*jmax,2*kmax) 7 | 8 | # Write profiles to file: 9 | if eps_s.plot_eps: 10 | np.save("epsZ_a1",eps_s.epsZ_a1) 11 | np.save("epsZ_a2",eps_s.epsZ_a2) 12 | np.save("epsZ_a3",eps_s.epsZ_a3) 13 | elif eps_s.Profile == "Wire" or eps_s.Profile == "Ribbon": 14 | # Construct epsilon profile and fourier transform 15 | eps_s.construct_epsxy(cell_s,2*imax,2*jmax) 16 | eps_s.FFT(2*imax,2*jmax,2*kmax) 17 | # Write the profiles to file 18 | if eps_s.plot_eps: 19 | np.save("eps_xy_a1",eps_s.eps_xy_a1) 20 | np.save("eps_xy_a2",eps_s.eps_xy_a2) 21 | np.save("eps_xy_a3",eps_s.eps_xy_a3) 22 | -------------------------------------------------------------------------------- /PotentialAlignment/README: -------------------------------------------------------------------------------- 1 | The codes here can be used to obtain the 2 | two potential alignment terms: 3 | 4 | 1. Neutral defect and pristine: V_{0/p}. The potential 5 | far from the defect is compared to the pristine cell 6 | potential. 7 | dV_0p.py performs (V_0 - V_p)*q and plots the planar averaged 8 | potential along the desired direction. 9 | 10 | 2. Model potential and the DFT difference. The model potential 11 | far from the defect is compared to the DFT difference potential 12 | between charged and neutral cell. 13 | dV_mD.py plots the planar averaged DFT difference potential, (V_q - V_0), 14 | and the model potential, V_m, along the desired direction. 15 | 16 | 17 | The input parameters for dV_0p.py and dV_mD.py are read from an input file. 18 | Format of the input files: 19 | &dv_0p 20 | file_type = cube # No quotes. Takes cube/xsf 21 | file_neutral = # No quotes. Path to the neutral DFT potential file 22 | file_pristine = # No quotes. Path to the pristine DFT potential file 23 | plt_dir = a1 # No quotes. Takes a1/a2/a3. If a1 24 | # is specified, the data is averaged along a2 25 | # and a3 directions and the planar averaged data is plotted 26 | # along a1 in a file pa_dv0p_a1.plot 27 | charge = -1 # Charge, to be multiplied to (V_0 - V_p) 28 | factor = Ryd # factor to be multiplied to the data. If the data is in 29 | # rydberg and the plot is needed in eV, specify 30 | # factor = Ryd, else factor = None. If data is in Hartree 31 | # units, specify factor = Hartree 32 | / 33 | 34 | Output: pa_dv0p_a1.plot (for plt_dir = a1) 35 | 36 | &dV_mD 37 | file_type = cube # No quotes. Format of the DFT potential files: cube/xsf 38 | file_model = # No quotes. Path to the model potential file (.npy) 39 | file_charged = # No quotes. Path to the charged DFT potential file 40 | file_neutral = # No quotes. Path to the neutral DFT potential file 41 | plt_dir = a1 # No quotes. Takes a1/a2/a3. If a1 42 | # is specified, the data is averaged along a2 43 | # and a3 directions and the planar averaged data is plotted 44 | # along a1 in files DFTdiff_a1.plot, model_a1.plot 45 | factor = Ryd # factor to be multiplied to the data. If the data is in 46 | # rydberg and the plot is needed in eV, specify 47 | # factor = Ryd, else factor = None. If data is in Hartree 48 | # units, specify factor = Hartree 49 | / 50 | 51 | Output: DFTdiff_a1.plot, model_a1.plot (for plt_dir = a1) 52 | -------------------------------------------------------------------------------- /PotentialAlignment/Utilities/README: -------------------------------------------------------------------------------- 1 | plavg.py can be run independently to find the planar 2 | average of 3D data in a file with cube/xsf format. It 3 | can also be used to plot the .pysave potential files 4 | generated by the code. 5 | 6 | Input file: 7 | &plavg 8 | file_name = ../MoS2.cube # No quotes 9 | file_type = cube # No quotes. Takes cube/xsf/python 10 | plt_dir = a1 # No quotes. Takes a1/a2/a3. If a1 11 | # is specified, the data is averaged along a2 12 | # and a3 directions and the planar averaged data is plotted 13 | # along a1 in a file plavg_a1.plot 14 | factor = 1.0 # factor to be multiplied to the data. If the data is in 15 | # rydberg and the plot is needed in eV, specify 16 | # factor = 13.60569253. 17 | cell_dim = 1 # For plotting .pysave files, cell_dim can be 18 | # provided. It is the dimension of the cell along 19 | # plt_dir. 20 | / 21 | -------------------------------------------------------------------------------- /PotentialAlignment/Utilities/__init__.py: -------------------------------------------------------------------------------- 1 | from plavg import * 2 | -------------------------------------------------------------------------------- /PotentialAlignment/Utilities/input: -------------------------------------------------------------------------------- 1 | &plavg 2 | file_name = ../MoS2.cube 3 | file_type = cube 4 | plt_dir = a1 5 | factor = 13.605698 6 | / 7 | -------------------------------------------------------------------------------- /PotentialAlignment/Utilities/plavg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #----------------- 4 | # plavg.py 5 | # Computes planar average of 3D data 6 | # written by Mit Naik (March 2017) 7 | #----------------- 8 | import sys, string 9 | import numpy as np 10 | 11 | bohr = 0.52917721092 12 | rydberg = 13.60569253 13 | hartree = 27.21138505 14 | inf9 = 1.0e+9 15 | 16 | def read_input(file_name): 17 | cell_dim = 1.0 18 | fp = open(file_name,'r') 19 | lines = fp.readlines() 20 | for il in range(len(lines)): 21 | if "file_name" in lines[il]: 22 | w = lines[il].split("=") 23 | if len(w) < 2 or len(w) > 3: 24 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 25 | sys.exit() 26 | file_inp = w[1].split()[0] 27 | if "file_type" in lines[il]: 28 | w = lines[il].split("=") 29 | if len(w) < 2 or len(w) > 3: 30 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 31 | sys.exit() 32 | file_type = w[1].split()[0] 33 | if "plt_dir" in lines[il]: 34 | w = lines[il].split("=") 35 | if len(w) < 2 or len(w) > 3: 36 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 37 | sys.exit() 38 | plt_dir = w[1].split()[0] 39 | if "factor" in lines[il]: 40 | w = lines[il].split("=") 41 | if len(w) < 2 or len(w) > 3: 42 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 43 | sys.exit() 44 | factor = w[1].split()[0] 45 | if "cell_dim" in lines[il]: 46 | w = lines[il].split("=") 47 | if len(w) < 2 or len(w) > 3: 48 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 49 | sys.exit() 50 | cell_dim = eval(w[1]) 51 | 52 | return file_inp,file_type,plt_dir,factor,cell_dim 53 | 54 | 55 | 56 | def write2file(file_name,A,v_a): 57 | fp = open(file_name,'w') 58 | if len(A) != len(v_a): 59 | print("Error: len(A) != len(v_a)") 60 | for i in range(len(A)): 61 | fp.write("%4.3f %4.8f\n"%(A[i],v_a[i])) 62 | fp.close() 63 | 64 | def pl_avg_a3(vol,a1_dim,a2_dim,a3_dim,step_l,factor): 65 | A3 = [] 66 | vol_a3 = np.zeros((a3_dim)) 67 | for k in range(a3_dim): 68 | Sum1 = 0. 69 | for i in range(a1_dim): 70 | for j in range(a2_dim): 71 | Sum1 = Sum1 + vol[i][j][k] 72 | vol_a3[k] = Sum1/(a2_dim*a1_dim) 73 | A3.append(k*step_l) 74 | if factor == "Ryd": 75 | vol_a3 = vol_a3*rydberg 76 | elif factor == "Hartree": 77 | vol_a3 = vol_a3*hartree 78 | return vol_a3, np.array(A3) 79 | 80 | def pl_avg_a1(vol,a1_dim,a2_dim,a3_dim,step_l,factor): 81 | A1 = [] 82 | vol_a1 = np.zeros((a1_dim)) 83 | for i in range(a1_dim): 84 | Sum1 = 0. 85 | for j in range(a2_dim): 86 | for k in range(a3_dim): 87 | Sum1 = Sum1 + vol[i][j][k] 88 | vol_a1[i] = Sum1/(a2_dim*a3_dim) 89 | A1.append(i*step_l) 90 | if factor == "Ryd": 91 | vol_a1 = vol_a2*rydberg 92 | elif factor == "Hartree": 93 | vol_a1 = vol_a2*hartree 94 | return vol_a1,np.array(A1) 95 | 96 | def pl_avg_a2(vol,a1_dim,a2_dim,a3_dim,step_l,factor): 97 | A2 = [] 98 | vol_a2 = np.zeros((a2_dim)) 99 | for j in range(a2_dim): 100 | Sum1 = 0. 101 | for i in range(a1_dim): 102 | for k in range(a3_dim): 103 | Sum1 = Sum1 + vol[i][j][k] 104 | vol_a2[j] = Sum1/(a1_dim*a3_dim) 105 | A2.append(j*step_l) 106 | if factor == "Ryd": 107 | vol_a2 = vol_a2*rydberg 108 | elif factor == "Hartree": 109 | vol_a2 = vol_a2*hartree 110 | return vol_a2,np.array(A2) 111 | 112 | def py_read(file): 113 | vol = np.load(file) 114 | grid = np.shape(vol) 115 | return grid,vol 116 | 117 | def xsf_read(file): 118 | fp = open(file,"r") 119 | lines = fp.readlines() 120 | primvec = [] 121 | primcoord = [] 122 | grid = [] 123 | vol = [] 124 | origin = [] 125 | for i in range(len(lines)): 126 | if "PRIMVEC" in lines[i]: 127 | for j in range(3): 128 | w = lines[i+j+1].split() 129 | primvec.append([eval(w[0]),eval(w[1]),eval(w[2])]) 130 | if "PRIMCOORD" in lines[i]: 131 | w = lines[i+1].split() 132 | na = eval(w[0]) 133 | for j in range(na): 134 | w = lines[i+j+2].split() 135 | primcoord.append([w[0],eval(w[1]),eval(w[2]),eval(w[3])]) 136 | if "DATAGRID_3D_" in lines[i]: 137 | w = lines[i+1].split() 138 | grid = [eval(w[0]),eval(w[1]),eval(w[2])] 139 | w = lines[i+2].split() 140 | origin = [eval(w[0]),eval(w[1]),eval(w[2])] 141 | # Skip the next 3 lines 142 | a1_index = 0 143 | a2_index = 0 144 | z_index = 0 145 | vol = np.zeros((grid[0],grid[1],grid[2])) 146 | for j in range(6,len(lines)): 147 | if "END_DATAGRID" in lines[i+j]: 148 | break 149 | words = lines[i+j].split() 150 | words = list(filter(bool, words)) 151 | for w in words: 152 | vol[a1_index][a2_index][z_index] = eval(w) 153 | a1_index = a1_index + 1 154 | if a1_index == grid[0]: 155 | a2_index = a2_index+1 156 | a1_index = 0 157 | if a2_index == grid[1]: 158 | z_index = z_index + 1 159 | a2_index = 0 160 | primvec = np.array(primvec) 161 | step = np.array([primvec[0]/grid[0],primvec[1]/grid[1],primvec[2]/grid[2]]) 162 | return na, primcoord, grid, origin, step, vol 163 | 164 | 165 | def cub_read(file): 166 | ierr = 0 167 | na = 0 168 | aspecies = [] 169 | acharge = [] 170 | aposition = [] 171 | grid = [] 172 | origin = [] 173 | step = [] 174 | vol = [[[]]] 175 | try: 176 | h = open(file, 'r') 177 | except: 178 | ierr = 1 179 | if ierr == 0: 180 | for i in range(2): 181 | s = h.readline() 182 | s = h.readline() 183 | t = s.split() 184 | na = int(t[0]) 185 | origin = [] 186 | for j in range(3): 187 | origin.append(float(t[j + 1])) 188 | grid = [] 189 | step = [] 190 | for i in range(3): 191 | s = h.readline() 192 | t = s.split() 193 | grid.append(int(t[0])) 194 | step.append([]) 195 | for j in range(3): 196 | step[i].append(float(t[j + 1])) 197 | for i in range(na): 198 | s = h.readline() 199 | t = s.split() 200 | aspecies.append(int(t[0])) 201 | acharge.append(float(t[1])) 202 | aposition.append([]) 203 | for j in range(3): 204 | aposition[i].append(float(t[j + 2])) 205 | n = grid[0] * grid[1] * ((grid[2] - 1) / 6 + 1) 206 | i = 0 207 | j = 0 208 | k = 0 209 | for m in range(n): 210 | s = h.readline() 211 | t = s.split() 212 | for l in range(6): 213 | if k < grid[2]: 214 | vol[i][j].append(float(t[l])) 215 | k += 1 216 | if k == grid[2]: 217 | k = 0 218 | j += 1 219 | if j < grid[1]: 220 | vol[i].append([]) 221 | else: 222 | k = 0 223 | j = 0 224 | i += 1 225 | if i < grid[0]: 226 | vol.append([[]]) 227 | h.close() 228 | return ierr, na, aspecies, acharge, aposition, grid, origin, step, vol 229 | 230 | if __name__ == "__main__": 231 | import sys, string 232 | import math 233 | import numpy as np 234 | 235 | if len(sys.argv) == 1: 236 | print("Please provide input file after call: plavg.py input_file") 237 | sys.exit() 238 | 239 | file_inp,file_type,dir,factor,cell_dim = read_input(sys.argv[1]) 240 | if dir != "a1" and dir != "a2" and dir != "a3": 241 | print("Please specify plt_dir in the input file. It takes a1/a2/a3") 242 | sys.exit() 243 | if file_type != "cube" and file_type != "xsf" and file_type != "python": 244 | print("Please specify file_type in the input file. It takes cube/xsf/python") 245 | if file_type == "cube": 246 | ierr, na, aspecies, acharge, aposition, grid, origin, step, vol = cub_read(file_inp) 247 | elif file_type == "xsf": 248 | na, primcoord, grid, origin, step, vol = xsf_read(file_inp) 249 | elif file_type == "python": 250 | grid,vol = py_read(file_inp) 251 | 252 | vol = np.array(vol) 253 | print("Shape of the data in the file:", np.shape(vol)) 254 | if dir == "a1": 255 | if file_type == "python": 256 | step_l = cell_dim/grid[0] 257 | else: 258 | step_l = np.sqrt(np.dot(step[0],step[0])) 259 | vol_a1, A1 = pl_avg_a1(vol,grid[0],grid[1],grid[2], step_l,factor) 260 | write2file("plavg_a1.plot",A1,vol_a1) 261 | if dir == "a2": 262 | if file_type == "python": 263 | step_l = cell_dim/grid[1] 264 | else: 265 | step_l = np.sqrt(np.dot(step[1],step[1])) 266 | vol_a2, A2 = pl_avg_a2(vol,grid[0],grid[1],grid[2], step_l,factor) 267 | write2file("plavg_a2.plot",A2,vol_a2) 268 | if dir == "a3": 269 | if file_type == "python": 270 | step_l = cell_dim/grid[2] 271 | else: 272 | step_l = np.sqrt(np.dot(step[2],step[2])) 273 | vol_a3, A3 = pl_avg_a3(vol,grid[0],grid[1],grid[2], step_l,factor) 274 | write2file("plavg_a3.plot",A3,vol_a3) 275 | sys.exit() 276 | -------------------------------------------------------------------------------- /PotentialAlignment/dV_0p.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ## 3 | ## dV_0p.py plots (V_0 - V_p), planar averaged. 4 | ## V_0 is the total DFT potential of the neutral defect 5 | ## V_p is the pristine DFT potential of the same size cell 6 | ## 7 | import sys, string 8 | import numpy as np 9 | from Utilities import * 10 | 11 | 12 | 13 | def read_input(file_name): 14 | cell_dim = 1.0 15 | factor = None 16 | charge = -1 17 | plt_dir = 'a1' 18 | fp = open(file_name,'r') 19 | lines = fp.readlines() 20 | for il in range(len(lines)): 21 | if "file_neutral" in lines[il]: 22 | w = string.split(lines[il].rstrip(),"=") 23 | if len(w) < 2 or len(w) > 3: 24 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 25 | sys.exit() 26 | file_n = string.split(w[1])[0] 27 | if "file_pristine" in lines[il]: 28 | w = string.split(lines[il].rstrip(),"=") 29 | if len(w) < 2 or len(w) > 3: 30 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 31 | sys.exit() 32 | file_p = string.split(w[1])[0] 33 | if "file_type" in lines[il]: 34 | w = string.split(lines[il].rstrip(),"=") 35 | if len(w) < 2 or len(w) > 3: 36 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 37 | sys.exit() 38 | file_type = string.split(w[1])[0] 39 | if "plt_dir" in lines[il]: 40 | w = string.split(lines[il].rstrip(),"=") 41 | if len(w) < 2 or len(w) > 3: 42 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 43 | sys.exit() 44 | plt_dir = string.split(w[1])[0] 45 | if "factor" in lines[il]: 46 | w = string.split(lines[il].rstrip(),"=") 47 | if len(w) < 2 or len(w) > 3: 48 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 49 | sys.exit() 50 | factor = w[1].split()[0] 51 | if "charge" in lines[il]: 52 | w = string.split(lines[il].rstrip(),"=") 53 | if len(w) < 2 or len(w) > 3: 54 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 55 | sys.exit() 56 | charge = eval(w[1]) 57 | return file_n,file_p,file_type,plt_dir,factor,charge 58 | 59 | if len(sys.argv) == 1: 60 | print("Please provide input file after call: dV_0p.py input_file") 61 | sys.exit() 62 | # Read the input file 63 | file_n,file_p,file_type,dir,factor,charge = read_input(sys.argv[1]) 64 | if dir != "a1" and dir != "a2" and dir != "a3": 65 | print("Please specify plt_dir in the input file. It takes a1/a2/a3") 66 | sys.exit() 67 | if file_type != "cube" and file_type != "xsf": 68 | print("Please specify file_type in the input file. It takes cube/xsf") 69 | 70 | # Read the DFT potential files 71 | if file_type == "cube": 72 | ierr, na, aspecies, acharge, aposition, grid, origin, step, vol_n = cub_read(file_n) 73 | ierr, na, aspecies, acharge, aposition, grid, origin, step, vol_p = cub_read(file_p) 74 | elif file_type == "xsf": 75 | na, primcoord, grid, origin, step, vol_n = xsf_read(file_n) 76 | na, primcoord, grid, origin, step, vol_p = xsf_read(file_p) 77 | 78 | # Compute the difference 79 | vol = (np.array(vol_n) - np.array(vol_p))*charge 80 | 81 | print("Shape of the data in the file:", np.shape(vol)) 82 | if dir == "a1": 83 | step_l = np.sqrt(np.dot(step[0],step[0])) 84 | vol_a1, A1 = pl_avg_a1(vol,grid[0],grid[1],grid[2], step_l,factor) 85 | write2file("pa_dv0p_a1.plot",A1,vol_a1) 86 | if dir == "a2": 87 | step_l = np.sqrt(np.dot(step[1],step[1])) 88 | vol_a2, A2 = pl_avg_a2(vol,grid[0],grid[1],grid[2], step_l,factor) 89 | write2file("pa_dv0p_a2.plot",A2,vol_a2) 90 | if dir == "a3": 91 | step_l = np.sqrt(np.dot(step[2],step[2])) 92 | vol_a3, A3 = pl_avg_a3(vol,grid[0],grid[1],grid[2], step_l,factor) 93 | write2file("pa_dv0p_a3.plot",A3,vol_a3) 94 | -------------------------------------------------------------------------------- /PotentialAlignment/dV_mD.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ## 3 | ## dV_0p.py plots (V_0 - V_p), planar averaged. 4 | ## V_0 is the total DFT potential of the neutral defect 5 | ## V_p is the pristine DFT potential of the same size cell 6 | ## 7 | 8 | import sys, string 9 | import numpy as np 10 | from Utilities import * 11 | 12 | 13 | def read_input(file_name): 14 | fp = open(file_name,'r') 15 | lines = fp.readlines() 16 | for il in range(len(lines)): 17 | if "file_charged" in lines[il]: 18 | w = lines[il].split("=") 19 | if len(w) < 2 or len(w) > 3: 20 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 21 | sys.exit() 22 | file_q = w[1].split()[0] 23 | if "file_neutral" in lines[il]: 24 | w = lines[il].split("=") 25 | if len(w) < 2 or len(w) > 3: 26 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 27 | sys.exit() 28 | file_n = w[1].split()[0] 29 | if "file_model" in lines[il]: 30 | w = lines[il].split("=") 31 | if len(w) < 2 or len(w) > 3: 32 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 33 | sys.exit() 34 | file_m_py = w[1].split()[0] 35 | if "file_type" in lines[il]: 36 | w = lines[il].split("=") 37 | if len(w) < 2 or len(w) > 3: 38 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 39 | sys.exit() 40 | file_type = w[1].split()[0] 41 | if "plt_dir" in lines[il]: 42 | w = lines[il].split("=") 43 | if len(w) < 2 or len(w) > 3: 44 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 45 | sys.exit() 46 | plt_dir = w[1].split()[0] 47 | if "factor" in lines[il]: 48 | w = lines[il].split("=") 49 | if len(w) < 2 or len(w) > 3: 50 | print("ERROR while parsing input file: %s, line: %d"%(file_name,il)) 51 | sys.exit() 52 | factor = w[1].split()[0] 53 | return file_q,file_n,file_m_py,file_type,plt_dir,factor 54 | 55 | if __name__ == "__main__": 56 | 57 | # Check for the input file 58 | if len(sys.argv) == 1: 59 | print("Please provide input file after call: dV_mD.py input_file") 60 | sys.exit() 61 | 62 | # Read the input file 63 | file_q,file_n,file_m_py,file_type,dir,factor = read_input(sys.argv[1]) 64 | if dir != "a1" and dir != "a2" and dir != "a3": 65 | print("Please specify plt_dir in the input file. It takes a1/a2/a3") 66 | sys.exit() 67 | if file_type != "cube" and file_type != "xsf": 68 | print("Please specify file_type in the input file. It takes cube/xsf") 69 | sys.exit() 70 | 71 | # Read the DFT potential files 72 | if file_type == "cube": 73 | ierr, na, aspecies, acharge, aposition, grid, origin, step, vol_q = cub_read(file_q) 74 | ierr, na, aspecies, acharge, aposition, grid, origin, step, vol_n = cub_read(file_n) 75 | elif file_type == "xsf": 76 | na, primcoord, grid, origin, step, vol_q = xsf_read(file_q) 77 | na, primcoord, grid, origin, step, vol_n = xsf_read(file_n) 78 | 79 | 80 | # Read the model potential (python) file: 81 | grid_py,vol_m = py_read(file_m_py) 82 | 83 | # We will use the same cell_dim for model potential plot 84 | # as read from the DFT potential file. 85 | 86 | 87 | # DFT difference potential: 88 | vol = np.array(vol_q) - np.array(vol_n) 89 | print "dir", dir 90 | 91 | print("Shape of the data in the file:", np.shape(vol)) 92 | print("The first column in the files is in bohr") 93 | 94 | # Planar average the DFT difference and the model potential 95 | # and write the plot to file 96 | if dir == "a1": 97 | step_l = np.sqrt(np.dot(step[0],step[0])) 98 | vol_a1, A1 = pl_avg_a1(vol,grid[0],grid[1],grid[2], step_l,factor) 99 | write2file("DFTdiff_a1.plot",A1,vol_a1) 100 | # cell_dim1 is step_l*grid[0], in bohr 101 | step_n = step_l*grid[0]/grid_py[0] 102 | vol_a1_py, A1_py = pl_avg_a1(vol_m,grid_py[0],grid_py[1],grid_py[2], step_n,None) 103 | write2file("model_a1.plot",A1_py,vol_a1_py) 104 | if dir == "a2": 105 | step_l = np.sqrt(np.dot(step[1],step[1])) 106 | vol_a2, A2 = pl_avg_a2(vol,grid[0],grid[1],grid[2], step_l,factor) 107 | write2file("DFTdiff_a2.plot",A2,vol_a2) 108 | # cell_dim2 is step_l*grid[1], in bohr 109 | step_n = step_l*grid[1]/grid_py[1] 110 | vol_a2_py, A2_py = pl_avg_a2(vol_m,grid_py[0],grid_py[1],grid_py[2], step_n,None) 111 | write2file("model_a2.plot",A2_py,vol_a2_py) 112 | if dir == "a3": 113 | step_l = np.sqrt(np.dot(step[2],step[2])) 114 | vol_a3, A3 = pl_avg_a3(vol,grid[0],grid[1],grid[2], step_l,factor) 115 | write2file("DFTdiff_a3.plot",A3,vol_a3) 116 | # cell_dim3 is step_l*grid[2], in bohr 117 | step_n = step_l*grid[2]/grid_py[2] 118 | vol_a3_py, A3_py = pl_avg_a3(vol_m,grid_py[0],grid_py[1],grid_py[2], step_n,None) 119 | write2file("model_a3.plot",A3_py,vol_a3_py) 120 | sys.exit() 121 | -------------------------------------------------------------------------------- /PotentialAlignment/in_dV_0p: -------------------------------------------------------------------------------- 1 | &dV_mD 2 | file_type = cube 3 | file_pristine = V_p.cube 4 | file_neutral = V_0.cube 5 | charge = -2 6 | plt_dir = a1 7 | factor = Ryd 8 | / 9 | -------------------------------------------------------------------------------- /PotentialAlignment/in_dV_mD: -------------------------------------------------------------------------------- 1 | &dV_mD 2 | file_type = cube 3 | file_model = V_r.npy 4 | file_charged = V_q.cube 5 | file_neutral = V_0.cube 6 | plt_dir = a1 7 | factor = Ryd 8 | / 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CoFFEE 2 | Corrections for formation energy and eigenvalues for charged defect simulations 3 | 4 | CoFFEE: Corrections For Formation Energy and Eigenvalues is a complete electrostatic corrections package applicable to charged defects in 3D (bulk), 2D (slabs, 2D materials) and 1D (nanowires, nanoribbons) systems. The code is released under the BSD license. Please cite the following paper if you use this code in your work: 5 | 6 | CoFFEE: Corrections For Formation Energy and Eigenvalues for charged defect simulations, Mit H. Naik and Manish Jain, Computer Physics Communications **226**, 114 - 126 (2018). [[link]](http://www.sciencedirect.com/science/article/pii/S0010465518300158) [[arxiv]](https://arxiv.org/abs/1705.01491) 7 | 8 | The UserGuide.pdf helps you run through the installation, 9 | examples and in setup of your input files for the code. 10 | 11 | ---------------------------------------------------------- 12 | 13 | DEPENDENCIES: 14 | 15 | 1. SciPy (https://www.scipy.org/install.html) 16 | 2. NumPy (https://docs.scipy.org/doc/numpy/user/install.html) 17 | 3. mpi4py (https://mpi4py.scipy.org/docs/usrman/install.html) 18 | 4. matplotlib (http://matplotlib.org/users/installing.html) 19 | 5. Cython, if you wish to make any changes to the Poisson solver. 20 | 21 | ---------------------------------------------------------- 22 | 23 | INSTALL: 24 | 25 | Run the following command from the CoFFEE folder: 26 | 27 | python3 setup.py build_ext -b PoissonSolver/ 28 | 29 | This checks for the dependencies and compiles the 30 | C routines in the folders: 31 | - PoissonSolver/MV_2D_cy/, 32 | - PoissonSolver/MV_1D_cy/ and 33 | - PoissonSolver/PS_3D_cy/ 34 | 35 | If you have Cython intalled, this command will first 36 | Cythonize the .pyx files present in these directories, 37 | and then compile the .c file generated. 38 | 39 | On compiling the C code, this creates the following .so files in 40 | the PoissonSolver/ folder: 41 | - matvec1D.so 42 | - matvec2D.so 43 | - ps3D.so 44 | 45 | (In case these file names have changed for some reason, you would have to 46 | rename them to the above.) 47 | 48 | (Run clean.py to remove the .so files before recompilation) 49 | 50 | --------------------------------------------------------- 51 | 52 | To report current bugs or problems, contact 53 | - Mit H. Naik: mitwise@gmail.com 54 | - Manish Jain: mjain@iisc.ac.in 55 | 56 | --------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | 2 | CoFFEE: Corrections For Formation Energy and Eigenvalues 3 | is a complete electrostatic corrections package applicable 4 | to charged defects in 3D (bulk), 2D (slabs, 2D materials) and 5 | 1D (nanowires, nanoribbons) systems. The code is released 6 | under the BSD license. Please cite the following paper if 7 | you use this code in your work: 8 | 9 | CoFFEE: Corrections For Formation Energy and Eigenvalues for charged defect simulations, 10 | Mit H. Naik and Manish Jain, 11 | Computer Physics Communications 226, 114 - 126 (2018). 12 | http://www.sciencedirect.com/science/article/pii/S0010465518300158 13 | https://arxiv.org/abs/1705.01491 14 | 15 | The UserGuide.pdf helps you run through the installation, 16 | examples and in setup of your input files for the code. 17 | 18 | ---------------------------------------------------------- 19 | 20 | DEPENDENCIES: 21 | 22 | 1. SciPy (https://www.scipy.org/install.html) 23 | 2. NumPy (https://docs.scipy.org/doc/numpy/user/install.html) 24 | 3. mpi4py (https://mpi4py.scipy.org/docs/usrman/install.html) 25 | 4. matplotlib (http://matplotlib.org/users/installing.html) 26 | 5. Cython, if you wish to make any changes to the Poisson solver. 27 | 28 | ---------------------------------------------------------- 29 | 30 | INSTALL: 31 | 32 | Run the following command from the CoFFEE folder: 33 | 34 | python3 setup.py build_ext -b PoissonSolver/ 35 | 36 | This checks for the dependencies and compiles the 37 | C routines in the folders: 38 | PoissonSolver/MV_2D_cy/, 39 | PoissonSolver/MV_1D_cy/ and 40 | PoissonSolver/PS_3D_cy/ 41 | 42 | If you have Cython intalled, this command will first 43 | Cythonize the .pyx files present in these directories, 44 | and then compile the .c file generated. 45 | 46 | On compiling the C code, this creates the following .so files in 47 | the PoissonSolver/ folder: 48 | matvec1D.so 49 | matvec2D.so 50 | ps3D.so 51 | 52 | (In case these file names have changed for some reason, you would have to 53 | rename them to the above.) 54 | 55 | (Run clean.py to remove the .so files before recompilation) 56 | 57 | --------------------------------------------------------- 58 | 59 | To report current bugs or problems, contact 60 | Mit H. Naik: mitwise@gmail.com 61 | Manish Jain: mjain@iisc.ac.in 62 | 63 | --------------------------------------------------------- 64 | -------------------------------------------------------------------------------- /UserGuide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qtm-iisc/CoFFEE/ba992b45ecda6b7d0d8872085eab8c6902f136d8/UserGuide.pdf -------------------------------------------------------------------------------- /clean.py: -------------------------------------------------------------------------------- 1 | import os 2 | path = ["PoissonSolver/matvec1D.so","PoissonSolver/matvec2D.so","PoissonSolver/ps3d.so"] 3 | for p in path: 4 | if os.path.isfile(p): 5 | os.remove(p) 6 | print(".so files removed") 7 | -------------------------------------------------------------------------------- /coffee.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys, string 3 | import numpy as np 4 | from math import * 5 | from PoissonSolver import * 6 | from scipy.sparse.linalg import LinearOperator, cg, cgs, bicgstab 7 | from mpi4py import MPI 8 | import time 9 | 10 | ryd = 13.605698066 11 | start_time = time.time() 12 | comm = MPI.COMM_WORLD 13 | size = comm.size 14 | rank = comm.rank 15 | 16 | if len(sys.argv) == 1: 17 | print("Please provide input file after call: coffee.py input_file") 18 | sys.exit() 19 | #print "Reading input from" 20 | if rank == 0: 21 | display_init() 22 | print("Running on %d processor(s)"%(comm.size)) 23 | 24 | # Initalize the cell class 25 | c = cell() 26 | # Read in the cell parameters from input file, file_in. 27 | file_in = sys.argv[1] 28 | c.read_params(file_in) 29 | # Display params: 30 | if rank == 0: 31 | c.disp_params() 32 | 33 | # Initalize the dielectric profile class 34 | eps = diel_profile() 35 | # Read in the epsilon profile parameters from input file, file_in. 36 | eps.read_params(file_in) 37 | 38 | # Initalize the gaussian model charge class 39 | charge = gaussian() 40 | # Read in the gaussian paramters from input file, file_in. 41 | if rank == 0: 42 | charge.read_params(file_in) 43 | charge.disp_params() 44 | 45 | # Initialize the calculation. Compute the FFT and real space grids. 46 | imax, jmax, kmax = c.init_calc() 47 | 48 | construct_eps(c,eps,imax,jmax,kmax) 49 | # Display params: 50 | if rank == 0: 51 | eps.disp_params() 52 | 53 | if rank==0: 54 | print("Grid: %d, %d, %d"%( 2*imax + 1, 2*jmax + 1, 2*kmax + 1)) 55 | 56 | GlobalValues.c_g = c 57 | GlobalValues.kmax = kmax 58 | GlobalValues.lmax = imax 59 | GlobalValues.mmax = jmax 60 | GlobalValues.eps_g = eps 61 | 62 | V_r = Solver(c,charge,eps,imax,jmax,kmax,comm) 63 | if rank==0: 64 | # V_r = IFFTnew( V_G, imax, jmax, kmax) 65 | ComputeEnergy(V_r,charge.rho_r,imax,jmax,kmax,c) 66 | np.save("V_r",V_r*2.*ryd) 67 | Exec_time=time.time()-start_time 68 | if rank == 0: 69 | print("Execution time: %.2f s"%(Exec_time)) 70 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | from distutils.extension import Extension 3 | import os 4 | #from Cython.Distutils import build_ext 5 | 6 | #Check the dependencies 7 | try: 8 | import scipy 9 | except ImportError: 10 | print("scipy not found. Please install scipy: https://www.scipy.org/install.html") 11 | 12 | try: 13 | import numpy 14 | except ImportError: 15 | print("Numpy not found. Please install Numpy: https://docs.scipy.org/doc/numpy/user/install.html") 16 | 17 | try: 18 | import mpi4py 19 | except ImportError: 20 | print("mpi4py not found. Please install mpi4py: https://mpi4py.scipy.org/docs/usrman/install.html") 21 | 22 | try: 23 | import matplotlib 24 | except ImportError: 25 | print("matplotlib not found. Please install matplotlib: http://matplotlib.org/users/installing.html") 26 | 27 | 28 | # If Cython is installed, cythonize the .pyx files. 29 | # Else, the .c files are used. 30 | try: 31 | from Cython.Distutils import build_ext 32 | except ImportError: 33 | use_cython = False 34 | else: 35 | use_cython = True 36 | 37 | use_cython = False 38 | 39 | cmdclass = {} 40 | if use_cython: 41 | ext_modules=[ Extension("matvec2D", 42 | ["PoissonSolver/MV_2D_cy/matvec2D.pyx"], 43 | extra_compile_args = ["-ffast-math"]), 44 | Extension("matvec1D", 45 | ["PoissonSolver/MV_1D_cy/matvec1D.pyx"], 46 | extra_compile_args = ["-ffast-math"]), 47 | Extension("ps3d", 48 | ["PoissonSolver/PS_3D_cy/ps3d.pyx"], 49 | extra_compile_args = ["-ffast-math"]) 50 | ] 51 | cmdclass.update({ 'build_ext': build_ext }) 52 | else: 53 | ext_modules=[ Extension("matvec2D", 54 | ["PoissonSolver/MV_2D_cy/matvec2D.c"], 55 | extra_compile_args = ["-ffast-math"]), 56 | Extension("matvec1D", 57 | ["PoissonSolver/MV_1D_cy/matvec1D.c"], 58 | extra_compile_args = ["-ffast-math"]), 59 | Extension("ps3d", 60 | ["PoissonSolver/PS_3D_cy/ps3d.c"], 61 | extra_compile_args = ["-ffast-math"]) 62 | ] 63 | 64 | setup( 65 | name = "CoFFEE", 66 | author="Mit H Naik", 67 | author_email = "mitwise@gmail.com", 68 | cmdclass = cmdclass, 69 | ext_modules = ext_modules, 70 | include_dirs = [numpy.get_include()] 71 | ) 72 | 73 | os.system("mv PoissonSolver/matvec1D*.so PoissonSolver/matvec1D.so") 74 | os.system("mv PoissonSolver/matvec2D*.so PoissonSolver/matvec2D.so") 75 | os.system("mv PoissonSolver/ps3d*.so PoissonSolver/ps3d.so") 76 | --------------------------------------------------------------------------------