Skip to content

Ecosystem Integration

FBTK demonstrates its true value when combined with existing high-performance molecular simulation tools.

Bulk systems constructed with FBTK can be directly injected into the OpenFF ecosystem. This allows you to combine FBTK’s high-speed structure generation with OpenFF’s high-precision parameter assignment (such as the Sage force field).

  • Bi-directional Conversion: Seamlessly convert structures, topologies, charges, and unit cell information between FBTK and OpenFF.
  • Auto-Cell Sync: Automatic conversion from Angstroms to Nanometers and synchronization of box vectors.
  • Charge Preservation: Import high-precision charges (e.g., AM1-BCC) from OpenFF to FBTK, or ensure FBTK-assigned charges are maintained during OpenFF parameter assignment.

Pattern A: Construct in FBTK, Simulate in OpenFF

Section titled “Pattern A: Construct in FBTK, Simulate in OpenFF”
  1. FBTK: Build mixed bulk or polymer systems at high speed.
  2. OpenFF: Call to_openff(forcefield="...") to generate an Interchange object with parameters and cell synchronized in one go.
  3. Export: Output to simulation formats like GROMACS or LAMMPS.
import fbtk
# 1. Build a bulk system in FBTK
builder = fbtk.Builder(density=0.8)
builder.add_molecule_smiles("Ethanol", count=100, smiles="CCO")
system = builder.build()
system.relax()
# 2. Convert directly to OpenFF Interchange
# Force field assignment and cell synchronization are handled automatically.
# Applying the latest Sage 2.2.1 force field.
interchange = system.to_openff(forcefield="openff-2.2.1.offxml")
# 3. Export to simulation formats
interchange.to_lammps("system.data")

Pattern B: Use High-Precision OpenFF Charges in FBTK Building

Section titled “Pattern B: Use High-Precision OpenFF Charges in FBTK Building”
  1. OpenFF: Calculate AM1-BCC charges for a monomer.
  2. FBTK: Import via Molecule.from_openff(off_mol).
  3. FBTK: Perform polymerization or packing while maintaining high-precision charges.
import fbtk
from openff.toolkit import Molecule
# 1. Calculate high-precision charges in OpenFF
off_mol = Molecule.from_smiles("CCO")
off_mol.assign_partial_charges("am1bcc") # Requires AmberTools/OpenEye
# 2. Import into FBTK (charges are preserved)
fbtk_mol = fbtk.Molecule.from_openff(off_mol)
# 3. Use for building
builder = fbtk.Builder(density=0.9)
builder.add_molecule(fbtk_mol, count=500)
system = builder.build()

RadonPy is an excellent library for automating polymer property calculations, but building large amorphous cells can be time-consuming. Using FBTK as a “fast packing engine” can dramatically accelerate your workflow.

  1. RadonPy: Generate molecular topologies (RDKit Mol).
  2. FBTK: Fast packing and initial relaxation in unit cells.
  3. RadonPy / ASE: Execute property calculation MD.
import fbtk
# 1. Pass RDKit Mol generated by RadonPy to FBTK
fbtk_mol = fbtk.Molecule.from_rdkit(radon_mol, name="RadonPoly")
# 2. Fast packing in FBTK
builder = fbtk.Builder(density=1.0)
builder.add_molecule(fbtk_mol, count=50)
system = builder.build()
system.relax()
# 3. Return to ASE Atoms for RadonPy MD execution
atoms = system.to_ase()

Molecules with specific tacticity or complex functional groups generated in RDKit can be imported into FBTK while maintaining coordinates and topology.

from rdkit import Chem
mol = Chem.MolFromSmiles("...")
fbtk_mol = fbtk.Molecule.from_rdkit(mol)

ASE (Atomic Simulation Environment) Integration

Section titled “ASE (Atomic Simulation Environment) Integration”

FBTK’s analysis functions act like an extension library for ASE.

import fbtk
from ase.io import read
# Read existing MD trajectory and analyze using FBTK's fast Rust engine
traj = read("production.lammpstrj", index=":")
r, g_r = fbtk.compute_rdf(traj, query="element C - element O")

When importing structures from external files or RDKit, charge information might be missing. You can calculate and assign Gasteiger partial charges using the assign_partial_charges() method.

# Load from external data
system = fbtk.System.from_file("imported.mol2")
# Calculate and normalize partial charges using FBTK standards
system.assign_partial_charges()

Because FBTK has no mandatory dependencies, it is ideal for data analysis platforms like KNIME or Pipeline Pilot.

  • Python Script Node: Works immediately with a simple pip install fbtk.
  • Fast Batch Processing: Call standalone CLI tools (like fbtk-build) directly from external execution nodes to build high-speed pipelines without Python overhead.