Esempio n. 1
0
    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.assert_( os.path.exists( self.fcrg ) )
Esempio n. 2
0
    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.assert_(os.path.exists(self.fcrg))
Esempio n. 3
0
    def __init__(self,
                 data={},
                 chunk_size=5,
                 hosts=[],
                 niceness={'default': 20},
                 slave_script='',
                 verbose=1,
                 show_output=0,
                 add_hosts=1,
                 redistribute=1):
        """
        @param data: dict of items to be processed
        @type  data: {str_id:any}
        @param chunk_size: number of items that are processed per job
        @type  chunk_size: int
        @param hosts: list of host-names
        @type  hosts: [str]
        @param niceness: host niceness dictionary {str_host-name: int_niceness}
        @type  niceness: {str:int}
        @param slave_script: absolute path to slave-script
        @type  slave_script: str
        @param verbose: verbosity level (default: 1)
        @type  verbose: 1|0
        @param show_output: display one xterm per slave (default: 0)
        @type  show_output: 1|0
        @param add_hosts: add hosts to PVM before starting (default: 1)
        @type  add_hosts: 1|0
        @param redistribute: at the end, send same job out several times
                             (default: 1)
        @type  redistribute: 1|0
        """
        if add_hosts:
            if verbose: T.errWrite('adding %i hosts to pvm...' % len(hosts))
            pvm.addHosts(hosts=hosts)
            if verbose: T.errWriteln('done')

        JobMaster.__init__(self,
                           data,
                           chunk_size,
                           hosts,
                           niceness,
                           slave_script,
                           show_output=show_output,
                           redistribute=redistribute,
                           verbose=verbose)

        self.progress = {}

        self.disabled_hosts = []
        self.slow_hosts = {}

        self.verbose = verbose

        ## end of calculation is signalled on lockMsg
        self.lock = RLock()
        self.lockMsg = Condition(self.lock)

        ## this method is called when everything is calculated
        self.call_done = None
Esempio n. 4
0
    def isFailed( self ):
        """
        Overrides Executor method
        """
        if not os.path.exists(self.f_out_name):
            T.errWrite( '\nSurfaceRacer result file %s does not exist. You have probably encountered a very rare SurfaceRacer round off error that have caused the program to terminate. Will now try to recalculate the surface with a slightly increased surface probe radii: increasing radii from %.3f to %.3f.\n'%(self.f_out_name, self.probe,self.probe+0.001))
            return 1

        return self.error is None 
Esempio n. 5
0
    def isFailed( self ):
        """
        Overrides Executor method
        """
        if not os.path.exists(self.f_out_name):
            T.errWrite( '\nSurfaceRacer result file %s does not exist. You have probably encountered a very rare SurfaceRacer round off error that have caused the program to terminate. Will now try to recalculate the surface with a slightly increased surface probe radii: increasing radii from %.3f to %.3f.\n'%(self.f_out_name, self.probe,self.probe+0.001))
            return 1

        return self.error is None 
Esempio n. 6
0
    def __init__(self, data={}, chunk_size=5,
                 hosts=[], niceness={'default':20},
                 slave_script='', verbose=1,
                 show_output=0, add_hosts=1, redistribute=1 ):
        """
        @param data: dict of items to be processed
        @type  data: {str_id:any}
        @param chunk_size: number of items that are processed per job
        @type  chunk_size: int
        @param hosts: list of host-names
        @type  hosts: [str]
        @param niceness: host niceness dictionary {str_host-name: int_niceness}
        @type  niceness: {str:int}
        @param slave_script: absolute path to slave-script
        @type  slave_script: str
        @param verbose: verbosity level (default: 1)
        @type  verbose: 1|0
        @param show_output: display one xterm per slave (default: 0)
        @type  show_output: 1|0
        @param add_hosts: add hosts to PVM before starting (default: 1)
        @type  add_hosts: 1|0
        @param redistribute: at the end, send same job out several times
                             (default: 1)
        @type  redistribute: 1|0
        """
        if add_hosts:
            if verbose: T.errWrite('adding %i hosts to pvm...' % len(hosts) )
            pvm.addHosts( hosts=hosts )
            if verbose: T.errWriteln('done')

        JobMaster.__init__( self, data, chunk_size, hosts, niceness,
                            slave_script, show_output=show_output,
                            redistribute=redistribute, verbose=verbose )

        self.progress = {}

        self.disabled_hosts = []
        self.slow_hosts = {}

        self.verbose = verbose

        ## end of calculation is signalled on lockMsg
        self.lock = RLock()
        self.lockMsg = Condition( self.lock )

        ## this method is called when everything is calculated
        self.call_done = None