Skip to content

Commit

Permalink
Merge pull request #109 from ReactionMechanismGenerator/misc
Browse files Browse the repository at this point in the history
Miscellaneous changes
  • Loading branch information
alongd authored Apr 3, 2019
2 parents e4c85a6 + ea19450 commit 3a2d844
Show file tree
Hide file tree
Showing 17 changed files with 770 additions and 445 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
# PyCharm project files
.idea/*

# settings file
arc/settings.py

# Projects
Projects/

# Examples
examples/

# Unit test files
.coverage
testing/*
Expand Down
5 changes: 1 addition & 4 deletions ARC.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ def main():
verbose = logging.DEBUG
elif args.quiet:
verbose = logging.WARNING
try:
input_dict['verbose']
except KeyError:
input_dict['verbose'] = verbose
input_dict['verbose'] = input_dict['verbose'] if 'verbose' in input_dict else verbose
arc_object = ARC(input_dict=input_dict, project_directory=project_directory)
arc_object.execute()

Expand Down
40 changes: 20 additions & 20 deletions arc/arc_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,71 +13,71 @@ class InputError(Exception):
pass


class OutputError(Exception):
class JobError(Exception):
"""
This exception is raised whenever an error occurs while saving output information
An exception class for exceptional behavior that occurs while working with jobs
"""
pass


class SettingsError(Exception):
class OutputError(Exception):
"""
An exception raised when dealing with settings
This exception is raised whenever an error occurs while saving output information
"""
pass


class SpeciesError(Exception):
class ReactionError(Exception):
"""
An exception class for exceptional behavior that occurs while working with chemical species
An exception class for exceptional behavior that occurs while working with reactions
"""
pass


class TSError(Exception):
class RotorError(Exception):
"""
An exception class for exceptional behavior that occurs while working with transition states
An exception class for exceptional behavior that occurs while working with rotors
"""
pass


class ReactionError(Exception):
class SanitizationError(Exception):
"""
An exception class for exceptional behavior that occurs while working with reactions
Exception class to handle errors during SMILES perception.
"""
pass


class RotorError(Exception):
class SchedulerError(Exception):
"""
An exception class for exceptional behavior that occurs while working with rotors
An exception class for exceptional behavior that occurs while working with the scheduler
"""
pass


class SchedulerError(Exception):
class ServerError(Exception):
"""
An exception class for exceptional behavior that occurs while working with the scheduler
An exception class for exceptional behavior that occurs while working with servers
"""
pass


class JobError(Exception):
class SettingsError(Exception):
"""
An exception class for exceptional behavior that occurs while working with jobs
An exception raised when dealing with settings
"""
pass


class ServerError(Exception):
class SpeciesError(Exception):
"""
An exception class for exceptional behavior that occurs while working with servers
An exception class for exceptional behavior that occurs while working with chemical species
"""
pass


class SanitizationError(Exception):
class TSError(Exception):
"""
Exception class to handle errors during SMILES perception.
An exception class for exceptional behavior that occurs while working with transition states
"""
pass
4 changes: 2 additions & 2 deletions arc/job/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
input_files = {
'gaussian': """%chk=check.chk
%mem={memory}mb
%nproc=8
%nproc={cpus}
#P {job_type_1} {restricted}{method}{slash}{basis} {job_type_2} {fine} {trsh} iop(2/9=2000)
Expand Down Expand Up @@ -113,7 +113,7 @@
""",

'arkane_species': """#!/usr/bin/env python
'arkane_input_species': """#!/usr/bin/env python
# -*- coding: utf-8 -*-
linear = {linear}{bonds}
Expand Down
283 changes: 192 additions & 91 deletions arc/job/job.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions arc/job/jobTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def setUpClass(cls):
A method that is run before all unit tests in this class.
"""
cls.maxDiff = None
settings = {'gaussian': 'server1', 'molpro': 'server2', 'qchem': 'server1', 'ssh': False}
cls.job1 = Job(project='project_test', settings=settings, species_name='tst_spc', xyz='C 0.0 0.0 0.0',
job_type='opt', level_of_theory='b3lyp/6-31+g(d)', multiplicity=1,
ess_settings = {'gaussian': ['server1','server2'], 'molpro': ['server2'], 'qchem': ['server1'], 'ssh': False}
cls.job1 = Job(project='project_test', ess_settings=ess_settings, species_name='tst_spc', xyz='C 0.0 0.0 0.0',
job_type='opt', level_of_theory='b3lyp/6-31+g(d)', multiplicity=1, testing=True,
project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True, job_num=100)
cls.job1.initial_time = datetime.datetime(2019, 3, 15, 19, 53, 7, 0)
cls.job1.final_time = datetime.datetime(2019, 3, 15, 19, 53, 8, 0)
Expand Down
11 changes: 9 additions & 2 deletions arc/job/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ def _download_file(self, remote_file_path, local_file_path):
Download a file from `remote_file_path` to `local_file_path`.
"""
sftp, ssh = self.connect()
sftp.get(remotepath=remote_file_path, localpath=local_file_path)
try:
sftp.get(remotepath=remote_file_path, localpath=local_file_path)
except IOError:
logging.warning('Got an IOError when trying to download file {0} from {1}'.format(remote_file_path,
self.server))
sftp.close()
ssh.close()

Expand Down Expand Up @@ -257,7 +261,10 @@ def try_connecting(self):
def get_last_modified_time(self, remote_file_path):
"""returns the last modified time of `remote_file` in a datetime format"""
sftp, ssh = self.connect()
timestamp = sftp.stat(remote_file_path).st_mtime
try:
timestamp = sftp.stat(remote_file_path).st_mtime
except IOError:
return None
sftp.close()
ssh.close()
return datetime.datetime.fromtimestamp(timestamp)
Expand Down
69 changes: 53 additions & 16 deletions arc/job/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#SBATCH -p defq
#SBATCH -J {name}
#SBATCH -N 1
#SBATCH -n 8
#SBATCH -n {cpus}
#SBATCH --time={t_max}
#SBATCH --mem-per-cpu 4500
Expand Down Expand Up @@ -48,14 +48,55 @@
rm -rf $GAUSS_SCRDIR
rm -rf $WorkDir
""",
# Gaussian16 on RMG
'gaussian16': """#!/bin/bash -l
#SBATCH -p long
#SBATCH -J {name}
#SBATCH -N 1
#SBATCH -n {cpus}
#SBATCH --time={t_max}
#SBATCH --mem-per-cpu={mem_cpu}
which 16
echo "============================================================"
echo "Job ID : $SLURM_JOB_ID"
echo "Job Name : $SLURM_JOB_NAME"
echo "Starting on : $(date)"
echo "Running on node : $SLURMD_NODENAME"
echo "Current directory : $(pwd)"
echo "============================================================"
WorkDir=/scratch/users/{un}/$SLURM_JOB_NAME-$SLURM_JOB_ID
SubmitDir=`pwd`
GAUSS_SCRDIR=/scratch/users/{un}/g16/$SLURM_JOB_NAME-$SLURM_JOB_ID
export GAUSS_SCRDIR
mkdir -p $GAUSS_SCRDIR
mkdir -p $WorkDir
cd $WorkDir
. $g16root/g16/bsd/g16.profile
cp $SubmitDir/input.gjf .
g16 < input.gjf > input.log
formchk check.chk check.fchk
cp * $SubmitDir/
rm -rf $GAUSS_SCRDIR
rm -rf $WorkDir
""",

# Orca on C3DDB:
'orca': """#!/bin/bash -l
#SBATCH -p defq
#SBATCH -J {name}
#SBATCH -N 1
#SBATCH -n 8
#SBATCH -n {cpus}
#SBATCH --time={t_max}
#SBATCH --mem-per-cpu 4500
Expand Down Expand Up @@ -95,7 +136,7 @@
#SBATCH -p long
#SBATCH -J {name}
#SBATCH -N 1
#SBATCH -n 8
#SBATCH -n {cpus}
#SBATCH --time={t_max}
#SBATCH --mem-per-cpu={mem_cpu}
Expand All @@ -112,7 +153,7 @@
sdir=/scratch/{un}/$SLURM_JOB_NAME-$SLURM_JOB_ID
mkdir -p $sdir
molpro -n 8 -d $sdir input.in
molpro -n {cpus} -d $sdir input.in
rm -rf $sdir
Expand All @@ -125,10 +166,9 @@
'gaussian': """#!/bin/bash -l
#$ -N {name}
#$ -l long
#$ -l harpertown
#$ -l long{architecture}
#$ -l h_rt={t_max}
#$ -pe singlenode 6
#$ -pe singlenode {cpus}
#$ -l h=!node60.cluster
#$ -cwd
#$ -o out.txt
Expand All @@ -152,10 +192,9 @@
'gaussian03_pharos': """#!/bin/bash -l
#$ -N {name}
#$ -l long
#$ -l harpertown
#$ -l long{architecture}
#$ -l h_rt={t_max}
#$ -pe singlenode 6
#$ -pe singlenode {cpus}
#$ -l h=!node60.cluster
#$ -cwd
#$ -o out.txt
Expand All @@ -179,10 +218,9 @@
'qchem': """#!/bin/bash -l
#$ -N {name}
#$ -l long
#$ -l harpertown
#$ -l long{architecture}
#$ -l h_rt={t_max}
#$ -pe singlenode 6
#$ -pe singlenode {cpus}
#$ -l h=!node60.cluster
#$ -cwd
#$ -o out.txt
Expand All @@ -207,10 +245,9 @@
'molpro': """#! /bin/bash -l
#$ -N {name}
#$ -l long
#$ -l harpertown
#$ -l long{architecture}
#$ -l h_rt={t_max}
#$ -pe singlenode 6
#$ -pe singlenode {cpus}
#$ -l h=!node60.cluster
#$ -cwd
#$ -o out.txt
Expand Down
Loading

0 comments on commit 3a2d844

Please sign in to comment.