openmm / pdbfixer

PDBFixer fixes problems in PDB files
Other
453 stars 114 forks source link

combining fixed PDBs #207

Closed michelsanner closed 4 years ago

michelsanner commented 4 years ago

Hello I am wondering is there is an easy way to "combine" 2 fixed moelcules. Basically I am creating a fixer for a first PDB file

fixer1 = PDBFixer(filename=pdb1) fixer1.findMissingResidues() fixer1.findMissingAtoms() fixer1.findNonstandardResidues() fixer1.addMissingAtoms() fixer1.addMissingHydrogens(7.4) fixer1.removeHeterogens(False)

then create fixer2 for the second molecule and I would like to write you the PDB (or prmtop, and coordinate file) for the complex of the 2

It seems that fixer2.positions.extend(fixer1.positions) does what I expect. I tried for n, chain in enumerate(fixer1.topology.chains()): chain.id = n+1 chain.index = n+1 fixer2.topology.addChain(chain)

but when I writ to write out the PDB for the complex I get ValueError: The number of positions must match the number of atoms

Would it be reasonable/possible to add an add operator to PDBfixer to perform this ?

thanks for any advise

-M

michelsanner commented 4 years ago

Apologies. I should have dug a little more before asking

I realize now Modeller provides support for this modeller = Modeller(fixer2.topology, fixer2.positions) modeller.add(fixer1.topology, fixer1.positions)

did the trick -M

peastman commented 4 years ago

Glad you figured it out!