semicon issueshttps://gitlab.kwant-project.org/groups/semicon/-/issues2018-12-17T14:50:18Zhttps://gitlab.kwant-project.org/semicon/semicon/-/issues/6add tests that covers decent part of code2018-12-17T14:50:18ZRafal Skolasinskiadd tests that covers decent part of codebeta versionhttps://gitlab.kwant-project.org/semicon/semicon/-/issues/12arbitrary growth directions2018-12-17T14:50:06ZRafal Skolasinskiarbitrary growth directionsAdd support for arbitrary growth direction, e.g. wire grown in [110] or [111] direction.
Idea from Daniel: make user provide how crystallographic axes looks in new system axis, aka rotation matrix ``R`` and use [scipy.spatial.transform]...Add support for arbitrary growth direction, e.g. wire grown in [110] or [111] direction.
Idea from Daniel: make user provide how crystallographic axes looks in new system axis, aka rotation matrix ``R`` and use [scipy.spatial.transform](https://scipy.github.io/devdocs/generated/scipy.spatial.transform.Rotation.html#scipy.spatial.transform.Rotation) to get rotation vector ``n``.
Then rotation matrix ``R`` can be used to transform momentum operators, as well as magnetic and electric field, and ``scipy.linalg.expm(1j * np.dot(n, S_total))`` will be used as unitary basis transformation for spin components.alpha versionhttps://gitlab.kwant-project.org/semicon/semicon/-/issues/15make a PyPi release2018-12-17T14:49:43ZRafal Skolasinskimake a PyPi releasefinal releasehttps://gitlab.kwant-project.org/semicon/semicon/-/issues/16design decisions2018-12-17T14:49:33ZRafal Skolasinskidesign decisionsTo summarise discussion (10/09/2018) about Semicon design:
* Renormalization parameters (effective parameters -> bare parameters) should be separated from workaround the spurious solution. This will simplify the logic and make more visi...To summarise discussion (10/09/2018) about Semicon design:
* Renormalization parameters (effective parameters -> bare parameters) should be separated from workaround the spurious solution. This will simplify the logic and make more visible distinction between these two operations.
* Parameters should be more tight with the model, as the parameter renormalization (see point 1) is model dependent.
* Helper that provides piece-wise parameter functions for stacking different materials should be more general.
-------
# API Design
In addition to keeping in mind above few suggestions lets make this thread a general discussion about the API design.
## Need for more abstraction in API
In addition to Kane model that describes well Zincblende structures we should also make room to easily provide e.g. Wurtzide models (see issue https://gitlab.kwant-project.org/semicon/semicon/issues/1). These models in principle will have different Hamiltonians and parameters.
Specialised models, like ``Zincblende``, could inherit from a base bulk ``Model``:
```mermaid
graph TD;
Model-->Zincblende;
Model-->Wurtzite;
Model-->...;
```
Base ``Model`` would also guarantee that required API elements like ``hamiltonian`` and ``parameters`` are implemented:
```mermaid
graph TD;
Model-->hamiltonian;
Model-->parameters;
Model-->...;
```
## Required information for a specific components
* **Hamiltonian:** Hamiltonian requires information about present ``coords``, ``bands`` and ``components``
* **Parameters:** Bulk parameters require information about present ``bands``, ``components`` (so that it can be verified that required parameters are present) and the ``databank`` (source of the parameters).
Of course ``parameters`` are material specific (different for InAs or GaSb) whereas same ``Hamiltonian`` will be used for all materials present in the simulation, as the main idea for dealing with heterostructures with k.p models is to use same Hamiltonian with parameters that vary in space).
Regarding the following I believe that:
* ``components`` and ``bands`` should be provided via constructor
* ``hamiltonian`` should be a property
* ``parameters`` should be a method that takes single parameter about the material.
## Removing spurious solution
There should be a way to easily remove spurious solutions.
It is probably good to logically separate this operation from ``Model.parameters`` method.
As this is model specific it may be good idea to introduce a new class (of which instances are returned by ``Model.parameters`` that has a convenience methods to remove spurious solutions, e.g.
```python
model = Zincblende(bands=..., components=....)
InAs = model.parameters('InAs')
InAs = InAs.renormalize(gamma_0=1)
```
where InAs would be of type
```python
class ZincblendeParameters(Parameters):
pass
```
This in principle would allow to get all required parameters as
```python
parameters = {k: model.parameters(material=k).renormalize(gamma_0=1)
for k in ['InAs', 'GaSb', 'AlSb']}
```
## Beyond bulk models
Above discussion covers the bulk models and specify interface for getting Hamiltonians and parameters. Beyond bulk systems ``semicon`` should also handle various heterostructures (like 2DEGs or nanowires) that in principle can be made out of few different materials and have different growth directions.
### Heterostructure parameters
For heterostructures some of bulk parameters (that would go into ``syst.hamiltonian_submatrix`` argument ``params``) will be a space dependent function instead of a scalar.
For example material band edges ``E_c`` and ``E_v`` for a 2DEG will now be ``E_c(z)`` and ``E_v(z)`` that can look for example like following:
![Screenshot_20180917_161533](/uploads/fa21258a7ff36b657899812885cc6c4f/Screenshot_20180917_161533.png)
To create such a function one require:
* bulk parameters of each of present materials
* mapping: coordinate -> material name
* site locations (to properly conduct the interpolation procedure)
### Different growth directions
Procedure details are discussed in issue https://gitlab.kwant-project.org/semicon/semicon/issues/12. This operation require to know:
* information about new crystal axes orientation (provided through rotation matrix R)
* spin operators of the model's basis: this should be provided through method of a bulk ``Model`` as it requires to know the present ``bands``.
As this is generally useful I see implementation of a function that does the main job in collection of helper functions, e.g.
```python
def rotate(hamiltonian_matrix, R, S):
pass
```
and Model's having a method ``Model.rotate(R)`` that returns a copy of rotated Hamiltonian.
# Things to also keep in mind
But all means not complete list things I don't know where to put yet:
* parameters plotting
* shapes library
* where to provide support for ternary alloys? https://gitlab.kwant-project.org/semicon/semicon/-/issues/18databank files are not included when pip installing2018-12-13T12:30:02ZJoseph Westondatabank files are not included when pip installingafter `pip install`ing semicon following the readme:
```
$ python -c "import semicon; semicon.parameters.bulk('lawaetz', 'AlSb', 1.0, valence_band_offset=0.0)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
...after `pip install`ing semicon following the readme:
```
$ python -c "import semicon; semicon.parameters.bulk('lawaetz', 'AlSb', 1.0, valence_band_offset=0.0)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/jbw/.local/miniconda/envs/testu/lib/python3.6/site-packages/semicon/parameters.py", line 153, in bulk
dict_pars = load_params(bank)[material]
File "/home/jbw/.local/miniconda/envs/testu/lib/python3.6/site-packages/semicon/parameters.py", line 47, in load_params
with open(fpath, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/jbw/.local/miniconda/envs/testu/lib/python3.6/site-packages/semicon/databank/bank_lawaetz.yml'
```
These files need to be properly included in the manifest so that they are packaged correctly.https://gitlab.kwant-project.org/semicon/semicon/-/issues/17undeclared dependencies2018-12-13T12:20:36ZJoseph Westonundeclared dependenciesI created a conda environment and installed kwant and semicon like so:
```
conda create -n test-env
source activate test-env
conda install kwant=1.3.3
pip install git+https://gitlab.kwant-project.org/semicon/semicon.git
```
Then
```
$ ...I created a conda environment and installed kwant and semicon like so:
```
conda create -n test-env
source activate test-env
conda install kwant=1.3.3
pip install git+https://gitlab.kwant-project.org/semicon/semicon.git
```
Then
```
$ python -c 'import semicon'
File "/home/jbw/.local/miniconda/envs/testu/lib/python3.6/site-packages/semicon/__init__.py", line 5, in <module>
exec('from . import {0}'.format(module))
File "<string>", line 1, in <module>
File "/home/jbw/.local/miniconda/envs/testu/lib/python3.6/site-packages/semicon/parameters.py", line 4, in <module>
import yaml
ModuleNotFoundError: No module named 'yaml'
```
once I install `pyyaml` I get a similar error that `xarray` needs to be installed.
After installing these packages I then try to import semicon again:
```
$ python -c 'import semicon'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/jbw/.local/miniconda/envs/testu/lib/python3.6/site-packages/semicon/__init__.py", line 5, in <module>
exec('from . import {0}'.format(module))
File "<string>", line 1, in <module>
File "/home/jbw/.local/miniconda/envs/testu/lib/python3.6/site-packages/semicon/models.py", line 10, in <module>
from . import misc
File "/home/jbw/.local/miniconda/envs/testu/lib/python3.6/site-packages/semicon/misc.py", line 11, in <module>
from scipy.spatial.transform import Rotation
ModuleNotFoundError: No module named 'scipy.spatial.transform'
```
A bit of googling reveals that this package is only available in the development version of scipy.
Probably we should not have bleeding-edge dependencies in library code, as we want the library to be of use to as many people as possible.https://gitlab.kwant-project.org/semicon/semicon/-/issues/2support of model with custom bands2017-10-08T17:56:45ZRafal Skolasinskisupport of model with custom bandsWhere appropriate function should take optional parameter ``bands`` which specify which k.p bands are used
This should be sequence of strings, e.g.
```python
hamiltonian = semicon.models.kane(
...
bands=['gamma_6c', 'gamma_8v'...Where appropriate function should take optional parameter ``bands`` which specify which k.p bands are used
This should be sequence of strings, e.g.
```python
hamiltonian = semicon.models.kane(
...
bands=['gamma_6c', 'gamma_8v', 'gamma_7v'],
...
)
```alpha versionhttps://gitlab.kwant-project.org/semicon/semicon/-/issues/11make installation copy cache files2017-10-08T14:35:40ZRafal Skolasinskimake installation copy cache filesSome references:
- https://stackoverflow.com/questions/1612733/including-non-python-files-with-setup-py
- https://docs.python.org/3/distutils/sourcedist.html#the-manifest-in-template
Could be worth to check how it is done in Kwant.Some references:
- https://stackoverflow.com/questions/1612733/including-non-python-files-with-setup-py
- https://docs.python.org/3/distutils/sourcedist.html#the-manifest-in-template
Could be worth to check how it is done in Kwant.alpha versionhttps://gitlab.kwant-project.org/semicon/semicon/-/issues/10support for strain2017-08-02T07:35:29ZGeorg Winklersupport for strain