Skip to content

Commit

Permalink
Merge pull request #117 from ReactionMechanismGenerator/oneDMin
Browse files Browse the repository at this point in the history
Calculating Lennard-Jones coefficients
  • Loading branch information
alongd committed Apr 28, 2019
2 parents d40572b + 7db2a3c commit c7b5474
Show file tree
Hide file tree
Showing 29 changed files with 2,035 additions and 307 deletions.
7 changes: 7 additions & 0 deletions arc/arc_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class OutputError(Exception):
pass


class ParserError(Exception):
"""
This exception is raised whenever an error occurs while parsing files
"""
pass


class ReactionError(Exception):
"""
An exception class for exceptional behavior that occurs while working with reactions
Expand Down
30 changes: 30 additions & 0 deletions arc/job/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,34 @@

'arkane_free_rotor':
"""FreeRotor(pivots={pivots}, top={top}, symmetry={symmetry})""",

'onedmin': """ 484040 10 ! Rand. no. seed, N_samples
geo.xyz ! Name of geometry file; units are Angstroms
{bath} ! Bath gas; allowed values are He, Ne, Ar, Kr, H2, N2, O2
2 5 ! Rmin, Rmax; allowed center of mass range
""",

'onedmin.molpro.x': """molpro -n 1 --nouse-logfile --no-xml-output -L /opt/molpro2012/molprop_2012_1_Linux_x86_64_i8/lib/ -d /scratch/$USER -o qc.out -s qc.in
""",

'onedmin.qc.mol': """***
memory,500,m
nosym
noorient
geometry
GEOMETRY
end
basis,default=avdz,h=vdz
{df-rhf}
{df-rmp2}
set,spin=SPIN
molpro_energy=energy
show[1,e25.15],molpro_energy
---
""",
}
116 changes: 90 additions & 26 deletions arc/job/job.py

Large diffs are not rendered by default.

20 changes: 18 additions & 2 deletions arc/job/jobTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def setUpClass(cls):
A method that is run before all unit tests in this class.
"""
cls.maxDiff = None
cls.ess_settings = {'gaussian': ['server1','server2'], 'molpro': ['server2'],
'qchem': ['server1'], 'ssh': False}
cls.ess_settings = {'gaussian': ['server1', 'server2'], 'molpro': ['server2'],
'qchem': ['server1'], 'onedmin': ['server1'], 'ssh': False}
cls.job1 = Job(project='project_test', ess_settings=cls.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'),
Expand Down Expand Up @@ -121,6 +121,22 @@ def test_automatic_ess_assignment(self):
self.assertEqual(job0.memory, 15000)
self.assertEqual(job0.max_job_time, 120)

def test_bath_gas(self):
"""Test correctly assigning the bath_gas attribute"""
self.assertIsNone(self.job1.bath_gas)

job2 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc',
xyz='C 0.0 0.0 0.0', job_type='onedmin', 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)
self.assertEqual(job2.bath_gas, 'N2')

job2 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc',
xyz='C 0.0 0.0 0.0', job_type='onedmin', 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, bath_gas='Ar')
self.assertEqual(job2.bath_gas, 'Ar')


################################################################################

Expand Down
17 changes: 12 additions & 5 deletions arc/job/ssh.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env python
# encoding: utf-8

"""
A module for SSHing into servers
"""

from __future__ import (absolute_import, division, print_function, unicode_literals)
import logging
import os
Expand All @@ -15,7 +19,7 @@
##################################################################


class SSH_Client(object):
class SSHClient(object):
"""
This is a class for communicating with servers
"""
Expand Down Expand Up @@ -79,7 +83,7 @@ def upload_file(self, remote_file_path, local_file_path='', file_string=''):
while not success and times_tried < max_times_to_try:
times_tried += 1
try:
write_file(sftp, ssh, remote_file_path, local_file_path, file_string)
write_file(sftp, remote_file_path, local_file_path, file_string)
except IOError:
pass
else:
Expand Down Expand Up @@ -195,7 +199,7 @@ def delete_job(self, job_id):

def check_running_jobs_ids(self):
"""
Return a list of ``int`` representing job IDs of all jobs submited by the user on a server
Return a list of ``int`` representing job IDs of all jobs submitted by the user on a server
"""
running_jobs_ids = list()
cmd = check_status_command[servers[self.server]['cluster_soft']] + ' -u ' + servers[self.server]['un']
Expand All @@ -207,9 +211,11 @@ def check_running_jobs_ids(self):
return running_jobs_ids

def submit_job(self, remote_path):
"""Submit a job"""
job_status = ''
job_id = 0
cmd = submit_command[servers[self.server]['cluster_soft']] + ' ' + submit_filename[servers[self.server]['cluster_soft']]
cmd = submit_command[servers[self.server]['cluster_soft']] + ' ' +\
submit_filename[servers[self.server]['cluster_soft']]
stdout, stderr = self.send_command_to_server(cmd, remote_path)
if len(stderr) > 0 or len(stdout) == 0:
job_status = 'errored'
Expand Down Expand Up @@ -270,7 +276,8 @@ def get_last_modified_time(self, remote_file_path):
return datetime.datetime.fromtimestamp(timestamp)


def write_file(sftp, ssh, remote_file_path, local_file_path='', file_string=''):
def write_file(sftp, remote_file_path, local_file_path='', file_string=''):
"""Write content into a remote file (either write content or upload)"""
with sftp.open(remote_file_path, "w") as f_remote:
if file_string:
f_remote.write(file_string)
Expand Down
103 changes: 64 additions & 39 deletions arc/job/submit.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
#!/usr/bin/env python
# encoding: utf-8

