Skip to content

Case 7: High-Throughput Batch Processing via CLI

Case 7: High-Throughput Batch Processing via CLI

Section titled “Case 7: High-Throughput Batch Processing via CLI”

FBTK’s CLI tool (fbtk-build) is provided as an independent executable file that does not depend on a Python environment. By leveraging this feature, you can call it directly from shell scripts to automatically generate many composition variations at once, enabling “high-throughput initial structure screening.”

  • No Python Required: Works by simply placing the binary in supercomputing or CI/CD environments without worrying about dependencies.
  • Easy Automation: Combine with standard Linux commands like for loops and cat to prepare thousands of initial structures instantly.
  • Pipeline Integration: Complete an entire workflow from “recipe generation → structure construction → MD execution” in a single shell script.

Automation Example: Salt Concentration Screening Script

Section titled “Automation Example: Salt Concentration Screening Script”

The following shell script (batch_build.sh) automatically generates corresponding recipe files while varying the number of salt pairs (LiTFSI) and executes fbtk-build sequentially.

#!/bin/bash
# Base polymer settings
PEO_COUNT=6
PEO_DEGREE=40
# Loop through different salt (LiTFSI) counts (10, 30, 50)
for salt_count in 10 30 50; do
echo "Processing salt count: $salt_count..."
# 1. Dynamically generate recipe file (YAML)
# Polymer settings must be nested under polymer_params
cat << EOF > recipe_${salt_count}.yaml
system:
density: 0.8
components:
- name: PEO
role: polymer
input:
smiles: "*COC*"
polymer_params:
degree: $PEO_DEGREE
n_chains: $PEO_COUNT
- name: Li
role: molecule
input:
smiles: "[Li+]"
count: $salt_count
- name: TFSI
role: molecule
input:
smiles: "C(F)(F)(F)S(=O)(=O)[N-]S(=O)(=O)C(F)(F)(F)"
count: $salt_count
EOF
# 2. Run CLI tool to build and relax the structure
# The --recipe (or -r) flag is mandatory
fbtk-build --recipe recipe_${salt_count}.yaml --output cell_${salt_count}.mol2 --relax
echo " - Generated: cell_${salt_count}.mol2"
done

Running the script outputs logs for each concentration, and .mol2 files with accurate atom counts are generated immediately.

Processing salt count: 30...
Forblaze Toolkit (c) 2026 Forblaze Project https://forblaze-works.com/
--- fbtk-build ---
Threads: 4
Reading recipe from "recipe_30.yaml"
System Summary:
Target Density: 0.8 g/cm^3
Components:
- [Polymer] PEO: degree=40, n_chains=6, tacticity=Isotactic
- [Molecule] Li: count=30
- [Molecule] TFSI: count=30
Generating template from SMILES for PEO: *COC*
Resolved polymer indices for PEO: head=1, tail=3, h_leaving=Some(0), t_leaving=Some(4)
Generating template from SMILES for Li: [Li+]
Generating template from SMILES for TFSI: C(F)(F)(F)S(=O)(=O)[N-]S(=O)(=O)C(F)(F)(F)
Building system...
System built successfully.
Atoms: 2172
Bonds: 2106
Relaxing system (Default parameters)...
Saved to "cell_30.mol2"

Downstream: Integration with MD Simulations

Section titled “Downstream: Integration with MD Simulations”

The generated .mol2 files hold not just coordinate data but also bonding topology. This can be used as a starting point for advanced workflows:

  1. Conversion to LAMMPS/GROMACS: Based on the .mol2 format, convert data into input for MD software (e.g., LAMMPS data files). This allows you to start MD calculations for 100 different compositions automatically.
  2. Immediate Analysis with fbtk-analyze: For the newly constructed structures, use the same CLI tool fbtk-analyze to check RDF (Radial Distribution Function) or density distributions, screening for physically reasonable composition ranges.
  3. Visualization: Instantly check packing states with tools like Ovito or VMD.

By utilizing FBTK’s CLI tools, you can eliminate the bottleneck of “initial structure creation” in materials design and build truly automated simulation pipelines.