ChemApp for Python is a Python package that makes the ChemApp thermochemistry library developed by GTT-Technologies accessible in Python. It also adds some powerful tools to make it easier and more productive to do thermochemical calculations.

If you frequently work with thermochemistry, you have done basic calculations, such as calculating the enthalpy of SiO2 at 1000 ^\circ \text{C}, and calculating the equilibrium state of a set of input compounds countless times. ChemApp for Python helps you take care of those details in a structured and reliable manner so that you can focus more of your attention on higher-level concepts and problems.

In this chapter we provide an overview of the contents of the ChemApp for Python package, and then give some background information about the most important tools that you will need when working with ChemApp for Python and Python. This will help to prepare you for working with Python, if you are unfamiliar with it.

Package Contents

ChemApp for Python is distributed in the form of a Python package, which you will receive as a .tar.gz file. The package contains the following modules:

  • core module

    The core module contains Python classes for entities like phases, phase constituents, thermochemical systems and calculation results. These classes can be used to create objects that make it easy and flexible to do computational thermochemistry work. We demonstrate this with examples.

  • basic module

    This module provides access to ChemApp through the original, very compact tq* application programmer’s interface (API).

  • friendly module

    This module allows you to work with ChemApp through a more verbose, and more friendly API that is easier to read and remember. This API is also more power, in that you can get more done with fewer lines of code.

  • User manual

    This manual is provided in .pdf format in the ChemApp for Python distribution package. It is also available as online ressource at <>

  • Examples

    The distribution package contains a set of examples that demonstrate how to use the different parts of ChemApp for Python, step by step.

Descriptive Naming

Most of the modules in ChemApp for Python use a common naming convention. The only exception to this is the basic module, which is meant to be a copy of the original ChemApp API. It therefore retains all the naming used in ChemApp.

The purpose of the naming convention is to ensure that Python code that uses ChemApp for Python is easily readable and understandable.

The ChemApp for Python naming convention uses a set of one-, two-, and three-letter abbreviations for frequently used terms. This is shown in the following table.










molar mass


relative activity




heat capacity






phase constituent


Gibbs energy


phase constituents




system component


incoming amount


system components


chemical potential




















total volume


amount fraction


mole fraction


mass fraction

These abbreviations are used to create descriptive and easily readable names for functions and variables. Here are a few examples.

from chemapp.friendly import ThermochemicalSystem
from chemapp.friendly import EquilibriumCalculation

# get the number of system components in the thermochemical system

# get the molar mass of the system component 'Fe'
mm_Fe = ThermochemicalSystem.get_mm_sc('Fe')

# set the equilibrium pressure and temperature for a calculation

# get the equilibrium amounts of all phases after a calculation
amounts = EquilibriumCalculation.get_eq_A_phs()

# get the equilibrium Gibbs energy of a phase after a calculation
G = EquilibriumCalculation.get_eq_G_ph('gas_ideal')


ChemApp is a software library that contains code that can be run by calling it from an application that you create. Since it is a library, ChemApp cannot be run by itself. You need to create an application (write a program) to call its functions.

The ChemApp library contains a set of 75 functions, all of which have a name that starts with the letters tq. We refer to this set of functions as ChemApp’s basic API. An API is a set of components like functions that programmers can use to call the library when they develop applications. As you use ChemApp for Python to write programs to do thermochemical calculations, you can therefore use ChemApp’s basic API, or one of the other APIs provided within ChemApp for Python.

GTT-Technologies released three different editions of ChemApp, namely Development, Redistributable, and Light. The Development edition is intended for people developing new applications with ChemApp, and the Redistributable edition for packaging and distributing applications that were developed with the Developer edition. The Light edition is provided free of charge for demonstration purposes, but has limited functionality. ChemApp for Python is intended to be a development tool, and is only provided in Development and Light editions.

Important Computing Aspects

You need to understand the following points related to your computer and operating system.

  • 64-bit vs. 32-bit

    Since most modern computers use 64-bit central processing units (CPUs), and most modern operating systems are able to make use of the enhanced capacity of these CPUs, we always provide ChemApp for Python in 64-bit form. 32-bit versions of ChemApp for Python do not exist.

  • Operating system (OS)

    We provide ChemApp for Python for use on two operating systems, namely Windows and Linux. Mac OS is not currently supported.

  • Python version

    Due to the slightly sensitive approach of fully compiled python code, the ChemApp for Python package should only be used with Python versions that are exactly, even down to the minor version number identical to the one that we provide. This may be slightly less flexible than many other Python packages.


