Exemplo n.º 1
0
    def coord_num_array_specific(
        self,
        distance_dict: Dict[str, float],
        run_start: int,
        run_end: int,
        center_atom: str = "cation",
        counter_atom: str = "anion",
    ) -> Dict[str, np.ndarray]:
        """Calculates the coordination number array of multiple species of specific
        coordination types (SSIP, CIP, AGG).

        Args:
            distance_dict: A dict of coordination cutoff distance of the neighbor species.
            run_start: Start frame of analysis.
            run_end: End frame of analysis.
            center_atom: The solvation shell center atom. Default to "cation".
            counter_atom: The neighbor counter ion species. Default to "anion".

        Return:
             A diction containing the coordination number sequence of each specified neighbor species
             and the total coordination number sequence in the specified frame range.
        """
        nvt_run = self.wrapped_run
        center_atoms = nvt_run.select_atoms(self.select_dict.get(center_atom))
        num_array_dict = concat_coord_array(
            nvt_run,
            num_of_neighbor_specific,
            center_atoms,
            distance_dict,
            self.select_dict,
            run_start,
            run_end,
            counter_atom=counter_atom,
        )
        return num_array_dict
Exemplo n.º 2
0
    def coord_type_array(
        self,
        distance: float,
        run_start: int,
        run_end: int,
        center_atom: str = "cation",
        counter_atom: str = "anion",
    ) -> np.ndarray:
        """Calculates the solvation structure type (1 for SSIP, 2 for CIP,
        3 for AGG) array of the solvation structure ``center_atom`` (typically the cation).

        Args:
            distance: The coordination cutoff distance.
            run_start: Start frame of analysis.
            run_end: End frame of analysis.
            center_atom: The solvation shell center atom. Default to "cation".
            counter_atom: The neighbor counter ion species. Default to "anion".

        Return:
            An array of the solvation structure type in the specified frame range.
        """
        nvt_run = self.wrapped_run
        distance_dict = {counter_atom: distance}
        center_atoms = nvt_run.select_atoms(self.select_dict.get(center_atom))
        num_array = concat_coord_array(
            nvt_run,
            num_of_neighbor_simple,
            center_atoms,
            distance_dict,
            self.select_dict,
            run_start,
            run_end,
        )["total"]
        return num_array
Exemplo n.º 3
0
    def coord_num_array_single_species(
        self,
        species: str,
        distance: float,
        run_start: int,
        run_end: int,
        center_atom: str = "cation",
    ) -> np.ndarray:
        """Calculates the coordination number array of one ``species`` around the interested ``center_atom``.

        Args:
            species: The neighbor species.
            distance: The coordination cutoff distance.
            run_start: Start frame of analysis.
            run_end: End frame of analysis.
            center_atom: The solvation shell center atom. Default to "cation".

        Return:
             An array of coordination number in the frame range.
        """
        nvt_run = self.wrapped_run
        distance_dict = {species: distance}
        center_atoms = nvt_run.select_atoms(self.select_dict.get(center_atom))
        num_array = concat_coord_array(
            nvt_run,
            num_of_neighbor,
            center_atoms,
            distance_dict,
            self.select_dict,
            run_start,
            run_end,
        )["total"]
        return num_array
Exemplo n.º 4
0
    def angle_array(
        self,
        distance_dict: Dict[str, float],
        run_start: int,
        run_end: int,
        center_atom: str = "cation",
        cip=True,
    ):
        """
        Calculates the angle of a-c-b in the specified frame range.

        Args:
            distance_dict: A dict of coordination cutoff distance of the neighbor species.
                The dictionary key must be in the order of a, b, where a is the neighbor species
                used for determining coordination type, b is the other neighbor species, and the
                corresponding values are cutoff distance of a->c and b->c, where c is the center species.
            run_start: Start frame of analysis.
            run_end: End frame of analysis.
            center_atom: The center atom species.
            cip: Only includes contact ion pair structures with only one `a` and one `c` atoms.
                Default to True.

        Returns:
            An array of angles of a-c-b in the specified frames.
        """
        nvt_run = self.wrapped_run
        center_atoms = nvt_run.select_atoms(self.select_dict.get(center_atom))
        assert len(distance_dict) == 2, "Only distance a->c, b->c shoud be specified in the distance_dict."
        distance_dict[center_atom] = list(distance_dict.values())[0]
        ang_array = concat_coord_array(
            nvt_run,
            angular_dist_of_neighbor,
            center_atoms,
            distance_dict,
            self.select_dict,
            run_start,
            run_end,
            cip=cip,
        )["total"]
        return ang_array