Web-apps for:
- C2DB
- CMR-projects
- QPOD
- BiDB
- CRYSP
- OQMD12345 (CrystalBank)
Contents
- Bottle
- uWSGI
- Plotly
- Bootstrap
- WSGI
- HTMX
- ASE
- CMR-projects
- CMR-repo
- ASR-repo
- Scaling to many users
- OPTIMADE
Forwarding to https://fysik-cmr02.fysik.dtu.dk:<port>:
| Link | port |
|---|---|
| C2DB | 8081 |
| CMR-projects | 8082 |
| QPOD | 8083 |
| BiDB | 8084 |
| CRYSP | 8085 |
| OQMD12345 | 8086 |
| OPTIMADE | |
| OPTIMADE |
CAMd-web needs Python version 3.9 or later.
$ python -m venv venv
$ source venv/bin/activate
$ git clone [email protected]:ase/ase
$ pip install -e ase
$ git clone [email protected]:asr-dev/asr
$ pip install -e asr
$ git clone [email protected]:camd/camd-web
$ pip install -e camd-web[test,optimade]usage: camd-web [-h] filename [filename ...]
- positional arguments:
- filename Filename of atomic structure file.
- options:
-h, --help show this help message and exit
$ python -m camdweb.cmr.app *.db
$ python -m camdweb.c2db.copy ~cmr/C2DB-ASR "tree/*/*/*/" ... $ python -m camdweb.c2db.app A*/
Folder structure for UIDs 1MoS2-1 and 1MoS2-2:
AB2/1MoS2/1/data.json
structure.xyz
results-asr.<property1>.json
results-asr.<property2>.json
...
...
2/data.json
structure.xyz
...
oqmd123.json.gz
convex-hulls/MoS.json
Mo.json
S.json
For development work, just copy one or a few meterial folders from Niflheim to your local machine:
$ mkdir C2DB-test $ ssh sylg $ cd /home/niflheim2/cmr/C2DB-ASR/tree/AB2/MoS2 $ scp -r MoS2-b3b4685fb6e1 <your-machine>:C2DB-test/ $ ^D
Then you can play with those files like this:
$ cd C2DB-test $ python -m camdweb.c2db.copy . "MoS2*/" $ python -m camdweb.c2db.app AB2
Please run the following checks on your code:
$ cd <root-of-repo> $ mypy $ flake8 camdweb $ camd-web-coverage
If 100 % coverage is not possible then you can make CI pass by adding
# pragma: no cover or # pragma: no branch comments.
On the fysik-cmr02 server run uWSGI like this:
$ uwsgi -w "camdweb.c2db.app:create_app()" --http :8081 --master --threads=2 --enable-threads --daemonize=c2db.log $ uwsgi -w "camdweb.cmr.app:create_app()" --http :8082 --master --threads=2 --enable-threads --daemonize=cmr.log $ uwsgi -w "camdweb.bidb.app:create_app()" --http :8084 --master --threads=2 --enable-threads --daemonize=bidb.log $ uwsgi -w "camdweb.oqmd12345.app:create_app()" --http :8086 --master --threads=2 --enable-threads --daemonize=oqmd12345.log
In the picture below, camd.app is the WSGI app:
camd
|
v
+---------+
| CAMDApp | app +------------+
| |-------->| bottle.App |
| and | +------------+
| sub- |
| classes | sessions +----------+
| |------------->| Sessions |
| | +----------+
+---------+
|
|materials
|
v
+------------+ index +-------+
| Materials |--------->| Index |
| | +-------+
| -------- |
| |Material| |
| -------- | panels +--------------+
| |Material| |----------->| list[Panel] |
| -------- | | |
| : | | ---------- |
| : | | |AtomsPanel| |
+------------+ | ---------- |
| |OtherPanel| |
| ---------- |
| : |
| : |
+--------------+
| bottle.App: | WSGI app. Defines the end-points |
|---|---|
| Material: | Attributes: |
| Panel: | Has a |
| Index: | Handles efficient filtering of materials using the values in
|
| Materials: | Keeps track of all the
|
| Sessions: | Handles |
| Session: | Remembers selected columns, sorting information, ... |