generation.sh 2.41 KB
Newer Older
1
2
3
4
5
#!/bin/bash
# =============================================================================
# BOMLIP-CSP: Conformer Search & Crystal Structure Generation Pipeline
# =============================================================================
# Usage: ./search_gen_proc.sh [config_file]
6
#   config_file  Path to the parameter configuration file (default: generation_config.sh)
7
8
# =============================================================================

9
# --- Determine config file path (default: generation_config.sh in the same directory) ---
10
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
PROJECT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
12
CONFIG_FILE="${1:-${SCRIPT_DIR}/generation_config.sh}"
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

if [ ! -f "${CONFIG_FILE}" ]; then
    echo "Error: Configuration file not found: ${CONFIG_FILE}"
    echo "Usage: $0 [config_file]"
    exit 1
fi

echo "Loading configuration from: ${CONFIG_FILE}"

# --- Source the configuration file ---
source "${CONFIG_FILE}"

# --- Validate required parameters ---
if [ -z "${SMILES}" ]; then
    echo "Error: SMILES is not set in the configuration file."
    exit 1
fi

# --- Set up directory ---
32
TAR_DIR="${PROJECT_DIR}/${OUTPUT_DIR}"
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

mkdir -p "${TAR_DIR}"
cd "${TAR_DIR}" || { echo "Error: Cannot access directory ${TAR_DIR}"; exit 1; }

echo "=========================================="
echo " BOMLIP-CSP Pipeline"
echo "=========================================="
echo " SMILES:               ${SMILES}"
echo " Output directory:     ${TAR_DIR}"
echo " Mode:                 ${MODE}"
echo " Generate conformers:  ${GENERATE_CONFORMERS}"
echo " Use conformers:       ${USE_CONFORMERS}"
echo " Molecule num in cell: ${MOLECULE_NUM_IN_CELL}"
echo " Space group list:     ${SPACE_GROUP_LIST}"
echo " Add name:             ${ADD_NAME}"
echo " Num generation:       ${NUM_GENERATION}"
echo " Max workers:          ${MAX_WORKERS}"
echo "=========================================="

# --- Run the pipeline ---
53
python "${SCRIPT_DIR}/generation.py" \
54
55
56
57
58
59
60
61
62
63
64
65
66
    --path "${TAR_DIR}" \
    --smiles "${SMILES}" \
    --molecule_num_in_cell ${MOLECULE_NUM_IN_CELL} \
    --space_group_list "${SPACE_GROUP_LIST}" \
    --add_name "${ADD_NAME}" \
    --max_workers "${MAX_WORKERS}" \
    --num_generation ${NUM_GENERATION} \
    --generate_conformers "${GENERATE_CONFORMERS}" \
    --use_conformers "${USE_CONFORMERS}" \
    --mode "${MODE}" \
    > generate.log 2>&1

echo "Pipeline finished. Log saved to ${TAR_DIR}/generate.log"