Пример #1
0
    def create_state_from_gsd(self, filename, frame=-1):
        """Create the simulation state from a GSD file.

        Args:
            filename (str): GSD file to read

            frame (int): Index of the frame to read from the file. Negative
                values index back from the last frame in the file.
        """
        if self.state is not None:
            raise RuntimeError("Cannot initialize more than once\n")
        filename = _hoomd.mpi_bcast_str(filename, self.device._cpp_exec_conf)
        # Grab snapshot and timestep
        reader = _hoomd.GSDReader(self.device._cpp_exec_conf, filename,
                                  abs(frame), frame < 0)
        snapshot = Snapshot._from_cpp_snapshot(reader.getSnapshot(),
                                               self.device.communicator)

        step = reader.getTimeStep() if self.timestep is None else self.timestep
        self._state = State(self, snapshot)

        reader.clearSnapshot()
        # Store System and Reader for Operations
        self._cpp_sys = _hoomd.System(self.state._cpp_sys_def, step)
        self._init_communicator()
        self.operations._store_reader(reader)
Пример #2
0
    def create_state_from_snapshot(self, snapshot):
        """Create the simulations state from a `Snapshot`.

        Args:
            snapshot (Snapshot or gsd.hoomd.Snapshot): Snapshot to initialize
                the state from. A `gsd.hoomd.Snapshot` will first be
                converted to a `hoomd.Snapshot`.


        When `timestep` is `None` before calling, `create_state_from_snapshot`
        sets `timestep` to 0.
        """
        if self.state is not None:
            raise RuntimeError("Cannot initialize more than once\n")

        if isinstance(snapshot, Snapshot):
            # snapshot is hoomd.Snapshot
            self._state = State(self, snapshot)
        elif _match_class_path(snapshot, 'gsd.hoomd.Snapshot'):
            # snapshot is gsd.hoomd.Snapshot
            snapshot = Snapshot._from_gsd_snapshot(snapshot,
                                                   self._device.communicator)
            self._state = State(self, snapshot)
        else:
            raise TypeError(
                "Snapshot must be a hoomd.Snapshot or gsd.hoomd.Snapshot.")

        step = 0
        if self.timestep is not None:
            step = self.timestep

        # Store System and Reader for Operations
        self._cpp_sys = _hoomd.System(self.state._cpp_sys_def, step)
        self._init_communicator()
Пример #3
0
    def create_state_from_snapshot(self, snapshot):
        """Create the simulations state from a `Snapshot`.

        Args:
            snapshot (Snapshot): Snapshot to initialize the state from.

        When `timestep` is `None` before calling, `create_state_from_snapshot`
        sets `timestep` to 0.

        Warning:
            *snapshot* must be a `hoomd.Snapshot`. Use `create_state_from_gsd`
            to read GSD files. `create_state_from_snapshot` does not support
            ``gsd.hoomd.Snapshot`` objects from the ``gsd`` Python package.
        """
        if self.state is not None:
            raise RuntimeError("Cannot initialize more than once\n")

        self._state = State(self, snapshot)

        step = 0
        if self.timestep is not None:
            step = self.timestep

        # Store System and Reader for Operations
        self._cpp_sys = _hoomd.System(self.state._cpp_sys_def, step)
        self._init_communicator()
