# Simplifying a complex ctrl file

The input files ctrl.ext can be very complex and difficult to read. This tutorial explains how to extract information from that file and make a simpler one. Of course, the simplified file need not generate the same results as the original.

This tutorial assumes you have cloned and built the lm repository (located here), and the executables (blm, lmchk, lmfa) reside in your path. The repository is assumed to reside in ~/lm for the purpose of demonstration.

First, make sure there are no prior files for GaAs in your build directory (or where ever you are going to be working in). These come in the form of gas.* or *.gas, such as ctrl.gas (note: gas is not a typo of gaas).

$cp [repo location]/fp/test/ctrl.gas .  Now run the lmchk utility, which will generate site data (atom locations) from the ctrl.gas file: $ lmchk gas --wsitex=site


This generates a site file for gas; site.gas. lmf does not normally need empty spheres, edit site.gas and remove the lines starting wiWe then copy site.gas to sitein.gas:

$cp site.gas sitein.gas  We can now run blm : $ blm --nk=5 --rdsite --wsitex --express gas


Which will create a actrl.gas file for us. Copy this to ctrl.gas

$cp actrl.gas ctrl.gas  Technically this is the express ctrl.gas file created, however the file contents are not complete. Specifically, GMAX is not set as blm cannot determine it on its own. To find it, we can use the lmfa tool: $ lmfa gas


At the end of this output you will see a output such as

FREEAT:  estimate HAM_GMAX from RSMH:  GMAX=4.9


Specifically we care about the GMAX=* part. Although we are not done yet: copy the file lmfa generated, basp0.gas, to basp.gas and run lmfa again:

$cp basp0.gas basp.gas$ lmfa gas


Finally, you will see another lmfa output looking like

FREEAT:  estimate HAM_GMAX from RSMH:  GMAX=4.9 (valence)  8.1 (local orbitals)


Now we have the value we want, namely the local orbital value (in this example: 8.1). We go back in to our ctrl.gas file and find the gmax= flag, which we should set to 8.1. You can use the following command to do this automatically:

\$ sed -i 's/gmax=0/gmax=8.1/' ctrl.gas


The ctrl.gas is now complete!