def prepare( self ): """ """ mrec = self.com.rec() mlig = self.com.lig() m = mrec.concat( mlig ) if self.protonate: if self.verbose: self.log.add( '\nRe-building hydrogen atoms...' ) tempdir = self.tempdir if tempdir: tempdir += '/0_reduce' r = Reduce( m, tempdir=tempdir, log=self.log, autocap=False, debug=self.debug, verbose=self.verbose ) m = r.run() if self.addcharge: if self.verbose: self.log.add( '\nAssigning charges from Amber topologies...') ac = AtomCharger( log=self.log, verbose=self.verbose ) ac.charge( m ) mrec = m.takeChains( range( mrec.lenChains() ) ) mlig = m.takeChains( range( mrec.lenChains(), m.lenChains() ) ) self.delphicom = Complex( mrec, mlig )
def prepare(self): """ """ mrec = self.com.rec() mlig = self.com.lig() m = mrec.concat(mlig) if self.protonate: if self.verbose: self.log.add('\nRe-building hydrogen atoms...') tempdir = self.tempdir if tempdir: tempdir += '/0_reduce' r = Reduce(m, tempdir=tempdir, log=self.log, autocap=False, debug=self.debug, verbose=self.verbose) m = r.run() if self.addcharge: if self.verbose: self.log.add('\nAssigning charges from Amber topologies...') ac = AtomCharger(log=self.log, verbose=self.verbose) ac.charge(m) mrec = m.takeChains(range(mrec.lenChains())) mlig = m.takeChains(range(mrec.lenChains(), m.lenChains())) self.delphicom = Complex(mrec, mlig)
def test_delphiCharges2(self): """ PDB2DelphiCharges test """ if self.local: T.errWrite('loading PDB...') self.m1 = self.MODEL or PDBModel(T.testRoot('lig/1A19_dry.model')) Test.MODEL = self.m1 if self.local: T.errWriteln('Done.') if self.local: T.errWrite('Adding hydrogens to model (reduce)...') self.rmodel = Reduce(self.m1, verbose=self.local).run() self.rmodel.xplor2amber() if self.local: T.errWriteln('Done.') ac = AtomCharger() ac.charge(self.rmodel) self.rmodel.addChainFromSegid() self.dc = PDB2DelphiCharges(self.rmodel) self.dc.prepare() self.assertEqual(len(self.dc.resmap['LYS']), 2) # normal and N' self.assertEqual(len(self.dc.resmap['SER']), 2) # normal and C' if self.local: T.errWriteln('writing delphi charge file to %s' % self.fcrg) self.dc.tofile(self.fcrg) self.assertTrue(os.path.exists(self.fcrg))
def test_delphiCharges2( self ): """ PDB2DelphiCharges test """ if self.local: T.errWrite( 'loading PDB...' ) self.m1 = self.MODEL or PDBModel( T.testRoot( 'lig/1A19_dry.model' ) ) Test.MODEL = self.m1 if self.local: T.errWriteln( 'Done.' ) if self.local: T.errWrite( 'Adding hydrogens to model (reduce)...' ) self.rmodel = Reduce( self.m1, verbose=self.local ).run() self.rmodel.xplor2amber() if self.local: T.errWriteln( 'Done.' ) ac = AtomCharger() ac.charge(self.rmodel) self.rmodel.addChainFromSegid() self.dc = PDB2DelphiCharges( self.rmodel ) self.dc.prepare() self.assertEqual( len(self.dc.resmap['LYS']), 2 ) # normal and N' self.assertEqual( len(self.dc.resmap['SER']), 2 ) # normal and C' if self.local: T.errWriteln( 'writing delphi charge file to %s' % self.fcrg ) self.dc.tofile( self.fcrg ) self.assertTrue( os.path.exists( self.fcrg ) )
def __prepareCharges(self, f_out): try: if self.addcharge: if self.verbose: self.log.add( '\nAssigning atomic charges with AtomCharger...') if self.topologies is None: reslib = None else: reslib = AmberResidueLibrary(self.topologies, log=self.log, verbose=self.verbose) ac = AtomCharger(reslibrary=reslib, log=self.log, verbose=self.verbose) ac.charge(self.delphimodel) if self.verbose: self.log.add('Creating Delphi charge file %s' % f_out) dc = PDB2DelphiCharges(self.delphimodel) dc.prepare() dc.tofile(f_out) if self.verbose: qmissing = self.delphimodel['partial_charge'] == 0 self.log.add('\nAtoms without charges: %i' % N.sum(qmissing)) if N.sum(qmissing) > 0: self.log.add('Warning: there are atoms without charge:') m = self.delphimodel.compress(qmissing) for a in m: self.log.add( '%(serial_number)4i %(name)-4s %(residue_name)3s %(residue_number)3i %(chain_id)s'\ % a) except IOError as why: raise IOError('Error creating custom delphi charge file '+f_out+\ '( '+str(why)+' )')
def __prepareCharges(self, f_out ): try: if self.addcharge: if self.verbose: self.log.add( '\nAssigning atomic charges with AtomCharger...') if self.topologies is None: reslib = None else: reslib = AmberResidueLibrary(self.topologies,log=self.log, verbose=self.verbose) ac = AtomCharger( reslibrary=reslib, log=self.log, verbose=self.verbose ) ac.charge( self.delphimodel ) if self.verbose: self.log.add('Creating Delphi charge file %s'%f_out) dc = PDB2DelphiCharges( self.delphimodel ) dc.prepare() dc.tofile( f_out ) if self.verbose: qmissing = self.delphimodel['partial_charge']==0 self.log.add('\nAtoms without charges: %i' % N.sum(qmissing)) if N.sum(qmissing) > 0: self.log.add('Warning: there are atoms without charge:') m = self.delphimodel.compress( qmissing ) for a in m: self.log.add( '%(serial_number)4i %(name)-4s %(residue_name)3s %(residue_number)3i %(chain_id)s'\ % a) except IOError as why: raise IOError('Error creating custom delphi charge file '+f_out+\ '( '+str(why)+' )')
def prepare(self): if not 'partial_charge' in self.model.atoms: ac = AtomCharger() ac.charge(self.model) self.resmap = self.mapResidues()
def prepare( self ): if not 'partial_charge' in self.model.atoms: ac = AtomCharger() ac.charge( self.model ) self.resmap = self.mapResidues()