CHARMM to GMX
It could be very tricky to get the GROMACS’s topology (TOP) and configuration (GRO) files from CHARMM’s files. And even more when you are not familiar with the CHARMM syntax. This flash tutorial will explain how to do it.
Requirements
- ParmED python library installed:
pip install parmed
. - PSF (protein structure file): contains all of the molecule-specific information needed to apply a particular force field to a molecular system.
- PRM (forcefield parameter file): contains all of the numerical constants needed to evaluate forces and energies, given a PSF structure file and atomic coordinates.
- RTF (topology file): contains all of the information needed to convert a list of residue names into a complete PSF structure file.
- MOL2 or PDB. Any file with coordinates that can be reeded by ParmED (see this article File input/output with ParmEd).
Then, you just need to execute the following code:
import parmed as pmd
psf = pmd.charmm.CharmmPsfFile('mol.psf')
psf.load_parameters(pmd.charmm.CharmmParameterSet('mol.prm', 'mol.rtf'))
struc = pmd.load_file('mol.mol2', structure=True)
psf.coordinates = struc.coordinates
psf.save('mol.top')
psf.save('mol.gro')
In case you are converting a small molecule and you would like to change the name to a specific keyword; before using the save
method on the psf
object you can:
for atom in psf.atoms:
atom.residue.name = 'LIG'
Happy simulations!