SDKs overview
The Materials Platform for Data Science (MPDS) offers Software Development Kits (SDKs) and libraries designed to streamline programmatic access to its extensive database of materials properties. These tools enable researchers and developers to integrate MPDS data directly into their computational environments, facilitating tasks such as data query, analysis, and visualization. The primary focus of the MPDS SDKs is to provide a consistent and efficient interface for retrieving diverse materials science data, including crystallographic data, phase diagrams, and thermodynamic properties, which are crucial for materials discovery and development workflows.
The platform's approach to SDK development emphasizes ease of use within common scientific computing ecosystems. By abstracting the underlying API calls, SDKs allow users to focus on data manipulation and scientific inquiry rather than the intricacies of HTTP requests and JSON parsing. This design choice supports both academic researchers conducting theoretical studies and industrial R&D teams working on new material formulations. The official SDKs are maintained to ensure compatibility with the latest platform features and data schema updates, providing a reliable pathway for data access as detailed in the MPDS official documentation.
While the core offering is centered on official SDKs, the community also contributes to supporting tools and examples, expanding the utility and accessibility of the MPDS platform across various programming paradigms and specialized research areas. The development experience is noted for its clear Python examples and structured data access, supporting common data science workflows, as described in Materials Platform for Data Science's developer information.
Official SDKs by language
The Materials Platform for Data Science provides an official SDK primarily for Python, which is a widely adopted language in scientific computing and data science. This SDK is designed to offer comprehensive access to the MPDS API, allowing users to query, retrieve, and process materials data efficiently.
| Language | Package Name | Installation Command | Maturity |
|---|---|---|---|
| Python | mpds-api |
pip install mpds-api |
Stable |
The official Python SDK wraps the underlying RESTful API, providing a more idiomatic and convenient interface for Python developers. It handles authentication, request formatting, and response parsing, simplifying the process of interacting with the MPDS database. This SDK is regularly updated to reflect new API functionalities and improvements, ensuring that developers have access to the most current features and data types available on the platform. The Python ecosystem, supported by libraries like NumPy and Pandas, further enhances the utility of the MPDS SDK for data analysis and manipulation. For instance, the Python SDK can integrate seamlessly with data visualization tools or machine learning frameworks, which are frequently used in materials science research, as highlighted by resources like the developer documentation on common data types.
Installation
Installing the official Python SDK for Materials Platform for Data Science is typically done using pip, the Python package installer. This method ensures that the SDK and its dependencies are correctly set up in your Python environment.
Prerequisites
- Python 3.6 or higher
pip(usually included with Python installations)
Installation Steps
- Open your terminal or command prompt.
- Run the installation command:
pip install mpds-apiThis command downloads the latest version of the
mpds-apipackage from the Python Package Index (PyPI) and installs it along with any required dependencies. If you encounter permissions issues, you might need to usepip install --user mpds-apito install it for your user only, or use a virtual environment. - Verify the installation (optional):
You can verify that the package is installed by running a simple Python script or by checking your installed packages:
pip show mpds-apiThis command will display information about the installed
mpds-apipackage, including its version and location. - Authentication:
After installation, you will need an API key to access the MPDS data. You can obtain an API key by registering on the Materials Platform for Data Science website. The API key is typically passed during the initialization of the SDK client.
It is recommended to use Python virtual environments to manage project-specific dependencies and avoid conflicts with other installed packages. A virtual environment can be created and activated before installing the SDK:
python -m venv mpds_env
source mpds_env/bin/activate # On Windows: mpds_env\Scripts\activate
pip install mpds-api
Quickstart example
This quickstart example demonstrates how to use the official Python SDK to connect to the Materials Platform for Data Science, perform a basic query, and retrieve materials data.
1. Initialize the MPDS client
First, you need to import the MPDSDataRetrieval class and initialize it with your API key. Replace "YOUR_API_KEY" with your actual API key obtained from the MPDS website.
from mpds_api import MPDSDataRetrieval
# Replace 'YOUR_API_KEY' with your actual MPDS API key
client = MPDSDataRetrieval(api_key="YOUR_API_KEY")
print("MPDS client initialized.")
2. Perform a basic data query
You can query the database using various parameters. This example searches for all entries related to 'silicon' (Si).
# Query for all entries related to Silicon (Si)
query_results = client.get_dataframe({"elements": "Si"})
print(f"Found {len(query_results)} entries for Silicon.")
# Display the first few results
if not query_results.empty:
print("First 5 results:")
print(query_results.head())
else:
print("No results found for the query.")
3. Retrieve specific data attributes
The MPDS SDK allows you to specify what kind of data you want to retrieve. For example, you can query for crystallographic data ("property": "crystallography").
# Query for crystallographic data of Silicon
crystallography_data = client.get_dataframe({"elements": "Si", "property": "crystallography"})
print(f"Found {len(crystallography_data)} crystallographic entries for Silicon.")
# Display the first few crystallographic results
if not crystallography_data.empty:
print("First 5 crystallographic results:")
print(crystallography_data.head())
else:
print("No crystallographic data found for Silicon.")
4. Advanced filtering and data types
The get_dataframe method supports various filtering options, including chemical systems, properties, and specific conditions. The data returned is typically in a Pandas DataFrame format, which is convenient for further analysis.
# Example: Query for entries containing both Silicon and Oxygen with a specific property
si_o_data = client.get_dataframe({"elements": "Si,O", "property": "phonon properties"})
print(f"Found {len(si_o_data)} phonon property entries for Silicon-Oxygen systems.")
# Display selected columns for a clearer view
if not si_o_data.empty:
print("First 5 phonon property entries (selected columns):")
print(si_o_data[['chemical_formula', 'property', 'sample_id']].head())
This quickstart provides a basic introduction to querying the MPDS. More complex queries, including those involving specific phase diagrams or experimental conditions, can be found in the MPDS API reference documentation.
Community libraries
While Materials Platform for Data Science primarily supports an official Python SDK, the broad utility and open nature of scientific computing often lead to community-driven efforts to extend functionality or create integrations. These community libraries or code snippets might emerge in various forms, such as custom data parsers, visualization scripts, or connectors to other materials science tools that complement the MPDS data. They are typically developed by individual researchers, academic groups, or open-source contributors who utilize the MPDS API in their specific projects.
Community contributions often address niche requirements not covered by the official SDK or provide alternative interfaces for different programming preferences. Examples could include:
- Data conversion utilities: Scripts to convert MPDS data into formats compatible with specific simulation software (e.g., VASP, LAMMPS input files). These might be shared on platforms like GitHub.
- Interactive visualization tools: Jupyter notebooks or web applications that fetch MPDS data and present it through interactive plots, making it easier to explore material properties visually.
- Integration with other materials informatics platforms: Libraries that bridge MPDS data with other databases or analysis tools, creating more comprehensive materials research workflows.
- Language wrappers: Although less common for MPDS due to the strong Python focus, community members might develop basic API wrappers in other languages (e.g., Julia, R) for specific project needs, often relying directly on the HTTP/REST principles of the underlying API.
These community-driven resources are usually found in public repositories on platforms like GitHub, academic project websites, or through scientific forums. While not officially supported or maintained by MPDS, they can offer valuable insights and solutions for specific use cases. Users should always evaluate the reliability, documentation, and maintenance status of any community-contributed code before integrating it into critical workflows. Checking for active development, issue tracking, and community engagement can help in assessing the quality and longevity of such libraries.