Exemplo n.º 1
0
    def _checkInput(self):
        async_re_job._checkInput(self)
        try:
            engine = str(self.keywords.get('ENGINE')).upper()
            engine = SUPPORTED_AMBER_ENGINES[engine]
        except KeyError:
            _exit('Requested ENGINE (%s) is either invalid or not '
                  'currently supported.'%self.keywords.get('ENGINE'))

        if int(self.keywords.get('SUBJOB_CORES')) > 1:
            self.spmd = 'mpi'
            engine = '%s.MPI'%engine
            if ((engine == 'sander.MPI' and not at.SANDER_MPI_EXE)
                or engine == 'pmemd.MPI' and not at.PMEMD_MPI_EXE):
                no_exe = True
            else:
                no_exe = False
        else:
            self.spmd = 'single'
            if ((engine == 'sander' and not at.SANDER_SERIAL_EXE)
                or engine == 'pmemd' and not at.PMEMD_SERIAL_EXE):
                no_exe = True
            else:
                no_exe = False
        if no_exe:
            _exit('Cannot find %s executable. Is it compiled and in '
                  'AMBERHOME/bin?'%engine)

        self.exe = os.path.join(at.AMBERHOME,'bin',engine)
        self.states = amber_states_from_configobj(self.keywords,self.verbose)
        self.nreplicas = len(self.states)
Exemplo n.º 2
0
def amber_states_from_configobj(keywords, verbose=False):
    """Return an AmberRunCollection from an ASyncRE command file."""
    # keywords = ConfigObj(command_file)
    try:
        engine = keywords.get('ENGINE').upper()
        engine = SUPPORTED_AMBER_ENGINES[engine]
    except KeyError:
        _exit('Requested ENGINE (%s) is either invalid or not currently '
              'supported.'%keywords.get('ENGINE'))        
    
    # Set up the general state/replica information - 2 methods
    # 
    # (1) If present, read the AMBER groupfile and define the states,
    if keywords.get('AMBER_GROUPFILE') is not None:
        groupfile = keywords.get('AMBER_GROUPFILE')
        states = read_amber_groupfile(groupfile,engine)
        if verbose:
            print ('Created %d replicas from AMBER groupfile: %s'
                   %(len(states),groupfile))
    # (2) otherwise assume that the states can be inferred from the extfiles 
    # and input from a specific application (e.g. umbrella sampling).
    else:
        basename = keywords.get('ENGINE_INPUT_BASENAME')
        extfiles = keywords.get('ENGINE_INPUT_EXTFILES')
        if extfiles is not None and extfiles != '':
            extfiles = extfiles.split(',')
        else:
            extfiles = None
        nreplicas = int(keywords.get('NREPLICAS'))
        if nreplicas is None:
            _exit('Could not determine the replica count from the input '
                  'provided (set NREPLICAS directly or provide an AMBER '
                  'groupfile)')
        try:
            states = amberrun_from_files(basename,extfiles,nreplicas,'-O',
                                         engine)
        except IOError:
            _exit('Problem creating replicas, not enough information?')
        if verbose:
            print ('Created %d replicas using the provided '
                   'ENGINE_INPUT_EXTFILES and ENGINE_INPUT_BASENAME'
                   %nreplicas)
    return states
Exemplo n.º 3
0
    def _checkInput(self):
        async_re_job._checkInput(self)
        try:
            engine = self.keywords.get('ENGINE').upper()
            engine = SUPPORTED_AMBER_ENGINES[engine]
        except KeyError:
            _exit('Requested ENGINE (%s) is either invalid or not '
                  'currently supported.'%self.keywords.get('ENGINE'))

        if int(self.keywords.get('SUBJOB_CORES')) > 1:
            self.spmd = 'mpi'
            engine = '%s.MPI'%engine
            if not at.AMBER_MPI_EXES:
                _exit('Cannot find AMBER MPI executables. Are these compiled '
                      'and in AMBERHOME/bin?')
        else:
            self.spmd = 'single'
            if not at.AMBER_SERIAL_EXES:
                _exit('Cannot find AMBER serial executables. Are these '
                      'compiled and in AMBERHOME/bin?')
      
        self.exe = os.path.join(at.AMBERHOME,'bin',engine)
        self.states = amber_states_from_configobj(self.keywords,self.verbose)
        self.nreplicas = len(self.states)