Пример #4
0
def read_gsd(filename, restart=None, frame=0, time_step=None):
    R""" Read initial system state from an GSD file.

    Args:
        filename (str): File to read.
        restart (str): If it exists, read the file *restart* instead of *filename*.
        frame (int): Index of the frame to read from the GSD file.
        time_step (int): (if specified) Time step number to initialize instead of the one stored in the GSD file.

    All particles, bonds, angles, dihedrals, impropers, constraints, and box information
    are read from the given GSD file at the given frame index. To read and write GSD files
    outside of hoomd, see http://gsd.readthedocs.io/. :py:class:`hoomd.dump.gsd` writes GSD files.

    For restartable jobs, specify the initial condition in *filename* and the restart file in *restart*.
    :py:func:`hoomd.init.read_gsd` will read the restart file if it exists, otherwise it will read *filename*.

    If *time_step* is specified, its value will be used as the initial time
    step of the simulation instead of the one read from the GSD file.

    The result of :py:func:`hoomd.init.read_gsd` can be saved in a variable and later used to read and/or
    change particle properties later in the script. See :py:mod:`hoomd.data` for more information.

    See Also:
        :py:class:`hoomd.dump.gsd`
    """
    hoomd.util.print_status_line()

    hoomd.context._verify_init()

    # check if initialization has already occured
    if is_initialized():
        hoomd.context.msg.error("Cannot initialize more than once\n")
        raise RuntimeError("Error initializing")

    if restart is not None and os.path.exists(restart):
        reader = _hoomd.GSDReader(hoomd.context.exec_conf, restart, frame)
    else:
        reader = _hoomd.GSDReader(hoomd.context.exec_conf, filename, frame)
    snapshot = reader.getSnapshot()
    if time_step is None:
        time_step = reader.getTimeStep()

    # broadcast snapshot metadata so that all ranks have _global_box (the user may have set box only on rank 0)
    snapshot._broadcast(hoomd.context.exec_conf)
    my_domain_decomposition = _create_domain_decomposition(
        snapshot._global_box)

    if my_domain_decomposition is not None:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(
            snapshot, hoomd.context.exec_conf, my_domain_decomposition)
    else:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(
            snapshot, hoomd.context.exec_conf)

    # initialize the system
    hoomd.context.current.system = _hoomd.System(
        hoomd.context.current.system_definition, time_step)

    _perform_common_init_tasks()
    return hoomd.data.system_data(hoomd.context.current.system_definition)
Пример #5
0
    def _init_system(self, step):
        """Initialize the system State.

        Perform additional initialization operations not in the State
        constructor.
        """
        self._cpp_sys = _hoomd.System(self.state._cpp_sys_def, step)

        if self._seed is not None:
            self._state._cpp_sys_def.setSeed(self._seed)

        self._init_communicator()
Пример #6
0
def read_snapshot(snapshot):
    R""" Initializes the system from a snapshot.

    Args:
        snapshot (:py:mod:`hoomd.data` snapshot): The snapshot to initialize the system.

    Snapshots temporarily store system data. Snapshots contain the complete simulation state in a
    single object. Snapshots are set to time_step 0, and should not be used to restart a simulation.

    Example use cases in which a simulation may be started from a snapshot include user code that generates initial
    particle positions.

    Example::

        snapshot = my_system_create_routine(.. parameters ..)
        system = init.read_snapshot(snapshot)

    See Also:
        :py:mod:`hoomd.data`
    """
    hoomd.util.print_status_line()

    hoomd.context._verify_init()

    # check if initialization has already occurred
    if is_initialized():
        hoomd.context.msg.error("Cannot initialize more than once\n")
        raise RuntimeError("Error initializing")

    # broadcast snapshot metadata so that all ranks have _global_box (the user may have set box only on rank 0)
    snapshot._broadcast_box(hoomd.context.exec_conf)
    my_domain_decomposition = _create_domain_decomposition(
        snapshot._global_box)

    if my_domain_decomposition is not None:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(
            snapshot, hoomd.context.exec_conf, my_domain_decomposition)
    else:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(
            snapshot, hoomd.context.exec_conf)

    # initialize the system
    hoomd.context.current.system = _hoomd.System(
        hoomd.context.current.system_definition, 0)

    _perform_common_init_tasks()
    return hoomd.data.system_data(hoomd.context.current.system_definition)
