- function chfl_version()¶
Get the version of the Chemfiles library.
- CHFL_STRING_LENGTH [integer]¶
Chemfiles uses fixed length strings, containing at most
CHFL_STRING_LENGTHcharacters. If you need longer strings than the default (1024), you will need to edit the corresponding source code.
- function chfl_last_error()¶
Get the last error message emitted by Chemfiles.
- subroutine chfl_clear_errors([status])¶
Clear the last error message emitted by Chemfiles.
All chemfiles functions have an optional
status argument which is an integer
chfl_status, and can take the following values:
- chfl_status [integer]¶
Kind parameter for subroutine and function optional integer status.
- CHFL_MEMORY_ERROR [integer(chfl_status)]¶
Status code for error concerning memory: out of memory, wrong size for pre-allocated buffers, etc.
- CHFL_FILE_ERROR [integer(chfl_status)]¶
Status code for error concerning files: the file do not exist, the user does not have rights to open it, etc.
- CHFL_FORMAT_ERROR [integer(chfl_status)]¶
Status code for error in file formatting, i.e. for invalid files.
- subroutine chfl_set_warning_callback(callback[, status])¶
Chemfiles sends warning on various events, for example invalid files or errors in the API usage. By default they are printed to the standard error stream, but you can redirect them by setting a callback to be called on each event with the event message. This function set the callback for all warning events.
- subroutine chfl_warning_callback(message)¶
Interface for the warning callback to be used with
message [string] :: The warning message
- subroutine chfl_add_configuration(path[, status])¶
Read configuration data from the file at
By default, chemfiles reads configuration from any file named
chemfiles.tomlin the current directory or any parent directory. This function can be used to add data from another configuration file.
This function will fail if there is no file at path, or if the file is incorrectly formatted. Data from the new configuration file will overwrite any existing data.
List known formats¶
- type chfl_format_metadata¶
chfl_format_metadatacontains metadata associated with one format
- Type fields:
% name [character(len=CHFL_STRING_LENGTH)] :: name of the format
% extension [character(len=CHFL_STRING_LENGTH)] :: extension associated with the format, or empty string if there is no associated extension
% description [character(len=CHFL_STRING_LENGTH)] :: extended, user-facing description of the format
% reference [character(len=CHFL_STRING_LENGTH)] :: URL pointing to the format definition/reference
% read [logical] :: is reading files in this format implemented?
% write [logical] :: is writing files in this format implemented?
% memory [logical] :: does this format support in-memory IO?
% positions [logical] :: does this format support storing atomic positions?
% velocities [logical] :: does this format support storing atomic velocities?
% unit_cell [logical] :: does this format support storing unit cell information?
% atoms [logical] :: does this format support storing atom names or types?
% bonds [logical] :: does this format support storing bonds between atoms?
% residues [logical] :: does this format support storing residues?
- subroutine chfl_formats_list(metadata[, status])¶
Get the list of formats known by chemfiles, as well as all associated metadata.
This function allocate memory for all known formats. Users of this function are responsible with cleaning up this memory using the standard
- function chfl_guess_format(path[, status])¶
Get the format that chemfiles would use to read a file at the given
The format is mostly guessed from the path extension, chemfiles only tries to read the file to distinguish between CIF and mmCIF files. Opening the file using the returned format string might still fail. For example, it will fail if the file is not actually formatted according to the guessed format; or the format/compression combination is not supported (e.g.
XTC / GZwill not work since the XTC reader does not support compressed files).
The returned format is represented in a way compatible with the various
"<format name> [/ <compression>]", where compression is optional.