diff --git a/arkane/ess/adapter.py b/arkane/ess/adapter.py index 9b25b1e2c1..f0a30c932a 100644 --- a/arkane/ess/adapter.py +++ b/arkane/ess/adapter.py @@ -45,10 +45,11 @@ class ESSAdapter(ABC): An abstract ESS Adapter class """ - def __init__(self, path, check_for_errors=True): + def __init__(self, path, check_for_errors=True, scratch_directory=None): self.path = path if check_for_errors: self.check_for_errors() + self.scratch_directory = scratch_directory if scratch_directory is not None else os.path.join(os.path.abspath('.'), str('scratch')) @abstractmethod def check_for_errors(self): @@ -174,7 +175,7 @@ def get_symmetry_properties(self): coordinates, atom_numbers, _ = self.load_geometry() unique_id = '0' # Just some name that the SYMMETRY code gives to one of its jobs # Scratch directory that the SYMMETRY code writes its files in: - scr_dir = os.path.join(os.path.abspath('.'), str('scratch')) + scr_dir = self.scratch_directory if not os.path.exists(scr_dir): os.makedirs(scr_dir) try: diff --git a/arkane/ess/factory.py b/arkane/ess/factory.py index 8e50390093..ca0baee26c 100644 --- a/arkane/ess/factory.py +++ b/arkane/ess/factory.py @@ -61,6 +61,7 @@ def register_ess_adapter(ess: str, def ess_factory(fullpath: str, check_for_errors: bool = True, + scratch_directory: str = None, ) -> Type[ESSAdapter]: """ A factory generating the ESS adapter corresponding to ``ess_adapter``. @@ -106,4 +107,4 @@ def ess_factory(fullpath: str, raise InputError(f'The file at {fullpath} could not be identified as a ' f'Gaussian, Molpro, Orca, Psi4, QChem, or TeraChem log file.') - return _registered_ess_adapters[ess_name](path=fullpath, check_for_errors=check_for_errors) + return _registered_ess_adapters[ess_name](path=fullpath, check_for_errors=check_for_errors, scratch_directory=scratch_directory) diff --git a/environment.yml b/environment.yml index 48a4da34a3..b81c13cd9f 100644 --- a/environment.yml +++ b/environment.yml @@ -16,7 +16,7 @@ # made dependency list more explicit (@JacksonBurns). # - October 16, 2023 Switched RDKit and descripatastorus to conda-forge, # moved diffeqpy to pip and (temporarily) removed chemprop -# +# - August 4, 2024 Restricted pyrms to <2 name: rmg_env channels: - defaults @@ -88,7 +88,7 @@ dependencies: # packages we maintain - rmg::pydas >=1.0.3 - rmg::pydqed >=1.0.3 - - rmg::pyrms + - rmg::pyrms <2 - rmg::symmetry # packages we would like to stop maintaining (and why) diff --git a/rmgpy/molecule/draw.py b/rmgpy/molecule/draw.py index 6dd6c8b46b..e18611b92a 100644 --- a/rmgpy/molecule/draw.py +++ b/rmgpy/molecule/draw.py @@ -1644,6 +1644,7 @@ def __init__(self, options=None): self.options = MoleculeDrawer().options.copy() self.options.update({ 'arrowLength': 36, + 'drawReversibleArrow': True }) if options: self.options.update(options) @@ -1744,11 +1745,30 @@ def draw(self, reaction, file_format, path=None): rxn_cr.save() rxn_cr.set_source_rgba(0.0, 0.0, 0.0, 1.0) rxn_cr.set_line_width(1.0) - rxn_cr.move_to(rxn_x + 8, rxn_top + 0.5 * rxn_height) - rxn_cr.line_to(rxn_x + arrow_width - 8, rxn_top + 0.5 * rxn_height) - rxn_cr.move_to(rxn_x + arrow_width - 14, rxn_top + 0.5 * rxn_height - 3.0) - rxn_cr.line_to(rxn_x + arrow_width - 8, rxn_top + 0.5 * rxn_height) - rxn_cr.line_to(rxn_x + arrow_width - 14, rxn_top + 0.5 * rxn_height + 3.0) + if self.options['drawReversibleArrow'] and reaction.reversible: # draw double harpoons + TOP_HARPOON_Y = rxn_top + (0.5 * rxn_height - 1.75) + BOTTOM_HARPOON_Y = rxn_top + (0.5 * rxn_height + 1.75) + + # Draw top harpoon + rxn_cr.move_to(rxn_x + 8, TOP_HARPOON_Y) + rxn_cr.line_to(rxn_x + arrow_width - 8, TOP_HARPOON_Y) + rxn_cr.move_to(rxn_x + arrow_width - 14, TOP_HARPOON_Y - 3.0) + rxn_cr.line_to(rxn_x + arrow_width - 8, TOP_HARPOON_Y) + + # Draw bottom harpoon + rxn_cr.move_to(rxn_x + arrow_width - 8, BOTTOM_HARPOON_Y) + rxn_cr.line_to(rxn_x + 8, BOTTOM_HARPOON_Y) + rxn_cr.move_to(rxn_x + 14, BOTTOM_HARPOON_Y + 3.0) + rxn_cr.line_to(rxn_x + 8, BOTTOM_HARPOON_Y) + + + else: # draw forward arrow + rxn_cr.move_to(rxn_x + 8, rxn_top + 0.5 * rxn_height) + rxn_cr.line_to(rxn_x + arrow_width - 8, rxn_top + 0.5 * rxn_height) + rxn_cr.move_to(rxn_x + arrow_width - 14, rxn_top + 0.5 * rxn_height - 3.0) + rxn_cr.line_to(rxn_x + arrow_width - 8, rxn_top + 0.5 * rxn_height) + rxn_cr.line_to(rxn_x + arrow_width - 14, rxn_top + 0.5 * rxn_height + 3.0) + rxn_cr.stroke() rxn_cr.restore() rxn_x += arrow_width