Ecosystem Integration
Ecosystem Integration
Section titled “Ecosystem Integration”FBTK demonstrates its true value when combined with existing high-performance molecular simulation tools.
OpenFF (Open Force Field) Integration
Section titled “OpenFF (Open Force Field) Integration”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).
Key Features
Section titled “Key Features”- 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.
Recommended Workflows
Section titled “Recommended Workflows”Pattern A: Construct in FBTK, Simulate in OpenFF
Section titled “Pattern A: Construct in FBTK, Simulate in OpenFF”- FBTK: Build mixed bulk or polymer systems at high speed.
- OpenFF: Call
to_openff(forcefield="...")to generate anInterchangeobject with parameters and cell synchronized in one go. - Export: Output to simulation formats like GROMACS or LAMMPS.
import fbtk
# 1. Build a bulk system in FBTKbuilder = 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 formatsinterchange.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”- OpenFF: Calculate AM1-BCC charges for a monomer.
- FBTK: Import via
Molecule.from_openff(off_mol). - FBTK: Perform polymerization or packing while maintaining high-precision charges.
import fbtkfrom openff.toolkit import Molecule
# 1. Calculate high-precision charges in OpenFFoff_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 buildingbuilder = fbtk.Builder(density=0.9)builder.add_molecule(fbtk_mol, count=500)system = builder.build()RadonPy Integration
Section titled “RadonPy Integration”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.
Hybrid Workflow
Section titled “Hybrid Workflow”- RadonPy: Generate molecular topologies (RDKit Mol).
- FBTK: Fast packing and initial relaxation in unit cells.
- RadonPy / ASE: Execute property calculation MD.
import fbtk
# 1. Pass RDKit Mol generated by RadonPy to FBTKfbtk_mol = fbtk.Molecule.from_rdkit(radon_mol, name="RadonPoly")
# 2. Fast packing in FBTKbuilder = 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 executionatoms = system.to_ase()RDKit Integration
Section titled “RDKit Integration”Molecules with specific tacticity or complex functional groups generated in RDKit can be imported into FBTK while maintaining coordinates and topology.
from rdkit import Chemmol = 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 fbtkfrom ase.io import read
# Read existing MD trajectory and analyze using FBTK's fast Rust enginetraj = read("production.lammpstrj", index=":")r, g_r = fbtk.compute_rdf(traj, query="element C - element O")Charge Supplementation
Section titled “Charge Supplementation”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 datasystem = fbtk.System.from_file("imported.mol2")
# Calculate and normalize partial charges using FBTK standardssystem.assign_partial_charges()KNIME / Workflow Tool Integration
Section titled “KNIME / Workflow Tool Integration”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.