Hi,
I got an output file from simulation of pdb file.
The output.pdb contains 20 models.
I want to be able to loop over positions and elements for every model. How can select certain model?
How can I select certain model to use its .positions and elemenets!
- Elsaid Mohamed
- Posts: 26
- Joined: Tue Jan 04, 2022 2:35 am
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: How can I select certain model to use its .positions and elemenets!
Use getPositions() to get the coordinates for a particular model. There's only a single Topology, because the PDB spec requires all models to have the same atoms.
- Elsaid Mohamed
- Posts: 26
- Joined: Tue Jan 04, 2022 2:35 am
Re: How can I select certain model to use its .positions and elemenets!
This means that I have to cut the output files to many files every file contains positions for every model?
By the way I have used pandas, and it counts number 10 and more or -10 and less as positive whatever their signs.
By the way I have used pandas, and it counts number 10 and more or -10 and less as positive whatever their signs.
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: How can I select certain model to use its .positions and elemenets!
I don't understand what you mean. You don't need to repeat the same model in multiple files. But all the models in a single file have to have the same set of atoms. That's a requirement of the PDB format. The spec states, "each model should have the exact same atoms (hydrogen and heavy atoms), sequence and chemistry."This means that I have to cut the output files to many files every file contains positions for every model?
I don't understand what you're talking about. What does pandas have to do with OpenMM?By the way I have used pandas, and it counts number 10 and more or -10 and less as positive whatever their signs.
- Elsaid Mohamed
- Posts: 26
- Joined: Tue Jan 04, 2022 2:35 am
Re: How can I select certain model to use its .positions and elemenets!
Highlighting of the positions of atoms in each model is a goal of my project.
Say I have 20 models(same atoms, but distributed differently). I think I have to cut my output.pdb into 20 modelxs.pdb then get every model then get its coordinate like:
I have used all output.pdb to produce one dataframe in one script by "Pandas" but I found mistakes in the results.
Say I have 20 models(same atoms, but distributed differently). I think I have to cut my output.pdb into 20 modelxs.pdb then get every model then get its coordinate like:
Code: Select all
X = [float(coord[0]/nanometer) for coord in modelxpdb.positions]
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: How can I select certain model to use its .positions and elemenets!
As long as they all have identical atoms, it's fine for them to be a single file. To get the coordinates of the i'th model, call pdb.getPositions(frame=i).
- Elsaid Mohamed
- Posts: 26
- Joined: Tue Jan 04, 2022 2:35 am
Re: How can I select certain model to use its .positions and elemenets!
Thank you, I got the answer for my question.
I think it is possible to meet some output.pdb, its frames have different atoms or elements............?
How can we define them like position!
I think it is possible to meet some output.pdb, its frames have different atoms or elements............?
How can we define them like position
Code: Select all
pdb.getPositions(frame=i-1)
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: How can I select certain model to use its .positions and elemenets!
No, that can never happen. Any file with different atoms in different models would violate the spec. And there are a lot of records that only appear once per file, not once per model: CONECT, CRYST1, SEQRES, etc. It would be impossible to specify different sequences, bonds, etc. for the different models.