diff --git a/autosolvate/FFmetalcomplex.py b/autosolvate/FFmetalcomplex.py index a6c1f69..9807fd3 100644 --- a/autosolvate/FFmetalcomplex.py +++ b/autosolvate/FFmetalcomplex.py @@ -13,8 +13,8 @@ class genFF(): - def __init__(self, filename,metal_charge, chargefile, solvent,slv_count,folder, - mode,spinmult,software,basisset,method,cubesize,closeness, + def __init__(self, filename,metal_charge, chargefile, solvent,slv_count,folder,maxcore, + mode,spinmult,software,basisset,method,cubesize,closeness,cutoff, totalcharge,nprocs,QMexe,amberhome,solvent_off,solvent_frcmod,opt): self.metal_charge = metal_charge self.filename = filename @@ -37,6 +37,8 @@ def __init__(self, filename,metal_charge, chargefile, solvent,slv_count,folder, self.closeness = closeness self.slv_count = slv_count self.folder = folder + self.cutoff = cutoff + self.maxcore = maxcore def inputCheck(self): @@ -465,23 +467,23 @@ def build(self): print('******************** start to generate inputs for MCPB.py -s 1 ********************') step1 = autoMCPB.AutoMCPB(filename=self.filename,metal_charge=self.metal_charge, spinmult=self.spinmult,amberhome=self.amberhome, - mode=self.mode,chargefile=self.chargefile,round='1',software=self.software) + mode=self.mode,chargefile=self.chargefile,round='1',software=self.software,cutoff=self.cutoff) step1.build() print('******************** Finish generating inputs for MCPB.py -s 1 ********************') print('******************** start to QM calculations for', self.software + '_small_opt', self.software + '_small_fc',self.software + '_large_mk','********************') step2 = QM_gen.QM_inputs_gen(filename=self.filename,software=self.software,caltype='opt',multi=self.spinmult,method=self.method, - basisset=self.basisset,metal='default',totalcharge=self.totalcharge,nprocs=self.nprocs,opt=self.opt) + basisset=self.basisset,metal='default',totalcharge=self.totalcharge,nprocs=self.nprocs,opt=self.opt,maxcore=self.maxcore) # print(self.filename,'!!!!!!!!!!!!!!!!') step2.build() self.runQM_opt() step3 = QM_gen.QM_inputs_gen(filename=self.filename,software=self.software,caltype='fc',multi=self.spinmult,method=self.method, - basisset=self.basisset,metal='default',totalcharge=self.totalcharge,nprocs=self.nprocs,opt=self.opt) + basisset=self.basisset,metal='default',totalcharge=self.totalcharge,nprocs=self.nprocs,opt=self.opt,maxcore=self.maxcore) step3.build() self.runQM_freq() step4 = QM_gen.QM_inputs_gen(filename=self.filename,software=self.software,caltype='mk',multi=self.spinmult,method=self.method, - basisset=self.basisset,metal='default',totalcharge=self.totalcharge,nprocs=self.nprocs,opt=self.opt) + basisset=self.basisset,metal='default',totalcharge=self.totalcharge,nprocs=self.nprocs,opt=self.opt,maxcore=self.maxcore) step4.build() #print('#######################') self.runQM_mk() @@ -497,7 +499,7 @@ def build(self): if checkfreq == 'converged': step5=autoMCPB.AutoMCPB(filename=self.filename,metal_charge=self.metal_charge, spinmult=self.spinmult,amberhome=self.amberhome, - mode=self.mode,chargefile=self.chargefile,round='2',software=self.software) + mode=self.mode,chargefile=self.chargefile,round='2',software=self.software,cutoff=self.cutoff) step5.build() # print('nnnnnnnnnnnnnn') elif checkfreq == 'notconverged': @@ -514,7 +516,7 @@ def build(self): if checkmk == 'converged': if self.software != 'orca': step6 = autoMCPB.AutoMCPB(filename=self.filename,metal_charge=self.metal_charge, spinmult=self.spinmult, - mode=self.mode,chargefile=self.chargefile,round='3',software=self.software,amberhome=self.amberhome) + mode=self.mode,chargefile=self.chargefile,round='3',software=self.software,amberhome=self.amberhome,cutoff=self.cutoff) step6.build() else: if self.opt == 'Y': @@ -557,14 +559,14 @@ def build(self): raise TypeError('Erorr: charge calculation is not finished!') sys.exit() if os.path.exists('resp2.chg'): - step7 = autoMCPB.AutoMCPB(filename=self.filename,metal_charge=self.metal_charge, spinmult=self.spinmult, + step7 = autoMCPB.AutoMCPB(filename=self.filename,metal_charge=self.metal_charge, spinmult=self.spinmult,cutoff=self.cutoff, mode=self.mode,chargefile=self.chargefile,round='4',software=self.software,amberhome=self.amberhome) step7.build() else: raise TypeError('Erorr: can not find resp2.chg') sys.exit() if os.path.exists(self.filename + '_dry.prmtop'): - step8 = autoMCPB.AutoMCPB(filename=self.filename,metal_charge=self.metal_charge, spinmult=self.spinmult, + step8 = autoMCPB.AutoMCPB(filename=self.filename,metal_charge=self.metal_charge, spinmult=self.spinmult,cutoff=self.cutoff, mode=self.mode,chargefile=self.chargefile,round='5',software=self.software,amberhome=self.amberhome) step8.build() else: @@ -626,9 +628,9 @@ def build(self): """ def startFFgen(argumentList): - options = 'hm:k:u:v:f:e:c:y:d:i:l:p:j:a:w:s:b:t:D:' - long_options = ["help", 'filename=', 'metal_charge=', 'spin=', 'mode=', 'folder=', 'rundir=', - 'chargefile=', 'charge=', 'nprocs=', 'method=', 'cubesize=', 'closeness=', 'qmdir=', + options = 'hm:k:u:v:f:e:c:y:d:i:l:p:j:a:w:s:b:t:D:x:g:' + long_options = ["help", 'filename=', 'metal_charge=', 'spin=', 'mode=', 'folder=', 'rundir=','cutoff=' + 'chargefile=', 'charge=', 'nprocs=', 'method=', 'cubesize=', 'closeness=', 'qmdir=', 'maxcore=' 'qmexe=', 'basisset=', 'solventoff=', 'solventfrcmod=', 'amberhome=', 'opt=', 'solvent='] arguments, values = getopt.getopt(argumentList, options, long_options) filename = None @@ -653,7 +655,8 @@ def startFFgen(argumentList): cubesize = 54 slv_count = 210*8 folder = './' - + cutoff = 2.8 + maxcore = "1000" for currentArgument, currentValue in arguments: if currentArgument in ("-h", "--help"): @@ -680,7 +683,9 @@ def startFFgen(argumentList): -s --solvent name of solvent (water, methanol, chloroform, nma, acetonitrile) -b --cubesize size of solvent cube in angstroms default: 54 -t --closeness Solute-solvent closeness setting default value is used if the option is not specified - -D, --rundir running directory where temporary files are stored, default: the current folder './' + -D --rundir running directory where temporary files are stored, default: the current folder './' + -x --cutoff the cutoff to defined bonded pair in MCPB default: 2.8 + -g --maxcore the memory(M) requrested for orca calculation ''' @@ -724,10 +729,15 @@ def startFFgen(argumentList): closeness = str(currentValue) elif currentArgument in ('-D','--rundir'): folder = str(currentValue) + elif currentArgument in ('-x','--cutoff'): + cutoff = str(currentValue) + elif currentArgument in ('-g','--maxcore'): + maxcore = str(currentValue) + # print('cutoff=',cutoff) - builder = genFF(filename=filename,metal_charge=metal_charge, spinmult=spinmult,basisset=basisset,closeness=closeness,folder = folder, - mode=mode,chargefile=chargefile,software=software,solvent_frcmod=solvent_frcmod,amberhome=amberhome,cubesize=cubesize, + builder = genFF(filename=filename,metal_charge=metal_charge, spinmult=spinmult,basisset=basisset,closeness=closeness,folder = folder,cutoff= cutoff, + mode=mode,chargefile=chargefile,software=software,solvent_frcmod=solvent_frcmod,amberhome=amberhome,cubesize=cubesize,maxcore= maxcore, totalcharge=totalcharge,nprocs=nprocs,QMexe=QMexe,method=method,solvent_off=solvent_off,opt=opt,solvent=solvent,slv_count=slv_count) builder.build() diff --git a/autosolvate/QM_gen.py b/autosolvate/QM_gen.py index b7fd176..eb5d72c 100644 --- a/autosolvate/QM_gen.py +++ b/autosolvate/QM_gen.py @@ -10,7 +10,7 @@ metalbasisset = ['LANL2DZ','SBKJC'] vdw = {"H":1.1,"Li":2.2,"Be":1.9,"B":1.8,"C":1.7,"N":1.55,"O":1.52,"F":1.47,"Na":2.4,"Mg":2.2,"Al":2.1,"Si":2.1, - "P":1.8,"S":1.8,"Cl":1.75,"K":2.8,"Ca":2.31,"Sc":2.3,"Ti":2.15,"V":2.05, + "P":1.8,"S":1.8,"Cl":1.75,"K":2.8,"Ca":2.31,"Sc":2.3,"Ti":2.15,"V":2.05,"Pb":2.02, "Cr":2.05,"Mn":2.05,"Fe":2.05,"Co":2.0,"Ni":2.0,"Cu":2.0,"Zn":2.1,"Ga":2.1, "As":2.05,"Se":1.9,"Br":1.83,"Rb":2.9,"Sr":2.55,"Y":2.4,"Zr":2.3,"Nb":2.15, "Mo":2.1,"Tc":2.05,"Ru":2.05,"Rh":2.0,"Pd":2.05,"Ag":2.1,"Cd":2.2,"In":2.2,"I":1.98,"W":2.1,"Os":2.1,"Ir":2.1} @@ -117,7 +117,7 @@ def get_crds_from_orcaopt(orcaout,trjxyz): class QM_inputs_gen(): - def __init__(self, filename,software,caltype,multi,method,basisset,totalcharge,metal,nprocs,opt): + def __init__(self, filename,software,caltype,multi,method,basisset,totalcharge,metal,nprocs,opt,maxcore): self.software = software self.caltype = caltype self.multi = multi @@ -129,6 +129,7 @@ def __init__(self, filename,software,caltype,multi,method,basisset,totalcharge,m self.metal = metal self.nprocs = nprocs self.opt = opt + self.maxcore = maxcore if self.totalcharge in ['default','Default'] : with open(self.info, 'r') as f: @@ -255,6 +256,7 @@ def write_orca_opt(self,crds,out,multi,totalcharge,nprocs,basisset,method): ofile.write('! ' + method + ' ' + basisset + ' OPT\n') ofile.write('\n') ofile.write("%pal\nnprocs " + str(nprocs) + "\nend\n\n") + ofile.write('%maxcore ' + self.maxcore + '\n\n') ofile.write('* xyz ' + str(totalcharge) + ' ' + str(multi) + '\n') for line in crds: atomname = line[0] @@ -269,6 +271,7 @@ def write_orca_fc(self,crds,out,multi,totalcharge,nprocs,basisset,method): ofile = open(out,'w') ofile.write('! ' + method + ' ' + basisset + ' Freq\n\n') ofile.write("%pal\nnprocs " + str(nprocs) + "\nend\n\n") + ofile.write('%maxcore ' + self.maxcore + '\n\n') ofile.write('* xyz ' + str(totalcharge) + ' ' + str(multi) + '\n') for line in crds: atomname = line[0] @@ -283,6 +286,7 @@ def write_orca_mk(self,crds,out,multi,totalcharge,basisset,nprocs, method): ofile = open(out,'w') ofile.write('! ' + method + ' ' + basisset + ' keepdens\n\n') ofile.write("%pal\nnprocs " + str(nprocs) + "\nend\n\n") + ofile.write('%maxcore ' + self.maxcore + '\n\n') ofile.write('* xyz ' + str(totalcharge) + ' ' + str(multi) + '\n') for line in crds: atomname = line[0] diff --git a/autosolvate/autoMCPB.py b/autosolvate/autoMCPB.py index f5e56d3..3f95c68 100644 --- a/autosolvate/autoMCPB.py +++ b/autosolvate/autoMCPB.py @@ -162,7 +162,7 @@ class AutoMCPB(): """ - def __init__(self, filename, metal_charge, chargefile,mode,spinmult,round,software,amberhome): #liglist='', denticity='',ligcons='',atomsinfo='',ligand_charge='',metal_name=''): + def __init__(self, filename, metal_charge, chargefile,mode,spinmult,round,software,amberhome,cutoff): #liglist='', denticity='',ligcons='',atomsinfo='',ligand_charge='',metal_name=''): self.metal_charge = metal_charge self.filename = filename self.xyzfile = filename + '.xyz' @@ -172,6 +172,7 @@ def __init__(self, filename, metal_charge, chargefile,mode,spinmult,round,softwa self.round = round self.software = software self.amberhome = amberhome + self.cutoff = cutoff def coordinates_reader_xyz(self): r""" @@ -765,7 +766,7 @@ def generate_MCPB_input(self): f.write('software_version ' + self.software +'\n') f.write(original_pdb + '\n') f.write('group_name ' + self.filename + '\n') - f.write('cutoff 2.8\n') + f.write('cut_off ' + str(self.cutoff) + '\n') f.write(ion_ids + '\n') if self.ligcons != 'NA': f.write(self.add_bonded_pairs + '\n') @@ -1322,8 +1323,8 @@ def build(self): self.checkingFF() def startautoMCPB(argumentList): - options = "hn:c:u:m:f:s:x:A:" - long_options = ["help",'filename=','metal_charge=','spin=','mode=','chargefile=','round=','software=','amberhome='] + options = "hn:c:u:m:f:s:x:A:e" + long_options = ["help",'filename=','metal_charge=','spin=','mode=','chargefile=','round=','software=','amberhome=','cutoff='] arguments, values = getopt.getopt(argumentList,options,long_options) filename = None metal_charge = None @@ -1333,6 +1334,7 @@ def startautoMCPB(argumentList): software = 'gms' round = '1' amberhome = '$AMBERHOME/bin/' + cutoff = '2.8' # print(arguments) for currentArgument, currentValue in arguments: if currentArgument in ("-h", "--help"): @@ -1348,7 +1350,8 @@ def startautoMCPB(argumentList): LG1 -1 # ligand name charge -s, --round round of MCPB.py -x, --software g09,g16 or gms - -A, --amberhome path of AmberTools bin + -A, --amberhome path of AmberTools bin + -e --cutoff cutoff of MCPB ''' print(message) sys.exit() @@ -1370,9 +1373,12 @@ def startautoMCPB(argumentList): software = str(currentValue) elif currentArgument in ('-A','--amberhome'): amberhome = str(currentValue) + elif currentArgument in ('-e','--cutoff'): + cutoff = str(currentValue) - builder = AutoMCPB(filename=filename,metal_charge=metal_charge, spinmult=spinmult, + + builder = AutoMCPB(filename=filename,metal_charge=metal_charge, spinmult=spinmult,cutoff=cutoff, mode=mode,chargefile=chargefile,round=round,software=software,amberhome=amberhome) builder.build() diff --git a/autosolvate/boxgen_metal.py b/autosolvate/boxgen_metal.py index 6b28f7d..1bfb77b 100644 --- a/autosolvate/boxgen_metal.py +++ b/autosolvate/boxgen_metal.py @@ -41,8 +41,8 @@ def __init__(self, pdb_prefix, totalcharge, self.solvent_frcmod=solvent_frcmod self.solvent_off = solvent_off self.cube_size = cube_size - self.slu_pos = self.cube_size/2.0 - self.pbcbox_size = self.cube_size+2 + self.slu_pos = str(float(self.cube_size)/2.0) + self.pbcbox_size = str(float(self.cube_size)+2) self.amberhome = amberhome self.closeness = closeness @@ -64,7 +64,7 @@ def __init__(self, pdb_prefix, totalcharge, self.closeness = 0.5 self.waterbox_size = 8.0 self.cube_size = cube_size - self.volumne = (self.cube_size * 10**(-10))**3 + self.volumne = (float(self.cube_size) * 10**(-10))**3 if self.solvent not in ['acetonitrile','water','methanol','nma','chloroform']: print("Warning: solvent not supported for automated counting determination, using the default number") slv_count = 210*8