# pymatgen.ext.crystalsai module

This module provides an interface to the MaterialsVirtualLab’s MEGNet REST API for rapid property prediction.

class CrystalAIRester

  Bases: `object`

  This is a high-level interface to the REST API for http://megnet.crystals.ai for property prediction. Using this API, you can use MatErials Graph Networks (MEGNet) developed by the Materials Virtual Lab to predict the properties of any given crystal. These models are trained on the latest versions of the Materials Project. The open-source code implementing these MEGNet models are available at https://github.com/materialsvirtuallab/megnet.

  For the details of MEGNet and benchmarks, please refer to the following work: Chen, C.; Ye, W.; Zuo, Y.; Zheng, C.; Ong, S. P. <i>Graph Networks as a Universal Machine Learning Framework

  > > for Molecules and Crystals.</i> Chemistry of Materials 2019, acs.chemmater.9b01294.

  > DOI: <a href=”https://doi.org/10.1021/acs.chemmater.9b01294”>10.1021/acs.chemmater.9b01294</a>.</p>

  Init for Rester.

  get_available_models()
    Returns

      Available model names. It should be noted that model names starting with log10 are for the log10 of that quantity.

  predict_mp(model_name, mp_id)

    Predict using the http://megnet.crystals.ai API.

    Parameters

      - model_name – An available model in the http://megnet.crystals.ai API. Use get_available_models to find the model names.

      - mp_id – A Materials Project id.

    Returns

      Predicted value. It should be noted that model names starting with log10 are for the log10 of that quantity and you should apply 10 ** prediction to get the actual value.

  predict_structure(model_name, structure)

    Predict using the http://megnet.crystals.ai API.

    Parameters

      - model_name – An available model in the http://megnet.crystals.ai API. Use get_available_models to find the model names.

      - structure – A Pymatgen Structure.

    Returns

      Predicted value. It should be noted that model names starting with log10 are for the log10 of that quantity and you should apply 10 ** prediction to get the actual value.