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

Import trajectories from PDB files #1524

Open
joerivan opened this issue Dec 12, 2023 · 8 comments · May be fixed by #1659
Open

Import trajectories from PDB files #1524

joerivan opened this issue Dec 12, 2023 · 8 comments · May be fixed by #1659
Labels
file-format relevant to IO file formats good first issue

Comments

@joerivan
Copy link
Contributor

It could be a good add if Avogadro could import trajectories from PDB files. The old Avogadro had this feature, but it does not seem present/working in Avogadro 2.

Similar to loading a 'normal' PDB file, the feature should allow the user the drag and drop a PDB file into Avogadro, and Avogadro should read the PDB file, where each geometry that is separated by an ENDMDL1 should be imported as a separate frame.

Switching between the frames should then be possible (as normal) via the Animation Tool.

An alternative would be to import with a separate tool/menu. For example, adding an option to import trajectories inside of the Animation Tool (specific for PDB files). I believe that the first suggestion would be more user-friendly.

Footnotes

  1. In PDB files coordinates are read until either the file ends or the keyword ENDMDL is encountered. Using this, a PDB file can be used as a trajectory format. The different steps are then separated by an ENDMDL.

Copy link

welcome bot commented Dec 12, 2023

Thanks for opening your first issue here! Please try to include example files and screenshots if possible. If you're looking for support, please post on our forum: https://discuss.avogadro.cc/

@avo-bot
Copy link

avo-bot commented Dec 12, 2023

This issue has been mentioned on Avogadro Discussion. There might be relevant details there:

https://discuss.avogadro.cc/t/import-trajectories-from-pdb-files/5113/1

@ghutchis ghutchis added good first issue file-format relevant to IO file formats labels Dec 13, 2023
@ghutchis
Copy link
Member

I'm going to mark this as "help wanted" and "good first issue" since I've got a few other things on my plate right now.

The code for this is in

while (getline(in, buffer)) { // Read Each line one by one

An example of adding frames is in the XYZ code:

while (numAtoms == numAtoms2) {

@vaibhav-1508
Copy link

Hey there @ghutchis , I was interested in working on this issue but had problem in figuring out how to set up the repository locally. Apart from forking and cloning, what next do I have to do?. Are there any docs which I can refer to?

@ghutchis
Copy link
Member

The README points to https://two.avogadro.cc/install/build.html

@Himanshuu23
Copy link

Himanshuu23 commented Feb 11, 2024

It could be a good add if Avogadro could import trajectories from PDB files. The old Avogadro had this feature, but it does not seem present/working in Avogadro 2.

Similar to loading a 'normal' PDB file, the feature should allow the user the drag and drop a PDB file into Avogadro, and Avogadro should read the PDB file, where each geometry that is separated by an ENDMDL1 should be imported as a separate frame.

Switching between the frames should then be possible (as normal) via the Animation Tool.

An alternative would be to import with a separate tool/menu. For example, adding an option to import trajectories inside of the Animation Tool (specific for PDB files). I believe that the first suggestion would be more user-friendly.

Footnotes

  1. In PDB files coordinates are read until either the file ends or the keyword ENDMDL is encountered. Using this, a PDB file can be used as a trajectory format. The different steps are then separated by an ENDMDL.

@joerivan Hi Sir, please assign me to work on this issue. I have already written the required code for this following issue, just need to find out the correct file in the repository and I'll raise a PR asap!

@ghutchis
Copy link
Member

We generally don't "assign" issues except to mark that someone from the core development team is working on it.

If you want to find the correct files, you need to look at:
https://github.com/OpenChemistry/avogadrolibs/blob/master/avogadro/io/pdbformat.cpp

An example of reading multiple coordinate sets can be found in xyzformat.cpp, e.g.

mol.setCoordinate3d(mol.atomPositions3d(), 0);

Basically, you push back each frame:

Array<Vector3> positions;
positions.reserve(numAtoms);
unsigned coordSet = 0;
mol.setCoordinate3d(positions, 0);

@Himanshuu23
Copy link

Raised an PR for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
file-format relevant to IO file formats good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants