From 46c4232cd1f722958556e1a8c1bc151e2d74e4d5 Mon Sep 17 00:00:00 2001 From: fabothch <49951809+fabothch@users.noreply.github.com> Date: Mon, 15 Mar 2021 14:22:14 +0100 Subject: [PATCH] added dcosmors option Signed-off-by: fabothch <49951809+fabothch@users.noreply.github.com> --- README.rst | 8 ++++++++ tmprep.py | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index ccf2227..905a789 100644 --- a/README.rst +++ b/README.rst @@ -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 ============== diff --git a/tmprep.py b/tmprep.py index 05614b9..66ccba0 100755 --- a/tmprep.py +++ b/tmprep.py @@ -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 @@ -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 """ @@ -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", @@ -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", @@ -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) @@ -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")