IndexFile

Index files are frequently used in Gromacs to select subsets of a simulation system. In pmx you can read, change and write index files with the IndexFile class.

API Reference

class pmx.ndx.IndexGroup(name='', ids=[], atoms=[])

Class for storing information about a Gromacs index group.

Parameters
  • name (str) – name of the group

  • ids (list, optional) – list of atom indices

  • atoms (list, optional) – list of Atom instances. If this is provided, the ids will be taken from the Atom instances.

name

name of the group

Type

str

ids

list of atom indices

Type

list

class pmx.ndx.IndexFile(fname=None, names=[], groups=[])

Class for storing ndx file information. It can be initialsed as an empty index file, or by providing an ndx file as input, or by providing a list of names and IndexGroup instances.

Parameters
  • fname (str, optional) – input index file. Default is None.

  • names (list, optional) – list of the group names.

  • groups (list, optional) – list of IndexGroup instances.

groups

list of IndexGroup instances

Type

list

names

list if index group names

Type

list

dic

dictionary containg index group names as keys and IndexGroup instances as values

Type

dict

Methods

add_group(group)

Adds a group to the IndexFile.

delete_group(name)

Removes a group from the IndexFile.

parse(fp)

Reads an index file.

write([fn, fp])

Writes the index file.