# HitDIC-doc
**Repository Path**: hitdic/hitdic-doc
## Basic Information
- **Project Name**: HitDIC-doc
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2017-06-24
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
HitDIC Introduction
===================
hitDIC (HIgh Throughtput Determination of Interdiffusivion Coefficient) is a free program. hitDIC is designed to robotize the application of the numerical inverse method. And the numerical inverse method is used to calculate the interdiffusion coefficients of binary, ternary and multicompoenent alloys from the composition profiles.
HitDIC framework
----------------
HitDIC is a solver for the inverse problem that intends to compute the experimental interdiffusion coefficients from the composition profiles of diffusion couples. The essential framework is presented as following.
.. figure:: _static/hitdic-framework.png
How to cite HitDIC?
-------------------
The following is the bibtex content.
::
@article{hitdic2017,
title={HitDIC: A free-accessible code for High-throughput Determination of Interdiffusion Coefficients in single solution phase},
author={Jing, Zhong and Weimin, Chen and Lijun, Zhang},
journal={null},
volume={null},
number={null},
pages={null},
year={2017},
publisher={null}
}
Installation
====================
Installation
----------------
HitDIC is a single static executatble program which is expected to run in the terminal. One can place it anywhere they like as long as HitDIC is accessible from the CLI (Command Line Interface).
For Windows system, one should manually append the absolute path to HitDIC to the environment variable "Path". For example, you create a folder in "C:\", namely, hitdic, then you place "hitdic.exe" into this folder, and now the full path to HitDIC program read as "C:\hitdic\hitdic.exe". In order to run HitDIC from CLI, one should append "C:\hitdic" to the environment variable "Path", and confirm your operations. Now you are possible to run "hitdic.exe" from CLI.
For Linux system, one can copy "hitdic" to "/usr/local/bin" and it is likely that "hitdic" is available from the terminal.
For OSx system, there is no release at present. Anyone who expect such an version please contact me with email. (
email: zhongjingjogy@email)
Enter "hitdic" in CLI (cmd, terminal, etc.), and the options from the HitDIC program should be listed.
.. figure:: _static/hitdic-cli.jpg
FAQs
------------------
Not yet.
Feedback
----------------
Al suggestions are warmly welcomed! (
email: zhongjingjogy@email)
Get Started
===========
This part of tutorial is to cover the basic usage of the HitDIC program. Here the options from HitDIC is listed.
::
Usage:
-v, --version
-h, --help show this help message.
-c, --couple select the couple.
--sim activate the simulation module.
--exp activate the experiment module.
--auto automatically adjust the matan position.
--load load optimization result whil simulation.
-e, --err show/output output the errors.
-i, --init initialize a hitdic project.
-m, --min options: [steep, pw, enu, sobol, com]
-m, --min options: [steep, pw, enu, sobol, com]
-c, --crit options: [conc(default), flux, slope]
--target options: [raw(default), log]
Examples:
hitdic -c couple --sim # simulate the couple
hitdic -c couple --exp # render the experimenta properties
hitdic -c couple --auto # mapping the matan position
hitdic -c couple --ver # serialize the propertie of couple.
hitdic --err show # displaying the squar resiuals
hitdic --min steep # run the minimization
hitdic -c couple --sim --load # simulate the couple with the optimization result.
Please confirm the version of HitDIC and stick to the right version of documentation.
::
hitdic --version
New project
------------
The HitDIC program provide a useful command option to help user to start a new project,
::
hitdic --init
then, the HitDIC will generate the general input files in the current working directory.
::
.
├── database.input
├── optimize.input
└── simulation.input
The three files ended with "input" are text file, which can be edited by the user and utilized by HitDIC.
Currently, the experimental information is left out here.
database.input
---------------
This file is the input file for the database information. HitDIC would collect the information in database.input,
and use them to construct the model for evaluating the composition and temperature dependent interdiffusion coefficients.
The general syntax for database.input read as following,
::
[default]
MQA_A0 = -267000;
MQA_B0 = -267000;
MQB_A0 = -267000;
MQB_B0 = -267000;
MQA_AB0 = p0;
MQB_AB0 = p1;
where p0 and p1 are the unknown parameters, whose default values are zeros. The tag in the square bracket denotes the name of the database. The user can define as many as possible number of tags for different databases. Moreover such tags will be refered by the other input files when they are read by HitDIC.
simulation.input
----------------
This file is used to define the condition of different diffusion couples,
::
[couple1]
elements = A, B;
length = 1000e-6;
time = 21600;
temperature = 1100;
clefts = 0.275, 0.725;
crights = 0.325, 0.675;
initpos = 500e-6;
exppath = case1.txt;
dbname = default;
dx = 2.0e-6;
dt = 2.0;
The keyword "elements" is used to defined the components of the diffusion couple. "length" is the length of the diffusion couple, "time" is the annealing time, and "temperature" is the annealing temperature. Since a diffusion couple is a combination of two sample bolcks, "clefts" is used to specified the one on the left, and "crights" is for the right part. "initpos" specifies the initial position of the diffusion couple. "exppath" refer the source of experimental composition profile. "dbname" is a link to the database parameters in database.input. "dx" and "dt" are parameters for finite difference method when solving the Fick's second law.
optimize.input
--------------
This file is used to specified the adjustable parameters for different optimization algorithms.
::
[steep]
parameternumber = 2;
initialvalues = -100000, -100000;
spacings = 1, 1;
hinit = 1e8;
hlimit = 1.0e-5;
fraction = 0.5;
trialnumber = 289;
[enu]
parameternumber = 2;
gridnumber = 16, 16;
lowerlimit = -100000, -100000;
upperlimit = 0, 0;
fraction = 0.5;
[sobol]
parameternumber = 2;
lowerlimit = -100000, -100000;
upperlimit = 0, 0;
trialnumber = 289;
Experimental data
-------------------
The main purpose of HitDIC is to calculate the interdiffusion coefficients from the experimental composition profiles. In order to do this, the experimental composition profiles should be provided. Notice that the source of experimental data is specified in simulation.input with "exppath", namely, "case1.txt". In HitDIC, such an experimental file should be provided by the user in text format. In such a text file, the data points of the composition profiles should be arranged as collumns in the pattern as [distance compositon diatance composition ....]. Currently, the international unit should be considered for all infomation, i.e., meter for distance and at. for composition. For example, copy the following content and store them into a text file, namely, "case1.txt".
::
# case1.txt
# this is annotation, which starts with #.
#dist-A conc-A dist-B conc-B
1.18E-06 4.29E-04 1.18E-12 1.00E+00
3.15E-06 2.15E-04 3.15E-12 1.00E+00
5.51E-06 0.00E+00 5.51E-12 1.00E+00
6.69E-06 2.15E-04 6.69E-12 1.00E+00
9.45E-06 0.00E+00 9.45E-12 1.00E+00
1.10E-05 2.15E-04 1.10E-11 1.00E+00
1.34E-05 2.15E-04 1.34E-11 1.00E+00
1.54E-05 2.15E-04 1.54E-11 1.00E+00
1.73E-05 2.15E-04 1.73E-11 1.00E+00
1.93E-05 2.15E-04 1.93E-11 1.00E+00
2.17E-05 2.15E-04 2.17E-11 1.00E+00
2.44E-05 2.15E-04 2.44E-11 1.00E+00
2.76E-05 4.29E-04 2.76E-11 1.00E+00
3.03E-05 2.15E-04 3.03E-11 1.00E+00
3.23E-05 2.15E-04 3.23E-11 1.00E+00
3.50E-05 2.15E-04 3.50E-11 1.00E+00
3.74E-05 4.29E-04 3.74E-11 1.00E+00
3.86E-05 2.15E-04 3.86E-11 1.00E+00
4.13E-05 2.15E-04 4.13E-11 1.00E+00
4.29E-05 2.15E-04 4.29E-11 1.00E+00
4.61E-05 4.29E-04 4.61E-11 1.00E+00
4.80E-05 2.15E-04 4.80E-11 1.00E+00
5.08E-05 2.15E-04 5.08E-11 1.00E+00
5.28E-05 2.15E-04 5.28E-11 1.00E+00
5.55E-05 2.15E-04 5.55E-11 1.00E+00
5.83E-05 0.00E+00 5.83E-11 1.00E+00
6.02E-05 0.00E+00 6.02E-11 1.00E+00
6.26E-05 0.00E+00 6.26E-11 1.00E+00
6.50E-05 0.00E+00 6.50E-11 1.00E+00
6.77E-05 2.15E-04 6.77E-11 1.00E+00
6.93E-05 0.00E+00 6.93E-11 1.00E+00
7.09E-05 0.00E+00 7.09E-11 1.00E+00
7.36E-05 0.00E+00 7.36E-11 1.00E+00
7.60E-05 2.15E-04 7.60E-11 1.00E+00
7.76E-05 4.29E-04 7.76E-11 1.00E+00
7.99E-05 1.07E-03 7.99E-11 9.99E-01
8.19E-05 2.15E-03 8.19E-11 9.98E-01
8.39E-05 3.22E-03 8.39E-11 9.97E-01
8.62E-05 5.36E-03 8.62E-11 9.95E-01
8.82E-05 8.37E-03 8.82E-11 9.92E-01
8.98E-05 1.27E-02 8.98E-11 9.87E-01
9.17E-05 1.76E-02 9.17E-11 9.82E-01
9.41E-05 2.45E-02 9.41E-11 9.76E-01
9.57E-05 3.24E-02 9.57E-11 9.68E-01
9.80E-05 3.93E-02 9.80E-11 9.61E-01
9.96E-05 5.02E-02 9.96E-11 9.50E-01
1.02E-04 6.29E-02 1.02E-10 9.37E-01
1.04E-04 6.78E-02 1.04E-10 9.32E-01
1.06E-04 7.12E-02 1.06E-10 9.29E-01
1.08E-04 7.36E-02 1.08E-10 9.26E-01
1.09E-04 7.51E-02 1.09E-10 9.25E-01
1.11E-04 7.64E-02 1.11E-10 9.24E-01
1.14E-04 7.79E-02 1.14E-10 9.22E-01
1.15E-04 7.94E-02 1.15E-10 9.21E-01
1.18E-04 8.09E-02 1.18E-10 9.19E-01
1.19E-04 8.13E-02 1.19E-10 9.19E-01
1.22E-04 8.18E-02 1.22E-10 9.18E-01
1.24E-04 8.26E-02 1.24E-10 9.17E-01
1.26E-04 8.33E-02 1.26E-10 9.17E-01
1.29E-04 8.35E-02 1.29E-10 9.17E-01
1.32E-04 8.37E-02 1.32E-10 9.16E-01
1.34E-04 8.28E-02 1.34E-10 9.17E-01
1.35E-04 8.37E-02 1.35E-10 9.16E-01
1.38E-04 8.52E-02 1.38E-10 9.15E-01
1.40E-04 8.71E-02 1.40E-10 9.13E-01
1.41E-04 8.37E-02 1.41E-10 9.16E-01
1.43E-04 8.43E-02 1.43E-10 9.16E-01
1.45E-04 8.43E-02 1.45E-10 9.16E-01
1.48E-04 8.43E-02 1.48E-10 9.16E-01
1.50E-04 8.39E-02 1.50E-10 9.16E-01
1.54E-04 8.43E-02 1.54E-10 9.16E-01
1.56E-04 8.43E-02 1.56E-10 9.16E-01
1.58E-04 8.45E-02 1.58E-10 9.15E-01
1.60E-04 8.56E-02 1.60E-10 9.14E-01
1.63E-04 8.43E-02 1.63E-10 9.16E-01
1.65E-04 8.39E-02 1.65E-10 9.16E-01
1.67E-04 8.45E-02 1.67E-10 9.15E-01
1.68E-04 8.45E-02 1.68E-10 9.15E-01
1.70E-04 8.43E-02 1.70E-10 9.16E-01
1.72E-04 8.43E-02 1.72E-10 9.16E-01
1.75E-04 8.45E-02 1.75E-10 9.15E-01
1.80E-04 8.45E-02 1.80E-10 9.15E-01
1.85E-04 8.45E-02 1.85E-10 9.15E-01
1.90E-04 8.41E-02 1.90E-10 9.16E-01
1.96E-04 8.41E-02 1.96E-10 9.16E-01
2.00E-04 8.41E-02 2.00E-10 9.16E-01
Simulate the couple
---------------------
The very first action to calculate the interdiffusion coefficients is to make sure that the current setting for a diffusion couple is feasible. In other word, you should able to simulate such a diffusion couple with HitDIC.
::
hitdic -c couple1 --sim
hitdic -c couple1 --exp
The option [-c] specifies the tag of the diffusion couple in simulation.input, and the flag [--sim] is used to activate the simulation module. After running the command line above, the simulation result will be searialized to the current working directory. By assigning the [--exp] flag, the experimental data in text would also be searialized as binary file together with the fluxes and interdiffusion coefficients along the diffusion distance.
::
.
├── case1.txt
├── couple1_expconc_distance.cols
├── couple1_expflux_distance.cols
├── couple1_expslope_distance.cols
├── couple1_simconc_distance.cols
├── couple1_simflux_distance.cols
├── couple1_siminterd_distance.cols
├── couple1_simslope_distance.cols
├── database.input
├── optimize.input
└── simulation.input
The name of the ouput result always has a prefix of the tag of the diffusion couple and has a posfix of ".cols". The parts in the middle denote the type of properties being stored. All these output are binary files, which can not be edited directly. The following Python script would do you a favor to retrieve the content,
::
import struct
import matplotlib.pyplot as plt
def readbin(filename):
datas = []
with open(filename, "rb") as infile:
buf = infile.read(4)
while buf:
size = struct.unpack("i", buf)[0]
buf = infile.read(8*size)
datas.append(struct.unpack("d"*size, buf))
buf = infile.read(4)
return datas
if __name__ == "__main__":
sim = readbin("couple1_simconc_distance.cols")
exp = readbin("couple1_expconc_distance.cols")
print(d)
for i in range(2):
plt.plot(sim[i*2], sim[i*2+1], "-", label="sim%d" % i)
plt.plot(exp[i*2], exp[i*2+1], "v", label="exp%d" % i)
plt.legend()
plt.show()
Optimization
-------------
As everything is ready, we are able to determine the unknown parameters in database.input.
First, we run the optimization with enumeration algorithm.
::
hitdic --min enu
By running this option, the setting in optimize.input titled with [enu] would be utilized. For the enumeration algorithm, one should specify the lower and upper limits of the unknowns, as well as the number of grid points that are expected for all coordinates. A log file with the prefix of "enu" and the posfix of ".log" would be available as the enumeration module is terminated. The estimation for the unknowns would also be printed on the screen, while the best estimation will be silently stored in a text file, namely, ".workspace". By runnning,
::
hitdic -c couple1 --sim --load
The simulation result considering the current best estimation would be generated.
The enumeration algorithm is able to provide a rough estimation for the unknowns, though it is insufficient to declare it as the best result.
To achive more precise result, the iterative algorithm is proposed, i.e., the batch steep descent algorithm.
::
hitdic --min steep
Before running command, one would better enter the best estimation from the enumeration algorithm to the setting for [steep] in optimize.input.
Again, another log file for the steepest descent algorithm would be produced and the best estimation in ".workspace" would be replaced by the current result. Running the simulation module again with the flag [--load] to get the latest simulation result.