Skip to content

Commit

Permalink
Merge 092dd9d into 61760da
Browse files Browse the repository at this point in the history
  • Loading branch information
samwaseda committed Mar 19, 2020
2 parents 61760da + 092dd9d commit b11b960
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions pyiron/interactive/sxextoptint.py
Expand Up @@ -45,6 +45,7 @@ def __init__(
max_step_length=1.0e-1,
soft_mode_damping=1,
executable=None,
ssa=False,
):
self.__name__ = "SxExtOpt"
if working_directory is None:
Expand All @@ -70,14 +71,18 @@ def __init__(
max_step_length=max_step_length,
soft_mode_damping=soft_mode_damping,
selective_dynamics="selective_dynamics" in structure._tag_list.keys(),
ssa=ssa,
)
self._cell = structure.cell
magmom = structure.get_initial_magnetic_moments()
magmom[magmom!=None] = np.round(magmom[magmom!=None], decimals=1)
magmom = np.char.mod('%s', magmom)
self._elements = np.char.add(structure.get_parent_symbols(), magmom)
self._elements = np.char.replace(self._elements, '-', 'm')
self._elements = np.char.replace(self._elements, '.', 'p')
if ssa:
self._elements = structure.get_parent_symbols()
else:
magmom = structure.get_initial_magnetic_moments()
magmom[magmom!=None] = np.round(magmom[magmom!=None], decimals=1)
magmom = np.char.mod('%s', magmom)
self._elements = np.char.add(structure.get_parent_symbols(), magmom)
self._elements = np.char.replace(self._elements, '-', 'm')
self._elements = np.char.replace(self._elements, '.', 'p')
self._positions = structure.positions
self._converged = False

Expand All @@ -92,10 +97,13 @@ def _start_process(
max_step_length=1.0e-1,
soft_mode_damping=1,
selective_dynamics=False,
ssa=False,
):
if selective_dynamics:
input_writer_obj = InputWriter()
input_writer_obj.structure = structure
if ssa:
input_writer_obj.structure.set_initial_magnetic_moments(len(structure)*[None])
input_writer_obj.write_structure(
file_name="structure.sx",
cwd=self.working_directory,
Expand Down Expand Up @@ -188,7 +196,6 @@ def interactive_close(self):
os.remove(posixpath.join(self.working_directory, "control"))
os.remove(posixpath.join(self.working_directory, "response"))


def interactive_is_activated(self):
if self._interactive_library is None:
return False
Expand Down Expand Up @@ -310,6 +317,7 @@ def run_static(self):
max_step_length=float(self.input["max_step_length"]),
soft_mode_damping=float(self.input["soft_mode_damping"]),
executable=self.executable.executable_path,
ssa=self.input['ssa'],
)
try:
self._coarse_run = self.ref_job.coarse_run
Expand Down Expand Up @@ -405,6 +413,7 @@ def load_default(self):
"ionic_forces = 1.0e-2\n"
"maxDist = 5 // maximum possible distance for considering neighbors\n"
"max_step_length = 1.0e-1 // maximum displacement at each step\n"
"ssa = False // ignore different magnetic moment values when internal symmetries are considered\n"
"soft_mode_damping = 1.0 // Tikhonov damper\n"
)
self.load_string(file_content)
Expand Down

0 comments on commit b11b960

Please sign in to comment.