Fireworks is a workflow management tool designed for materials science simulations. The full documentation can be found here: https://materialsproject.github.io/fireworks/ . This installation guide is for Linux and macOS for the Kulkarni group at UC Davis.
- This tutorial assumes that you have conda installed and configured.
- This tutorial also assumes that you are working on MacOS or Linux machine. If you are using windows then I recommend using windows bash with Ubuntu to go through this tutorial.
- Create a new conda environment for fireworks, with the python version set to 3.7.
conda create -n fw37 python=3.7 anaconda. Major changes to the python multiprocessing library formacostook place in the transition from3.7to3.8, thus3.7is what was used for this tutorial (specifically3.7.9). - Pick a location to store the cloned fireworks repo. The location does not matter, but it is important to keep it in its place after cloning it.
- Clone the kul-group fork of the fireworks repo https://github.com/kul-group/fireworks by typing
git clone https://github.com/kul-group/fireworks.git. The kul-group fireworks repo is a fork of the materials project fireworks repo and includes additional Fireworks for custom optimization tasks. - After cloning the repo navigate into the repo
cd fireworks - Activate your conda environment by typing
conda activate fw37(replacefw37with the name of your conda env if you chose a different name). - Install the package using pip with the -e flag to ensure that the package is editable
pip install -e . - At different points you might need to install additional packages. The full list of installed packages in the conda env used when creating this tutorial can be found here. It is recommended to install the latest version of the packages as needed (i.e. when you get an error) rather than trying to install them before preceding. Use
condato install packages whenever possible and only usepipas a last result or to install packages in the dev/editable mode. The conda command for installing a certain package can be found by googlingconda install package-name.
Fireworks requires a MongoDB database to store fireworks. You can use either a local or remote MongoDB database. MongoDB used to be an open source database platform, but it switched to a Server Side Public License. Amazon has its own MongoDB ripoff that might or might-not work with fireworks. MongoDB is a NoSQL or document database, which is basically a standard relational database with the capacity to store JSON data in some fields. As you work with fireworks, you will notice the heavy use of JSON data.
- Install homebrew
- Follow the official guide for installing MongoDB with homebrew
- Launch a local MongoDB instance with the following command
mongod --config /usr/local/etc/mongod.conf --fork
MongoDB makes money by selling access to remote MongoDB database clusters through a software as a service business model. To attract customers they offer a free-tier MongoDB database option. This free-tier works great for fireworks since the total amount of data generated by fireworks is small. It can also be accessed from anywhere removing the headache of configuring port forwarding. To setup a free-tier remote MongoDB database follow these instructions.
- Create a MongoDB account by logging in with a google account
- Select create an organization and select the MongoDB Atlas option
- Select create a new project and name it whatever you want
- Select build a cluster
- Select the free
Shared ClusterOption - Select your choice of cloud provider (I chose AWS)
- Select the region closest to you
- Choose a cluster name
- Press the
Create Clusterbutton - Wait for the cluster to spin up
- Press the connect button
- Select
allow access from anywherefollowed byAdd IP Address - Create a database username and note the password. This password might be exposed so don't pick the same one you use for anything else. Also be sure to write it down since it cannot be recovered.
- Click
Connect with your applicationand note the command and host url. You will need it for the next steps.
The next steps are getting fireworks to communicate with a the remote, MongoDB cluster. These instructions are taken from the post on the materials project forum and revised slightly for clarity. Also PulseSecure interferes with connecting to remote databases so be sure to turn that off before continuing.
- Activate your conda environment that has fireworks installed
source activate fw37 - install dnspython
conda install -c anaconda dnspython - Remember the username and password you created in step 13 above. Your password will be called
DB USER PASSWORDin the next step - Compute the URL-quoted DB user’s password:
python -c "import urllib.parse; print(urllib.parse.quote('DB USER PASSWORD'))" - Note the returned
URL_QUOTED_DB_USER_PASSWORDpassword, which can be different than your original password - Create a connection URL based off of the URL you found on the MongoDB website in step 14 and this template
mongodb+srv://DBUSERNAME:URL_QUOTED_DB_USER_PASSWORD@cluster1.6wxyz.azure.mongodb.net/fireworks - Create
my_launchpad.yamlby typing the following commands and replacing the host parameter with the one you assembled in step 6.lpad init -uEnter host parameter: mongodb+srv://DBUSERNAME:URL_QUOTED_DB_USER_PASSWORD@cluster1.6wxyz.azure.mongodb.net/fireworks Enter ssl_ca_file parameter: Enter authsource parameter: admin - reset the launch pad with
lpad resetto confirm that the program works.
- Create an AWS account
- Go to the RDS amazon service
- Click on create database
- Click on standard create
- Select PostgreSQL
- select the
free tiertemplate - Select the most recent version
- Name the db instance something description like
db-instance - Set the master username to an easy to remember name
- Set a master password and write it down
- Click standard classes
- In the connectivity settings select the default VPC (you will alter them later)
- Select yes for
Public Access - For VPC security group select
Choose Existing - For database authentication press Password authentication
- Click the additional configuration tap and enter an
initial database name - Press Create Database
- Change the network configurations to allow outside connections (see this video)
- activate your fireworks environment and install the postgressql python package
source activate fw37 conda install -c anaconda psycopg2 - Try to connect to the database with ASE by creating a connection string (see ASE tutorial) that looks like this
postgresql://user:pw@host:port/dbname - Then try to add an Atom object to the database by running the following script
from ase.build import molecule from ase.db import connect from ase.visualize import view water = molecule('H2O') db = connect("postgresql://user:pw@host:port/dbname") index = db.write(water) water2 = db.get_atoms(index) view(water2) - Confirm that you see a water molecule