Пример #7
0
def create_random(N, phi_p=None, name="A", min_dist=0.7, box=None, seed=1, dimensions=3):
    R""" Generates N randomly positioned particles of the same type.

    Args:
        N (int): Number of particles to create.
        phi_p (float): Packing fraction of particles in the simulation box (unitless).
        name (str): Name of the particle type to create.
        min_dist (float): Minimum distance particles will be separated by (in distance units).
        box (:py:class:`hoomd.data.boxdim`): Simulation box dimensions.
        seed (int): Random seed.
        dimensions (int): The number of dimensions in the simulation.

    .. deprecated:: 2.0 Random initialization is best left to specific methods tailored by the user for their work.

    Either *phi_p* or *box* must be specified. If *phi_p* is provided, it overrides the value of *box*.

    Examples::

        init.create_random(N=2400, phi_p=0.20)
        init.create_random(N=2400, phi_p=0.40, min_dist=0.5)
        system = init.create_random(N=2400, box=data.boxdim(L=20))

    When *phi_p* is set, the
    dimensions of the created box are such that the packing fraction
    of particles in the box is *phi_p*. The number density \e n
    is related to the packing fraction by :math:`n = 2d/\pi \cdot \phi_P`,
    where *d* is the dimension, and assumes the particles have a radius of 0.5.
    All particles are created with the same type, given by *name*.

    The result of :py:func:`hoomd.deprecated.init.create_random` can be saved in a variable and later used to read
    and/or change particle properties later in the script. See :py:mod:`hoomd.data` for more information.

    """
    hoomd.util.print_status_line();

    hoomd.context._verify_init();

    # check if initialization has already occurred
    if hoomd.init.is_initialized():
        hoomd.context.msg.error("Cannot initialize more than once\n");
        raise RuntimeError("Error initializing");

    # check that dimensions are appropriate
    if dimensions not in (2,3):
        raise ValueError('dimensions must be 2 or 3')

    # abuse the polymer generator to generate single particles

    if phi_p is not None:
        # calculate the box size
        L = math.pow(math.pi/(2.0*dimensions)*N / phi_p, 1.0/dimensions);
        box = hoomd.data.boxdim(L=L, dimensions=dimensions);

    if box is None:
        raise RuntimeError('box or phi_p must be specified');

    if not isinstance(box, hoomd.data.boxdim):
        hoomd.context.msg.error('box must be a data.boxdim object');
        raise TypeError('box must be a data.boxdim object');

    # create the generator
    generator = _deprecated.RandomGenerator(hoomd.context.exec_conf, box._getBoxDim(), seed, box.dimensions);

    # build type list
    type_vector = _hoomd.std_vector_string();
    type_vector.append(name);

    # empty bond lists for single particles
    bond_ab = _hoomd.std_vector_uint();
    bond_type = _hoomd.std_vector_string();

    # create the generator
    generator.addGenerator(int(N), _deprecated.PolymerParticleGenerator(hoomd.context.exec_conf, 1.0, type_vector, bond_ab, bond_ab, bond_type, 100, box.dimensions));

    # set the separation radius
    generator.setSeparationRadius(name, min_dist/2.0);

    # generate the particles
    generator.generate();

    # initialize snapshot
    snapshot = generator.getSnapshot()

    my_domain_decomposition = hoomd.init._create_domain_decomposition(snapshot._global_box);
    if my_domain_decomposition is not None:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(snapshot, hoomd.context.exec_conf, my_domain_decomposition);
    else:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(snapshot, hoomd.context.exec_conf);

    # initialize the system
    hoomd.context.current.system = _hoomd.System(hoomd.context.current.system_definition, 0);

    hoomd.init._perform_common_init_tasks();
    return hoomd.data.system_data(hoomd.context.current.system_definition);
