API Examples

For demos and tutorials for API access to Citrination.com, visit our Github.

Contents

Four of the tutorials are organized as a sequence demonstrating the import and usage of DFT data:

Importing VASP calculations
Working with PIFs
Introduction to queries
Machine learning on Citrination

There are also advanced topics tutorials:

Advanced PIFs
Advanced queries

Additional Resources

Documentation of the Physical Information File (PIF) schema
Documentation of the Citrination API

Requirements

Most of these tutorials are jupyter notebooks backed by a python3 kernel. You’ll need:

-python3 with Jupyter. Anaconda is highly recommended.
-pypif, pypif-sdk and citrination_client packages: pip install pypif citrination_client pypif-sdk dfttopif
-A valid citrination client API key set in your environment variables

1.Create an account on Citrination (if you don’t already have one)
2.Go to your account page and look for “API Key”
3.Add the key to your environment. If you use a bash shell, the command is: export CITRINATION_API_KEY=<your key copied from the website>

You can add this command to your .bashrc file to automatically set the API key in each new session.

The API key functions as the password for the client, so its important to keep it private. Its a good practice to put it in your environment instead of in the source code to help avoid unintentional sharing or publication of your API key.

References

The example data used in these tutorials is drawn from:

Alloy Database by Mihalkovic, Widom, and coworkers