This tool is both a front-end to TC-Python and an analysis tool for finding coherent second phases in n-component alloy systems.
This code is only tested on Python 3.7. Pipenv should be installed already, as it is required for creating the virtual environment and installing all the dependencies, including TC-Python. For windows user, you should have Anaconda installed.
- clone this repository and cd into
CohPhaseFind
$ module load gcc anaconda/5.3.1-py37 thermocalc
$ conda create -n <env-name> python=3.7
$ source activate <env-name>
-
using editor of your choice, add the following in ~/.bashrc: ... export PATH="$PATH:< Path to Thermo-Calc > /version/SDK/TCAPI" export PATH="$PATH:< Path to Thermo-Calc > /version/SDK/TQ" export TC19B_HOME=="$PATH:< Path to Thermo-Calc > /version" export LSHOST="< ip of your license serve >" or export LSERVRC="path to your license file" export PATH="$PATH:$HOME/.local/bin" ...
-
using editor of your choice, edit the Pipfile:
The location of the TC-python api should be at: < Path to Thermo-Calc > /version/SDK/TC-Python/TC_Python-version info.whl. For windows, you should include the full path name.
CohPhaseFind/Pipfile
-----------------------------------
...
tc-python = {path = "insert your path to tc-python here"}
...
- Install all the dependencies via:
$ source ~/.bashrc
$ pipenv install
$ !pmg config --add PMG_MAPI_KEY <your API key>
- Activate the new virtual environment with:
$ pipenv shell
$ cd CohPhaseFind
$ source ~/.bashrc
$ pipenv shell
$ cd Src
$ pipenv run python phase_eq_par.py template.ini > Output/calculation-template.log
or
$ sbatch template_slurm.sh (to submit job on cluster)
Following script has been used for example calculation on AlNiTi system:
AlNiTi
# temperature step in Kelvins
t_step = 50
# composition step in mole fractions
c_step = 0.01
# minimum temperature
t_min = 873
# maximum temperature
t_max = 973
# elements to be included
components = Al, Ni, Ti
# (opt) elements to have restricted composition range
controlled_components = Ni, Ti
# (opt) minimum composition for the controlled elements
min_composition = 0, 0
# (opt) maximum composition for the controlled elements
max_composition = 1, 1
# database to be used
database = TCNI8
# (opt) phases to be enabled
phases = H_L21, MOSI2_C11B
# Output directory
output = ../Examples/Thermodynamic-calculations/
After running this, output for thermodynamic calculations will be written in CohPhaseFind/Example/Thermodynamic-calculations/NI8/AlNiTi/AlNiTi_873_973NI8.json
Following command can be used to run the interactive script:
$ python coherent.py
Input JSON file path (type 'exit' for exit):../Example/Thermodynamic-calculations/NI8/AlNiTi/AlNiTi_873_973NI8.json
Enter the phase that must be included : BCC_B2#2
Enter the composition range of Al for BCC_B2#2 in atomic fraction (min,max): 0.01,0.1
Enter the composition range of Ni for BCC_B2#2 in atomic fraction (min,max): 0.45,0.51
Enter the composition range of Ti for BCC_B2#2 in atomic fraction (min,max): 0.45,0.51
Enter the minimum phase fraction of BCC_B2#2: 0.5
Total number of phases: 2
Path to save selected phases to, this file name will be modified to be used to save other outputs too: ../Example/Coherent-phase-screening/AlNiTi/AlNiTi.json
Please choose the matrix phase: BCC_B2#2
Please enter the stoichiometric formula for the matrix phase (e.g. NiTi, Co2NiGa): NiTi
Enter minimum and maximum strain (min,max): 0, 0.05
Enter minimum and maximum area (min,max): 0, 100
This will write final results for coherent second phases in CohPhaseFind/Example/Coherent-phase-screening/AlNiTi_wanted_interface.csv. The intermediate files will also be saved in CohPhaseFind/Example/Coherent-phase-screening/
Following command can be used to run the interactive script:
$ python phase_diagrams.py
Input JSON file path (relative or absolute): ../Example/Thermodynamic-calculations/NI8/AlNiTi/AlNiTi_873_973NI8.json
Path to save diagrams: ../Example/Coherent-phase-screening/AlNiTi/
Type ? for help > ?
The following are the list of accepted commands:
? : show this help text
bound : calculate phase boundaries in 3D for atleas 3 components systems
pad : Isothermal ternary or pseudo ternary phase diagram
Type ? for help > bound
Select phase(s) to find boundary: BCC_B2#2,H_L21#1
Enter step size, lower value create smaller clusters (default: 0.05): 0.01 (for all temperatures)
Temperature (in Kelvin): 923
Image name to save the diagram: AlNiTi_B2_L21_923K
Type ? for help > pad
emperature to be plotted (in Kelvin) (type 'exit' to exit): 923
Show diagram? [Y/N] N
Save diagram? [Y/N] Y
Ternary isotherm and corresponding legends will be saved as CohPhaseFind/Example/Coherent-phase-screening/AlNiTi_923.png and CohPhaseFind/Example/Coherent-phase-screening/AlNiTi_923_legend.png, respectively. Phase boundaries will be saved as CohPhaseFind/Example/Coherent-phase-screening/AlNiTi_B2_L21_923K.png