mirror of
https://github.com/RosettaCommons/foundry.git
synced 2026-06-04 13:24:22 +08:00
124 lines
3.0 KiB
Plaintext
124 lines
3.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "819e8193",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# For now, we still need to manually add atomworks dependency\n",
|
|
"import sys;\n",
|
|
"sys.path.insert(0, '/home/jbutch/Projects/HT25/af3/rfd3-release/lib/atomworks/src')\n",
|
|
"sys.path.append('/home/jbutch/Projects/HT25/af3/rfd3-release/models/rfd3/src')\n",
|
|
"sys.path.append('/home/jbutch/Projects/HT25/af3/rfd3-release/src')\n",
|
|
"\n",
|
|
"from atomworks.io.utils.visualize import view"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "d944272a",
|
|
"metadata": {},
|
|
"source": [
|
|
"# 1) Design with RFD3"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "137dbccd",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from rfd3.engine import RFD3InferenceConfig, RFD3InferenceEngine\n",
|
|
"from rfd3.inference.input_parsing import DesignInputSpecification\n",
|
|
"conf = RFD3InferenceConfig(\n",
|
|
" ckpt_path='/projects/ml/aa_design/models/rfd3_latest_cleaned.ckpt',\n",
|
|
" diffusion_batch_size=2,\n",
|
|
" dump_trajectories=True,\n",
|
|
" inference_sampler={\"num_timesteps\": 10},\n",
|
|
")\n",
|
|
"# Lazily initialize model\n",
|
|
"model = RFD3InferenceEngine(**conf)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "2d422b11",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"spec = DesignInputSpecification(\n",
|
|
" input='/home/jbutch/Projects/HT25/af3/rfd3-release/models/rfd3/tests/test_data/amidase_LOW.pdb',\n",
|
|
" length=10,\n",
|
|
" ligand='L:G',\n",
|
|
" unindex='A92-96,B2,E5',\n",
|
|
" select_fixed_atoms={\n",
|
|
" 'B2': 'ND1,CG,NE2,CD2,CB,CE1',\n",
|
|
" 'E5': \"OH,CZ,CE1,CE2,CD2,CD1,CG,CB\"\n",
|
|
" }\n",
|
|
")\n",
|
|
"view(spec.build())"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "050d7613",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"outputs = model.run(\n",
|
|
" inputs=spec,\n",
|
|
" n_batches=1,\n",
|
|
")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "de18ec69",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"for idx, data in outputs.items():\n",
|
|
" print(f\"Output type for batch {idx}: {type(data)}[0] = {type(data[0])}\")\n",
|
|
" print(f\"Output atom_array: {data[0].atom_array}\")\n",
|
|
" atom_array = data[0].atom_array\n",
|
|
"view(atom_array)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "d07ae413",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "rfd3-release",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.12.3"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|