You didn't know you can't do CALPHAD without it.
This VS Code Language Extension, developed by Adam M. Krajewski in Prof. Zi-Kui Liu's group at The Pennsylvania State University, provides syntax highlighting for the Thermodynamic DataBase (TDB) files used in the CALPHAD community to describe thermodynamic properties of materials. You can find them alongside publications in the CALPHAD Journal published by Elsevier, or in the Thermodynamic DataBase DataBase (TDBDB) maintained by Prof. van de Walle group at Brown University.
Most critically, if something is highlighted differently than you expect, you know something may be wrong with it :). E.g., in
Together, they yield the following neat-looking TDB header and function definitions:
and the main body of thermodynamic model parameters:
Oh! And it works in the dark mode, too!
We have tested that it performs very well with a number of themes, including: (VSCode Default) Light Modern, Quiet Light, Solarized Light, Monokai, Monokai Dimmed, Synthwave '84, and (VSCode Default) Dark Modern. You can see some of the example renderings below. If you find that TDB Highlighter does not work well with your theme, please open an issue in this repository and we will try to fix it.
No known errors at this time! However, in some cases listed below, the highlighting may not be perfect due to the arbitrary nature of the TDB files and the limitations of the approach.
The phase highlighting is not perfect in a way that it will never cover all the cases since names are arbitrary user choices and can be any string. Thus, without interpreting the TDB file (as opposed to lexing it like we do here), it is impossible to know what is a phase in every context.
Thus, we rely on a list of common phase name patterns that are known to be used in the community. They are currently (as of V1.2.0) covered by this regex (where
You will notice all compound-based names (both explicit
If you believe something is missing, please open an issue in this repository where you secify the phase name you wish to recognize and we will try to add it.
If you wish to add something yourself, unsolicited pull requests are very welcome. To do so, adjust regexes in the
Names of Species
Similar to phases, species names can be arbitrarily set by users, but in this case, the number is so large that it is not feasible to cover even the common ones, as even the same ion can be found written differently across research groups; e.g.,
If you wish to highlight your species, please add them to your local phases list and avoid opening a pull request for this.
Function Names Not Recognized in Equations
Most likely, your function name does not have the
Line Lenght Limit
Some software, like the very popular Thermo-Calc, has a limit on the length of a line in the TDB file, which is 80 characters following the legacy of Fortran standard. We do not enforce this limit in the syntax highlighting, as not all software has this limit (e.g. pycalphad).
However, if you wish to enforce this limit, you can quickly do so by adding the following to your user
Light Modern (VSCode Default Light)
Dark Modern (VSCode Default Dark)
Modifying the Theme to Your Liking
In VS Code, language extensions are meant to use a color theme chosen by the user and thus are, by design, prohibited from making modifications to them. Therefore, TDB Highlighter has to work with existing so-called tokens that are provided by the theme. In some cases, like in [the Dark Modern (VSCode Default Dark)] theme, some critical tokens are explicitly defined to be the same, and there is little we can do about it.
Fortunately, as the user, you have complete control over theme customizations! You can, for instance, add the following to your
And you will get the following:
Selected Release Notes
1.0.0 - 1.2.1