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
bsonto seed the database in themongo-seed/dump/xrd-patternsdirectory. You can download the file from Dropbox - Start the docker-compose with
docker-compose up -d - Then enter the
mongodbcontainerdocker exec -i -t xrd-predict_mongodb_1 bash - Seed the database by running
mongorestore dump
- If you visit the documentation at
localhost:$PORTyou can test if the lookup works
-
GETto/shows some basic info -
GETto/versionshows the version -
POSTto/predictxrdwithfileContentdata (CIF as string) returns:x: with the 2 theta positions of the reflexesy: intensity of the reflexeshklarray of objects{hkl: , multiplicity: }
if you also provide
jcamp=trueyou will receivejcamp: a string of the JCAMP-DX file with the predicted pattern
you can also specify a
wavelengthwhich 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. -
POSTto/latticepatternwith 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
GETto/getpattern?dbName=returns and object of the following form
{
"x": [
null
],
"y": [
null
],
"hkls": [
null
],
"dbName": "string",
"link": "string",
"cif": "string",
"apiVersion": "string"
}