"""
Submit scripts
sorted in a dictionary with server names as keys
"""

##################################################################


submit_scripts = {
'Slurm': {
# Gaussian09 on C3DDB
'c3ddb': {
# Gaussian09
'gaussian': """#!/bin/bash -l
#SBATCH -p defq
#SBATCH -J {name}
#SBATCH -N 1
#SBATCH -n {cpus}
#SBATCH --time={t_max}
#SBATCH --mem-per-cpu 4500
#SBATCH --mem-per-cpu {mem_cpu}
module add c3ddb/gaussian/09.d01
which g09
Expand Down Expand Up @@ -50,16 +54,22 @@
rm -rf $WorkDir
""",
# Gaussian16 on RMG
'gaussian16': """#!/bin/bash -l
#SBATCH -p long

# Orca
'orca': """#!/bin/bash -l
#SBATCH -p defq
#SBATCH -J {name}
#SBATCH -N 1
#SBATCH -n {cpus}
#SBATCH --time={t_max}
#SBATCH --mem-per-cpu={mem_cpu}
#SBATCH --mem-per-cpu {mem_cpu}
which 16
module add c3ddb/orca/4.0.0
module add c3ddb/openmpi/2.0.2
which orca
export ORCA_DIR=/cm/shared/c3ddb/orca/4.0.0/
export PATH=$PATH:$ORCA_DIR
echo "============================================================"
echo "Job ID : $SLURM_JOB_ID"
Expand All @@ -69,44 +79,34 @@
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 .
cp $SubmitDir/input.inp .
g16 < input.gjf > input.log
formchk check.chk check.fchk
${ORCA_DIR}/orca input.inp > input.log
cp * $SubmitDir/
rm -rf $GAUSS_SCRDIR
rm -rf $WorkDir
""",
},

# Orca on C3DDB:
'orca': """#!/bin/bash -l
#SBATCH -p defq
'rmg': {
# Gaussian16
'gaussian16': """#!/bin/bash -l
#SBATCH -p long
#SBATCH -J {name}
#SBATCH -N 1
#SBATCH -n {cpus}
#SBATCH --time={t_max}
#SBATCH --mem-per-cpu 4500
module add c3ddb/orca/4.0.0
module add c3ddb/openmpi/2.0.2
which orca
#SBATCH --mem-per-cpu={mem_cpu}
export ORCA_DIR=/cm/shared/c3ddb/orca/4.0.0/
export PATH=$PATH:$ORCA_DIR
which 16
echo "============================================================"
echo "Job ID : $SLURM_JOB_ID"
Expand All @@ -116,23 +116,29 @@
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.inp .
cp $SubmitDir/input.gjf .
${ORCA_DIR}/orca input.inp > input.log
g16 < input.gjf > input.log
formchk check.chk check.fchk
cp * $SubmitDir/
rm -rf $GAUSS_SCRDIR
rm -rf $WorkDir
""",

# Molpro 2015 on RMG
# Molpro 2015
'molpro': """#!/bin/bash -l
#SBATCH -p long
#SBATCH -J {name}
Expand Down Expand Up @@ -161,9 +167,8 @@
""",
},


'OGE': {
# Gaussian16 on Pharos
'pharos': {
# Gaussian16
'gaussian': """#!/bin/bash -l
#$ -N {name}
Expand All @@ -189,7 +194,7 @@
rm -r /scratch/{un}/{name}
""",
# Gaussian03 on Pharos
# Gaussian03
'gaussian03_pharos': """#!/bin/bash -l
#$ -N {name}
Expand All @@ -215,7 +220,7 @@
rm -r /scratch/{un}/{name}
""",
# QChem 4.4 on Pharos:
# QChem 4.4
'qchem': """#!/bin/bash -l
#$ -N {name}
Expand All @@ -242,7 +247,7 @@
rm -r /scratch/{un}/{name}
""",
# Molpro 2012 on Pharos
# Molpro 2012
'molpro': """#! /bin/bash -l
#$ -N {name}
Expand All @@ -260,6 +265,26 @@
mkdir -p /scratch/{un}/qlscratch
molpro -d $sdir -n 6 input.in
""",
# oneDMin
'onedmin': """#! /bin/bash -l
#$ -N {name}
#$ -l long{architecture}
#$ -l h_rt={t_max}
#$ -pe singlenode {cpus}
#$ -l h=!node60.cluster
#$ -cwd
#$ -o out.txt
#$ -e err.txt
WorkDir=`pwd`
cd
sdir=/scratch/{un}
mkdir -p /scratch/{un}/onedmin
cd $WorkDir
~/auto1dmin/exe/auto1dmin.x < input.in > output.out
""",
}
}
30 changes: 30 additions & 0 deletions arc/job/submitTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
This module contains unit tests of the arc.job.submit module
"""

from __future__ import (absolute_import, division, print_function, unicode_literals)
import unittest

from arc.job.submit import submit_scripts

################################################################################


class TestSubmit(unittest.TestCase):
"""
Contains unit tests for the submit module
"""

def test_servers(self):
"""Test server keys in submit_scripts"""
for server in submit_scripts.keys():
self.assertTrue(server in ['pharos', 'c3ddb', 'rmg'])


################################################################################

if __name__ == '__main__':
unittest.main(testRunner=unittest.TextTestRunner(verbosity=2))

0 comments on commit c7b5474

Please sign in to comment.