Parameter/topology editor and molecular simulator
245 120 30 596

Error writing out prmtop file from OpenMM system

I am trying to write out a prmtop file from an OpenMM system. However, we are getting an error when we try to save the file. Here is an example of the code:

import parmed as pmd
import openmm
import os

forcefield ='amber14-all.xml','amber14/tip3pfb.xml')
pdb =
modeller =, pdb.positions)
modeller.addSolvent(forcefield, padding=0.9*openmm.unit.nanometers, positiveIon='Na+', negativeIon='Cl-',
solvated_system = forcefield.createSystem(modeller.topology)
structure = pmd.openmm.load_topology( modeller.topology, solvated_system, modeller.positions),'complex_solvated_system.prmtop'), overwrite=True),'complex_solvated_system.inpcrd'), overwrite=True)

However, we get an error on the line that saves the .prmtop file.

Traceback (most recent call last):
  File "/lustre/scratch/code/", line 165, in <module>,'complex_solvated_system.prmtop'), overwrite=True)
  File "/fslhome/anaconda3/envs/openmm/lib/python3.9/site-packages/parmed/", line 1507, in save
    s = amber.AmberParm.from_structure(self)
  File "/fslhome/anaconda3/envs/openmm/lib/python3.9/site-packages/parmed/amber/", line 349, in from_structure
  File "/fslhome/anaconda3/envs/openmm/lib/python3.9/site-packages/parmed/amber/", line 676, in remake_parm
  File "/fslhome/anaconda3/envs/openmm/lib/python3.9/site-packages/parmed/amber/", line 1580, in _xfer_bond_info
    bond.type.used = True
AttributeError: 'NoneType' object has no attribute 'used'

We don't get this error when trying to save the same system without solvent, so it may have something to do with the solvent. Any ideas how to fix this? Thanks for the help!


  1. You're using a rigid water model and adopt the default behavior for constraints which is to adopt rigid water (3-constraint waters). By default, ForceField does not add bond parameters to the system when constraining those degrees of freedom. As a result, ParmEd cannot assign that bond type (it remains None) and the (admittedly obscure) error appears.

    Fortunately, forcefield.createSystem supports a flexibleConstraints keyword that will force OpenMM to add constrained parameters to the system. So this issue should be resolved by changing

    solvated_system = forcefield.createSystem(modeller.topology)


    solvated_system = forcefield.createSystem(modeller.topology, flexibleConstraints=True)

    in your code snippet.