Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combining fixed PDBs #207

Closed
michelsanner opened this issue Aug 18, 2020 · 2 comments
Closed

combining fixed PDBs #207

michelsanner opened this issue Aug 18, 2020 · 2 comments

Comments

@michelsanner
Copy link

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
Copy link
Author

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
Copy link
Member

Glad you figured it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants