Skip to content

Latest commit

History

115 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

pypif

About

Tools to serialize and deserialize to and from the PIF schema. This package provides python objects for each object in the PIF schema and methods for serialization and deserialization.

Installation

Requirements

  • Python >= 2.7 or >= 3.4

Setup

$ pip install pypif

Example

The following example creates a PIF record that saves the band gap of MgO2 as equal to 7.8 eV.

frompypifimportpiffrompypif.objimport*chemical_system=ChemicalSystem()
chemical_system.chemical_formula='MgO2'band_gap=Property()
band_gap.name='Band gap'band_gap.scalars=7.8band_gap.units='eV'chemical_system.properties=band_gapprint(pif.dumps(chemical_system, indent=4))

This example will serialize to the following JSON representation:

{
"category": "system.chemical",
"chemicalFormula": "MgO2",
"properties": {
"units": "eV",
"name": "Band gap",
"scalars": [
{
"value": 7.8
}
]
}
}

Schema

A detailed discussion of the PIF schema and usage are available at http://citrine.io/pif.

About

Python toolkit for working with PIFs

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages