Syntax of integer lists
Integer lists consist of a sequence of strings separated by commas:
Each of the strn1, strn2, … can assume one of the following forms:
a single integer or algebraic expression
two integer expressions separated by a colon, viz
gets expanded into
low, low+1, low+2, ... high
Three integer expressions separated by colons, viz
gets expanded into:
low, low+step, low+2*step, ... high
(Extension, not always applicable). The dup tag
duplicates the entire list to this point, adding # to each of the duplicate elements. The list up to the current point doubles in size.
- (Extension, not always applicable). The seq tag
is similar to dup, with the following modifications:
- The existing list is replicated and shifted for each of the #1, #2, #3, ….
- The shift is constructed so that the first element of the the duplicated list begins at #1, the second at #2, etc.
The size of the list thus increases by a factor n, n being the number of integers in
If you want to continue the list after seq=#1,#2,#3,… , delimit this string with a semicolon (see the mlist example below).
- (Extension, not always applicable). The “!” modifier
A shriek (!) acts like a logical NOT. The list is created, and then masked against the range of numbers in the list 1…n; thus any element missing from the supplied list is returned in the actual list. This only applies in special instances where n is known e.g. for the blm switch
--wsite~ib=list(n is the size of the basis) and the
--band~col=listswitch (n is the rank of the hamiltonian).
The shriek can occur only once, and it must be the first character in the string.
5+1 becomes a single number, 6. 5+1:8+2 becomes a sequence of numbers, 6 7 8 9 10 5+1:8+2:2 becomes a sequence of numbers, 6 8 10 1:4,7:11 becomes the sequence 1 2 3 4 7 8 9 10 11 5,6,dup=16,8 becomes the sequence 5 6 21 22 8 7:9:2,seq=16,25 becomes the sequence 7 9 16 18 25 27
The mlist utility
The Questaal suite comes with a utility mlist that enables you to enter a list on the command line and see how it is expanded. mlist normally performs a corresponding function for real numbers (capabilities 1,2,3 but not 4,5); but if you invoke mlist with -i it will generate an integer list according to all five rules explained above.
Example using mlist:
mlist -i '0,dup=2,seq=10,20;dup=100,seq=1000'
doubles the initial list (0), then trebles the new list to make 6 elements (seq=10,20), doubles it again (dup=100), and doubles it once more to make the following list of 24 elements:
0 2 10 12 20 22 100 102 110 112 120 122 1000 1002 1010 1012 1020 1022 1100 1102 1110 1112 1120 1122
Note: slatsm/mkilst.f contains the source code for generating integer lists.