

"""simple docstring"""


from typing import Dict

import numpy as np
import torch

from . import residue_constants as rc
from .tensor_utils import tensor_tree_map, tree_map



def   _A					(	_a	:						Dict[str, torch.Tensor]				):



      """simple docstring"""






      A				  =		[]
      A				  =		[]
      A				  =		[]

      for rt in rc.restypes:
            A				  =		rc.restype_name_to_atomaa_names[rc.restype_atoa[rt]]
            restype_atomaa_to_atomaa_list.append([(rc.atom_order[name] if name else 0) for name in atom_names]				)
            A				  =		{name: i for i, name in enumerate(_a				)}
            restype_atomaa_to_atomaa_list.append(
                [(atom_name_to_idxaa[name] if name in atom_name_to_idxaa else 0) for name in rc.atom_types]				)

            restype_atomaa_mask_list.append([(1.0 if name else 0.0) for name in atom_names]				)

      # Add dummy mapping for restype 'UNK'
      restype_atomaa_to_atomaa_list.append([0] * 1_4				)
      restype_atomaa_to_atomaa_list.append([0] * 3_7				)
      restype_atomaa_mask_list.append([0.0] * 1_4				)

      A				  =		torch.tensor(
          _a     ,   dtype=torch.intaa     ,   device=protein["""aatype"""].device     ,   )
      A				  =		torch.tensor(
          _a     ,   dtype=torch.intaa     ,   device=protein["""aatype"""].device     ,   )
      A				  =		torch.tensor(
          _a     ,   dtype=torch.floataa     ,   device=protein["""aatype"""].device     ,   )
      A				  =		protein["""aatype"""].to(torch.long				)

      # create the mapping for (residx, atom14) --> atom37, i.e. an array
      # with shape (num_res, 14) containing the atom37 indices for this protein
      A				  =		restype_atomaa_to_atomaa[protein_aatype]
      A				  =		restype_atomaa_mask[protein_aatype]

      A				  =		residx_atomaa_mask
      A				  =		residx_atomaa_to_atomaa.long()

      # create the gather indices for mapping back
      A				  =		restype_atomaa_to_atomaa[protein_aatype]
      A				  =		residx_atomaa_to_atomaa.long()

      # create the corresponding mask
      A				  =		torch.zeros([2_1, 3_7]     ,   dtype=torch.floataa     ,   device=protein["""aatype"""].device				)
      for restype, restype_letter in enumerate(rc.restypes				):
            A				  =		rc.restype_atoa[restype_letter]
            A				  =		rc.residue_atoms[restype_name]
            for atom_name in atom_names:
                  A				  =		rc.atom_order[atom_name]
                  A				  =		1

      A				  =		restype_atomaa_mask[protein_aatype]
      A				  =		residx_atomaa_mask

      return protein





def   _A					(	_a	:						Dict[str, torch.Tensor]				):



      """simple docstring"""






      A				  =		tree_map(lambda _a				: torch.tensor(_a     ,   device=batch["""aatype"""].device				)     ,   _a     ,   np.ndarray				)
      A				  =		tensor_tree_map(lambda _a				: np.array(_a				)     ,   make_atomaa_masks(_a				)				)
      return out







"""simple docstring"""


import qiskit



def   _A					(	_a	:						int     ,   _a	:						int				):



      """simple docstring"""






      A				  =		qiskit.Aer.get_backend("""aer_simulator"""				)

      # Create a Quantum Circuit acting on the q register
      A				  =		qiskit.QuantumCircuit(_a     ,   _a				)

      # Apply X (NOT) Gate to Qubits 0 & 1
      circuit.x(0				)
      circuit.x(1				)

      # Map the quantum measurement to the classical bits
      circuit.measure([0, 1]     ,   [0, 1]				)

      # Execute the circuit on the qasm simulator
      A				  =		qiskit.execute(_a     ,   _a     ,   shots=1_0_0_0				)

      # Return the histogram data of the results of the experiment.
      return job.result().get_counts(_a				)


if __name__ == "__main__":
  UpperCAmelCase													=single_qubit_measure(2, 2)
  print(f"""Total count for various states are: {counts}""")




