
     i*                     B   d Z ddlmZ ddlmZ  edg d          Z edd          Z ed	d
          Z edd          Z edg d          Z	 edd          Z
 edd          Z edg d          Z G d de          Z G d de          Z G d de          ZdS )zJ
Class definitions for the TPRParser
===================================

    )
namedtuple   )Z2SYMB	TpxHeader)ver_str	precisionfverfgenfile_tagnatomsngtc	fep_statelambbIrbTopbXbVbFbBoxsizeOfTprBodyBoxz
size rel vMtopznmoltype moltypes nmolblockParamsz#atnr ntypes functype reppow fudgeQQAtom)	mqmBqBtptypeBptyperesind
atomnumberAtomsz+atoms nr nres type typeB atomnames resnamesIlistznr ik, iatomsMolblock)	molb_type	molb_nmolmolb_natoms_molmolb_nposres_xAmolb_nposres_xBc                   L    e Zd Z	 	 	 	 	 	 d
dZd Zd Zd Zd Zd Zd Z	d	 Z
dS )MoleculeKindNc	                 v    || _         || _        || _        || _        || _        || _        || _        || _        d S N)name	atomkindsbondsanglesdiheimprdonors	acceptors)	selfr0   r1   r2   r3   r4   r5   r6   r7   s	            e/srv/www/vhosts/g4struct/public_html/venv/lib/python3.11/site-packages/MDAnalysis/topology/tpr/obj.py__init__zMoleculeKind.__init__P   s@     	"
		"    c                 p    d| j         dd|                                 dd|                                 dS )Nz
Molecule: z<20sz	 #atoms: z<10dz #residues: )r0   number_of_atomsnumber_of_residuesr8   s    r9   __repr__zMoleculeKind.__repr__d   sU    ;* ; ;++--5; ;1133:; ;	
r;   c                 *    t          | j                  S r/   lenr1   r?   s    r9   r=   zMoleculeKind.number_of_atomsk   s    4>"""r;   c                 >    t          d | j        D                       S )Nc                     h | ]	}|j         
S  )resid).0as     r9   	<setcomp>z2MoleculeKind.number_of_residues.<locals>.<setcomp>o   s    444AG444r;   rB   r?   s    r9   r>   zMoleculeKind.number_of_residuesn   s!    44T^444555r;   c                 <    | j         rfd| j         D             S g S )Nc                 F    g | ]}t          fd |D                       S )c              3   "   K   | ]	}|z   V  
d S r/   rF   rH   iatom_start_ndxs     r9   	<genexpr>z6MoleculeKind.remap_bonds.<locals>.<listcomp>.<genexpr>u   (      88!n,888888r;   tuple)rH   brP   s     r9   
<listcomp>z,MoleculeKind.remap_bonds.<locals>.<listcomp>u   s6    MMMQE8888a88888MMMr;   )r2   r8   rP   s    `r9   remap_bondszMoleculeKind.remap_bondss   s.    : 	MMMM$*MMMMIr;   c                 <    | j         rfd| j         D             S g S )Nc                 F    g | ]}t          fd |D                       S )c              3   "   K   | ]	}|z   V  
d S r/   rF   rN   s     r9   rQ   z7MoleculeKind.remap_angles.<locals>.<listcomp>.<genexpr>{   rR   r;   rS   rH   rI   rP   s     r9   rV   z-MoleculeKind.remap_angles.<locals>.<listcomp>{   s6    NNNQE8888a88888NNNr;   )r3   rW   s    `r9   remap_angleszMoleculeKind.remap_anglesy   s.    ; 	NNNN$+NNNNIr;   c                 <    | j         rfd| j         D             S g S )Nc                 F    g | ]}t          fd |D                       S )c              3   "   K   | ]	}|z   V  
d S r/   rF   rN   s     r9   rQ   z5MoleculeKind.remap_dihe.<locals>.<listcomp>.<genexpr>   rR   r;   rS   r\   s     r9   rV   z+MoleculeKind.remap_dihe.<locals>.<listcomp>   6    LLLQE8888a88888LLLr;   )r4   rW   s    `r9   
remap_dihezMoleculeKind.remap_dihe   s.    9 	LLLL$)LLLLIr;   c                 <    | j         rfd| j         D             S g S )Nc                 F    g | ]}t          fd |D                       S )c              3   "   K   | ]	}|z   V  
d S r/   rF   rN   s     r9   rQ   z5MoleculeKind.remap_impr.<locals>.<listcomp>.<genexpr>   rR   r;   rS   r\   s     r9   rV   z+MoleculeKind.remap_impr.<locals>.<listcomp>   ra   r;   )r5   rW   s    `r9   
remap_imprzMoleculeKind.remap_impr   s.    9 	LLLL$)LLLLIr;   )NNNNNN)__name__
__module____qualname__r:   r@   r=   r>   rX   r]   rb   rf   rF   r;   r9   r-   r-   O   s        
 # # # #(
 
 
# # #6 6 6
          r;   r-   c                   0    e Zd Zd Zed             Zd ZdS )AtomKindc	                 v    || _         || _        || _        || _        || _        || _        || _        || _        d S r/   )idr0   typerG   resnamemasschargeatomic_number)	r8   rm   r0   rn   rG   ro   rp   rq   rr   s	            r9   r:   zAtomKind.__init__   sC     		
	*r;   c                 6    t          j        | j        d          S )a  
        The symbol of the atom element.

        The symbol corresponding to the atomic number. If the atomic number
        is not recognized, which happens if a particle is not really an
        atom (e.g a coarse-grained particle), an empty string is returned.
         )r   getrr   r?   s    r9   element_symbolzAtomKind.element_symbol   s     z$,b111r;   c                 |    d| j         dd| j        dd| j        dd| j        dd| j        d	d
| j        dddddS )Nz< AtomKind: id 6dz, name 5sz, type 10sz, resid z
, resname 4sz, mass z8.4fz	, charge    z12.3fz >)rm   r0   rn   rG   ro   rp   r?   s    r9   r@   zAtomKind.__repr__   s    '  I$  I%  Z&	 
 |*  I&     
	
r;   N)rg   rh   ri   r:   propertyrv   r@   rF   r;   r9   rk   rk      sM        + + + 2 2 X2
 
 
 
 
r;   rk   c                       e Zd Zd Zd ZdS )InteractionKindc                 0    || _         || _        || _        dS )z<natoms: number of atoms involved in this type of interactionN)r0   	long_namer   )r8   r0   r   r   s       r9   r:   zInteractionKind.__init__   s    	"r;   c              #      K   t          dt          |          | j        dz             D ]}||dz   |dz   | j        z            V  d S )Nr      )rangerC   r   )r8   atom_ndxcursors      r9   processzInteractionKind.process   se       As8}}dkAo>> 	B 	BF6A:
T[(@@AAAAA	B 	Br;   N)rg   rh   ri   r:   r   rF   r;   r9   r   r      s7          B B B B Br;   r   N)__doc__collectionsr   guesser.tablesr   r   r   r   r   r   r$   r%   r&   objectr-   rk   r   rF   r;   r9   <module>r      s  : 
 # " " " " " $ $ $ $ $ $J   	* j%%z&788	HC	D	Dz
JJJ  	
7IJJ
7O,,:  	 	; ; ; ; ;6 ; ; ;|$
 $
 $
 $
 $
v $
 $
 $
NB B B B Bf B B B B Br;   