Skip to main content

MaterialsMap is Python package for mapping properties, manufacturing feasibility, and desirability. We focus on guiding materials design graphically while proving API to underlying methods.

Project description

Cross-Platform Tests License: MIT

MaterialsMap is Python package for mapping properties, manufacturing feasibility, and desirability. We focus on guiding materials design graphically while proving an API to underlying methods, so that others can utlize it as an engine behind their tools, like machine learning (ML) based alloy design.

It can utilize both free and open source (FOSS) pycalphad and industry-trusted Thermo-Calc for performing underlying thermodynamic calculations.

Theory

MaterialsMap uses several different methods out-of-the-box. These include thermodynamic equlibrium calculations, Scheil-Gulliver solidification, and 5 different models for predicting cracking susceptibility.

Our upcoming (March 2024) article discusses in detail all implemented methods, underlying thermodynamics, and their applications.

Use Example (SS304L-NiCr-V)

results of SS304L-NiCr-V

import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from materialsmap.core.compositions import generateCompositions, createComposition
from materialsmap.ref_data import periodic_table, materials
from materialsmap.core.pycalphad_run import pycalphad_eq, pycalphad_scheil
from materialsmap.core.GenerateEqScript import createEqScript
from materialsmap.core.ReadEqResult import getEqdata
from materialsmap.core.GenerateScheilScript import createScheilScript
from materialsmap.core.ReadScheilResult import getScheilSolidPhase
from materialsmap.plot.FeasibilityMap import plotMaps

# Create Compositions
comps = ['SS304L', 'NiCr', 'V']
eleAmountType = 'massFraction'
pressure = 101325
ngridpts = 41  # number of points along each dimension of the composition grid
TemperatureRange = (900, 2300, 10)  #(lower limit, upper limit, temperature step)
indep_comps = [comps[1], comps[2]]  # choose them automatically
for i in comps:
    if i in periodic_table:
        materials[i] = {i: 1}
    elif i not in materials.keys():
        materials['SS304L'] = {'Ni': 0.09611451943, 'Cr': 0.1993865031,
                               'Fe': 0.7044989775}  # the composition of this element/alloys(in weight fractions)
maxNumSim = 250  # maximum number of simulations in each TCM file

# Equilibrium simulation settings
pressure = 101325
database = 'TCFE8'  # <userDatabase>.TDB or TCFE8
eleAmountType = 'massFraction'  # Candidates: massFraction massPercent moleFraction molePercent
output_Eq = f'{TemperatureRange[0]}-{TemperatureRange[1]}-{TemperatureRange[2]}-{comps[0]}-{comps[1]}-{comps[2]}-Eq'

# Create folder in curent path to store simulation results
from datetime import datetime

current_dateTime = datetime.now()
if '.tdb' in database or '.TDB' in database:
    database_name = database.split('/')
    path = f'./Simulation/{datetime.now().strftime("%m-%d-%Y")}-{comps[0]}-{comps[1]}-{comps[2]}-database-{database_name[-1][:-4]}'
else:
    path = f'./Simulation/{datetime.now().strftime("%m-%d-%Y")}-{comps[0]}-{comps[1]}-{comps[2]}-database-{database}'
isExist = os.path.exists(path)
if not isExist:
    os.makedirs(path)
    print("The new directory is created!")

# Save compostion results
compositions_list = generateCompositions(indep_comps, ngridpts)
Compositions, numPoint, comp, numSimultion = createComposition(indep_comps, comps, compositions_list, materials, path)
settings = [TemperatureRange, numPoint, numSimultion, comp, comps, indep_comps, os.path.abspath(database), pressure, eleAmountType]
np.save(f'{path}/setting.npy', settings)

# Running with PyCalphad
pycalphad_eq(path)
pycalphad_scheil(path, 2000)  # temperature to start scheil if not eq results

# Running with Thermo_Calc
# Create TCM files with path
createEqScript(path)
createScheilScript(path, 2000)  # temperature to start scheil if not eq results

# Open TCM files with Thermo_Calc

# Collect results from Thermo_Calc
getEqdata(path)
getScheilSolidPhase(path)

# Plot deleterious phase diagram and crack susceptibility map 
plotMaps(path, 'pycalphad')

Installation

PyPI (recommended)

MaterialsMap can be quickly installed from PyPI with a simple:

pip install materialsmap

Development Versions

To install an editable development version with pip:

git clone https://github.com/HUISUN24/materialsmap.git
cd materialsmap
pip install -e .

Upgrading scheil later requires you to run git pull in this directory.

Testing

Automated testing is performed on every commit to the repository, as defined in .github/workflows/lastCommit.yml workflow. On your system, you can also run it with a simple:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

materialsmap-0.2.2.tar.gz (48.0 kB view details)

Uploaded Source

Built Distribution

materialsmap-0.2.2-py3-none-any.whl (63.3 kB view details)

Uploaded Python 3

File details

Details for the file materialsmap-0.2.2.tar.gz.

File metadata

  • Download URL: materialsmap-0.2.2.tar.gz
  • Upload date:
  • Size: 48.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for materialsmap-0.2.2.tar.gz
Algorithm Hash digest
SHA256 ff77bd63b4753cd36c2363e4e26cf447b5d4f9e20b75ac60a236ebdd66fd7ba2
MD5 519731cbadaa0d7eccd419690f226c9f
BLAKE2b-256 c732390d9eaaf2afe075c1c13e6f34861becef365b6e1751f2a13175ad301cdc

See more details on using hashes here.

File details

Details for the file materialsmap-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for materialsmap-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f4eccfd38de9310b3f41545536d79922561f1bfae3841b08a771174794d08691
MD5 bd486f8a03d4451666c021ea45fff087
BLAKE2b-256 64604b7035293f2197530b8a1aa1cce26902b4a9b283918596a6d5ed97186619

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page