def load_config(config, name="base"): """ Load a LaunchPad, FWorker of QueueAdapter from the configuration files. Args: config (str): Type of configuration file to load. Either "launchpad", "fworker" or "qadapter". name (str): Name of the configuration. Defaults to "base". Returns: Either a LaunchPad, FWorker or QueuAdapter, depending on the "config" argument. """ try: if config == "launchpad": return LaunchPad.from_file( os.path.join(os.path.expanduser("~"), ".workflow_config", "launchpad", name + "_launchpad.yaml")) if config == "fworker": return FWorker.from_file( os.path.join(os.path.expanduser("~"), ".workflow_config", "fworker", name + "_fworker.yaml")) if config == "qadapter": return CommonAdapter.from_file( os.path.join(os.path.expanduser("~"), ".workflow_config", "fworker", name + "_qadapter.yaml")) except FileNotFoundError: raise FileNotFoundError( "Did not find the corresponding configuration file in " + os.path.join(os.path.expanduser("~"), ".workflow_config") + ". Use 'vsc config " + config + "' to set up the " + name + " configuration for the " + config + ".")
def fworker(fireworker_file=None, fworker_name="base"): """ Script to set up the configuration of the fireworker. Args: fireworker_file (str): fworker.yaml file from which to configure the fireworker. fworker_name (str): Which fworker configuration to add the fireworker to. Returns: None """ if fireworker_file: fireworker = FWorker.from_file(fireworker_file) else: name = input("Please provide the fireworker name: ") vasp_cmd = input("Please provide the full vasp command: ") fireworker = FWorker(name=name, env={"vasp_cmd": vasp_cmd}) # Make sure the fireworker has the required node categories. if fireworker.category: print( "\nNote: The category in the fireworker file has been adjuster to " "make sure that the jobs submitted on this fireworker only pick up " "the Fireworks with the correct category setting, i.e. corresponding " "to a number of nodes.\n") fireworker.category = ["none", "1nodes"] try: os.makedirs( os.path.join(os.path.expanduser("~"), ".workflow_config", "fworker")) except FileExistsError: pass config_fw_file = os.path.join(os.path.expanduser("~"), ".workflow_config", "fworker", fworker_name + "_fworker.yaml") fireworker.to_file(config_fw_file) print("Fireworker file written to " + config_fw_file + "\n")
os.path.join(pseudo_dojo.dojotable_absdir("ONCVPSP-PBE-PDv0.4"), 'standard.djson')) pseudo_path = pseudo_dojo.dojotable_absdir("ONCVPSP-PBE-PDv0.4") # connection data of the output MongoDB database # it can be the same database used for fireworks with other collections or a different one db = DatabaseData(host='database_address', port=27017, collection='collection_name', database='database_name', username='******', password='******') # in case you are using multiple workers for the same fireworks db (i.e. different clusters or queues) it may be a good idea # setting the worker explicitly. Here I just get the name fworker = FWorker.from_file( os.path.join(os.getenv("HOME"), ".fireworks", "my_fworker.yaml")) # Get the structure from the Materials Project. mp-149 is silicon. mp_id = 'mp-149' structure = MPRester().get_structure_by_material_id(mp_id) # check if the pseudo is available and just selects those that are needed for the specific structure try: pseudos = pseudo_table.get_pseudos_for_structure(structure) except BaseException as e: print("no pseudo") exit(1) # density of k-points per reciprocal atom. set to 1500 for phonons. kppa = 1500