Some days ago, I made a post about openmm_runner. Previous code can’t calculate MD which contains metal ion such as Mg2+. I wonder that does openmm can handle metal ion. I asked the question in the openmm community and could get the answer ;) I know that ‘Amber14 includes parameters for Mg2+ as well as the protein’
So I updated openmm_runner and tried to run MD simulation with metal containing protein-ligand complex.
Basic usage is same as previous version. At first I got PDB file and removed additional information from it.
$ wget https://files.rcsb.org/download/1BYQ.pdb
$ grep -e '^ATOM\|^HETATM\|^TER\|^END' 1byq.pdb > 1byq_clean.pdb
The pdb has metal ion Magnesium, to handle the ion in openmm_runner, the ion should be separated from original PDB because mdutils.prepare_protein will remove all HETATMs (due to pdbfixer). To do that, I used pdb_tools. After getting mg.pdb, I added 2+ charge to the mg.
$ pdb_selresname -MG 1byq_clean.pdb > mg.pdb
$ vim mg.pdb
- HETATM 1680 MG MG A1001 37.976 -46.355 68.629 1.00 13.06 MG2
+ HETATM 1680 MG MG A1001 37.976 -46.355 68.629 1.00 13.06 MG2+
END
Almost there, make config_template and edit it. Change metal_ion null > mg.pdb means prepare_protein function will merge mg.pdb at final step
$ openmm_makeconfig
$ vim config_template.yml
from ...
pdb_file: ''
metal_ion: null
ligands_info:
resname: smiles
ignore_missing_residues: false
ignore_terminal_missing_residues: false
ph: 7.0
data_path: data
protein_ff: amber14-all.xml
solvent_ff: amber14/tip3pfb.xml
integrator: LangevinMiddleIntegrator
integrator_settings:
temperature: 300
frictionCoeff: 1.0
stepSize: 2.0
platform:
name: CUDA
properties:
DeviceIndex: '0'
md_steps: 1000
write_interval: 1
log_interval: 1
to ..[1byb_clean.pdb has MG and ADP as HETATM]
pdb_file: '1byq_clean.pdb'
metal_ion: 'mg.pdb'
ligands_info:
ADP: Nc1ncnc2c1ncn2[C@@H]1O[C@H](COP(=O)(O)OP(=O)(O)O)[C@@H](O)[C@H]1O
ignore_missing_residues: false
ignore_terminal_missing_residues: false
ph: 7.0
data_path: data
protein_ff: amber14-all.xml
solvent_ff: amber14/tip3pfb.xml
integrator: LangevinMiddleIntegrator
integrator_settings:
temperature: 300
frictionCoeff: 1.0
stepSize: 2.0
platform:
name: CUDA
properties:
DeviceIndex: '0'
md_steps: 10000
write_interval: 10
log_interval: 1
Let’s run MD with and without mg.pdb
$ openmm_runmd config.yml
Following images are snapshot of MD trajectory.
There is difference of two oxygen atoms between with MG and without MG ion. I think it means that two oxygen atoms of phosphate group chelates Mg ion and Openmm can simulate it.

I don’t have any experience around these area, any comments and suggestions will be greatly appreciated.