Once you've written down the equations for your model as described in the previous section, writing the file to encode these equations for the program is quite simple. We strongly recommend that you start by copying an existing model file and then simply modify it as needed. You should always put a description of your model in the comments at the top of the model file as this makes it easy to refer to later as well as to show other people what you have done.
Probably the easiest way to read the rest of this section is to have a copy of the model file for the TWOFLDLAMBDA model next to you as you read so that you can refer to it and see what each section we describe looks like.
Before going through the different parts of the model file, we should point out that at some points in the file you will see certain macros such as FIELD, LOOP, and INDEXLIST that are defined in latticeeasy.h in order to simplify the process of writing code that works in different numbers of dimensions. For the most part these have already been encoded and you will have to make little use of them in modifying the model files, however there may be some occasions when you would like to do something a little more involved and would want to use these macros. Section 4.2.3 describes all of the macros defined for this purpose.
After the initial comments the first section of the model file is a list of model-specific adjustable parameters. In the TWOFLDLAMBDA model, for example, this section consists of the parameters and (defined above). You could just put your model parameters at the top of your model file and leave them there, but if you ever expect to modify these parameters we recommend instead that you write them in a commented out section at the top of the model file. Then copy them (uncommented) to the file parameters.h. This way your model file contains all the information about your model, but when you are actually doing runs with it all of your adjustable parameters will be in one place.
The next section of the file contains the rescaling parameters , , and described above. In the program they are called rescale_A, rescale_B, and rescale_r. If you want to set them to your own favorite values you can simply do so directly. Otherwise you can set the values , , and and let , , and be set in terms of them. Of course if you are copying a model file where these defaults were reset you will have to put them back in. You can copy the definitions of , , and in terms of , , and from the TWOFLDLAMBDA model file or simply write them in by hand; the equations are provided in comments just above the declarations of these parameters.
The next section of the file declares the array model_vars. This is a list of dynamic variables specific to your model. For most of our models this array is not used, but it is included to allow flexibility.
The last section before the functions is a list of macros for field variables. These are strictly optional. They are used to make the programs more readable. Their use should be clear from looking at any of our example files. Feel free to write appropriate ones for your model or not as you prefer.
The rest of this section describes the functions that must be defined in the model file.