REST-API built with flask that exposes pymatgen functionality.
The app used file-based caching.
Before you can run the image there are some settings you have to define. To get started you can cp .env.sample .env
.
MONGO_HOST
=127.0.0.1 Host for the MongoDB for pattern lookup (usually no need to change)MONGO_PORT
=27017 Port for MongoDB (usually no need to change)MONGO_DB
=xrd-patterns name of MongoDB (do not change)PORT
=8100 port used to expose the appWORKERS
=2 workers used to run the app (one processor per worker)CONCURRENCY_LIMIT
=2 maximum number of concurrent connections
- Make sure that you have the
bson
to seed the database in themongo-seed/dump/xrd-patterns
directory. You can download the file from Dropbox - Start the docker-compose with
docker-compose up -d
- Then enter the
mongodb
containerdocker exec -i -t xrd-predict_mongodb_1 bash
- Seed the database by running
mongorestore dump
- If you visit the documentation at
localhost:$PORT
you can test if the lookup works
-
GET
to/
shows some basic info -
GET
to/version
shows the version -
POST
to/predictxrd
withfileContent
data (CIF as string) returns:x
: with the 2 theta positions of the reflexesy
: intensity of the reflexeshkl
array of objects{hkl: , multiplicity: }
if you also provide
jcamp=true
you will receivejcamp
: a string of the JCAMP-DX file with the predicted pattern
you can also specify a
wavelength
which must be one of the following strings: CuKa, CuKa2, CuKa1, CuKb1, MoKa, MoKa2, MoKa1, MoKb1, CrKa, CrKa2, CrKa1, CrKb1, FeKa, FeKa2, FeKa1, FeKb1, CoKa, CoKa2, CoKa1, CoKb1, AgKa, AgKa2, AgKa1, AgKb1. -
POST
to/latticepattern
with a request body of the following form
{
"a": 0,
"b": 0,
"c": 0,
"alpha": 0,
"beta": 0,
"gamma": 0,
"wavelength": "string",
"jcamp": false
}
returns an answer as /predictxrd
GET
to/getpattern?dbName=
returns and object of the following form
{
"x": [
null
],
"y": [
null
],
"hkls": [
null
],
"dbName": "string",
"link": "string",
"cif": "string",
"apiVersion": "string"
}