PSCF v1.4.0
R-Grid Field Data Format (Periodic)

Symmetrized Basis Field Data Format (Periodic) (Prev)         K-Grid Field Data Format (Periodic) (Next)

The r-grid file format is used by the pscf_rpc and pscf_rpg programs to describe fields in a spatially periodic microstructure. This format outputs the values of set of fields on the nodes of a regular mesh that covers one unit cell of a periodic structure. This mesh is the same one as that used by the pseudo-spectral algorithm for solving the modified diffusion equation.

Example: 2D Hex Phase

Here is example of a converged omega field for a hex phase of a diblock copolymer melt:

format 1 0
dim
2
crystal_system
hexagonal
N_cell_param
1
cell_param
1.7703537313E+00
group_name
P_6_m_m
N_monomer
2
mesh
24 24
0.340581085 19.518839883
0.570887775 19.658020087
1.199229419 19.984609517
2.070864605 20.233012735
2.929754416 19.853514300
. .
. .
. .
0.999219800 19.890258066
0.570887775 19.658020087


File Format

Like other field formats, this file format contains a header section with crystallographic information followed by a data section. The header section is similar that for the symmetry adapted format, except for two differences:

  • The last variable in the header is an array "mesh" of integers giving the number of grid points in each direction.
  • The space_group parameter is optional element of the header for an r-grid field file.

In this example, because it is a two-dimensional crystal (dim = 2), the mesh parameter contains two numbers, both equal to 24, indicating a grid in which there are 24 grid points along each coordinate axis. To describe a hexagonal phase, we use a non-orthogonal coordinate system in which each axis is parallel to one of the Bravais lattice vectors, which in a hexagonal phase have an angle of 60 degrees between them.

The group_name parameter, which is present in the above example, is an optional element of r-grid file. This parameter may be included to document that the field is invariant under a known space group, though the r-grid file format does not impose any space group symmetry. When a w-field in is read from an r-grid file by the READ_W_GRID command, however, the presence of any group_name parameter is actually ignored, and the field is treated as if it has no nontrivial space group symmetry.

The data section contains the values of fields associated with N_monomer monomer types at grid points given by

\[ \textbf{r}(n_1, \ldots, n_{D}) = \sum_{i=0}^{\textrm{D}-1} \frac{n_{i}}{N_{i}}\textbf{a}_{i} \]

where \(D\) is the dimensionality of the crystal (denoted by "dim" in the header file), \(\textbf{a}_{i}\)is a Bravais lattice vector, \(N_{i}\) is the number of grid points along direction \(i\), and \(n_{i}\) is an integer index in the range \(0 \leq n_{i} < N_{i}\). The number of rows in the data section is equal to the total number of grid points. Each row in this section contains values of all field components at a single grid point. The number of columns is equal to the number of monomer types, so that data in column \(\alpha\), with columns numbered as \( \alpha = 0, 1, \ldots \), contains the values of the field associated with monomer type index \(\alpha\).

Grid points are listed in order using the first index \(n_{0}\) as the most rapidly varying (innermost) loop index. The order in which grid points are listed for a three-dimensional crystal can be expressed in pseudo-code as a nested loop of the form:

for (n2 = 0; n2 < N2; ++n2) {
for (n1 = 0; n1 < N1; ++n1) {
for (n0 = 0; n0 < N0; ++n0) {
[Read or write data at grid point r(n0, n1, n2)]
}
}
}

in which capitalized symbols (N0, N1, N2) denote the number of grid points in each direction and lower case-variables (n0, n1, n2) denote indices for a particular grid point. Note that the innermost loop iterates over index values for the first index, n0, while the outerm the outermost loop iterates over values for the last index, n2.

Note that this convention for the order in which grid points are listed in an r-grid file is completely different from order in which elements of a multi-dimensional array are stored in memory by C/C++ programs. For multi-dimensional C arrays, the most rapidly varying (or innermost) index is always the last index, rather than the first. The convention described above was chosen, however, to maintain backwards compatbility with the r-grid file format that was defined for the older Fortran version of PSCF. The ordering of grid points in the r-grid format reflects the order in which elements of multidimensional arrays are stored in memory by Fortran programs, which is different from the order used by C/C++ programs.


Symmetrized Basis Field Data Format (Periodic) (Prev)         Field Files (Up)         K-Grid Field Data Format (Periodic) (Next)