# How to create Bärnighausen Trees?

In crystallograpy exists an established visual representation for symmetry relations between different structures/phases which are called Bärnighausen trees.

Typical examples look like (from U. Müller 2013):

### Full Bärnighausen Tree

(Table of Wyckoff positions and their splittings)

1. With pictures:

1. Without pictures:

### Compact Bärnighausen Tree

(i.e. the tables of Wyckoff positions and the arrows denoting splits etc are omitted, typically used when many subgroups are shown)

1. Without pictures:

1. With pictures:

I would use tikz to create them. However, I am not sure how to do this conveniently to reduce extensive manual shifting to get correct alignment, and to get the correct reference points below and above the columns for the arrows representing Wyckoff splits.

To increase the difficulty, there would be following recommendation: the vertical distance of the nodes showing the groups and the structure/phase name should be the logarithm of the index of the subgroup in the original group (times a length scale). The index is shown after the letter k, t or i on top of the arrow. In the first picture the index is 2 (t2) and in the second picture its twice 2 (k2). This means a subgroup of index 6 and a subgroup of index 2 of a subgroup of index 3 would have the same vertical position. Mathematically speaking log(6)=log(2*3)=log(2)+log(3).

I do not necessarily want full code answers, but advice how to write a code which scales for the more complex situations.

I would not expect that the graph drawing library would be a good approach. I expect that I would specify the general positions of the big node boxes. I think my first try would be to put into one tikz node three minipages. In the second minipage a tikz matrix with named nodes.

However, explicit answers for the second picture would be great which should not necessarily be identical to the given picture but show how to do this kind of drawing.

PS. the word tree in Bärnighausen tree means not strictly a tree but can be a graph.

• It would help if you supplied an MWE showing what you have got, so far. May 29, 2018 at 17:09
• why don't you use the gu package? May 29, 2018 at 18:54
• @naphaneal That looks like an answer to me. Why not post an example using the package. (It's a shame the documentation is only in German.) May 29, 2018 at 19:19
• @HenriMenke: sorry for the bad fit of my question. But sometimes getting first feedback is also helpful. I am confident I would reach the desired result by investing enough time. I do not want you to do my work but get advice. If you think asking other people is a bad thing, I do not share your opinion. I have seen people implementing job control into a program where a shell script would have been sufficient. The added complexy to the c program made everything unnecessarily complicated. The person was simply not familiar with shell scripting. May 30, 2018 at 18:00

# Figure 1: Two-level full Bärnighausen Tree with the package gu

\documentclass{article}
\usepackage{gu}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{mwe}

\begin{document}

\begin{stammbaum}

{true}% Level 1: Space group and chemical formula
{2em}%   Level 1-2: Minimal length of line/arrow
{true}%  Level 1-2: Description of the group-subgroup relation (letter t,k, or i plus index, second & third row basis trafo)
{true}% Level 2: Space group  and chemical formula
{0em}%   Level 2-3: Minimal length of line/arrow
{false}% Level 2-3: Description of the group-subgroup relation (letter t,k, or i plus index, second & third row basis trafo)
{false}% Level 3: Space group  and chemical formula

\setuprechts%
{true}% Level 1: table Wyckoff positions
{2em}% Level 1-2: Minimal length of line/arrow
{false}% Level 1-2: Transformation
{true}% Level 2: table Wyckoff positions
{0em}% Level 2-3: Minimal length of line/arrow
{false}% Level 2-3: Transformation
{false}% Level 3: table Wyckoff positions

\setupdivers%
{1em}% horizontal distance left <-> right
{0em}% fine-tuning collision control x
{0em}% fine-tuning collision control y
{true}% lseins and rseins center vertically
{false}% lszwei and rszwei center vertically
{false}% draw framebox

\setuprlagentabellen%
{4.5em}% Width of the columns
{1}% Level 1: Number of colmns
{2}% Level 2: Number of colmns
{0}% Level 3: Number of colmns
{\spaltenbreiteem/2}% Level 1: horizontal displacement of the table
{0em}% Level 2: horizontal displacement of the table
{0em}% Level 3: horizontal displacement of the table

\begin{tabular}{c}%
$F4_1/d\bar{3}2/m$\\
\fbox{diamond}\\
\end{tabular}%
}

