Support

Support Options

Submit a Support Ticket

 

A Python code for material composition lines - composition line utility

By Amritanshu Palaria

Purdue University

Category

Downloads

Published on

Abstract

In material science and chemical thermodynamics, phase diagrams play an important role. In composition-phase diagrams, compositions of the various components constitute, depending on how the composition may change, one or more axes of the diagram. In the sub-space formed by only the composition axes, one can define a composition line by stating the compositions at its end-points. For such composition-phase diagrams or to simply analyze composition change in a system of several components, one may be interested in knowing the answers to the following questions:
1. Whether a given composition lies on a composition line (defined by its end compositions)
2. Whether two composition lines (again defined by their end compositions) intersect and if so what the intersecting composition is
3. What the energy of any composition on the composition line is, given the energies at the end-points of the line

This program answers the above three questions for the user. The code is self-contained in that the user can run it without knowing the structure of the code. The program will provide appropriate instructions for the user to enter data and make selections. During a single execution of the code, the program would work with one composition line defined by its start and end points and allow the user to carry out one or more of the above three tasks any number of times on that single composition line – the program will not quit until the user explicitly selects the option to quit. The program works for any number of components and is case-insensitive with regard to the component names. To test and familiarize himself/ herself with the code, the user can utilize the testing steps described in the document testing_the_code.pdf provided with the code.

About the code:
Provided are two alternative Python codes, compline_prog.py and compline_prog_numpy.py, both of which were written and tested in Python 2.7.3 for 64-bit Windows. The difference between the two codes is that the first uses simple algebra and is not dependent on numerical libraries such as NumPy. The second code uses linear algebra operations from NumPy and requires that this library be installed for successful run. In either case, the code first defines the class "CompLine" whose objects are composition lines defined by start and end compositions. The "main" section of the code instantiates the class and calls the appropriate function defined within the class depending on the user choice. The code carries out all float comparisons upto 7 rounded places after the decimal point.
Note that using simple algebra to find the intersection of composition lines makes the code lengthier but requires a single loop over the number of components, n – giving better performance for large n. Using linear algebra operations from NumPy makes the code shorter, simpler and more elegant in form, but finding the intersection of composition lines requires a matrix inversion – leading to poorer performance if n is large.

Cite this work

Researchers should cite this work as follows:

  • Amritanshu Palaria (2013), "A Python code for material composition lines - composition line utility," http://nanohub.org/resources/19375.

    BibTex | EndNote

Tags

nanoHUB.org, a resource for nanoscience and nanotechnology, is supported by the National Science Foundation and other funding agencies. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.