Open joerivan opened 10 months ago
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/
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
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 https://github.com/OpenChemistry/avogadrolibs/blob/bb080b5bfd45b8c197702d802888687450c6f5d5/avogadro/io/pdbformat.cpp#L59
An example of adding frames is in the XYZ code: https://github.com/OpenChemistry/avogadrolibs/blob/bb080b5bfd45b8c197702d802888687450c6f5d5/avogadro/io/xyzformat.cpp#L137
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?
The README points to https://two.avogadro.cc/install/build.html
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
ENDMDL
1 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
- 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 anENDMDL
. ↩
@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!
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.
https://github.com/OpenChemistry/avogadrolibs/blob/dfbd6f6bf9fefc4a13278a9c2fefd26f2dc1b98a/avogadro/io/xyzformat.cpp#L135
Basically, you push back each frame:
Array<Vector3> positions;
positions.reserve(numAtoms);
unsigned coordSet = 0;
mol.setCoordinate3d(positions, 0);
Raised an PR for it.
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
ENDMDL
[^1] 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.[^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 anENDMDL
.