HOOMD Schema¶
HOOMD-blue supports a wide variety of per particle attributes and properties.
Particles, bonds, and types can be dynamically added and removed during
simulation runs. The hoomd schema can handle all of these situations in a
reasonably space efficient and high performance manner. It is also backwards
compatible with previous versions of itself, as we only add new additional data
chunks in new versions and do not change the interpretation of the existing data
chunks. Any newer reader will initialize new data chunks with default values
when they are not present in an older version file.
- Schema name:
hoomd- Schema version:
2.0
See also
hoomd.State for a full description of how HOOMD interprets this
data.
Changes¶
Version 2.0¶
Each
floatdata chunk in 2.0 schema files may be either float32 or float64.
Use-cases¶
The GSD schema hoomd provides:
Every frame of GSD output is viable to restart a simulation
Support varying numbers of particles, bonds, etc…
Support varying attributes (type, mass, etc…)
Support orientation, angular momentum, and other fields.
Binary format on disk
High performance file read and write
Support logging computed quantities
Data chunks¶
Each frame the hoomd schema may contain one or more data chunks. The layout
and names of the chunksmatch that of the binary frame API in HOOMD-blue
itself. Data chunks are organized in categories. These categories have no
meaning in the hoomd schema specification, and are simply an organizational
tool. Some file writers may implement options that act on categories (i.e. write
attributes out to every frame, or just frame 0).
Values are well defined for all fields at all frames. When a data chunk is present in frame i, it defines the values for the frame. When it is not present, the data chunk of the same name at frame 0 defines the values for frame i (when N is equal between the frames). If the data chunk is not present in frame 0, or N differs between frames, values are default. Default values allow files sizes to remain small. For example, a simulation with point particles where orientation is always (1,0,0,0) would not write any orientation chunk to the file.
N may be zero. When N is zero, an index entry may be written for a data chunk with no actual data written to the file for that chunk.
Name |
Category |
Type |
Size |
Default |
Units |
|---|---|---|---|---|---|
Configuration |
|||||
uint64 |
1x1 |
0 |
number |
||
uint8 |
1x1 |
3 |
number |
||
float |
6x1 |
varies |
|||
Particle data |
|||||
attribute |
uint32 |
1x1 |
0 |
number |
|
attribute |
int8 |
NTxM |
[‘A’] |
UTF-8 |
|
attribute |
uint32 |
Nx1 |
0 |
number |
|
attribute |
int8 |
NTxM |
UTF-8 |
||
attribute |
float |
Nx1 |
1.0 |
mass |
|
attribute |
float |
Nx1 |
0.0 |
charge |
|
attribute |
float |
Nx1 |
1.0 |
length |
|
attribute |
int32 |
Nx1 |
-1 |
number |
|
attribute |
float |
Nx3 |
0,0,0 |
mass * length^2 |
|
property |
float |
Nx3 |
0,0,0 |
length |
|
property |
float |
Nx4 |
1,0,0,0 |
unit quaternion |
|
momentum |
float |
Nx3 |
0,0,0 |
length/time |
|
momentum |
float |
Nx4 |
0,0,0,0 |
quaternion |
|
momentum |
int32 |
Nx3 |
0,0,0 |
number |
|
Bond data |
|||||
topology |
uint32 |
1x1 |
0 |
number |
|
topology |
int8 |
NTxM |
UTF-8 |
||
topology |
uint32 |
Nx1 |
0 |
number |
|
topology |
uint32 |
Nx2 |
0,0 |
number |
|
Angle data |
|||||
topology |
uint32 |
1x1 |
0 |
number |
|
topology |
int8 |
NTxM |
UTF-8 |
||
topology |
uint32 |
Nx1 |
0 |
number |
|
topology |
uint32 |
Nx3 |
0,0,0 |
number |
|
Dihedral data |
|||||
topology |
uint32 |
1x1 |
0 |
number |
|
topology |
int8 |
NTxM |
UTF-8 |
||
topology |
uint32 |
Nx1 |
0 |
number |
|
topology |
uint32 |
Nx4 |
0,0,0,0 |
number |
|
Improper data |
|||||
topology |
uint32 |
1x1 |
0 |
number |
|
topology |
int8 |
NTxM |
UTF-8 |
||
topology |
uint32 |
Nx1 |
0 |
number |
|
topology |
uint32 |
Nx4 |
0,0,0,0 |
number |
|
Constraint data |
|||||
topology |
uint32 |
1x1 |
0 |
number |
|
topology |
float |
Nx1 |
0 |
length |
|
topology |
uint32 |
Nx2 |
0,0 |
number |
|
Special pairs data |
|||||
topology |
uint32 |
1x1 |
0 |
number |
|
topology |
int8 |
NTxM |
utf-8 |
||
topology |
uint32 |
Nx1 |
0 |
number |
|
topology |
uint32 |
Nx2 |
0,0 |
number |
Configuration¶
- configuration/step¶
- Type:
uint64
- Size:
1x1
- Default:
0
- Units:
number
Simulation time step.
- configuration/dimensions¶
- Type:
uint8
- Size:
1x1
- Default:
3
- Units:
number
Number of dimensions in the simulation. Must be 2 or 3.
Note
When using
gsd.hoomd.Frame, the object will try to intelligently default to a dimension. When setting a box with \(L_z = 0\),dimensionswill default to 2 otherwise 3. Explicit setting of this value by users always takes precedence.
- configuration/box¶
- Type:
float32 or float64
- Size:
6x1
- Default:
[1,1,1,0,0,0]
- Units:
varies
Simulation box. Each array element defines a different box property. See the hoomd documentation for a full description on how these box parameters map to a triclinic geometry.
box[0:3]: \((l_x, l_y, l_z)\) the box length in each direction, in length unitsbox[3:]: \((xy, xz, yz)\) the tilt factors, dimensionless values
Changed in version 2.0.
Particle data¶
Within a single frame, the number of particles N and NT are fixed for all chunks. N and NT may vary from one frame to the next. All values are stored in hoomd native units.
Attributes¶
- particles/N¶
- Type:
uint32
- Size:
1x1
- Default:
0
- Units:
number
Define N, the number of particles, for all data chunks
particles/*.
- particles/types¶
- Type:
int8
- Size:
NTxM
- Default:
[‘A’]
- Units:
UTF-8
Implicitly define NT, the number of particle types, for all data chunks
particles/*. M must be large enough to accommodate each type name as a null terminated UTF-8 character string. Row i of the 2D matrix is the type name for particle type i.
- particles/typeid¶
- Type:
uint32
- Size:
Nx1
- Default:
0
- Units:
number
Store the type id of each particle. All id’s must be less than NT. A particle with type id has a type name matching the corresponding row in
particles/types.
- particles/type_shapes¶
- Type:
int8
- Size:
NTxM
- Default:
empty
- Units:
UTF-8
Store a per-type shape definition for visualization. A dictionary is stored for each of the NT types, corresponding to a shape for visualization of that type. M must be large enough to accommodate the shape definition as a null-terminated UTF-8 JSON-encoded string. See: Shape Visualization for examples.
- particles/mass¶
- Type:
float32 or float64
- Size:
Nx1
- Default:
1.0
- Units:
mass
Store the mass of each particle.
Changed in version 2.0.
- particles/charge¶
- Type:
float32 or float64
- Size:
Nx1
- Default:
0.0
- Units:
charge
Store the charge of each particle.
Changed in version 2.0.
- particles/diameter¶
- Type:
float32 or float64
- Size:
Nx1
- Default:
1.0
- Units:
length
Store the diameter of each particle.
Changed in version 2.0.
- particles/body¶
- Type:
int32
- Size:
Nx1
- Default:
-1
- Units:
number
Store the composite body associated with each particle. The value -1 indicates no body. The body field may be left out of input files, as hoomd will create the needed constituent particles.
- particles/moment_inertia¶
- Type:
float32 or float64
- Size:
Nx3
- Default:
0,0,0
- Units:
mass * length^2
Store the moment_inertia of each particle \((I_{xx}, I_{yy}, I_{zz})\). This inertia tensor is diagonal in the body frame of the particle. The default value is for point particles.
Changed in version 2.0.
Properties¶
- particles/position¶
- Type:
float32 or float64
- Size:
Nx3
- Default:
0,0,0
- Units:
length
Store the position of each particle (x, y, z).
All particles in the simulation are referenced by a tag. The position data chunk (and all other per particle data chunks) list particles in tag order. The first particle listed has tag 0, the second has tag 1, …, and the last has tag N-1 where N is the number of particles in the simulation.
All particles must be inside the box:
\(-l_x/2 + (xz-xy \cdot yz) \cdot z + xy \cdot y \le x < l_x/2 + (xz-xy \cdot yz) \cdot z + xy \cdot y\)
\(-l_y/2 + yz \cdot z \le y < l_y/2 + yz \cdot z\)
\(-l_z/2 \le z < l_z/2\)
Where \(l_x\), \(l_y\), \(l_z\), \(xy\), \(xz\), and \(yz\) are the simulation box parameters (
configuration/box).Changed in version 2.0.
- particles/orientation¶
- Type:
float32 or float64
- Size:
Nx4
- Default:
1,0,0,0
- Units:
unit quaternion
Store the orientation of each particle. In scalar + vector notation, this is \((r, a_x, a_y, a_z)\), where the quaternion is \(q = r + a_xi + a_yj + a_zk\). A unit quaternion has the property: \(\sqrt{r^2 + a_x^2 + a_y^2 + a_z^2} = 1\).
Changed in version 2.0.
Momenta¶
- particles/velocity¶
- Type:
float32 or float64
- Size:
Nx3
- Default:
0,0,0
- Units:
length/time
Store the velocity of each particle \((v_x, v_y, v_z)\).
Changed in version 2.0.
- particles/angmom¶
- Type:
float32 or float64
- Size:
Nx4
- Default:
0,0,0,0
- Units:
quaternion
Store the angular momentum of each particle as a quaternion. See the HOOMD documentation for information on how to convert to a vector representation.
Changed in version 2.0.
- particles/image¶
- Type:
int32
- Size:
Nx3
- Default:
0,0,0
- Units:
number
Store the number of times each particle has wrapped around the box \((i_x, i_y, i_z)\). In constant volume simulations, the unwrapped position in the particle’s full trajectory is
\(x_u = x + i_x \cdot l_x + xy \cdot i_y \cdot l_y + xz \cdot i_z \cdot l_z\)
\(y_u = y + i_y \cdot l_y + yz \cdot i_z \cdot l_z\)
\(z_u = z + i_z \cdot l_z\)
Topology¶
- bonds/N¶
- Type:
uint32
- Size:
1x1
- Default:
0
- Units:
number
Define N, the number of bonds, for all data chunks
bonds/*.
- bonds/types¶
- Type:
int8
- Size:
NTxM
- Default:
empty
- Units:
UTF-8
Implicitly define NT, the number of bond types, for all data chunks
bonds/*. M must be large enough to accommodate each type name as a null terminated UTF-8 character string. Row i of the 2D matrix is the type name for bond type i. By default, there are 0 bond types.
- bonds/typeid¶
- Type:
uint32
- Size:
Nx1
- Default:
0
- Units:
number
Store the type id of each bond. All id’s must be less than NT. A bond with type id has a type name matching the corresponding row in
bonds/types.
- bonds/group¶
- Type:
uint32
- Size:
Nx2
- Default:
0,0
- Units:
number
Store the particle tags in each bond.
- angles/N¶
- Type:
uint32
- Size:
1x1
- Default:
0
- Units:
number
Define N, the number of angles, for all data chunks
angles/*.
- angles/types¶
- Type:
int8
- Size:
NTxM
- Default:
empty
- Units:
UTF-8
Implicitly define NT, the number of angle types, for all data chunks
angles/*. M must be large enough to accommodate each type name as a null terminated UTF-8 character string. Row i of the 2D matrix is the type name for angle type i. By default, there are 0 angle types.
- angles/typeid¶
- Type:
uint32
- Size:
Nx1
- Default:
0
- Units:
number
Store the type id of each angle. All id’s must be less than NT. A angle with type id has a type name matching the corresponding row in
angles/types.
- angles/group¶
- Type:
uint32
- Size:
Nx3
- Default:
0,0,0
- Units:
number
Store the particle tags in each angle.
- dihedrals/N¶
- Type:
uint32
- Size:
1x1
- Default:
0
- Units:
number
Define N, the number of dihedrals, for all data chunks
dihedrals/*.
- dihedrals/types¶
- Type:
int8
- Size:
NTxM
- Default:
empty
- Units:
UTF-8
Implicitly define NT, the number of dihedral types, for all data chunks
dihedrals/*. M must be large enough to accommodate each type name as a null terminated UTF-8 character string. Row i of the 2D matrix is the type name for dihedral type i. By default, there are 0 dihedral types.
- dihedrals/typeid¶
- Type:
uint32
- Size:
Nx1
- Default:
0
- Units:
number
Store the type id of each dihedral. All id’s must be less than NT. A dihedral with type id has a type name matching the corresponding row in
dihedrals/types.
- dihedrals/group¶
- Type:
uint32
- Size:
Nx4
- Default:
0,0,0,0
- Units:
number
Store the particle tags in each dihedral.
- impropers/N¶
- Type:
uint32
- Size:
1x1
- Default:
0
- Units:
number
Define N, the number of impropers, for all data chunks
impropers/*.
- impropers/types¶
- Type:
int8
- Size:
NTxM
- Default:
empty
- Units:
UTF-8
Implicitly define NT, the number of improper types, for all data chunks
impropers/*. M must be large enough to accommodate each type name as a null terminated UTF-8 character string. Row i of the 2D matrix is the type name for improper type i. By default, there are 0 improper types.
- impropers/typeid¶
- Type:
uint32
- Size:
Nx1
- Default:
0
- Units:
number
Store the type id of each improper. All id’s must be less than NT. A improper with type id has a type name matching the corresponding row in
impropers/types.
- impropers/group¶
- Type:
uint32
- Size:
Nx4
- Default:
0,0,0,0
- Units:
number
Store the particle tags in each improper.
- constraints/N¶
- Type:
uint32
- Size:
1x1
- Default:
0
- Units:
number
Define N, the number of constraints, for all data chunks
constraints/*.
- constraints/value¶
- Type:
float32 or float64
- Size:
Nx1
- Default:
0
- Units:
length
Store the distance of each constraint. Each constraint defines a fixed distance between two particles.
Changed in version 2.0.
- constraints/group¶
- Type:
uint32
- Size:
Nx2
- Default:
0,0
- Units:
number
Store the particle tags in each constraint.
- pairs/N¶
- Type:
uint32
- Size:
1x1
- Default:
0
- Units:
number
Define N, the number of special pair interactions, for all data chunks
pairs/*.Added in version 1.1.
- pairs/types¶
- Type:
int8
- Size:
NTxM
- Default:
empty
- Units:
UTF-8
Implicitly define NT, the number of special pair types, for all data chunks
pairs/*. M must be large enough to accommodate each type name as a null terminated UTF-8 character string. Row i of the 2D matrix is the type name for particle type i. By default, there are 0 special pair types.Added in version 1.1.
- pairs/typeid¶
- Type:
uint32
- Size:
Nx1
- Default:
0
- Units:
number
Store the type id of each special pair interaction. All id’s must be less than NT. A pair with type id has a type name matching the corresponding row in
pairs/types.Added in version 1.1.
- pairs/group¶
- Type:
uint32
- Size:
Nx2
- Default:
0,0
- Units:
number
Store the particle tags in each special pair interaction.
Added in version 1.1.
Logged data¶
Users may store logged data in log/* data chunks. Logged data encompasses
values computed at simulation time that are too expensive or cumbersome to
re-compute in post processing. This specification does not define specific chunk
names or define logged data. Users may select any valid name for logged data
chunks as appropriate for their workflow.
For any named logged data chunks present in any frame frame the file: If a chunk is not present in a given frame i != 0, the implementation should provide the quantity as read from frame 0 for that frame. GSD files that include a logged data chunk only in some frames i != 0 and not in frame 0 are invalid.
By convention, per-particle and per-bond logged data should have a chunk name
starting with log/particles/ and log/bonds, respectively. Scalar,
vector, and string values may be stored under a different prefix starting with
log/. This specification may recognize additional conventions in later
versions without invalidating existing files.
Name |
Type |
Size |
Units |
|---|---|---|---|
n/a |
NxM |
user-defined |
|
n/a |
NxM |
user-defined |
|
n/a |
NxM |
user-defined |
- log/particles/user_defined¶
- Type:
user-defined
- Size:
NxM
- Units:
user-defined
This chunk is a place holder for any number of user defined per-particle quantities. N is the number of particles in this frame. M, the data type, the units, and the chunk name (after the prefix
log/particles/) are user-defined.Added in version 1.4.
- log/bonds/user_defined¶
- Type:
user-defined
- Size:
NxM
- Units:
user-defined
This chunk is a place holder for any number of user defined per-bond quantities. N is the number of bonds in this frame. M, the data type, the units, and the chunk name (after the prefix
log/bonds/) are user-defined.Added in version 1.4.
- log/user_defined¶
- Type:
user-defined
- Size:
NxM
- Units:
user-defined
This chunk is a place holder for any number of user defined quantities. N, M, the data type, the units, and the chunk name (after the prefix
log/) are user-defined.Added in version 1.4.
State data¶
Removed in version 2.0: state/* data chunks do not exist in schema versions 2.0 and newer.