Пример #8
0
def create_random_polymers(box, polymers, separation, seed=1):
    R""" Generates any number of randomly positioned polymers of configurable types.

    Args:
        box (:py:class:`hoomd.data.boxdim`): Simulation box dimensions
        polymers (list): Specification for the different polymers to create (see below)
        separation (dict): Separation radii for different particle types (see below)
        seed (int): Random seed to use

    .. deprecated:: 2.0 Random initialization is best left to specific methods tailored by the user for their work.

    Any number of polymers can be generated, of the same or different types, as
    specified in the argument *polymers*. Parameters for each polymer include
    bond length, particle type list, bond list, and count.

    The syntax is best shown by example. The below line specifies that 600 block copolymers
    A6B7A6 with a bond length of 1.2 be generated::

        polymer1 = dict(bond_len=1.2, type=['A']*6 + ['B']*7 + ['A']*6,
                        bond="linear", count=600)

    Here is an example for a second polymer, specifying just 100 polymers made of 5 B beads
    bonded in a branched pattern::

        polymer2 = dict(bond_len=1.2, type=['B']*5,
                        bond=[(0, 1), (1,2), (1,3), (3,4)] , count=100)

    The *polymers* argument can be given a list of any number of polymer types specified
    as above. *count* randomly generated polymers of each type in the list will be
    generated in the system.

    In detail:

    - bond_len defines the bond length of the generated polymers. This should
      not necessarily be set to the equilibrium bond length! The generator is dumb and doesn't know
      that bonded particles can be placed closer together than the separation (see below). Thus
      bond_len must be at a minimum set at twice the value of the largest separation radius. An
      error will be generated if this is not the case.
    - type is a python list of strings. Each string names a particle type in the order that
      they will be created in generating the polymer.
    - bond can be specified as "linear" in which case the generator connects all particles together
      with bonds to form a linear chain. bond can also be given a list if python tuples (see example
      above).
      - Each tuple in the form of \c (a,b) specifies that particle \c a of the polymer be bonded to
      particle \c b. These bonds are given the default type name of 'polymer' to be used when specifying parameters to
      bond forces such as bond.harmonic.
      - A tuple with three elements (a,b,type) can be used as above, but with a custom name for the bond. For example,
      a simple branched polymer with different bond types on each branch could be defined like so::

            bond=[(0,1), (1,2), (2,3,'branchA'), (3,4,'branchA), (2,5,'branchB'), (5,6,'branchB')]


    separation must contain one entry for each particle type specified in polymers
    ('A' and 'B' in the examples above). The value given is the separation radius of each
    particle of that type. The generated polymer system will have no two overlapping
    particles.

    Examples::

        init.create_random_polymers(box=data.boxdim(L=35),
                                    polymers=[polymer1, polymer2],
                                    separation=dict(A=0.35, B=0.35));

        init.create_random_polymers(box=data.boxdim(L=31),
                                    polymers=[polymer1],
                                    separation=dict(A=0.35, B=0.35), seed=52);

        # create polymers in an orthorhombic box
        init.create_random_polymers(box=data.boxdim(Lx=18,Ly=10,Lz=25),
                                    polymers=[polymer2],
                                    separation=dict(A=0.35, B=0.35), seed=12345);

        # create a triclinic box with tilt factors xy=0.1 xz=0.2 yz=0.3
        init.create_random_polymers(box=data.boxdim(L=18, xy=0.1, xz=0.2, yz=0.3),
                                    polymers=[polymer2],
                                    separation=dict(A=0.35, B=0.35));

    With all other parameters the same, create_random_polymers will always create the
    same system if seed is the same. Set a different seed (any integer) to create
    a different random system with the same parameters. Note that different versions
    of HOOMD \e may generate different systems even with the same seed due to programming
    changes.

    Note:
        For relatively dense systems (packing fraction 0.4 and higher) the simple random
        generation algorithm may fail to find room for all the particles and print an error message.
        There are two methods to solve this. First, you can lower the separation radii allowing particles
        to be placed closer together. Then setup integrate.nve with the limit option set to a
        relatively small value. A few thousand time steps should relax the system so that the simulation can be
        continued without the limit or with a different integrator. For extremely troublesome systems,
        generate it at a very low density and shrink the box with the command update.box_resize
        to the desired final size.

    Note:
        The polymer generator always generates polymers as if there were linear chains. If you
        provide a non-linear bond topology, the bonds in the initial configuration will be stretched
        significantly. This normally doesn't pose a problem for harmonic bonds (bond.harmonic) as
        the system will simply relax over a few time steps, but can cause the system to blow up with FENE
        bonds (bond.fene).

    """
    hoomd.util.print_status_line();

    hoomd.context._verify_init();

    # check if initialization has already occurred
    if hoomd.init.is_initialized():
        hoomd.context.msg.error("Cannot initialize more than once\n");
        raise RuntimeError("Error creating random polymers");

    if len(polymers) == 0:
        hoomd.context.msg.error("Polymers list cannot be empty.\n");
        raise RuntimeError("Error creating random polymers");

    if len(separation) == 0:
        hoomd.context.msg.error("Separation dict cannot be empty.\n");
        raise RuntimeError("Error creating random polymers");

    if not isinstance(box, hoomd.data.boxdim):
        hoomd.context.msg.error('Box must be a data.boxdim object\n');
        raise TypeError('box must be a data.boxdim object');

    # create the generator
    generator = _deprecated.RandomGenerator(hoomd.context.exec_conf,box._getBoxDim(), seed, box.dimensions);

    # make a list of types used for an eventual check vs the types in separation for completeness
    types_used = [];

    # track the minimum bond length
    min_bond_len = None;

    # build the polymer generators
    for poly in polymers:
        type_list = [];
        # check that all fields are specified
        if not 'bond_len' in poly:
            hoomd.context.msg.error('Polymer specification missing bond_len\n');
            raise RuntimeError("Error creating random polymers");

        if min_bond_len is None:
            min_bond_len = poly['bond_len'];
        else:
            min_bond_len = min(min_bond_len, poly['bond_len']);

        if not 'type' in poly:
            hoomd.context.msg.error('Polymer specification missing type\n');
            raise RuntimeError("Error creating random polymers");
        if not 'count' in poly:
            hoomd.context.msg.error('Polymer specification missing count\n');
            raise RuntimeError("Error creating random polymers");
        if not 'bond' in poly:
            hoomd.context.msg.error('Polymer specification missing bond\n');
            raise RuntimeError("Error creating random polymers");

        # build type list
        type_vector = _hoomd.std_vector_string();
        for t in poly['type']:
            type_vector.append(t);
            if not t in types_used:
                types_used.append(t);

        # build bond list
        bond_a = _hoomd.std_vector_uint();
        bond_b = _hoomd.std_vector_uint();
        bond_name = _hoomd.std_vector_string();

        # if the bond setting is 'linear' create a default set of bonds
        if poly['bond'] == 'linear':
            for i in range(0,len(poly['type'])-1):
                bond_a.append(i);
                bond_b.append(i+1);
                bond_name.append('polymer')
        #if it is a list, parse the user custom bonds
        elif type(poly['bond']) == type([]):
            for t in poly['bond']:
                # a 2-tuple gets the default 'polymer' name for the bond
                if len(t) == 2:
                    a,b = t;
                    name = 'polymer';
                # and a 3-tuple specifies the name directly
                elif len(t) == 3:
                    a,b,name = t;
                else:
                    hoomd.context.msg.error('Custom bond ' + str(t) + ' must have either two or three elements\n');
                    raise RuntimeError("Error creating random polymers");

                bond_a.append(a);
                bond_b.append(b);
                bond_name.append(name);
        else:
            hoomd.context.msg.error('Unexpected argument value for polymer bond\n');
            raise RuntimeError("Error creating random polymers");

        # create the generator
        generator.addGenerator(int(poly['count']), _deprecated.PolymerParticleGenerator(hoomd.context.exec_conf, poly['bond_len'], type_vector, bond_a, bond_b, bond_name, 100, box.dimensions));


    # check that all used types are in the separation list
    for t in types_used:
        if not t in separation:
            hoomd.context.msg.error("No separation radius specified for type " + str(t) + "\n");
            raise RuntimeError("Error creating random polymers");

    # set the separation radii, checking that it is within the minimum bond length
    for t,r in separation.items():
        generator.setSeparationRadius(t, r);
        if 2*r >= min_bond_len:
            hoomd.context.msg.error("Separation radius " + str(r) + " is too big for the minimum bond length of " + str(min_bond_len) + " specified\n");
            raise RuntimeError("Error creating random polymers");

    # generate the particles
    generator.generate();

    # copy over data to snapshot
    snapshot = generator.getSnapshot()

    my_domain_decomposition = hoomd.init._create_domain_decomposition(snapshot._global_box);
    if my_domain_decomposition is not None:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(snapshot, hoomd.context.exec_conf, my_domain_decomposition);
    else:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(snapshot, hoomd.context.exec_conf);

    # initialize the system
    hoomd.context.current.system = _hoomd.System(hoomd.context.current.system_definition, 0);

    hoomd.init._perform_common_init_tasks();
    return hoomd.data.system_data(hoomd.context.current.system_definition);
