This page describes how to set up fireworks and atomate.
This page is intended to help you get set-up the first time you are using fireworks and atomate so you can learn how these softwares work. This set-up is not ideal for most research applications. Please refer to Fireworks: Advanced Usage if you are looking for practical advice and tips on how to run calculations once you understand the basics of fireworks.
Note: These instructions are based on the original version of atomate. atomate2 is a rising code that is still in development. Generally these research codes are under continuous improvement, so if something isn't working here please ask! It is likely the documentation needs to be updated.
Note: You will want to follow the steps in this section on both your local computer and the supercomputer where you will be running your calculations (e.g. making a fw_config folder in your home directory that contains the 3 files: FW_config.yaml, db.json, and my_launchpad.yaml) so you can easily interface with fireworks from both your local computer and the supercomputer.
Make directory in your home directory called fw_config:
cd~mkdirfw_configcdfw_config
Now create 3 files: FW_config.yaml, db.json, and my_launchpad.yaml with the following contents. Make sure you replace YOUR_USERNAME with your username; on NERSC you will also need to find your home folder, which is typically under another higher folder with the name of the FIRST LETTER of your username.Note: you can view your filesystem online. Also, consider setting up access to your NERSC filesystem locally on your computer: Check out "Mounting NERSC's file system locally" here:#running-jobs-on-nersc
Note: specifying singleshot in the queue adapter will limit each reserved job to running only one firework (even if other fireworks are ready and could run with your remaining wall time). This can be changed to rapidfire but this may result in lost runs (fireworks that do not complete because they run out of wall time).
Configure Bash profile:
Append the following lines to the .bashrc or .bashrc.ext file, which is located in your home directory, e.g. /global/homes/s/sivonxay:
Note: the line alias cdconfig='cd ~/fw_config' is optional but is recommended so you can more easily locate the directory with your configuration files stored by typing cdconfig into the command line.
Setup API key and Add POTCAR Directory to pymatgen
Go to materialsproject.org and get an API key. Make sure you are using the environment setup above to run these commands in terminal with your cms python environment activated.
Running these commands will create a .pmgrc.yaml file (if it doesn’t exist already) containing these configuration settings in your home directory
Using Fireworks and Atomate:
The Materials Project Workshop has some great sessions introducing how to use fireworks and atomate. It might be helpful to watch the youtube recordings before trying out launching your own calculations!
First, let's confirm that you have your fireworks configuration set-up correctly to point to the right MongoDB database for your launchpad. Check your default fireworks configuration file with echo.
echo $FW_CONFIG_FILE
Copy the file path printed out and check the contents of the specified FW_config.yaml file to find your FW_CONFIG_DIR using cat.
cat /HOME_DIRECTORY_PATH/fw_config/FW_config.yaml
You should see something like this printed out. Copy the file path specified by CONFIG_FILE_DIR.
CONFIG_FILE_DIR: /HOME_DIRECTORY_PATH/fw_config
QUEUE_UPDATE_INTERVAL: 5
ECHO_TEST: "cms fw_config activated"
Print out the contents of the my_launchpad.yaml file in your CONFIG_FILE_DIR using cat.
cat YOUR_FW_CONFIG_FILE_PATH/my_launchpad.yaml
If you do not see something that resembles your my_launchpad.yaml file written earlier, there may be something wrong with your fireworks configuration that needs to be resolved before moving forward.
BE EXTREMELY CAREFUL WHEN RUNNING THIS RESET COMMAND.It will wipe all existing entries in your fireworks database in the fireworks, workflows, and launches collections. You must activate your python environment where fireworks is installed before running this command in terminal.
lpadreset
Using Atomate to Create a Workflow
The following code blocks are python code that should be run in jupyter or via python from the terminal. Make sure you have the environment setup above activated. The computer running the code should have access to mongodb07.NERSC.gov; this can be disregarded when running directly on NERSC or when connected to to the LBNL intranet. For computers outside of LBNL, a VPN will need to be used.
Run the following python code in a jupyter notebook or by creating a file named make_workflow.py and running the command python make_workflow.py in terminal:
This adds a static energy calculation for Hexagonal Lu to your job database.
To check if this workflow has been added to your launch pad, run this command in terminal:
lpadget_fws-sREADY
You can also check if this workflow has been added successfully by looking at your MongoDB fireworks collection or the launchpad webgui.
Launching a Workflow
Use qlaunch command to reserve jobs with SLURM’s scheduler. qlaunch has 3 modes: singleshot, rapidfire, and multi. Singleshot is used to launch one job, rapidfire is used to launch multiple jobs in quick succession, and multi creates one job with multiple fireworks runs. You’ll probably want to use rapidfire (where it is important to add the --nlaunches flag to specify how many fireworks to run). Here is example code for launching one job from the command line.
Note: Make sure you are in the directory you want your calculations to be run from before you run these commands, you may want to create a new folder for this. Do not run these commands from your home directory.
Status of running fireworks can be determined by using the command:
lpad get_fws -s RUNNING
If a firework has failed or fizzled, you can rerun it by returning its state to ready to be launched again.
lpadrerun_fws-i<fw_id>
lpadrerun_fws-sFIZZLED
Launchpad Web GUI
Many prefer to view their jobs in the web GUI using the following command on their local computer in terminal with your python environment activated. Note this requires having your FW_CONFIG_FILE variable set-up to point correctly to your MongoDB database through the my_launchpad.yaml file. Otherwise you must run this command in a folder contain your my_launchpad.yaml file.
lpadwebgui
If you have not yet made a local copy your my_launchpad.yaml file, you can download it.
Download and install Robo 3T from the following link
Setup connection using mongodb credentials
For security reasons, if you want to connect to the database, you will either:
Have to connect via the NERSC network, e.g. enter your details in the "SSH" tab and connect via a data transfer node such as dtn01.nersc.gov.
Have to connect via the LBL network, e.g. by being on-site or using the LBL VPN. In this case you will have to add -ext to your database addressed, for example mongodb03-ext.nersc.gov
Special thanks to the original authors of this page: Eric Sivonxay, Julian Self, Ann Rutt, and Oxana Andriuc