本文整理汇总了Python中cogue.task.TaskElement.get_yaml_lines方法的典型用法代码示例。如果您正苦于以下问题:Python TaskElement.get_yaml_lines方法的具体用法?Python TaskElement.get_yaml_lines怎么用?Python TaskElement.get_yaml_lines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cogue.task.TaskElement
的用法示例。
在下文中一共展示了TaskElement.get_yaml_lines方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_yaml_lines
# 需要导入模块: from cogue.task import TaskElement [as 别名]
# 或者: from cogue.task.TaskElement import get_yaml_lines [as 别名]
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
示例2: _get_structopt_yaml_lines
# 需要导入模块: from cogue.task import TaskElement [as 别名]
# 或者: from cogue.task.TaskElement import get_yaml_lines [as 别名]
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
示例3: get_yaml_lines
# 需要导入模块: from cogue.task import TaskElement [as 别名]
# 或者: from cogue.task.TaskElement import get_yaml_lines [as 别名]
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
示例4: get_yaml_lines
# 需要导入模块: from cogue.task import TaskElement [as 别名]
# 或者: from cogue.task.TaskElement import get_yaml_lines [as 别名]
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
示例5: get_yaml_lines
# 需要导入模块: from cogue.task import TaskElement [as 别名]
# 或者: from cogue.task.TaskElement import get_yaml_lines [as 别名]
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
示例6: get_yaml_lines
# 需要导入模块: from cogue.task import TaskElement [as 别名]
# 或者: from cogue.task.TaskElement import get_yaml_lines [as 别名]
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