Exemplo n.º 1
0
    def __call__(self, **kwargs):

        NexusCore.write_splash()

        self.log('Applying user settings')

        # guard against invalid settings
        not_allowed = set(kwargs.keys()) - Settings.allowed_vars
        if len(not_allowed) > 0:
            self.error(
                'unrecognized variables provided\nyou provided: {0}\nallowed variables are: {1}'
                .format(sorted(not_allowed), sorted(Settings.allowed_vars)))
        #end if

        # assign simple variables
        for name in Settings.core_assign_vars:
            if name in kwargs:
                nexus_core[name] = kwargs[name]
            #end if
        #end for

        # assign simple variables
        for name in Settings.noncore_assign_vars:
            if name in kwargs:
                nexus_noncore[name] = kwargs[name]
            #end if
        #end for

        # extract settings based on keyword groups
        kw = Settings.kw_set(Settings.nexus_vars, kwargs)
        mach_kw = Settings.kw_set(Settings.machine_vars, kwargs)
        gamess_kw = Settings.kw_set(Settings.gamess_vars, kwargs)
        pwscf_kw = Settings.kw_set(Settings.pwscf_vars, kwargs)
        if len(kwargs) > 0:
            self.error(
                'some settings keywords have not been accounted for\nleftover keywords: {0}\nthis is a developer error'
                .format(sorted(kwargs.keys())))
        #end if

        # copy input settings
        self.transfer_from(mach_kw.copy())
        self.transfer_from(gamess_kw.copy())
        self.transfer_from(pwscf_kw.copy())

        # process machine settings
        self.process_machine_settings(mach_kw)

        # process nexus core settings
        self.process_core_settings(kw)

        # process nexus noncore settings
        self.process_noncore_settings(kw)

        # transfer select core data to the global namespace
        nexus_core_noncore.transfer_from(nexus_core, nexus_core_noncore.keys())
        nexus_noncore.set(
            **nexus_core_noncore.copy())  # prevent write to core namespace

        # copy final core and noncore settings
        self.transfer_from(nexus_core.copy())
        self.transfer_from(nexus_noncore.copy())

        # process gamess settings
        Gamess.settings(**gamess_kw)

        # process pwscf settings
        Pwscf.settings(**pwscf_kw)

        return
Exemplo n.º 2
0
    def __call__(self,**kwargs):

        NexusCore.write_splash()

        self.log('Applying user settings')

        # guard against invalid settings
        not_allowed = set(kwargs.keys()) - Settings.allowed_vars
        if len(not_allowed)>0:
            self.error('unrecognized variables provided.\nYou provided: {0}\nAllowed variables are: {1}'.format(sorted(not_allowed),sorted(Settings.allowed_vars)))
        #end if

        # assign simple variables
        for name in Settings.core_assign_vars:
            if name in kwargs:
                nexus_core[name] = kwargs[name]
            #end if
        #end for

        # assign simple variables
        for name in Settings.noncore_assign_vars:
            if name in kwargs:
                nexus_noncore[name] = kwargs[name]
            #end if
        #end for

        # extract settings based on keyword groups
        kw        = Settings.kw_set(Settings.nexus_vars  ,kwargs)   
        mach_kw   = Settings.kw_set(Settings.machine_vars,kwargs)      
        gamess_kw = Settings.kw_set(Settings.gamess_vars ,kwargs)       
        if len(kwargs)>0:
            self.error('some settings keywords have not been accounted for\nleftover keywords: {0}\nthis is a developer error'.format(sorted(kwargs.keys())))
        #end if


        # copy input settings
        self.transfer_from(mach_kw.copy())
        self.transfer_from(gamess_kw.copy())

        # process machine settings
        self.process_machine_settings(mach_kw)

        # process nexus core settings
        self.process_core_settings(kw)

        # process nexus noncore settings
        self.process_noncore_settings(kw)

        # transfer select core data to the global namespace
        nexus_core_noncore.transfer_from(nexus_core,nexus_core_noncore.keys())
        nexus_noncore.set(**nexus_core_noncore.copy()) # prevent write to core namespace

        # copy final core and noncore settings
        self.transfer_from(nexus_core.copy())
        self.transfer_from(nexus_noncore.copy())


        # process gamess settings
        Gamess.settings(**gamess_kw)

        return
Exemplo n.º 3
0
    def __call__(self, **kwargs):
        kwargs = obj(**kwargs)

        # guard against invalid settings
        not_allowed = set(kwargs.keys()) - Settings.allowed_vars
        if len(not_allowed) > 0:
            self.error(
                'unrecognized variables provided\nyou provided: {0}\nallowed variables are: {1}'
                .format(sorted(not_allowed), sorted(Settings.allowed_vars)))
        #end if

        # restore default core default settings
        restore_nexus_core_defaults()

        # process command line inputs, if any
        if 'command_line' in kwargs:
            nexus_core.command_line = kwargs.command_line
        #end if
        if nexus_core.command_line:
            self.process_command_line_settings(kwargs)
        #end if

        NexusCore.write_splash()

        # print version information
        try:
            from versions import versions
            if versions is not None:
                err, s, serr = versions.check(write=False, full=True)
                self.log(s)
            #end if
        except Exception:
            None
        #end try

        self.log('Applying user settings')

        # assign simple variables
        for name in Settings.core_assign_vars:
            if name in kwargs:
                nexus_core[name] = kwargs[name]
            #end if
        #end for

        # assign simple variables
        for name in Settings.noncore_assign_vars:
            if name in kwargs:
                nexus_noncore[name] = kwargs[name]
            #end if
        #end for

        # extract settings based on keyword groups
        kw = Settings.kw_set(Settings.nexus_vars, kwargs)
        mach_kw = Settings.kw_set(Settings.machine_vars, kwargs)
        gamess_kw = Settings.kw_set(Settings.gamess_vars, kwargs)
        pwscf_kw = Settings.kw_set(Settings.pwscf_vars, kwargs)
        qm_pkg_kw = Settings.kw_set(Settings.qm_package_vars, kwargs)
        if len(kwargs) > 0:
            self.error(
                'some settings keywords have not been accounted for\nleftover keywords: {0}\nthis is a developer error'
                .format(sorted(kwargs.keys())))
        #end if

        # copy input settings
        self.transfer_from(mach_kw.copy())
        self.transfer_from(gamess_kw.copy())
        self.transfer_from(pwscf_kw.copy())

        # process machine settings
        self.process_machine_settings(mach_kw)

        # process nexus core settings
        self.process_core_settings(kw)

        # process nexus noncore settings
        self.process_noncore_settings(kw)

        # transfer select core data to the global namespace
        nexus_core_noncore.transfer_from(nexus_core,
                                         list(nexus_core_noncore.keys()))
        nexus_noncore.set(
            **nexus_core_noncore.copy())  # prevent write to core namespace

        # copy final core and noncore settings
        self.transfer_from(nexus_core.copy())
        self.transfer_from(nexus_noncore.copy())

        # process gamess settings
        Gamess.restore_default_settings()
        Gamess.settings(**gamess_kw)

        # process pwscf settings
        Pwscf.restore_default_settings()
        Pwscf.settings(**pwscf_kw)

        # process quantum package settings
        QuantumPackage.restore_default_settings()
        QuantumPackage.settings(**qm_pkg_kw)

        return