Skip to content

Commit

Permalink
Merge branch 'main' into pdep_spin_conservation
Browse files Browse the repository at this point in the history
  • Loading branch information
donerancl committed Aug 6, 2024
2 parents 9fdc594 + a4cbbf8 commit 772c0df
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
5 changes: 3 additions & 2 deletions arkane/ess/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion arkane/ess/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
30 changes: 25 additions & 5 deletions rmgpy/molecule/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 772c0df

Please sign in to comment.