1 """ @package forcebalance.qchemio Q-Chem input file parser. """ 3 from builtins
import str
4 from builtins
import range
6 from re
import match, sub
7 from forcebalance
import BaseReader
11 from forcebalance.output
import getLogger
12 logger=getLogger(__name__)
24 pdict = {
'BASS':{0:
'A', 1:
'C'},
25 'BASSP' :{0:
'A', 1:
'B', 2:
'C'}
29 """Finite state machine for parsing Q-Chem input files. 45 @param[in] line The line of data 48 line = line.split(
'!')[0].strip()
53 if len(s) == 0
or match(
'^!',line):
return None,
None 57 self.
sec = sub(
'^\$',
'',line)
58 elif self.
sec ==
'basis':
59 if match(
'^[A-Za-z][a-z]* +0$',line):
62 elif match(
'^[SPDFGH]P? +[0-9]+ +1\.0+$',line):
67 logger.info(line +
'\n')
70 logger.info(
"%s %s %s\n" % (line, str(self.
snum), str(self.
cnum)))
75 for i
in range(QCIn.na):
77 if QCIn.Data[
'elem'][i]
in [
'M',
'L']:
78 QCIn.Data[
'elem'][i] =
'He' 79 CalcDir=os.path.splitext(fnm)[0]+
".d" 81 digits = len(str(QCIn.ns))
82 for i
in range(QCIn.ns):
83 sdir =
"%%0%ii" % digits % i
85 QCIn.write(
"qchem.in",selection=i)
86 queue_up(wq,
"qchem40 qchem.in qchem.out",input_files=[
"qchem.in"],output_files=[
"qchem.out"],verbose=
False)
90 for i
in range(QCIn.ns):
91 sdir =
"%%0%ii" % digits % i
93 for line
in open(
"qchem.out"):
94 if "PCM electrostatic energy" in line:
95 PCM_Energies.append(float(line.split()[-2]))
98 return np.array(PCM_Energies) * 2625.5
def feed(self, line)
Feed in a line.
Nifty functions, intended to be imported by any module within ForceBalance.
def QChem_Dielectric_Energy(fnm, wq)
def queue_up(wq, command, input_files, output_files, tag=None, tgt=None, verbose=True, print_time=60)
Submit a job to the Work Queue.
def wq_wait(wq, wait_time=10, wait_intvl=10, print_time=60, verbose=False)
This function waits until the work queue is completely empty.
Finite state machine for parsing Q-Chem input files.
def isfloat(word)
Matches ANY number; it can be a decimal, scientific notation, integer, or what have you...