3.5.4. ACErxnNetwork
********************

Class representing a reaction network. It contains a networkx graph,
as well as a list of PLAMS "Molecule" objects for the intermediates.

class ACErxnNetwork(reactant=None, products=None, known_intermediates=None, name='acerxn', settings=None)

   A class that represents an ACE reaction network

   List of constructor arguments:

   * "intermediates" -- Optional list of PLAMS "Molecule" objects
     representing the intermediates (vertices) of the network

   * "graph"         -- Optional networkx DiGraph object with vertices
     that match the names of the *intermediates*
     (intermediate[i].properties.name)

   All information on the reaction network is stored in two instance
   variables :

   * "intermediates" -- List of PLAMS "Molecule" objects representing
     the intermediates (vertices) of the network

   * "graph"         -- Networkx DiGraph object with vertices that
     match the names of the *intermediates*
     (intermediate[i].properties.name)

   property generator

      Get the generator object

   static default_settings()

      Get the default input settings for an ACErxn computation

   generate(jobrunner=None, resultsdir=None)

      Generate the network

   write(dirname='ams.results', filename='ams.rkf', write_ts=False)

      Writes the reaction network to RKF

      * "dirname" -- The name of the folder where the RKF files shoud
        be written

      * "filename" -- The name of the main RKF file that contains the
        network data (in the EnergyLandscape section)

      * "write_ts" -- The option to link all connected vertices with a
        fabricated transition state. May be useful for visualization
        in AMSMovie

   classmethod read(infile, reactant=None)

      Read the intermediates and graph from RKF.

      * "infile"   -- Can be either a file object, or a file name

      * "reactant" -- A complete Reactant object (including fragment
        data)

   classmethod from_rkf(path)

      Load an network from an rkf file in *path*.

      * "path" -- Can be either the folder containsing all the acerxn
        result RKF files, or the path to the main ams.rkf file

   get_graph()

      Return the networkx DiGraph object

   get_acenetwork()

      Convert the networkx DiGraph object to ACE format

   write_graph(path, file_format='ace')

      Write the networkx graph to file, in one of the available
      formats

      * "path"        -- The full filename of the main file to be
        written ('/path/to/acercn.results/ams.rkf')

      * "file_format" -- Currently the only option are the original
        ACE format and RKF ('ace','rkf')

   has_graph()

      Check if a networkx DiGraph object has already been created

   has_intermediates()

      Check if the intermediates have already been created

   get_intermediates(format='plams')

      Get the intermediates as a list of PLAMS molecules

      * "format" -- One of ['plams','ace']

   get_all_paths()

      Get all paths from reactant to product in the network

   get_shortest_paths(targets=None, single=False)

      Returns the shortest paths from reactant to products

      * "up_to" -- If set to 1 only the shortest paths are collected.
        If set to 2 path lengths of 1 higher are also added

   get_chemdists_for_path(path)

      For a single path out of the network, get the weights

      * "path" -- Sequence of names for the vertices, representing a
        path

   get_n_shortest_paths(n)

      Uses Yens algorithm to get the n shortest paths from reactant to
      products

   get_path_block(path)

      Return a string that represents the path

      * "path" -- List of names for the vertices in the path

   get_subnetwork(names)

      Get the subnetwork ACErxnNetwork object for the list of
      intermediates

      * "names" -- List/iterable of names for the intermediates

   store_submolecules_as_intermediate(submols, name)

      Find the order of atoms the original product or intermediate,
      matching the reactant

   get_reacted_reactant(reactant, product)

      Propagate the reactant to the product along the shortest path
      between the two

   optimize(engine_settings, jobrunner=None)

      Optimize the geometries of all intermediates

   read_energy_landscape(filename)

      Read the intermediates and graph from RKF (used by the
      generator).

      * "filename" -- Accepts either the full path to the main RKF
        file ('path/to/acerxn.results/ams.rkf') or the corresponding
        folder name ('path/to/acerxn.results')

   set_intermediates(intermediates)

      Set the intermediates instance variable (used by the generator)

      * "intermediates" -- List of PLAMS "Molecule" objects
        representing the intermediates (vertices) of the network. Each
        "Molecule" object must contain a name and an energy in
        mol.properties.name and mol.properties.energy.

   set_graph(graph)

      Set the graph instance variable (a networkx DiGraph object)
      (used by the generator)

      * "graph"         -- Networkx DiGraph object with vertices that
        match the names of the *intermediates*
        (intermediate[i].properties.name)

   order_paths(paths)

      Order a set of paths based on length AND highest energy

   trim_edges(paths)

      Remove incomplete paths

   _get_n_shortest_paths(n, source, target)

      Uses Yens algorithm to get the n shortest paths from source to
      target

   _get_fake_transitionstates(indices, ts_energy)

      Get molecule objects for the fake transition states in
      elementary reactions

   _get_sp_results(settings)

      Retrieve the results objects from the intermediate single point
      calculations

      Note: Obsolete
