From b3d0171a4910aeb8e40b5866fddbccf396f97a10 Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Fri, 17 Jul 2020 09:11:05 -0400 Subject: [PATCH 1/2] Writing out structure at end of eacg iteration for visualization. --- loop_step/loop.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/loop_step/loop.py b/loop_step/loop.py index b8556e7..acfe5b5 100644 --- a/loop_step/loop.py +++ b/loop_step/loop.py @@ -4,11 +4,14 @@ import configargparse import logging +import os.path + import loop_step import seamm from seamm_util import ureg, Q_, units_class # noqa: F401 import seamm_util.printing as printing from seamm_util.printing import FormattedText as __ +from seamm_util import to_mmcif, to_cif logger = logging.getLogger(__name__) job = printing.getPrinter() @@ -170,6 +173,8 @@ def run(self): self.set_variable('_loop_indices', (self._loop_value,)) self.set_variable('_loop_index', self._loop_value) else: + self.write_final_structure() + self._loop_value += P['step'] self.set_variable(P['variable'], self._loop_value) @@ -223,6 +228,9 @@ def run(self): else: self.set_variable('_loop_indices', (None,)) + if self._loop_value >= 0: + self.write_final_structure() + self._loop_value += 1 if self._loop_value >= self._loop_length: @@ -276,6 +284,10 @@ def run(self): )) else: self.set_variable('_loop_indices', (None,)) + + if self._loop_value >= 0: + self.write_final_structure() + self._loop_value += 1 if self._loop_value >= self.table.shape[0]: self._loop_value = None @@ -343,6 +355,26 @@ def run(self): # No loop body? just go on? return self.exit_node() + def write_final_structure(self): + """Write the final structure""" + if seamm.data.structure is not None: + system = seamm.data.structure + # MMCIF file has bonds + filename = os.path.join( + self.directory, f'iter_{self._loop_value}', + 'final_structure.mmcif' + ) + with open(filename, 'w') as fd: + print(to_mmcif(system), file=fd) + # CIF file has cell + if system['periodicity'] == 3: + filename = os.path.join( + self.directory, f'iter_{self._loop_value}', + 'final_structure.cif' + ) + with open(filename, 'w') as fd: + print(to_cif(seamm.data.structure), file=fd) + def default_edge_subtype(self): """Return the default subtype of the edge. Usually this is 'next' but for nodes with two or more edges leaving them, such as a loop, this From b14e9bf931ab19baf9bb558e10f95b531d66cd28 Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Tue, 21 Jul 2020 14:13:08 -0400 Subject: [PATCH 2/2] Fixing dependenciy versions. --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9b922c2..c594677 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ Pmw==2.0.1 -seamm==0.9.2 -seamm-util==0.9.1 +seamm>=0.9.5 +seamm-util>=0.9.3 seamm-widgets==0.9.1