H5MD Reader¶
This module provides a file reader for the H5MD format.
- class halmd.io.readers.h5md(args)¶
Construct H5MD reader.
- Parameters:
args (table) – keyword arguments
args.path (string) – pathname of input file
- reader(self, args)¶
Construct a group reader.
- Parameters:
args (table) – keyword arguments
args.location (table) – sequence with group’s path
args.mode (string) – read mode (“append” or “truncate”)
- Returns:
instance of group reader
- close(self)¶
Close file.
- root¶
HDF5 root group of the file.
- path¶
Filename of the file.
- version¶
H5MD major and minor version of file.
- creator¶
Name of the program that created the file.
- creator_version¶
Version of the program that created the file.
- creation_time¶
Creation time of the file in seconds since the Unix epoch.
This time stamp may be converted to a human-readable time using os.date:
halmd.log.message(("file created at %s"):format(os.date("%c", file.creation_time)))
- author¶
Name of author of the file.
- halmd.io.readers.h5md.check(path)¶
Check whether file is a valid H5MD file.
- Parameters:
path – filename
- Returns:
true
if the file is a valid H5MD file,false
if not, ornil
if the file does not exist
An error message is emitted if the return value is not
true
.The function is useful to validate a command-line argument:
local parser = halmd.utility.program_options.argument_parser() parser:add_argument("trajectory", { help = "H5MD trajectory file" , type = "string" , required = true , action = function(args, key, value) halmd.io.readers.h5md.check(value) args[key] = value end })