示例#1
0
    def write_qprep(self, writedir):
        replacements = {}
        center = f.COG(self.lig1 + '.pdb')
        center = '{:} {:} {:}'.format(center[0], center[1], center[2])
        qprep_in = s.ROOT_DIR + '/INPUTS/qprep.inp'
        qprep_out = writedir + '/qprep.inp'
        replacements['FF_LIB'] = s.ROOT_DIR + '/FF/' + self.FF + '.lib'
        replacements['LIG1'] = self.lig1 + '.lib'
        replacements['LIG2'] = self.lig2 + '_renumber.lib'
        replacements[
            'LIGPRM'] = self.FF + '_' + self.lig1 + '_' + self.lig2 + '_merged.prm'
        replacements['LIGPDB'] = self.lig1 + '_' + self.lig2 + '.pdb'
        replacements['CENTER'] = center
        replacements['SPHERE'] = self.sphereradius
        if self.system == 'vacuum':
            replacements['solvate'] = '!solvate'
        if self.system == 'water':
            replacements['SOLVENT'] = '1 HOH'
        if self.system == 'protein':
            replacements['SOLVENT'] = '4 water.pdb'

        with open(qprep_in) as infile, open(qprep_out, 'w') as outfile:
            for line in infile:
                line = run.replace(line, replacements)
                if line == '!addbond at1 at2 y\n' and self.cysbond != None:
                    cysbond = self.cysbond.split(',')
                    for cys in cysbond:
                        at1 = cys.split('_')[0]
                        at2 = cys.split('_')[1]
                        outfile.write('addbond ' + at1 + ' ' + at2 + ' y \n')
                    continue
                outfile.write(line)
示例#2
0
    def __init__(self, ligand, cofactor, forcefield, include, system,
                 preplocation, cluster, temperature, replicates,
                 radius,
                 *args, **kwargs):
        # Argparse arguments
        self.ligand         = ligand
        self.cofactor       = [ligand]
        self.forcefield     = forcefield
        self.system         = system
        self.preplocation   = preplocation
        self.cluster        = cluster
        if temperature == None:
            self.temperature = s.TEMPERATURE
            
        else:
            self.temperature = temperature
            
        if replicates == None:
            self.replicates = s.REPLICATES
            
        else:
            self.replicates = replicates
            
        # Constructs for local variables
        self.include        = include
        self.replacements   = {'TEMP_VAR':self.temperature,
                               'RUN_VAR':self.replicates,
                               'RUNFILE':'run' + self.cluster + '.sh'  
                              }
        self.CYX            = []
        self.PDB2Q          = {}
        self.PDB            = {}
        self.systemsize     = 0

        
        # Add cofactors to list for further pdb/prm parsing
        if cofactor != None:
            self.cofactor.append(cofactor)
            
        if self.system == 'water' or self.system == 'vacuum':
            self.sphere = f.COG(self.ligand +'.pdb')
            self.radius = radius