# cdctool **Repository Path**: hitdic/cdctool ## Basic Information - **Project Name**: cdctool - **Description**: A tool for the computation of the diffusion coefficients - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2016-04-03 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Computation of Diffusion Coefficient Toolkit =============================================== This toolkit intends to compute the diffusion coefficients from experimental concentration profiles using the Matano-Boltzmann method for binary system and the Boltzmann-Kirkaldy method for ternary system. Features --------- - Fit the composition profiles with the superpositions of Matano functions - Calculate the interdiffusion coefficients of binary and ternary diffusion couples Dependencies ------------- - numpy - scipy - matplotlib Get Started ------------ 1. Fake data ^^^^^^^^^^^^ Fake data is available in the cdctoolkit. One can visualize the fake data as following. :: import matplotlib.pyplot as plt from cdctool.faker import FakeBinary, FakeTernary fig = plt.figure() ax = fig.add_subplot(2, 1, 1) dist, c1 = FakeBinary() ax.plot(dist, c1) ax = fig.add_subplot(2, 1, 2) dist, c1, c2 = FakeTernary() ax.plot(dist, c1) ax.plot(dist, c2) plt.show() 2. Fitting the profiles ^^^^^^^^^^^^^^^^^^^^^^^^ The supperpositions of the Boltzmann functions are adopted as the fitting function in the cdctool. Two kinds of functions are considered, that is the fixed terminal composition and free terminal compositions. The fixed terminal fitting functions are proposed. - FitFixedBoltzmann - FitFixedDoubleBoltzmann - FitFixedTripleBoltzmann - AutoFitFixedBoltzmann - AutoFitFixedDoubleBoltzmann - AutoFitFixedTripleBoltzmann The first categories with the prefix Auto means that the user has to chose the fitting shceme automatically. The second categories provide a more intelligent implementation, where a number schemes are iteratively selected and the one with the best fitness is returned. :: import matplotlib.pyplot as plt from cdctool.faker import FakeBinary, FakeTernary from cdctool import AutoFitFixedBoltzmann fig = plt.figure() ax = fig.add_subplot(111) dist, c1 = FakeBinary() ax.plot(dist, c1, "D", label="experiment") r = AutoFitFixedBoltzmann(dist, c1, 0.1, 0.3) res, func = r["res"], r["func"] plt.plot(dist, func(dist, res, xes=(0.1, 0.3)), lbel="Fitted") plt.show() 3. Properties of diffusion profiles ---------------------------------------- One can use the `DiffProfile` to retrieve other properties for a profile. :: from cdctool.profile import DiffProfile pro = DiffProfile(dist, c1, cleft=0.1, cright=0.3, atime=21600, fitmethod="fixedboltzmann") flux = pro.flux(dist) slope = pro.slope interd = flux / slope 4. Interdiffusion coefficients for ternary system --------------------------------------------------- We use the experimental data imtimated by the cdctoolkit. :: import matplotlib.pyplot as plt import numpy as np from cdctool.faker import FakeBinary, FakeTernary, FakeTernaryAnother from cdctool.profile import DiffProfile from cdctool.solve import ternsolve dist1, c11, c12 = FakeTernary() dist2, c21, c22 = FakeTernaryAnother() p00 = DiffProfile(dist1, c11, 0.1, 0.3, atime=21600, fitmethod="fixedboltzmann") p01 = DiffProfile(dist1, c12, 0.2, 0.1, atime=21600, fitmethod="fixedboltzmann") p10 = DiffProfile(dist2, c21, 0.1, 0.3, atime=21600, fitmethod="fixedboltzmann") p11 = DiffProfile(dist2, c22, 0.1, 0.2, atime=21600, fitmethod="fixedboltzmann") d = ternsolve(p00, p01, p10, p11) print(d)