Exercise 5: | Writing a gauge field |
Goals: | Write files using QDP I/O |
Concepts: | I/O write, Subsets |
Directory: | $HOME/examples/05-writing-gauge |
How to: | $
cd
$HOME/examples/05-writing-gauge $ make $ submit plaquette /scratch/data/propagator_8x8x8x16 new-gauge |
Now let us write some new gauge field files. QDP provides different modes for writing data files. For this reason QDP_open_write() takes an extra argument, volfmt describing what kind of file is to be written. On Blue Gene we can safely use QDP_SINGLEFILE. Presently there are two file formats supported by QDP:
/* volume formats */
|
The begining of write-gauge.c is similar to read-gauge.c from the previous exercise. We start with associating a writer with a file name on line 10, then write an array of four lattice matrices into it on line 16 and close the writer at line 17.
1 #include <qdp-config.h>
|
In main() we start with reading the gauge on line 40, computing our favorite plaquette on line 46 and printing it at line 49.
39 /* read gauge field */
|
Our next step is to make a random link on sites where x+y+z+t is even (that is what QDP_even stands for. Yes, there is also QDP_odd. The formerly magical QDP_all stands for all sites on the lattice. You can even define your own set of points on a lattice with QDP_create_subset(), but it is beyond the scope of our exercise). Notice that we are being frugal here: the random link is created only on even sites on line 53. On lines 56 and 57 we multiply U[0] by force and store the result back to U[0]. The new value of the plaquette is computed on line 60.
35 /* allocate and initialize random state */
|
Freshly updated gauge field is stored into file argv[2] on line 65.
64 /* write U to a new file */
|