Skip to content

Latest commit

 

History

History
65 lines (44 loc) · 3.5 KB

README.md

File metadata and controls

65 lines (44 loc) · 3.5 KB

xps-service

This is a webservice built using FastAPI.

Allows to:

  • Predict X-ray photoelectron binding energies of C 1s et O 1s, given a SMILES or molFile string
  • Get conformers

Usage

To be usable on Heroku or Dokku, which use PORT environmental variables, you need to either create this environmental variable or put it into an .env file. For local development, the run_docker.sh script uses 8091.

./build_docker.sh # builds the docker image
./run_docker.sh # starts the service

For production, you may want to use Docker compose

docker-compose up

Customization

You have the possibility to modify the photoemission transition that will be used a base of the prediction. This is done in settings.py. Several transition_maps could be defined, and the one to be used by the API should be loaded in xpsservice.py. Modification include:

-The option to import your own ML_model that should be pickled scikit GPR models -The possibility to import your own descriptors which should be SOAP. A utiliy notebook allowing to convert a soap configuration to a saop file that could be further used to calculate the descriptor is saved in /SOAP_config

Note that adding elements to the transition_map implies adding dedicated GPR models as well as new SOAPs. It also implies the modification of the existing SOAP config to account for the new interactions between the described elements

You have the option to customize the behavior of the app using environment variables:

  • MAX_ATOMS_XTB: if the input contains more than this number of atoms, an error is thrown (at the optimization stage)
  • MAX_ATOMS_FF: if the input contains more than this number of atoms, an error is thrown (at the conformer generation stage)
  • TIMEOUT: If the request takes longer than this time (in seconds) a TimeOut error is raised
  • CACHEDIR: Sets the directory for the diskcache. It will be mounted by the docker container.

Acknowledgments

This webservices heavily relies on xtb and ase. If you find this service useful and mention it in a publication, please also cite ase and xtb:

It also uses RDKit and the conformer search proposed by Riniker/Landrum:

Docs

You find docs on http://127.0.0.1:$PORT/v1/docs.