How to use OpenCalphad Apptainer image?
Prerequisites
- Have Apptainer installed (installation guide)
- Have downloaded the opencalphad.sif image available here
- Have downloaded the input files available here
For more information on Apptainer containers, please look at this page or refer to this tutorial to have a quick look at Apptainer’s main commands.
Input files
To illustrate the various commands, a set of OpenCalphad input files is available in the form of an archive via this link.
Those files are adapted from a tutorial example from the OpenCalphad official repository. The archive contains the following files:
input.OCM: an OpenCalphad input file to compute and plot the phase diagram for C-Fe,steel1.TDB: a database file.
In this tutorial, we will assume that the input files contained in this archive are in the current directory. To extract them:
tar -xzf opencalphad-tutorial-inputs.tar.gzQuickstart
For impatient folks, here is how to launch an OpenCalphad computation in the case where the current directory contains the opencalphad.sif container image and all necessary OpenCalphad input files:
apptainer exec opencalphad.sif oc6P input.OCMDetailed usage for the OpenCalphad container
This section explains how to use the OpenCalphad image to compute and plot the classical phase diagram for C-Fe. For more details about Apptainer commands, please look at this tutorial.
Introduction
OpenCalphad is an OpenMP-parallelized open-source software suite designed for thermodynamic calculations in multicomponent systems.
The main executable in the image is the oc6P executable. The diagrams produced by OpenCalphad are plotted with the gnuplot executable, also embedded in the image.
Using OpenCalphad on the tutorial example
The input file input.OCM allows us to plot the phase diagram for the C-Fe system. It is adapted from the map3.OCM example from the macros directory of the
official repository corresponding to the release version of the software embedded in the container (v.6.0). A description of this example can be found in the official
documentation on page 14, under section 4.3.3: Phase diagram for C-Fe.
To run the computation:
apptainer exec opencalphad.sif oc6P input.OCMThis command displays different gnuplot diagrams such as a phase diagram for the system where the whole carbon range up to graphite is included and the metastable C-Fe system phase diagram with cementite. After each plot, the user is invited to hit the Enter key inside their shell to trigger the next plot. Some of the expected plots are shown in the example
documentation.
At the end of the computation, an interactive shell is opened by OpenCalphad. This shell can be safely closed with the Ctrl/Command + C keys combination.
Running other examples with the OpenCalphad container image
The official
documentation describes many more simple examples to expose the abilities of the OpenCalphad software. The associated input files can be found in the
macros directory of the release repository. A minor adaptation is required to run those examples with the containerized version of the software. To allow a .OCM macro to be run with the OpenCalphad container image, simply add the following lines at the very beginning of the script:
enter gnuplot_term
SCREEN
x11 size 600,500 font "Arial,16"These lines ensure that gnuplot uses the X11 window system instead of the Qt library which is not embedded in the container.
In most of the example scripts, the @& keyword is used at multiple places to pause the execution until a key is pressed. These commands can be safely deleted for convenience when they are not placed between two plots. Otherwise, when they do separate plots, these pauses should not be deleted as doing so would make gnuplot display the same diagram twice in a row.
Similarly, the set inter command at the end of an OpenCalphad script is responsible for triggering the interactive shell at the end of the script execution. Deleting this command makes the executable exit with an error at the end of a script.