ParmEd / ParmEd

Parameter/topology editor and molecular simulator
https://parmed.github.io/ParmEd
389 stars 148 forks source link

Fails to construct a system from own-written PSF file #1272

Open merkys opened 1 year ago

merkys commented 1 year ago

I am following ParmEd example with OpenMM and CHARMM, but instead of using the supplied PSF file I am trying to write one using ParmEd:

from io import StringIO
from parmed.charmm import CharmmParameterSet, CharmmPsfFile
import parmed

psf_tmp_file = StringIO()
parmed.load_file('examples/charmm/ala5_autopsf.pdb').write_psf(psf_tmp_file, vmd=True)
psf_tmp_file.seek(0)
psf = CharmmPsfFile(psf_tmp_file)

(I am doing this as I want to use CHARMM force fields, but have no other way to create the required PSF files)

However, when I attempt setting up a system via psf.createSystem(force_field, ...), it fails with:

  File "/usr/local/lib/python3.10/dist-packages/parmed/charmm/psf.py", line 650, in load_parameters
    raise ParameterError(f"Could not find atom type for {atom.type}")
parmed.exceptions.ParameterError: Could not find atom type for HT1

So it seems that ParmEd writes atom types that it does not know how to interpret. Is there a way to get around it?

wangm23456 commented 1 year ago

+1