本文整理汇总了Python中cogue.task.TaskElement类的典型用法代码示例。如果您正苦于以下问题:Python TaskElement类的具体用法?Python TaskElement怎么用?Python TaskElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TaskElement类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,
directory=None,
name=None,
lattice_tolerance=None,
force_tolerance=None,
pressure_target=None,
stress_tolerance=None,
max_increase=None,
max_iteration=None,
traverse=False,
is_cell_relaxed=False):
TaskElement.__init__(self)
self._directory = directory
if not name:
self._name = directory
else:
self._name = name
self._task_type = "elastic_constants"
self._lattice_tolerance = lattice_tolerance
self._pressure_target = pressure_target
self._stress_tolerance = stress_tolerance
self._force_tolerance = force_tolerance
self._max_increase = max_increase
self._max_iteration = max_iteration
self._traverse = traverse
self._is_cell_relaxed = is_cell_relaxed
self._stage = 0
self._tasks = None
self._cell = None
self._ec_tasks = None
self._elastic_constants = None
示例2: __init__
def __init__(self,
directory=None,
name=None,
ancestral_cells={},
tid_parent=None,
distance=None,
lattice_tolerance=None,
force_tolerance=None,
pressure_target=None,
stress_tolerance=None,
max_increase=None,
max_iteration=None,
min_iteration=None,
symmetry_tolerance=None,
cutoff_eigenvalue=None,
max_displacement=None,
num_sampling_points=None,
traverse=False):
TaskElement.__init__(self)
self._directory = directory
if not name:
self._name = directory
else:
self._name = name
self._ancestral_cells = ancestral_cells
self._tid_parent = tid_parent
self._task_type = "phonon_relax_element"
self._distance = distance
self._lattice_tolerance = lattice_tolerance
self._pressure_target = pressure_target
self._stress_tolerance = stress_tolerance
self._force_tolerance = force_tolerance
self._max_increase = max_increase
self._max_iteration = max_iteration
self._min_iteration = min_iteration
self._symmetry_tolerance = symmetry_tolerance
self._cutoff_eigenvalue = cutoff_eigenvalue
self._max_displacement = max_displacement
self._num_sampling_points = num_sampling_points
self._traverse = traverse
self._tasks = []
self._phre = []
self._stage = 0
self._supercell_dimention = None
self._space_group_type = None
self._energy = None
# self._imaginary_modes:
# (cell with modulation,
# q-point,
# Im(frequency),
# Index of q-point in the mesh sampling,
# Band index,
# Number of degeneracy)
self._imaginary_modes = []
示例3: __init__
def __init__(self,
directory=None,
name=None,
supercell_matrix=None,
primitive_matrix=None,
distance=None,
is_diagonal=True,
check_imaginary=True,
cutoff_frequency=None,
lattice_tolerance=None,
force_tolerance=None,
pressure_target=None,
stress_tolerance=None,
max_increase=None,
max_iteration=None,
min_iteration=None,
is_cell_relaxed=False,
traverse=False):
TaskElement.__init__(self)
self._directory = directory
if not name:
self._name = directory
else:
self._name = name
self._task_type = "anharmonic_phonon"
self._supercell_matrix = supercell_matrix
self._primitive_matrix = primitive_matrix
self._distance = distance
self._is_diagonal = is_diagonal
self._check_imaginary = check_imaginary
self._cutoff_frequency = cutoff_frequency # determine imaginary freq.
self._lattice_tolerance = lattice_tolerance
self._pressure_target = pressure_target
self._stress_tolerance = stress_tolerance
self._force_tolerance = force_tolerance
self._max_increase = max_increase
self._max_iteration = max_iteration
self._min_iteration = min_iteration
self._traverse = traverse
self._is_cell_relaxed = is_cell_relaxed
self._stage = 0
self._tasks = []
self._energy = None
self._cell = None
self._phonon = None # Phonopy object
self._phonon_fc3 = None # Phono3py object
self._phonon_fc3_tasks = None
示例4: __init__
def __init__(
self,
directory="structure_optimization",
name=None,
lattice_tolerance=None,
force_tolerance=None,
pressure_target=None,
stress_tolerance=None,
max_increase=None,
max_iteration=None,
min_iteration=None,
find_symmetry=True,
impose_symmetry=False,
symmetry_tolerance=None,
traverse=False,
):
TaskElement.__init__(self)
self._directory = directory
if not name:
self._name = directory
else:
self._name = name
self._task_type = "structure_optimization"
self._lattice_tolerance = lattice_tolerance
self._pressure_target = pressure_target
self._stress_tolerance = stress_tolerance
self._force_tolerance = force_tolerance
self._max_increase = max_increase
self._max_iteration = max_iteration
self._min_iteration = min_iteration
self._find_symmetry = find_symmetry
self._impose_symmetry = impose_symmetry
self._symmetry_tolerance = symmetry_tolerance
self._traverse = traverse
self._stage = 1
self._tasks = None
self._cell = None
self._next_cell = None
self._so_tasks = None
self._stress = None
self._forces = None
self._energy = None
self._space_group = None
示例5: __init__
def __init__(self,
directory=None,
name=None,
traverse=False):
TaskElement.__init__(self)
self._directory = directory
if not name:
self._name = directory
else:
self._name = name
self._tasks = [] # Means singular task
self._traverse = traverse
self._cell = None
示例6: _get_structopt_yaml_lines
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
示例7: get_yaml_lines
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
示例8: get_yaml_lines
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
示例9: __init__
def __init__(self,
directory=None,
name=None,
supercell_matrix=None,
primitive_matrix=None,
distance=None,
lattice_tolerance=None,
force_tolerance=None,
pressure_target=None,
stress_tolerance=None,
max_increase=None,
max_iteration=None,
min_iteration=None,
traverse=False,
is_cell_relaxed=False):
TaskElement.__init__(self)
self._directory = directory
if not name:
self._name = directory
else:
self._name = name
self._task_type = "phonon"
self._supercell_matrix = supercell_matrix
self._primitive_matrix = primitive_matrix
self._distance = distance
self._lattice_tolerance = lattice_tolerance
self._pressure_target = pressure_target
self._stress_tolerance = stress_tolerance
self._force_tolerance = force_tolerance
self._max_increase = max_increase
self._max_iteration = max_iteration
self._min_iteration = min_iteration
self._traverse = traverse
self._is_cell_relaxed = is_cell_relaxed
self._stage = 0
self._tasks = []
self._energy = None
self._cell = None
self._phonon = None # Phonopy object
示例10: get_yaml_lines
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
示例11: get_yaml_lines
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
示例12: get_yaml_lines
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
示例13: __init__
def __init__(self,
directory=None,
name=None,
strains=None,
sampling_mesh=None,
is_gamma_center=False,
t_step=None,
t_max=None,
t_min=None,
supercell_matrix=None,
primitive_matrix=None,
nac=False,
distance=None,
lattice_tolerance=None,
force_tolerance=None,
pressure_target=None,
stress_tolerance=None,
max_increase=None,
max_iteration=None,
min_iteration=None,
is_cell_relaxed=False,
max_num_atoms=None,
first_phonon_index=None,
traverse=False):
TaskElement.__init__(self)
self._directory = directory
if not name:
self._name = directory
else:
self._name = name
self._task_type = "quasiharmonic_phonon"
self._strains = strains
if self._strains is None:
self._estimate_strain = True
else:
self._estimate_strain = False
self._sampling_mesh = sampling_mesh
self._is_gamma_center = is_gamma_center
if t_step is None:
self._t_step = 2
else:
self._t_step = t_step
if t_max is None:
self._t_max = 1500
else:
self._t_max = t_max
if t_min is None:
self._t_min = 0
else:
self._t_min = t_min
self._supercell_matrix = supercell_matrix
self._primitive_matrix = primitive_matrix
self._nac = nac
self._distance = distance
self._lattice_tolerance = lattice_tolerance
self._pressure_target = pressure_target
self._stress_tolerance = stress_tolerance
self._force_tolerance = force_tolerance
self._max_increase = max_increase
self._max_iteration = max_iteration
self._min_iteration = min_iteration
self._traverse = traverse
self._is_cell_relaxed = is_cell_relaxed
self._max_num_atoms = max_num_atoms
self._first_phonon_index = first_phonon_index
self._stage = 0
self._tasks = None
self._cell = None
self._all_tasks = None
self._imaginary_ratio = None
self._grid_spacing = 200
示例14: __init__
def __init__(
self,
directory=None,
name=None,
strains=None,
sampling_mesh=None,
t_step=None,
t_max=None,
t_min=None,
supercell_matrix=None,
primitive_matrix=None,
distance=None,
lattice_tolerance=None,
force_tolerance=None,
pressure_target=None,
stress_tolerance=None,
max_increase=None,
max_iteration=None,
min_iteration=None,
is_cell_relaxed=False,
traverse=False,
):
TaskElement.__init__(self)
self._directory = directory
if not name:
self._name = directory
else:
self._name = name
self._task_type = "quasiharmonic_phonon"
self._lattices = [np.eye(3)]
for strain in strains:
if isinstance(strain, int) or isinstance(strain, float):
self._lattices.append((1 + strain) ** (1.0 / 3) * np.eye(3))
else:
self._lattices.append(np.eye(3) + np.array(strain))
self._sampling_mesh = sampling_mesh
if t_step is None:
self._t_step = 10
else:
self._t_step = t_step
if t_max is None:
self._t_max = 1500
else:
self._t_max = t_max
if t_min is None:
self._t_min = 0
else:
self._t_min = t_min
self._supercell_matrix = supercell_matrix
self._primitive_matrix = primitive_matrix
self._distance = distance
self._lattice_tolerance = lattice_tolerance
self._pressure_target = pressure_target
self._stress_tolerance = stress_tolerance
self._force_tolerance = force_tolerance
self._max_increase = max_increase
self._max_iteration = max_iteration
self._min_iteration = min_iteration
self._traverse = traverse
self._is_cell_relaxed = is_cell_relaxed
self._stage = 0
self._tasks = None
self._cell = None
self._qh_tasks = None