Skip to content

Commit

Permalink
Merge pull request #3 from fabothch/devel
Browse files Browse the repository at this point in the history
added dcosmors option
  • Loading branch information
fabothch authored Mar 15, 2021
2 parents dbebd84 + 46c4232 commit ac5b883
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
|GitHub release| |made-with-python|

.. |GitHub release| image:: https://img.shields.io/github/v/release/fabothch/TMprep
:target: https://github.com/fabothch/TMprep/releases/latest

.. |made-with-python| image:: https://img.shields.io/badge/Made%20with-Python-1f425f.svg
:target: https://www.python.org/

==============
TMprep Project
==============
Expand Down
37 changes: 34 additions & 3 deletions tmprep.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import argparse
from collections import Counter

version = "0.1.1"
version = "0.1.2"

def read_chrg(default=0):
# READ .CHRG .UHF
Expand Down Expand Up @@ -65,7 +65,7 @@ def read_uhf(default=0):
unpaired = default
return unpaired

def cml(internal_defaults, argv=None):
def cml(internal_defaults, solvent_dcosmors, argv=None):
"""
Process commandline arguments
"""
Expand Down Expand Up @@ -227,6 +227,17 @@ def cml(internal_defaults, argv=None):
metavar="",
help=("Dielectric constant for COSMO"),
)
group1.add_argument(
"-dcosmors",
"--dcosmors",
dest="dcosmors",
action="store",
required=False,
choices=list(solvent_dcosmors.keys()),
metavar="",
help=("Add DCOSMO-RS to control. Usage: -dcosmors [solvent]. "
"Options are {}. It is not necessary to additionally use -cosmo".format(', '.join(list(solvent_dcosmors.keys())))),
)
group1.add_argument(
"-noopt",
"--noopt",
Expand Down Expand Up @@ -292,8 +303,26 @@ def cml(internal_defaults, argv=None):
args.disp = ""
if args.radsize is not None:
args.modradsize = True
if args.dcosmors and not args.cosmo:
setattr(args, 'cosmo', solvent_dcosmors.get(args.dcosmors)[0])
return args

solvent_dcosmors = {
"acetone": [20.7, "$dcosmo_rs file=propanone_25.pot"],
"chcl3": [4.8, "$dcosmo_rs file=chcl3_25.pot"],
"acetonitrile": [36.6, "$dcosmo_rs file=acetonitrile_25.pot"],
"ch2cl2": [9.1, "$dcosmo_rs file=chcl3_25.pot"],
"dmso": [47.2, "$dcosmo_rs file=dimethylsulfoxide_25.pot"],
"h2o": [80.1, "$dcosmo_rs file=h2o_25.pot"],
"methanol": [32.7, "$dcosmo_rs file=methanol_25.pot"],
"thf": [7.6, "$dcosmo_rs file=thf_25.pot"],
"toluene": [2.4, "$dcosmo_rs file=toluene_25.pot"],
"octanol": [9.86, "$dcosmo_rs file=octanol_25.pot"],
"woctanol": [8.1, "$dcosmo_rs file=wet-octanol_25.pot"],
"hexadecane": [2.08, "$dcosmo_rs file=hexadecane_25.pot"],
}


internal_defaults = {
"symmetry": None, # not c1
"basis": "def2-mSVP",
Expand Down Expand Up @@ -401,7 +430,7 @@ def cml(internal_defaults, argv=None):
if os.path.isfile(file_path):
os.remove(file_path)

args = cml(internal_defaults)
args = cml(internal_defaults, solvent_dcosmors)

nat = len(elements)
element_occurence = Counter(elements)
Expand Down Expand Up @@ -878,6 +907,8 @@ def cml(internal_defaults, argv=None):
out.write("$cosmo \n")
out.write(" epsilon= {:.2f} \n".format(float(args.cosmo)))
# DCOSMO-RS:
if args.dcosmors:
out.write("{}\n".format(solvent_dcosmors.get(args.dcosmors)[1]))
### terminate control file
out.write("$end\n")

Expand Down

0 comments on commit ac5b883

Please sign in to comment.