Пример #9
0
def read_xml(filename, restart = None, time_step = None, wrap_coordinates = False):
    R""" ## Reads initial system state from an XML file

    Args:
        filename (str): File to read
        restart (str): If it exists, read *restart* instead of *filename*.
        time_step (int): (if specified) Time step number to use instead of the one stored in the XML file
        wrap_coordinates (bool): Wrap input coordinates back into the box

    .. deprecated:: 2.0
       GSD is the new default file format for HOOMD-blue. It can store everything that an XML file can in
       an efficient binary format that is easy to access. See :py:class:`hoomd.init.read_gsd`.

    Examples::

        deprecated.init.read_xml(filename="data.xml")
        deprecated.init.read_xml(filename="init.xml", restart="restart.xml")
        deprecated.init.read_xml(filename="directory/data.xml")
        deprecated.init.read_xml(filename="restart.xml", time_step=0)
        system = deprecated.init.read_xml(filename="data.xml")


    All particles, bonds, etc...  are read from the given XML file,
    setting the initial condition of the simulation.
    After this command completes, the system is initialized allowing
    other commands in hoomd to be run.

    For restartable jobs, specify the initial condition in *filename* and the restart file in *restart*.
    init.read_xml will read the restart file if it exists, otherwise it will read *filename*.

    All values are read in native units, see :ref:`page-units` for more information.

    If *time_step* is specified, its value will be used as the initial time
    step of the simulation instead of the one read from the XML file.

    If *wrap_coordinates* is set to True, input coordinates will be wrapped
    into the box specified inside the XML file. If it is set to False, out-of-box
    coordinates will result in an error.

    """
    hoomd.util.print_status_line();

    hoomd.context._verify_init();

    # check if initialization has already occurred
    if hoomd.init.is_initialized():
        hoomd.context.msg.error("Cannot initialize more than once\n");
        raise RuntimeError("Error reading XML file");

    filename_to_read = filename;
    if restart is not None:
        if os.path.isfile(restart):
            filename_to_read = restart;

    # read in the data
    initializer = _deprecated.HOOMDInitializer(hoomd.context.exec_conf,filename_to_read,wrap_coordinates);
    snapshot = initializer.getSnapshot()

    my_domain_decomposition = hoomd.init._create_domain_decomposition(snapshot._global_box);
    if my_domain_decomposition is not None:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(snapshot, hoomd.context.exec_conf, my_domain_decomposition);
    else:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(snapshot, hoomd.context.exec_conf);

    # initialize the system
    if time_step is None:
        hoomd.context.current.system = _hoomd.System(hoomd.context.current.system_definition, initializer.getTimeStep());
    else:
        hoomd.context.current.system = _hoomd.System(hoomd.context.current.system_definition, time_step);

    hoomd.init._perform_common_init_tasks();
    return hoomd.data.system_data(hoomd.context.current.system_definition);
