File size: 470 Bytes
10f2621 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | from pdbfixer import PDBFixer
from openmm.app import PDBFile
# Load the PDB file
fixer = PDBFixer(filename='your_file.pdb')
# Find missing residues
fixer.findMissingResidues()
# Replace nonstandard residues
fixer.findNonstandardResidues()
fixer.replaceNonstandardResidues()
# Find missing atoms and add them
fixer.findMissingAtoms()
fixer.addMissingAtoms()
# Write the fixed PDB file
PDBFile.writeFile(fixer.topology, fixer.positions, open('fixed_pdb.pdb', 'w')) |