\labstiegeins{% left descent one
t2%
}

\begin{tabular}{c}%
$F\overline{4}3m$\\
\fbox{zinc blende}\\
\end{tabular}%
}

\rlagentabelleeins{% right wyckoff table one
\begin{tabularx}{\spaltenbreiteem*\spalteneins}[b]{|z|} \hline
C: $8a$\\
$\overline{4}3m$ \\
\hline
0 \\
0 \\
0 \\
\hline
\end{tabularx}%
}
\rlagentabellezwei{% right wyckoff table two
\begin{tabularx}{\spaltenbreiteem*\spaltenzwei}[b]{|z|z|} \hline
S: $4a$ & Zn: $4c$\\
$\overline{4}3m$ & $\overline{4}3m$\\
\hline
0 & \ev\\ % \ev = ein viertel/one quarter
0 & \ev \\
0 & \ev\\
\hline
\end{tabularx}%
}

\rechtspfeilsetup{% right arrows setup
\rpfeileinszwei{1}{1}
\rpfeileinszwei{1}{2}
}

\end{stammbaum}
\begin{tikzpicture}
\draw[use as bounding box] (0,0) rectangle (0,0);
\path (0pt,0pt);
\node[inner sep=0pt] (A) at (240pt,170pt) {\includegraphics[width=100pt]{example-image-a}};
\node[inner sep=0pt] (B) at (240pt,60pt) {\includegraphics[width=100pt]{example-image-b}};
\end{tikzpicture}%
\end{document}


## Limitations of the package gu

• at most three-levels (hard coded) and only single subgroups (see Figure 1 in documentation of gu (only German))
• table of Wyckoff positions must have columns with equal width
• pictures have to be added manually.

# Fig. 4: Compact Bärnighausen Tree with Pictures: Tikz Graphdrawing Trees

%! TEX program = lualatex
\documentclass{scrartcl}
\usepackage{tikz}
\usepackage{mwe}
\usepackage[version=4]{mhchem}

\usetikzlibrary{calc, graphs, graphdrawing, quotes}
\usegdlibrary{trees}

\makeatletter
\def\extractcoord#1#2#3{
\path let \p1=(#3) in \pgfextra{
\pgfmathsetmacro#1{\x{1}/\pgf@xx}
\pgfmathsetmacro#2{\y{1}/\pgf@yy}
\xdef#1{#1} \xdef#2{#2}
};
}
\makeatother

