Ejemplo n.º 1
0
    def get_yaml_lines(self):
        lines = TaskElement.get_yaml_lines(self)

        if 'energies' in self._properties:
            self._energy = self._properties['energies'][-1]
        if 'forces' in self._properties:
            self._forces = self._properties['forces'][-1]
        if 'stress' in self._properties:
            self._stress = self._properties['stress'][-1]

        lines += self._get_oneshot_yaml_lines(self._cell)

        if ('eigenvalues' in self._properties and
            'occupancies' in self._properties):
            for i, (e_spin, o_spin) in enumerate(zip(
                    self._properties['eigenvalues'],
                    self._properties['occupancies'])):

                if e_spin is None or o_spin is None:
                    break

                if (len(self._properties['eigenvalues']) == 2 and
                    len(self._properties['occupancies']) == 2):
                    lines.append("eigenvalues_spin%d:" % (i + 1))
                else:
                    lines.append("eigenvalues:")
                for j, (eigs, occs) in enumerate(zip(e_spin, o_spin)):
                    lines.append("- # %d" % (j + 1))
                    for eig, occ in zip(eigs, occs):
                        lines.append("  - [ %15.10f, %15.10f ]" % (eig, occ))
            
        return lines
Ejemplo n.º 2
0
    def _get_structopt_yaml_lines(self):
        lines = []
        if self._all_tasks:
            lines.append("tasks:")
        for task in self._all_tasks:
            if not task:
                continue
            for i, line in enumerate(TaskElement.get_yaml_lines(task)):
                if i == 0:
                    lines.append("- " + line)
                else:
                    lines.append("  " + line)
        if self._lattice_tolerance is not None:
            lines.append("lattice_tolerance: %f" % self._lattice_tolerance)
        if self._stress_tolerance is not None:
            lines.append("stress_tolerance: %f" % self._stress_tolerance)
            lines.append("pressure_target: %f" % self._pressure_target)
        lines.append("force_tolerance: %f" % self._force_tolerance)
        if self._max_increase is None:
            lines.append("max_increase: unset")
        else:
            lines.append("max_increase: %f" % self._max_increase)
        lines.append("max_iteration: %d" % self._max_iteration)
        lines.append("min_iteration: %d" % self._min_iteration)

        return lines
Ejemplo n.º 3
0
    def get_yaml_lines(self):
        lines = TaskElement.get_yaml_lines(self)
        cell = self.get_cell()
        lines += self._get_ec_yaml_lines(cell)
        if self._all_tasks[0] is not None:
            if self._energy:
                lines.append("electric_total_energy: %20.10f" % self._energy)

        return lines
Ejemplo n.º 4
0
    def get_yaml_lines(self):
        lines = TaskElement.get_yaml_lines(self)
        if self._is_cell_relaxed:
            cell = self._cell
        else:
            cell = self._all_tasks[0].get_cell()
        lines += self._get_phonon_yaml_lines(cell)

        return lines
Ejemplo n.º 5
0
    def get_yaml_lines(self):
        lines = TaskElement.get_yaml_lines(self)
        lines += self._get_structopt_yaml_lines()
        cell = self.get_cell()
        if cell:
            lines += cell.get_yaml_lines()

        if self._bulk_modulus:
            lines.append("bulk_modulus: %f\n" % self._bulk_modulus)

        return lines
Ejemplo n.º 6
0
    def get_yaml_lines(self):
        lines = TaskElement.get_yaml_lines(self)
        lines.append("iteration: %d" % self._stage)
        lines += self._get_structopt_yaml_lines()
        cell = self._all_tasks[-1].get_current_cell()
        lines += self._get_oneshot_yaml_lines(cell)
        if self._space_group:
            lines.append("symmetry_tolerance: %s" % self._symmetry_tolerance)
            lines.append("space_group_type: %s" % self._space_group["international"])
            lines.append("space_group_number: %d" % self._space_group["number"])

        return lines
Ejemplo n.º 7
0
    def get_yaml_lines(self):
        lines = TaskElement.get_yaml_lines(self)
        if self._is_cell_relaxed:
            cell = self._cell
        else:
            cell = self.get_cell()
        lines += self._get_phonon_yaml_lines(cell)
        if self._all_tasks[0] is not None:
            if self._energy:
                lines.append("electric_total_energy: %20.10f" % self._energy)

        return lines
Ejemplo n.º 8
0
    def get_yaml_lines(self):
        lines = TaskElement.get_yaml_lines(self)
        if self._sampling_mesh is not None:
            lines.append("sampling_mesh: [ %3d, %3d, %3d ]" %
                         tuple(self._sampling_mesh))
            if self._is_gamma_center:
                lines.append("is_gamma_center: True")
            else:
                lines.append("is_gamma_center: False")
        if self._imaginary_ratio is not None:
            lines.append("imaginary_ratio: %f" % self._imaginary_ratio)
        if self._is_cell_relaxed:
            cell = self._cell
        else:
            cell = self._all_tasks[0].get_cell()
        lines += self._get_phonon_yaml_lines(cell)

        return lines
Ejemplo n.º 9
0
 def get_yaml_lines(self):
     lines = TaskElement.get_yaml_lines(self)
     lines += self._get_oneshot_yaml_lines(self._cell)
     return lines