Esempio n. 1
0
    def from_files(cls, gsr_files_paths, grun_file_path, ind_doses):
        """
        Creates an instance of QHA from a list og GSR files and a list PHDOS.nc files.
        The list should have the same size and the volumes should match.

        Args:
            gsr_files_paths: list of paths to GSR files.
            phdos_files_paths: list of paths to three PHDOS.nc files.
            ind_doses: list of three values indicating, for each of the three doses, the index of the
                corresponding gsr_file in "gsr_files_paths".

        Returns:
            A new instance of QHA
        """

        energies = []
        structures = []
        for gp in gsr_files_paths:
            with GsrFile.from_file(gp) as g:
                energies.append(g.energy)
                structures.append(g.structure)

        gruns = GrunsNcFile(grun_file_path)

        return cls(structures, gruns, energies, ind_doses)
Esempio n. 2
0
File: qha.py Progetto: gmatteo/abipy
    def from_files(cls, gsr_files_paths, grun_file_path, ind_doses):
        """
        Creates an instance of QHA from a list og GSR files and a list PHDOS.nc files.
        The list should have the same size and the volumes should match.

        Args:
            gsr_files_paths: list of paths to GSR files.
            phdos_files_paths: list of paths to three PHDOS.nc files.
            ind_doses: list of three values indicating, for each of the three doses, the index of the
                corresponding gsr_file in "gsr_files_paths".

        Returns:
            A new instance of QHA
        """

        energies = []
        structures = []
        for gp in gsr_files_paths:
            with GsrFile.from_file(gp) as g:
                energies.append(g.energy)
                structures.append(g.structure)

        gruns = GrunsNcFile(grun_file_path)

        return cls(structures, gruns, energies, ind_doses)
Esempio n. 3
0
    def from_files(cls, gsr_paths, phdos_paths):
        """
        Creates an instance of QHA from a list of GSR files and a list of PHDOS.nc files.
        The list should have the same size and the volumes should match.

        Args:
            gsr_paths: list of paths to GSR files.
            phdos_paths: list of paths to PHDOS.nc files.

        Returns: A new instance of QHA
        """
        energies = []
        structures = []
        for gp in gsr_paths:
            with GsrFile.from_file(gp) as g:
                energies.append(g.energy)
                structures.append(g.structure)

        #doses = [PhononDos.as_phdos(dp) for dp in phdos_paths]

        doses = []
        structures_from_phdos = []
        for path in phdos_paths:
            with PhdosFile(path) as p:
                doses.append(p.phdos)
                structures_from_phdos.append(p.structure)

        cls._check_volumes(structures, structures_from_phdos)

        return cls(structures, doses, energies)
Esempio n. 4
0
File: qha.py Progetto: gmatteo/abipy
    def from_files(cls, gsr_files_paths, phdos_files_paths):
        """
        Creates an instance of QHA from a list og GSR files and a list PHDOS.nc files.
        The list should have the same size and the volumes should match.

        Args:
            gsr_files_paths: list of paths to GSR files.
            phdos_files_paths: list of paths to PHDOS.nc files.

        Returns:
            A new instance of QHA
        """

        energies = []
        structures = []
        for gp in gsr_files_paths:
            with GsrFile.from_file(gp) as g:
                energies.append(g.energy)
                structures.append(g.structure)

        doses = [PhononDos.as_phdos(dp) for dp in phdos_files_paths]

        return cls(structures, doses, energies)