
     i+                         d Z ddlZddlZddlZddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZmZmZmZmZmZmZmZ  G d
 de
          ZdS )a  TXYZ topology parser
====================

Tinker_ topology parser: reads information from .txyz and .arc files.
Atom types are read from column 6, while bond connectivity is read from column 7
onwards.

.. _Tinker: https://dasher.wustl.edu/tinker/

See Also
--------
MDAnalysis.coordinates.TXYZ : further documentation on the Tinker format


Classes
-------

.. autoclass:: TXYZParser
   :members:
   :inherited-members:

    N   )SYMB2Z)openany   )TopologyReaderBase)Topology)	AtomnamesAtomids	AtomtypesBondsResidsResnumsSegidsElementsc                        e Zd ZdZddgZd ZdS )
TXYZParsera{  Parse a list of atoms from a Tinker XYZ file.

    Creates the following attributes:

    - Atomnames
    - Atomtypes
    - Elements (if all atom names are element symbols)

    .. note::

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

    .. versionadded:: 0.17.0
    .. versionchanged:: 2.4.0
       Adding the `Element` attribute if all names are valid element symbols.
    .. versionchanged:: 2.8.0
       Removed mass guessing (attributes guessing takes place now
       through universe.guess_TopologyAttrs() API).

    TXYZARCc                    t          | j                  5 }t          |                                                                d                   }t          j        |t                    }t          j        |t                    }t          j        |t                    }g }|                                }	 t          |                                d                    |                                }n# t          $ r Y nw xY wt          t          |          t          j        |g|                    D ]x\  }	}
|
                                }
|
d         ||	<   |
d         ||	<   |
d         ||	<   |
dd         }|D ]1}t          |          dz
  }|	|k     r|                    |	|f           2y	 ddd           n# 1 swxY w Y   t          |          t!          |          t#          |          t%          t'          |                    t)          t          j        dg                    t-          t          j        dg                    t/          t          j        dgt                              g}t1          d |D                       r<|                    t3          t          j        |t                                         nt5          j        d	           t9          |dd|
          }|S )ztRead the file and return the structure.

        Returns
        -------
        MDAnalysis Topology object
        r   )dtyper         NSYSTEMc              3   L   K   | ]}|                                 t          v V   d S )N)
capitalizer   ).0ns     h/srv/www/vhosts/g4struct/public_html/venv/lib/python3.11/site-packages/MDAnalysis/topology/TXYZParser.py	<genexpr>z#TXYZParser.parse.<locals>.<genexpr>   s/      77Aq||~~'777777    zElement information is missing, elements attribute will not be populated. If needed these can be guessed using universe.guess_TopologyAttrs(to_guess=['elements']).)attrs)r   filenameintreadlinesplitnpzerosobjectfloat
ValueErrorziprange	itertoolschainappendr	   r
   r   r   tupler   arrayr   r   allr   warningswarnr   )selfkwargsinfnatomsatomidsnamestypesbondsflineilinebonded_atoms
other_atomr!   tops                  r   parsezTXYZParser.parse]   s    T]##  	6s--//233FhvS111GHV6222EHV6222EE LLNNE
' ekkmmA&'''      uV}}iougs.K.KLL 	6 	64zz||!!W
7a7a#ABBx". 6 6J!$Z1!4J:~~a_5556	6/ 	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6F eGe%,,28QC==!!BHaSMM""28XJf55566
 7777777 		LL"(5"?"?"?@@AAAA M*   vq!5111
s7   B!F:7'C3F:3
D =F:?D  B-F::F>F>N)__name__
__module____qualname____doc__formatrC    r    r   r   r   C   s8         . e_F? ? ? ? ?r    r   )rG   r-   numpyr&   r3   guesser.tablesr   lib.utilr   baser   core.topologyr   core.topologyattrsr	   r
   r   r   r   r   r   r   r   rI   r    r   <module>rP      s/  . .          # # # # # #       $ $ $ $ $ $ $ $ $ $ $ $ # # # # # #	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Y Y Y Y Y# Y Y Y Y Yr    