Skip to content

Tutorial YY

Lee Burton edited this page Aug 5, 2025 · 1 revision

🧪 Local Atomate2 + Jobflow + Jupyter Setup (MacBook, Micromamba)

This guide walks you through creating a working Jupyter notebook environment for generating and visualizing VASP workflows using Atomate2 and Jobflow.


1. ✅ Create the Conda Environment

micromamba create -n atomate2_local -c conda-forge python=3.11
micromamba activate atomate2_local

2. 📦 Install Required Packages

pip install 'git+ssh://git@github.com/materialsproject/atomate2.git#egg=atomate2[jobs]'
pip install pymatgen monty custodian jobflow ase notebook ipywidgets nglview tqdm

3. 🗂️ Organize POTCAR Files

Restructure your POTCARs to this format:

VASP_PSP_DIR/
└── POT_GGA_PAW_PBE_54/
├── Si/POTCAR
├── O/POTCAR
└── ...

You can do this with:

importos, shutilsrc_dir="/path/to/flat_potcars"forfinos.listdir(src_dir):
iff.startswith("POTCAR_"):
el=f.replace("POTCAR_", "")
os.makedirs(os.path.join(src_dir, el), exist_ok=True)
shutil.copy(os.path.join(src_dir, f), os.path.join(src_dir, el, "POTCAR"))

Then rename the folder to match expected functional:

mv POT_GGA_PAW_PBE POT_GGA_PAW_PBE_54

4. 🧪 Build and Run a Workflow in a Notebook

a. Set environment variables

importosfrompymatgen.coreimportSETTINGSpotcar_path="/Users/yourname/path/to/VASP_PSP_DIR"os.environ["PMG_VASP_PSP_DIR"] =potcar_pathos.environ["VASP_PSP_DIR"] =potcar_pathSETTINGS["PMG_VASP_PSP_DIR"] =potcar_path

b. Generate inputs

frompymatgen.coreimportStructure, Latticefromatomate2.vasp.jobs.coreimportRelaxMakerfromatomate2.vasp.sets.baseimportVaspInputGeneratorfromjobflowimportrun_locallystructure=Structure.from_spacegroup("Fd-3m", Lattice.cubic(5.4307), ["Si"], [[0, 0, 0]])
input_set_generator=VaspInputGenerator(
user_incar_settings={"ISIF": 3, "IBRION": 2, "NSW": 99, "ENCUT": 520}
)
job=RelaxMaker(input_set_generator=input_set_generator).make(structure)
responses=run_locally([job], create_folders=True, ensure_success=False)

💡 This creates input files in job-0/, but does not run VASP (since it’s not installed).


5. 🎥 Visualize Structures in Jupyter

a. Install ase if not already:

pip install ase

b. Display the structure

importnglviewasnvnv.show_pymatgen(structure)

✅ Done!

You now have:

  • Atomate2 + Jobflow working locally
  • VASP input generation
  • Structure visualization
  • Reproducible environment for students

Clone this wiki locally