Python is an open-source, high-level, interpreted, general-purpose programming language. It was created by Guido van Rossum, and was first released in 1991.

The Language

Since Python is open source, you have access to the source code, if you need to see how the internals work. It also means that Python is freely accessible to anyone with a computer. This is one of the reasons why it has a large user community world wide, and why it has been one of the fastest-growing programming languages over the last few years.

Python is a high-level language, which means that you have much less responsibility to take care of detailed computing matters such as memory management and disk access. This is great if you are a scientist or engineer who doesn’t know or care about these things, and you just want to get on with getting your job done.

Since Python is interpreted, you don’t have to compile and build your software before you can run it. You can just type and run. This makes it very productive and easy to work with.

Python’s general-purpose nature means that once you have written a nice application to solve a thermochemical problem, it can be integrated into a web application or some other application written by programmers or other IT people. Python is not like MATLAB, which is purely scientific and technical. It can integrate with and be integrated with virtually any other system.

Our view is that learning Python is a wise investment for any modern scientist and engineer. If you choose to learn it, you will become part of a world-wide movement of people sharing ideas and software, and get access to a multitude of packages related to things like mathematics, chemistry, numerical methods, and much more. If you want a Python module to help you make coffee, you will probably find that as well. (Yup, I just confirmed this. Have a look at this package on GitHub!).


Python is available in many versions, which may be confusing. The first point to note is that we only make ChemApp for Python available for 3.x of Python, and not for 2.x versions. You should therefore not download or install Python 2.6 or 2.7 if you want to work with ChemApp for Python.

At the time of writing this manual, Python 3.7 - 3.10 were all available. The version of Python that you should use with ChemApp for Python is indicated in the ChemApp for Python distribution file name. An example of such a name is chemapp1.3.0-win-chemapp7.2.0-python3.6.5.tar.gz, which indicates that it is intended for use with Python 3.6.5.

Packages and Modules

When working with Python software, we use the terms package and module, and it is important that you understand them.

A package is analogous to a folder. The folder must contain at least an module to be recognised as a package. It can also contain other Python modules, and sub-packages.

A module is a file that contains Python code. When you write your first script, it will be contained in a Python module. Modules can be in the form of text files with the .py extension, or it can be compiled binary files with .so extensions on Linux, and .pyd extensions on Windows. A .pyd file is simply a dynamically linked library (.dll) with a different extension.


So how do you get Python? The most direct way is to download it from the website. We don’t recommend this.

Python Distributions

Python is a little like Linux. Many people take the core of it, and package it into useful distributions. If you want to use Linux, for example, most people would not start at downloading the kernel. This will leave you with A LOT to do before getting to a working operating system. You will probably rather download a distribution like Debian, Ubuntu, Fedora, or openSUSE. They get you up and running, and doing what is interesting to you in a flash.

Python also has many distributions, like WinPython, ActivePython, Python(x,y), and Anaconda. Anaconda is the one we recommend if you are a scientist or engineer.


We refer to Anaconda and conda quite a bit in this manual. This may be confusing. You now know that Anaconda is a Python distribution. The nice people at Anaconda Inc. have done a stirling job of packaging Python and many useful packages in a form that is easy to install and use. Without it, you will have to do lots of work before getting started with Python.

conda is Anaconda’s environment and package manager. We use it to create Python environments, and then install packages into these environments. We can then use the packges in our scripts and software components. conda is therefore much like apt, the package manager for Debian and Ubuntu that we use to install the software we need.

conda enables us to create multiple Python environments, which we refer to as conda environments. This is useful when we want to use multiple versions of Python (e.g. 2.7, 3.4, 3.6) on the same machine, and when we want to have Python environments configured for specific tasks, like one for thermochemical calculations, one for solving ordinary differential equations, and one for building web applications. These different scenarios will each require us to install a different set of packages. If we do everything in a single environment, it will become bloated. By keeping them separate, they are more lean, easy to work with, and easier to share with colleagues.


In most cases Python source code is written in text files that have a .py extension. You can develop your applications with only a text editor and the terminal. This is a bit daunting for most people, since they are unfamiliar with using the terminal. It is for this reason that we encourage you to use an integrated development environment (IDE).

An IDE is a user-friendly environment within which you can write computer programs. It hides many of the intricacies involved, and allows you to get more done in less time. It also helps you to discover and fix errors quickly and easily.

PyCharm is an IDE developed by JetBrains. It is provided in Professional, Educational, and Community editions. The Community edition is free, but still rich in functionality. We recommend it strongly, especially if you are new to the Python world.