|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -euo pipefail |
| 3 | + |
| 4 | +usage() { |
| 5 | + cat <<'USAGE' |
| 6 | +Usage: |
| 7 | + 00_download_omat24.sh --split <train|val|salex> [--all | <subset>...] |
| 8 | + 00_download_omat24.sh --split <salex> --all |
| 9 | +
|
| 10 | +Notes: |
| 11 | + - train/val subsets: rattled-1000, rattled-1000-subsampled, rattled-500, |
| 12 | + rattled-500-subsampled, rattled-300, rattled-300-subsampled, |
| 13 | + aimd-from-PBE-1000-npt, aimd-from-PBE-1000-nvt, |
| 14 | + aimd-from-PBE-3000-npt, aimd-from-PBE-3000-nvt, rattled-relax |
| 15 | + - salex split: train or val (use --split salex and subset train/val) |
| 16 | +
|
| 17 | +Examples: |
| 18 | + 00_download_omat24.sh --split train rattled-1000 rattled-relax |
| 19 | + 00_download_omat24.sh --split val --all |
| 20 | + 00_download_omat24.sh --split salex train |
| 21 | +USAGE |
| 22 | +} |
| 23 | + |
| 24 | +if ! command -v curl >/dev/null 2>&1; then |
| 25 | + echo "error: curl is required" >&2 |
| 26 | + exit 1 |
| 27 | +fi |
| 28 | + |
| 29 | +SPLIT="" |
| 30 | +SUBSETS=() |
| 31 | +ALL=false |
| 32 | + |
| 33 | +while [[ $# -gt 0 ]]; do |
| 34 | + case "$1" in |
| 35 | + --split) |
| 36 | + SPLIT="$2"; shift 2 ;; |
| 37 | + --all) |
| 38 | + ALL=true; shift ;; |
| 39 | + -h|--help) |
| 40 | + usage; exit 0 ;; |
| 41 | + *) |
| 42 | + SUBSETS+=("$1"); shift ;; |
| 43 | + esac |
| 44 | +done |
| 45 | + |
| 46 | +if [[ -z "$SPLIT" ]]; then |
| 47 | + echo "error: --split is required" >&2 |
| 48 | + usage |
| 49 | + exit 1 |
| 50 | +fi |
| 51 | + |
| 52 | +TRAIN_BASE="https://dl.fbaipublicfiles.com/opencatalystproject/data/omat/241018/omat/train" |
| 53 | +VAL_BASE="https://dl.fbaipublicfiles.com/opencatalystproject/data/omat/241220/omat/val" |
| 54 | +SALEX_BASE="https://dl.fbaipublicfiles.com/opencatalystproject/data/omat/241018/sAlex" |
| 55 | + |
| 56 | +TRAIN_SUBSETS=( |
| 57 | + rattled-1000 |
| 58 | + rattled-1000-subsampled |
| 59 | + rattled-500 |
| 60 | + rattled-500-subsampled |
| 61 | + rattled-300 |
| 62 | + rattled-300-subsampled |
| 63 | + aimd-from-PBE-1000-npt |
| 64 | + aimd-from-PBE-1000-nvt |
| 65 | + aimd-from-PBE-3000-npt |
| 66 | + aimd-from-PBE-3000-nvt |
| 67 | + rattled-relax |
| 68 | +) |
| 69 | + |
| 70 | +VAL_SUBSETS=( |
| 71 | + rattled-1000 |
| 72 | + rattled-1000-subsampled |
| 73 | + rattled-500 |
| 74 | + rattled-500-subsampled |
| 75 | + rattled-300 |
| 76 | + rattled-300-subsampled |
| 77 | + aimd-from-PBE-1000-npt |
| 78 | + aimd-from-PBE-1000-nvt |
| 79 | + aimd-from-PBE-3000-npt |
| 80 | + aimd-from-PBE-3000-nvt |
| 81 | + rattled-relax |
| 82 | +) |
| 83 | + |
| 84 | +mkdir -p train val salex |
| 85 | + |
| 86 | +fetch() { |
| 87 | + local base="$1" |
| 88 | + local subset="$2" |
| 89 | + local target_dir="$3" |
| 90 | + local url="${base}/${subset}.tar.gz" |
| 91 | + local out="${target_dir}/${subset}.tar.gz" |
| 92 | + if [[ -f "$out" ]]; then |
| 93 | + echo "skip: $out exists" |
| 94 | + return |
| 95 | + fi |
| 96 | + echo "downloading: $url" |
| 97 | + curl -L --fail --retry 3 --retry-delay 5 -o "$out" "$url" |
| 98 | +} |
| 99 | + |
| 100 | +case "$SPLIT" in |
| 101 | + train) |
| 102 | + if $ALL; then |
| 103 | + SUBSETS=("${TRAIN_SUBSETS[@]}") |
| 104 | + fi |
| 105 | + if [[ ${#SUBSETS[@]} -eq 0 ]]; then |
| 106 | + echo "error: no subsets provided" >&2 |
| 107 | + usage |
| 108 | + exit 1 |
| 109 | + fi |
| 110 | + for subset in "${SUBSETS[@]}"; do |
| 111 | + fetch "$TRAIN_BASE" "$subset" train |
| 112 | + done |
| 113 | + ;; |
| 114 | + val) |
| 115 | + if $ALL; then |
| 116 | + SUBSETS=("${VAL_SUBSETS[@]}") |
| 117 | + fi |
| 118 | + if [[ ${#SUBSETS[@]} -eq 0 ]]; then |
| 119 | + echo "error: no subsets provided" >&2 |
| 120 | + usage |
| 121 | + exit 1 |
| 122 | + fi |
| 123 | + for subset in "${SUBSETS[@]}"; do |
| 124 | + fetch "$VAL_BASE" "$subset" val |
| 125 | + done |
| 126 | + ;; |
| 127 | + salex) |
| 128 | + if $ALL; then |
| 129 | + SUBSETS=("train" "val") |
| 130 | + fi |
| 131 | + if [[ ${#SUBSETS[@]} -eq 0 ]]; then |
| 132 | + echo "error: no subsets provided (train|val)" >&2 |
| 133 | + usage |
| 134 | + exit 1 |
| 135 | + fi |
| 136 | + for subset in "${SUBSETS[@]}"; do |
| 137 | + if [[ "$subset" != "train" && "$subset" != "val" ]]; then |
| 138 | + echo "error: salex subset must be train or val" >&2 |
| 139 | + exit 1 |
| 140 | + fi |
| 141 | + fetch "$SALEX_BASE" "$subset" salex |
| 142 | + done |
| 143 | + ;; |
| 144 | + *) |
| 145 | + echo "error: unknown split '$SPLIT'" >&2 |
| 146 | + usage |
| 147 | + exit 1 |
| 148 | + ;; |
| 149 | +esac |
0 commit comments