Skip to content

Commit

Permalink
1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixingw committed Jun 28, 2017
1 parent 59afce2 commit 2c38415
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions tsubasa.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ def argparser():
'parameters from file'), )
parser.add_argument('--startfrom',
default='opt',
choices=['resp', 'antechamber', 'freq', 'Tsubasa'],
choices=['resp', 'antechamber', 'freq', 'buildMMfile'],
help=(
"Start from a certain step. Choices"
"=['resp','antechamber','freq','Tsubasa]"))
"=['resp','antechamber','freq','buildMMfile]"))
parser.add_argument('--stopafter',
default='Tsubasa',
default='buildMMfile',
choices=['opt', 'resp', 'antechamber', 'freq'],
help=("Stop after a certain step."
" Choices=['opt','resp','antechamber','freq']"))
Expand Down Expand Up @@ -176,7 +176,7 @@ def handleargs(args):
ctrl['resp'] = True
ctrl['antechamber'] = True
ctrl['freq'] = True
ctrl['Tsubasa'] = True
ctrl['buildMMfile'] = True
if args.startfrom == 'resp':
ctrl['opt'] = False
elif args.startfrom == 'antechamber':
Expand All @@ -186,14 +186,14 @@ def handleargs(args):
ctrl['opt'] = False
ctrl['resp'] = False
ctrl['antechamber'] = False
elif args.startfrom == 'Tsubasa':
elif args.startfrom == 'buildMMfile':
ctrl['opt'] = False
ctrl['resp'] = False
ctrl['antechamber'] = False
ctrl['freq'] = False

if args.stopafter == 'freq':
ctrl['Tsubasa'] = None
ctrl['buildMMfile'] = None
elif args.stopafter == 'antechamber':
ctrl['freq'] = None
elif args.stopafter == 'resp':
Expand Down Expand Up @@ -498,7 +498,7 @@ def f2s(fl):
improperlist = improperlist.split(',')
improperlist = [x.split() for x in improperlist]
for item in improperlist:
mmtail += 'ImpTrs ' + ' '.join(item) + ' XXXXXX 0.0 2.0\n'
mmtail += 'ImpTrs ' + ' '.join(item) + ' XXXXXX 180.0 2.0\n'

# Add Nonbon function and vdW parameters
with open('input.inp', 'w') as f:
Expand All @@ -517,23 +517,30 @@ def f2s(fl):
item = string.split()
radii.update({item[0].strip(' '): item[1].strip(' ')})
welldepth.update({item[0].strip(' '): item[2].strip(' ')})
if externalvdwfile:
logging.info('Read user provided vdW parameters from ' +
externalvdwfile)
with open(externalvdwfile, 'r') as f:
for string in f:
item = string.split()
radii.update({item[0].strip(' '): item[1].strip(' ')})
welldepth.update({item[0].strip(' '): item[2].strip(' ')})
try:
if externalvdwfile:
logging.info('Read user provided vdW parameters from ' +
externalvdwfile)
with open(externalvdwfile, 'r') as f:
for string in f:
item = string.split()
radii.update({item[0].strip(' '): item[1].strip(' ')})
welldepth.update({item[0].strip(' '): item[2].strip(' ')})
except:
logging.error('Read user provided vdW file failed. Please check the format.')

item = []

# find existing atomtypes
for atom in thisgeom:
item.append(atom.atomtype)
item = list(set(item))
for i in range(0, len(item)):
mmtail += 'VDW ' + item[i] + ' ' + radii[item[i]] + ' ' + welldepth[
item[i]] + '\n'
try:
mmtail += 'VDW ' + item[i] + ' ' + radii[item[i]] + ' ' + welldepth[
item[i]] + '\n'
except KeyError:
mmtail += 'VDW ' + item[i] + ' ' + 'RADII' + ' ' + 'WELLDEPTH' + '\n'
mmtail = mmtail + '\n'

# write mmfile
Expand Down

0 comments on commit 2c38415

Please sign in to comment.