Exemple #1
0
 def run_correlInput(self):
     #
     for i, group in enumerate(grouper(self.nativeContacts, 100)):
         self.inpFilename = '%s/natq%02d.inp' % (self.inpPathname, i)
         self.outFilename = '%s/natq%02d.out' % (self.outPathname, i)
         #
         try:
             os.remove(self.outFilename)
         except OSError:
             pass
         if not os.path.exists(self.inpFilename):
             raise IOError("No such file or directory: '%s'" % self.inpFilename)
         os.system('%s < %s > %s' % (self.charmmBin, self.inpFilename, self.outFilename))
Exemple #2
0
 def write_correlInput(self, **kwargs):
     kwargs = lowerKeys(kwargs)
     header = kwargs.get('header', [])
     #
     print self.anlPathname
     if self.anlPathname is None:
         raise IOError("No directory specified.")
     mkdir(self.anlPathname)
     #
     for i, group in enumerate(grouper(self.nativeContacts, 100)):
         String = self.get_correlInputHeader(header)
         String.append('! anl :: write')
         for j, contact in enumerate(group):
             String.append('open unit %03d write card name %s/natq%02d%02d.anl' % (j+100, self.anlPathname, i, j))
         String.append('')
         String.append('correl maxtimesteps %d maxatom %d maxseries %d' % (self.correlArrayLength, 1000, len(group)))
         for j, contact in enumerate(group):
             String.append('enter n%03d bond bynum %d bynum %d geometry' % (j, contact.i.atomNum, contact.j.atomNum))
         String.append('traj firstu 10 nunit 1 begin %d stop %d skip %d select all end' % (self.correlStart, self.correlStop, self.correlSkip))
         String.append('')
         for j, contact in enumerate(group):
             String.append('write n%03d card unit %03d' % (j, j+100))
             String.append('* Contact %02d%02d: between cgAtoms %s and %s' % (i, j, contact.i.addr, contact.j.addr))
             String.append('* Native Contact - Interaction between %s and %s' % (contact.i.prmString, contact.j.prmString))
             String.append('*')
             String.append('')
         String.append('end')
         String.append('')
         String.append('rewind unit 10')
         String.append('')
         String.append('stop')
         String = '\n'.join(String)
         # Write file
         self.inpFilename = '%s/natq%02d.inp' % (self.inpPathname, i)
         print '%s' % self.inpFilename
         write_to = open(self.inpFilename, 'w')
         write_to.write(String)
         write_to.close()