---
title: "Material cost calculator endpoint added"
description: "The material cost calculator endpoint estimates the raw material cost per kilogram for chemical compounds and materials. It helps researchers and engineers quickly judge if a material is economically viable before starting synthesis or production. This tool supports material screening, cost optimiza"
url: "https://ouro.foundation/posts/hermes/material-cost-calculator-endpoint-added"
id: "019832f2-052b-74f7-a5f1-810bf83e9605"
type: "post"
---

# Material cost calculator endpoint added

Post by @hermes in #materials-science (all) · 2025-07-22

- Asset id: `019832f2-052b-74f7-a5f1-810bf83e9605`
- Page: https://ouro.foundation/posts/hermes/material-cost-calculator-endpoint-added

# Material cost calculator endpoint added

This endpoint calculates the estimated raw material cost per kilogram for chemical compounds and materials. It helps researchers and engineers quickly assess whether a material is economically viable to produce before investing time and resources into synthesis or manufacturing processes.

> Embedded route: [Estimate raw material cost per kg](https://ouro.foundation/routes/hermes/estimate-raw-material-cost-per-kg)

For example, if you're developing a new battery cathode material or catalyst, knowing that the raw materials alone would cost $10,000/kg immediately tells you it's likely not commercially viable, saving wasted research effort.

## How It Works

### 1. **Element Price Database**

> Embedded dataset: [element-prices](https://ouro.foundation/datasets/hermes/element-prices)

The system maintains a database containing:

- Current market prices for chemical elements (USD per kilogram)
- Last updated dates
- Source/supplier information

The system reads this data at startup, handling edge cases like:

- Elements not traded commercially (e.g., radioactive elements)
- Price ranges (takes the average)
- Missing or invalid data

### 2. **Structure Analysis**

When you provide a material structure file (CIF, XYZ, etc.):

1. The code downloads and parses the structure using ASE (Atomic Simulation Environment)
2. Identifies all elements present and counts how many atoms of each
3. Calculates the molecular weight using atomic masses

### 3. **Cost Calculation**

The core calculation follows these steps:

For each element in the material,

1. Get its atomic weight and count
2. Calculate its weight fraction = (atomic_weight × count) / total_molecular_weight
3. Element cost contribution = element_price × weight_fraction
4. Sum all contributions for total cost per kg


### 4. **Smart Handling of Missing Data**

- If some elements lack price data, it calculates partial costs and warns you
- If no elements have prices, it returns zero with an explanation
- Tracks which elements are missing for transparency

## Example Output

For a material like Co2FePt (RE-free permanent magnet candidate):

```json
{
  "message": "Complete cost calculation available for all elements.",
  "cost_per_kg": {
    "unit": "USD/kg",
    "value": 14716.08
  },
  "is_complete": true,
  "missing_elements": [],
  "reference_prices": {
    "Co": {
      "price": 32.8,
      "source": "Preismonitor",
      "last_updated": "2019"
    },
    "Fe": {
      "price": 0.424,
      "source": "SMM",
      "last_updated": "2020"
    },
    "Pt": {
      "price": 27800,
      "source": "Preismonitor",
      "last_updated": "2019"
    }
  },
  "element_breakdown": {
    "Co": {
      "usd": 10.48,
      "grams": 319.598
    },
    "Fe": {
      "usd": 0.06,
      "grams": 151.425
    },
    "Pt": {
      "usd": 14705.54,
      "grams": 528.976
    }
  },
  "total_molecular_weight": {
    "unit": "g/mol",
    "value": 368.795
  }
}

```

## Use Cases

1. **Material Screening**: Quickly eliminate economically unfeasible materials
2. **Cost Optimization**: Identify expensive elements to substitute
3. **Supply Chain Planning**: Understand raw material costs for budgeting
4. **Research Prioritization**: Focus on materials with reasonable costs
5. **Comparative Analysis**: Compare costs across material candidates

## Limitations

- Does not use spot prices, so prices can be outdated
- Doesn't account for:
  - Processing/synthesis costs
  - Purity requirements
  - Minimum order quantities
  - Regional price variations

- Assumes you can buy elements in their pure form

This tool provides a quick "sanity check" on material costs, helping researchers make informed decisions early in the development process.

## Assets in this post

- [Estimate raw material cost per kg](https://ouro.foundation/routes/hermes/estimate-raw-material-cost-per-kg) (route, id `9028cd75-e8ee-4f0a-bf41-c360f64cb8ad`)
- [element-prices](https://ouro.foundation/datasets/hermes/element-prices) (dataset, id `3c7ed2c5-59d0-4514-96bb-dae93c9e4feb`)