Пример #10
0
def read_getar(filename, modes={'any': 'any'}):
    """Initialize a system from a trajectory archive (.tar, .getar,
    .sqlite) file. Returns a HOOMD `system_data` object.

    Args:
        filename (str): Name of the file to read from
        modes (dict): dictionary of {property: frame} values; see below

    Getar files are a simple interface on top of archive formats (such
    as zip and tar) for storing trajectory data efficiently. A more
    thorough description of the format and a description of a python
    API to read and write these files is available at `the libgetar
    documentation <http://libgetar.readthedocs.io>`_.

    The **modes** argument is a dictionary. The keys of this
    dictionary should be either property names (see the Supported
    Property Table below) or tuples of property names.

    If the key is a tuple of property names, data for those names will
    be restored from the same frame. Other acceptable keys are "any" to
    restore any properties which are present from the file, "angle_any"
    to restore any angle-related properties present, "bond_any", and so
    forth. The values associated with each key in the dictionary should
    be "any" (in which case any frame present for the data will be
    restored, even if the frames are different for two property names in
    a tuple), "latest" (grab the most recent frame data), "earliest", or
    a specific timestep value.

    Example::

        # creating file to initialize beforehand using libgetar
        with gtar.GTAR('init.zip', 'w') as traj:
            traj.writePath('position.f32.ind', positions)
            traj.writePath('velocity.f32.ind', velocities)
            traj.writePath('metadata.json', json.dumps(metadata))
        system = hoomd.init.read_getar('init.zip')
        # using the backup created in the `hoomd.dump.getar.simple` example
        system = hoomd.init.read_getar('backup.tar')

    **Supported Property Table**

    .. tabularcolumns:: |p{0.25 \textwidth}|p{0.1 \textwidth}|p{0.2 \textwidth}|p{0.45 \textwidth}|
    .. csv-table::
       :header: "Name", "Type", "Shape", "Notes"
       :widths: 1, 1, 1, 5

       "angle_type_names", "JSON [String]", "(N_angle_types,)", "list containing the name of each angle type in JSON format"
       "angle_tag", "unsigned int", "(N_angle, 3)", "array of particle tags for each angle interaction"
       "angle_type", "unsigned int", "(N_angle,)", "array of angle interaction types"
       "angular_momentum", "float", "(N, 4)", "per-particle angular momentum quaternion"
       "body", "int", "(N,)", "particle rigid body index"
       "bond_type_names", "JSON [String]", "(N_bond_types,)", "list containing the name of each bond type in JSON format"
       "bond_tag", "unsigned int", "(N_bond, 2)", "array of particle tags for each bond interaction"
       "bond_type", "unsigned int", "(N_bond,)", "array of bond interaction types"
       "box", "float", "(6,)", "vector of box lengths (x, y, z, tilt_xy, tilt_xz, tilt_yz); can be high precision"
       "charge", "float", "(N,)", "particle charge"
       "diameter", "float", "(N,)", "particle diameter"
       "dihedral_type_names", "JSON [String]", "(N_dihedral_types,)", "list containing the name of each dihedral type in JSON format"
       "dihedral_tag", "unsigned int", "(N_dihedral, 4)", "array of particle tags for each dihedral interaction"
       "dihedral_type", "unsigned int", "(N_dihedral,)", "array of dihedral interaction types"
       "dimensions", "unsigned int", "1", "number of dimensions of the system"
       "image", "int", "(N, 3)", "how many times each particle has passed through the periodic boundary conditions"
       "improper_type_names", "JSON [String]", "(N_improper_types,)", "list containing the name of each improper type in JSON format"
       "improper_tag", "unsigned int", "(N_improper, 4)", "array of particle tags for each improper interaction"
       "improper_type", "unsigned int", "(N_improper,)", "array of improper interaction types"
       "mass", "float", "(N,)", "particle mass"
       "moment_inertia", "float", "(N, 3)", "moment of inertia of each particle (diagonalized)."
       "orientation", "float", "(N, 4)", "particle orientation, expressed as a quaternion in the order (real, imag_i, imag_j, imag_k); can be high precision"
       "position", "float", "(N, 3)", "the position of each particle in the system (can be high precision)"
       "potential_energy", "float", "(N,)", "per-particle potential energy; can't be used in MPI runs"
       "type", "unsigned int", "(N,)", "particle numerical type index"
       "type_names", "JSON [String]", "(N_types,)", "list containing the name of each particle type in JSON format"
       "velocity", "float", "(N, 3)", "velocity of each particle in the system"

    """
    hoomd.context._verify_init();

    # check if initialization has already occurred
    if is_initialized():
        raise RuntimeError("Cannot initialize more than once\n");

    newModes = _parse_getar_modes(modes);
    # read in the data
    initializer = _hoomd.GetarInitializer(hoomd.context.current.device.cpp_exec_conf, filename);
    snapshot = initializer.initialize(newModes);

    # broadcast snapshot metadata so that all ranks have _global_box (the user may have set box only on rank 0)
    snapshot._broadcast_box(hoomd.context.current.device.cpp_exec_conf);

    try:
        box = snapshot._global_box;
    except AttributeError:
        box = snapshot.box;

    my_domain_decomposition = _create_domain_decomposition(box);
    if my_domain_decomposition is not None:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(
            snapshot, hoomd.context.current.device.cpp_exec_conf, my_domain_decomposition);
    else:
        hoomd.context.current.system_definition = _hoomd.SystemDefinition(
            snapshot, hoomd.context.current.device.cpp_exec_conf);

    hoomd.context.current.system = _hoomd.System(
        hoomd.context.current.system_definition, initializer.getTimestep());

    _perform_common_init_tasks();

    if (hoomd.data.get_snapshot_box(snapshot).dimensions == 2 and
        any(abs(z) > 1e-5 for z in snapshot.particles.position[:, 2])):
        raise RuntimeWarning('Initializing a 2D system with some z '
                             'components out-of-plane');

    return hoomd.data.system_data(hoomd.context.current.system_definition);