\renewcommand{\vec}[1]{\mathbf{#1}}

\begin{document}
\small
\begin{tikzpicture}[
every node/.style={align=center},
]

\graph[
tree layout,
minimum number of children=3,
missing nodes get space=false,
edge quotes={anchor=center, align=center},
edges={nodes={fill=white}},
sibling distance=28mm,
level distance=28mm,
]{

% copy nail at from log file
a/"$P4/m2/m/2/m$"                                 [nail at={(0.0,0.0)}];
b/"$P4/n2_1/m2/m$\\\fbox{\ce{$HT$-WO_3}}"         [nail at={(0.0,-2.8)}];
c/"$P\bar{4}m2$"                                  [nail at={(-2.8,-5.6)}];
d/"$P4/n2_1/c2/c^{(2)}$\\\fbox{\ce{\alpha-WO_3}}" [nail at={(0.0,-5.6)}];
e/"$P\bar{4}2_1m$\\\fbox{\ce{WO_{2.95}}}"         [nail at={(-5.6,-8.4)}];
f/"$P2_1/c2_1/c2/n$"                              [nail at={(-2.8,-8.4)}];
g/"$C2/c2/c2/e^{(2)}$"                            [nail at={(2.8,-8.4)}];
h/"$P12_1/c1$\\\fbox{\ce{$HP$-WO_3}}"             [nail at={(-2.8,-11.2)}];
i/"$P2_1/c2_1/n2/b$\\\fbox{\ce{\beta-WO_3}}"      [nail at={(2.8,-11.2)}];
j/"$P1c1$\\\fbox{\ce{\epsilon-WO_3}}"             [nail at={(-2.8,-14.0)}];
k/"$P\bar{1}$"                                    [nail at={(0.0,-14.0)}];
l/"$P12_1/n1$\\\fbox{\ce{\gamma-WO_3}}"           [nail at={(2.8,-14.0)}];
m/"$P\bar{1}$\\\fbox{\ce{\delta-WO_3}}"           [nail at={(2.8,-16.8)}];

a ->
["k2\\$\vec{a}-\vec{b}, \vec{a}+\vec{b},\vec{c}$\\$-\frac{1}{2},0,0$"]
b[second] ->
["t2\\$-\frac{1}{4},\frac{1}{4},0$"]
c[first] ->
["k2\\$\vec{a}+\vec{b}, -\vec{a}+\vec{b},\vec{c}$"]
e[first];

b ->
["k2\\$\vec{a}, \vec{b},2\vec{c}$\\$0,0,-\frac{1}{2}$"]
d[second] ->
["t2"]
f[first] ->
["t2"]
h[second] ->
["t2\\$0,\frac{1}{4},0$"]
j[second];

h ->
["t2"]
k[third] ->
["i2"]
m[third];

d ->
["t2\\$\vec{a}+\vec{b}, -\vec{a}+\vec{b},\vec{c}$"]
g[third]->
["k2"]
i[second] ->
["t2"]
l[second] ->
["t2"]
m[second];
};

\node[right=60pt] (pic1) at (b) {\includegraphics[width=80pt]{example-image-a}};
\node[right=60pt] (pic1) at (d) {\includegraphics[width=80pt]{example-image-b}};
\node[left=30pt] (pic1) at (e) {\includegraphics[width=80pt]{example-image-c}};
\node[left=30pt] (pic1) at (h) {\includegraphics[width=80pt]{example-image-a}};
\node[right=30pt] (pic1) at (i) {\includegraphics[width=80pt]{example-image-b}};
\node[right=30pt] (pic1) at (l) {\includegraphics[width=80pt]{example-image-c}};

\extractcoord\xa\ya{a}\typeout{[nail at={(\xa,\ya)}];}
\extractcoord\xb\yb{b}\typeout{[nail at={(\xb,\yb)}];}
\extractcoord\xc\yc{c}\typeout{[nail at={(\xc,\yc)}];}
\extractcoord\xd\yd{d}\typeout{[nail at={(\xd,\yd)}];}
\extractcoord\xe\ye{e}\typeout{[nail at={(\xe,\ye)}];}
\extractcoord\xf\yf{f}\typeout{[nail at={(\xf,\yf)}];}
\extractcoord\xg\yg{g}\typeout{[nail at={(\xg,\yg)}];}
\extractcoord\xh\yh{h}\typeout{[nail at={(\xh,\yh)}];}
\extractcoord\xi\yi{i}\typeout{[nail at={(\xi,\yi)}];}
\extractcoord\xj\yj{j}\typeout{[nail at={(\xj,\yj)}];}
\extractcoord\xk\yk{k}\typeout{[nail at={(\xk,\yk)}];}
\extractcoord\xl\yl{l}\typeout{[nail at={(\xl,\yl)}];}
\extractcoord\xm\ym{m}\typeout{[nail at={(\xm,\ym)}];}

\end{tikzpicture}
\end{document}


Based on my own answer from Tikz graphdrawing trees layout: center second child.