Package: diamond-bandalyzer
BandalyzerHighly customisable analysis of electronic bands in diamond, with a particular focus on near surface electronics.Installation instructions:Windows:The bandalyzer depends on numpy and scipy libraries.  The easiest way to install these pre-compiled is via miniconda.
The bandalyzer depends on a fd-int, precompiled versions exist for python 3.6 and 3.8.
Recommended installation instructions:InstallminicondaOpen up the anaconda prompt.Create a python 3.8 environmentconda create -n myenvname python=3.8Activateconda activate myenvnameInstall the banalyzerpip install diamond-bandalyzerLinux:In your preferred environment use pip to directly install.pip install diamond-bandalyzerTo use the solver ensure you are in the correct environment:For windows this means opening up the anaconda prompt and activating the conda python 3.8 environmentconda activate myenvnameOnce the environment where the bandalyzer is installed you can run:$diamondsolveFor now this readme, the built in help, .ini file comments and the incomplete source-code comments are the only sources of documentation.Basic usage pathway:First initalise the directory where you want to keep the solutions with:$diamondsolve init <directory>In that directory a settings.ini and defects.ini file will be created.  Modify these files so that you are solving the diamond
of interest.  You can check if you are happy with the chosen parameters before running with:$diamondsolve solve <directory> --dry-runIt can also be very instructive to live-plot a single surface charge (q_external) before solving for a full range of Q external:$diamondsolve solve <directory> --live-plot <a single Q_external>This will solve for the closest q_external specified in the the settings.ini to the chosen single q_external value. The
output is saved as a .txt file and can be re-input when solving the rest of the diamond with:$diamondsolve solve -i <output solution space>To partially validate the solver you can run the z_shift_test.py script found in the validation_tests sub package.
Partial validation can also be obtained by running intrinsic_test.py which provides comparison of intrsnsic diamond to published theory.For development:Install virtualenv on your system (preferably through your package manager 'python-virtualenv', or pip install virtualenv)
In the project folder (bandalyzer/) run:$virtualenv venvor if you want the virtualenv to symlink to use your system packages that already exsit.$virtualenv venv --system-site-packagesIf you have multiple versions of python installed you may need to specify python 3.8, seehttps://virtualenv.pypa.io/en/stable/for more information.To activate your new python virtual environment from the project folder (or anywhere just adjust path accordingly)$. venv/bin/activateThis should drop you into the virtual environment shell(venv) [ ... ]$From the project folder, and whilst in the virtual environment run:(venv) [ ... ]$pip install . -eThis will install the project into the virtualenv, the -e flag tells pip it is editable, so any changes you make to the code
will be incorporated into the program (technically instead of installing the package as an unchangeable .egg, the .egg is just a symlink to the src-code)From here on out, when things don't work/throw errors we submit it as an issue into gitlab :)If you want tab completion for filenames to work within the diamondsolve command we need to add an activation script to your shell completer.
This script is auto generated for bash by running (seehttps://click.palletsprojects.com/en/7.x/bashcomplete/for other shells):$DIAMONDSOLVE_COMPLETE=source_bash diamondsolveIn arch with bash shell using bash-completion i did this:sudo _DIAMONDSOLVE_COMPLETE=source_bash diamondsolve > /usr/share/bash-completion/completions/diamondsolveRelease v0.4.1:Updated ReadmeFixed bug that caused incorrect scaling of defects defined with an areal density.Fixed a bug where initial files where sought out even when specified by user.Release v0.4.0:Fixed bug in N-R codeImplemented defects that form bands not 'dirac delta' energy profiles.  Polycrystalline grain boundary diamond added to defect library as GB.Surface defects now specified in defect file not settings file, this is messy atm but functional.  Surface Acceptor defect added to defect library as sp2.Code de-optimised as a result of this change.Made solver output in user specified units, regardless of underlying unit system being implemented.TODOSolver code:Implement Schrodinger Equation for near surface region.Implement multi-dimensional solver.Not have functions do things other than named, i.e. e_field_from_rho computing e_field_from_v in SP-NR solver.Have schordingerpoissonequation class inherit poissonequation class, to remove repeated code!Estimator function for the inital Fermi level of a diamond, build in PossionEquations Class.Plotting framework than can wrap solver/equation class and provide live plots of solution defect densitiesGet rewritten relaxation solver to converge.Get NR solver to convergeExtend the defect.ini to include general acceptor/donor surface states, removing the sp2 definition from settings.ini.NewtonRhapsonPoisson solver class, inherets solver, poissonequations. Uses NewtonRhapson over Relaxation.Schrodinger-poissonequation class, inherets poissonequations. Solves schordinger equation near surface to ensure quantum properties of holes accounted for.Full solve to obtain V(Qsa, z), diamond potential for a given adsorbed charge.Implement Logger, Logging and optional Log saving.Generalise the solver with a materials class and library that can be taken (inherited) by PoissonEquations and provide relevant equations.Auto z-mesh generatorDerivative stencils can be reused with changing QexternalFind alternate instantiation path to avoid too-high memory situation, i.e.e len(z_mesh)**2*8)B currently required for stencil definition.Improve method of monitoring excess charges in solutions.Solve to step change convergence (average step change constant over some window).  Linesolve implemented.Testing:Testing framework that ensures potential/e-field/charge density equations give correct outputs.Testing framework that plots diamond defect definitions (to rapidly visualise poorly implemented diamonds). Started - see devOnly/structure_test.pyTesting framework that plots and compares specific solutions (no defects, constant defect) to original method and published theory.Ensure no settings names are capitalised - automate if need to be done again.Validation:Add z-shift validation test.Settings:Saving and loading of Settings in JSON files, build in SettingsObject base class.Create comments for default-settings.iniAutomatically store and add comments default-settings.iniFunction that strips and applies comments to a .ini file, so the the default-settings comments can propagate to instance settings files.Allow for capitalised settings names - maybe?CLI:Implment command line interface, CLI, for initalising and solving diamonds.Plot help automatically generate help option documentation from plotting definition comments.Implement check command.Implement progress bar.Packaging:Make it so that config files get copied on pip installLearn how to manage a package on PyPiFix FDint so that a c++ compiler is not required to install, pre-complied wheel?  Look into it.Check command needs to check:Syntax Errors in Settings and Defects Files.Solver type existsArray sizes make senseGenerate expected resource utilisation, memory, CPU core running time.Documentation:Add surface charge calculations and mathematical convolution approach to latex.Add newton rhapson solver to latex.