.. _input_files: Input files =========== .. _input_files_mapping_files: Mapping files ------------- Mapping relates atomistic and coarse-grained representations of the system. It is organized as follows: for each molecule *type* a mapping file is created. When used as a command option, these files are combined in a list separated by a semicolon, e. g. ``--cg`` ``protein.xml;solvent.xml``. .. _input_files_fig_mapping: .. figure:: fig/mapping.png :align: center Atom labeling and mapping from an all-atom to a united atom representation of a propane molecule. Each mapping file contains a *topology* of the coarse-grained molecule and a list of *maps*. Topology specifies coarse-grained beads and bonded interactions between them. Each coarse-grained bead has a name, type, a list of atoms which belong to it, and a link to a map. A map is a ``set of weights`` :math:`c_{Ii}` for an atom :math:`i` belonging to the bead :math:`I`. It is used to calculate the position of a coarse-grained bead from the positions of atoms which belong to it. Note that :math:`c_{Ii}` will be automatically re-normalized if their sum is not equal to 1, i. e. in the case of a center-of-mass mapping one can simply specify atomic masses. A complete reference for mapping file definitions can be found in :ref:`reference_mapping_file`. As an example, we will describe here a mapping file of a united atom model of a propane molecule, chemical structure of which is shown in :ref:`the figure in the introduction`. In this coarse-grained model, two bead types (A,B) and three beads (A1, B1, A2) are defined, as shown in :ref:`the figure above`. We will use the centers of mass of the beads as coarse-grained coordinates. Extracts from the ``propane.xml`` file of the tutorial are shown below. .. _propane_mapping_file: .. code:: xml ppn ppn A1 A A 1:ppn:C1 1:ppn:H4 1:ppn:H5 1:ppn:H6 bond A1 B1 B1 A2 angle A1 B1 A2 A 12 1 1 1 An extract from the mapping file propane.xml of a propane molecule. The complete file can be found in the csg-tutorials/propane/single_molecule tutorial The ``name`` tag indicates the molecule name in the coarse-grained topology. The ``ident`` tag must match the name of the molecule in the atomistic representation. In the ``topology`` section all beads are defined by specifying bead name (A1, B1, A2), type, and atoms belonging to this bead in the form ``residue id:residue name:atom name``. For each bead a map has to be specified, which is defined later in the ``maps`` section. Note that bead ``type`` and bead ``map`` can be different, which might be useful in a situation when chemically different beads (A1, B1) are assigned to the same bead type. After defining all beads, the bonded interactions of the coarse-grained molecule must be specified in the ``cg_bonded`` section. This is done by using the identifiers of the beads in the coarse-grained model. Finally, in the ``mapping`` section, the mapping coefficients are defined. This includes a weighting of the atoms in the topology section. In particular, the number of weights given should match the number of beads. Verification of a mapping ------------------------- Note that the ``ident`` tag should match the molecule name in the reference system. A common mistake occurs when beads have wrong names. In this case, the tool ``csg_dump`` can be used in order to identify the atoms which are read in from a topology file ``.tpr``. This tool displays the atoms in the format ``residue id:residue name:atom name``. For multicomponent systems, it might happen that molecules are not identified correctly. The workaround for this case is described in :ref:`input_files_advanced_topology_handling`. To compare coarse-grained and atomistic configurations one can use a standard visualization program, e. g. ``vmd``. When comparing trajectories, one has to be careful, since ``vmd`` opens both a ``.gro`` and ``.trr`` file. The first frame is then the ``.gro`` file and the rest is taken from the ``.trr`` file. The coarse-grained trajectory contains only the frames of the trajectory. Hence, the first frame of the atomistic run has to be removed using the ``vmd`` menu. .. _input_files_advanced_topology_handling: Advanced topology handling -------------------------- A topology is completely specified by a set of beads, their types, and a list of bonded interactions. VOTCA is able to read topologies in the GROMACS\ ``.tpr`` format. For example, one can create a coarse-grained topology based on the mapping file and atomistic GROMACS topology using ``csg_gmxtopol``. .. code:: bash csg_gmxtopol --top topol.tpr --cg propane.xml --out out.top In some cases, however, one might want to use a .pdb, H5MD or .dump file which does not contain all the required atomistic topology information. In this case, additional information can be supplied in the XMLmapping file. A typical example is lack of a clear definition of molecules, which can be a problem for simulations with several molecules with multiple types. During coarse-graining, the molecule type is identified by a name tag as names must be clearly identified. To do this, it is possible to read a topology and then modify parts of it. The new XML topology can be used with the ``--tpr`` option, as any other topology file. For example, if information about a molecule is not present at all, a XML topology file can be created from a ``.pdb`` file as follows .. code:: xml where ```` clears all information that was present before. Old versions of GROMACS did not store molecule names. In order to use this feature, a recent ``.tpr`` file containing molecule names should always be provided. For old topologies, rerun GROMACS *grompp* to update the old topology file. If molecule information is already present in the parent topology but molecules are not named properly (as is the case with old GROMACS\ ``.tpr`` files), one can rename them using .. code:: xml Here, the file ``topol.tpr`` is loaded first and all molecules are renamed afterwards. If you do not have a .pdb/.gro file and you want to read trajectories from a LAMMPS .dump file or H5MD file then it is also possible to directly define the topology in a XML file. Here is an example of a XML file where the trajectory is read from a H5MD file: .. code:: xml bond1 BUT:C1 BUT:C2 bond2 BUT:C2 BUT:C3 angle1 BUT:C1 BUT:C2 BUT:C3 BUT:C2 BUT:C3 BUT:C4 dihedral1 BUT:C1 BUT:C2 BUT:C3 BUT:C4 The list of molecules is defined in section ``molecules`` where every ``molecule`` is replicated ``nmols`` times. Inside ``molecule``, the list of ``bead`` has to be defined with the name, type, mass and charge. The box size can be set by the tag ``box``: .. code:: xml where ``xx, yy, zz`` are the dimensions of the box. A complete reference for a XML topology file can be found in :ref:`reference_topology_file`. .. _input_files_trajectories: Trajectories ------------ A trajectory is a set of frames containing coordinates (velocities and forces) for the beads defined in the topology. VOTCA currently supports ``.trr``, ``.xtc``, ``.pdb``, ``.gro`` and H5MD ``.h5`` trajectory formats. Once the mapping file is created, it is easy to convert an atomistic to a coarse-grained trajectory using ``csg_map``. .. code:: xml csg_map --top topol.tpr --trj traj.trr --cg propane.xml --out cg.gro The program ``csg_map`` also provides the option ``--no-map``. In this case, no mapping is done and ``csg_map`` instead works as a trajectory converter. In general, mapping can be enabled and disabled in most analysis tools, e.g. in ``csg_stat`` or ``csg_fmatch``. Note, the topology files can have different contents as bonded interactions are not provided in all formats. In this case, mapping files can be used to define and relabel bonds. Also note, the default settings concerning mapping varies individually between the programs. Some have a default setting that does mapping (such as ``csg_map``, use ``--no-map`` to disable mapping) and some have mapping disabled by default (e.g. ``csg_stat``, use ``--cg`` to enable mapping). .. _input_files_setting_files: Setting files ------------- .. code:: xml A-A A A 0 1.36 0.01 ... specific commands ... specific section for inverse boltzmann, force matching etc. Abstract of a ``settings.xml`` file. See secs. :ref:`methods_fm_program_input`, :ref:`methods_fm_threebody` or :ref:`methods_preparing_the_run` for full versions. A setting file is written in the format ``.xml``. It consists of a general section displayed above, and a specific section depending on the program used for simulations. The setting displayed above is later extended in the sections on iterative boltzmann inversion (``csg_inverse``), force matching (``csg_fmatch``) or statistical analysis (``csg_stat``). Generally, ``csg_stat`` is an analysis tool which can be used for computing radial distribution functions and analysing them. As an example, the command .. code:: xml csg_stat --top topol.tpr --trj traj.xtc --options settings.xml computes the distributions of all interactions specified in ``settings.xml`` and writes all tabulated distributions as files ``interaction name.dist.new``. A mapping file can be provided with the option ``--cg``. When calculating the angular distribution, an additional option ```` has to be added to the settings file. For example, the ``settings.xml`` file for calculating the angular distribution between three beads of type A which are all within a cutoff distance of 0.37 (nm) might look like: .. code:: xml A-A-A true A A A 0 3.14 0.02 0.37 In addition to distribution functions, ``csg_stat`` can also calculate the pair potential of mean force (PMF) for non-bonded pairs: .. _input_files_eq_pair_pmf: .. math:: U_{\text{PMF}}\left(r\right)= - \int_0^r \, F_{\text{rad}}\left(r^\prime\right)\,\text{d}r^\prime. The output file name is then ``interaction name.force.new``. Here, :math:`F_{\text{rad}}\left(r\right)` is the total force acting on a bead projected onto the unit distance vector connecting this pair of beads. The settings file has to contain the additional option: .. code:: xml A-A A A 0 1.36 0.01 true .. _input_files_table_formats: Table formats ------------- In the iterative framework distribution functions, potentials and forces are returned as tables and saved in a file. Those tables generally have the format .. code:: none x y [error] flag where ``x`` is input quantity (e.g. radius :math:`r`, angles :math:`\theta` or :math:`\phi`), ``y`` is the computed quantity (e.g. a potential) and ``[error]`` is an optional error for ``y``. The token ``flag`` can take the values ``i``, ``o`` or ``u``. In the first case, ``i`` (``in range``) describes a value that lies within the data range, ``o`` (``out of range``) symbolises a value out of the data range and ``u`` stands for an ``undefined`` value. The token ``flag`` will be important when extrapolating the table as described in :ref:`preparing_post-processing_of_the_potential`. For historical reasons, ``csg_boltzmann`` uses a slightly different table format, it has no ``flag`` column and uses the third column as a force column when outputting a potential.