
     i                     v    d Z ddlZddlmZ ddlmZmZmZm	Z	m
Z
mZ ddlmZ ddlmZmZ  G d	 d
e          ZdS )a  
GRO topology parser
===================

Read a list of atoms from a GROMOS/Gromacs GRO coordinate file to
build a basic topology.


See Also
--------
:mod:`MDAnalysis.coordinates.GRO`



Classes
-------

.. autoclass:: GROParser
   :members:
   :inherited-members:

    N   )openany)	AtomnamesAtomidsResidsResnamesResnumsSegids)Topology   )TopologyReaderBasechange_squashc                       e Zd ZdZdZd ZdS )	GROParsera  Reads a Gromacs GRO file

    Reads the following attributes:
      - resids
      - resnames
      - atomids
      - atomnames

    .. note::

        By default, atomtypes and masses will be guessed on Universe creation.
        This may change in release 3.0.
        See :ref:`Guessers` for more information.

    .. versionchanged:: 2.8.0
        Removed type and mass guessing (attributes guessing takes place now
        through universe.guess_TopologyAttrs() API).

    GROc                    t          | j                  5 }t          |           t          t          |                    }t	          j        |t          j                  }t	          j        |t                    }t	          j        |t                    }t	          j        |t          j                  }t          |          D ]\  }}	||k    r n	 t          |	dd                   ||<   |	dd         	                                ||<   |	dd         	                                ||<   t          |	dd                   ||<   # t          t          f$ r d|	 }
t          |
          dw xY wddd           n# 1 swxY w Y   t	          j        |          sIt	          j        |dk              }t          d	                    |d
         d
         dz                       t	          j        |d
k              rt	          j        |d
k              d
         }t	          j        |          dk    }t	          j        |d
         |dd         |         g          }|d
         d
k    r
|dd         }|D ]}||dxx         dz  cc<   t'          ||f||f          \  }\  }}t)          |          t+          |          t-          |          t/          |                                          t3          |          t5          t	          j        dgt                              g}t9          |t;          |          d||d          }|S )z*Return the *Topology* object for this file)dtypeN   
         z3Couldn't read the following line of the .gro file:
 zMissing atom name on line: {0}r      r   i SYSTEM)n_atomsn_resn_segattrsatom_resindexresidue_segindex)r   filenamenextintnpzerosint32object	enumeratestrip
ValueError	TypeErrorIOErrorallwhereformatanydiffhstackr   r   r   r   r	   copyr   r
   arrayr   len)selfkwargsinfr   residsresnamesnamesindicesilineerrmsgmissingwrapsr1   startssresidx
new_residsnew_resnamesr   tops                        g/srv/www/vhosts/g4struct/public_html/venv/lib/python3.11/site-packages/MDAnalysis/topology/GROParser.pyparsezGROParser.parseT   s    T]## 	4sIII$s))nnG XgRX666Fxv666HHWF333Ehwbh777G$S>> 4 44<<E
4 #D!HF1I"&qt*"2"2"4"4HQK#BrE{0022E!H!$T"R%[!1!1GAJJ"I. 4 4 4"" "  "&//t34%	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	42 ve}} 	hu{++G3::71:a=1;LMM  
 6&A+ 	%HVq[))!,E 75>>Q&DYa%)D/:;;F ayA~~  % %qrr


f$



-:X 2.
 .
**\ eG:JOO%%&&\""28XJf55566
 j// !
 
 
 
s+   B>E=A2EE='E..E==FFN)__name__
__module____qualname____doc__r/   rI        rH   r   r   =   s9         ( FN N N N NrO   r   )rM   numpyr$   lib.utilr   core.topologyattrsr   r   r   r   r	   r
   core.topologyr   baser   r   r   rN   rO   rH   <module>rU      s   0 ,                          % $ $ $ $ $ 3 3 3 3 3 3 3 3e e e e e" e e e e erO   