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

Add MDTraj converter and update to atom mapping code #622

Merged
merged 33 commits into from
Jan 3, 2025

Conversation

ChiCheng45
Copy link
Collaborator

@ChiCheng45 ChiCheng45 commented Dec 18, 2024

Description of work
Added MDTraj converter and optimized the atom mapping code.

Similarly to the MDAnalysis converter, the MDTraj converter converts trajectories with trajectory files and a topology file. Trajectory files can include one or more files but should only be of a single type e.g. xtc. In MDTraj topology files are optional if the trajectory files contain topology information.

To test

  1. Convert some gromacs trajectories from the MDANSE-Examples repository.
    Enter PDB files into the topology file setting and trr or xtc files into the trajectory files setting and convert the trajectory. Atom mapping should be generated faster than before.
  2. Convert some charmm trajectories from the MDANSE-Examples repository.
    Enter PDB files into the topology file setting and dcd files into the trajectory files setting and convert the trajectory.
  3. Try converting a trajectory using multiple coordinate files.
    Either generate multiple coordinate files or copy and rename them. Convert the trajectory, if you copy and renamed it then the MDANSE trajectory should be twice as long and repeat itself.

@ChiCheng45 ChiCheng45 changed the title Add MDTraj converter and updated to atom mapping code Add MDTraj converter and update to atom mapping code Dec 19, 2024
@MBartkowiakSTFC
Copy link
Collaborator

One problem that is worth looking at is the time step of the trajectory.

I tried converting the hDAT_mdma trajectory from SlimMD database. The atom types, positions and unit cell dimensions were correct, but the time axis should be checked. With the MDTraj converter I get

Frame times (1st, 2nd, ..., last) in ps:
0.0, 1.0, ..., 105.0

and with MDAnalysis

Frame times (1st, 2nd, ..., last) in ps:
0.0, 0.04888821, ..., 5.13326205

@ChiCheng45
Copy link
Collaborator Author

ChiCheng45 commented Jan 2, 2025

Those are the timesteps from MDTraj, I guess the default must be 1ps. I think I'll add a widget to let the user change the timestep if they want to, similarly to the MDAnalysis job.

@ChiCheng45
Copy link
Collaborator Author

I've updated the MDTraj converter to add a time step setting which should update similarly to the MDAnalysis one when files are inputted. This is ready to be reviewed again.

@MBartkowiakSTFC
Copy link
Collaborator

Now my GUI has the input field for time step, but it does not seem to find the same value that MDAnalysis found. Also, I manually changed the value of the time step from 1.0 to 0.048, but when I loaded the resulting trajectory, it still had 1.0 step, independent of what I set.

@ChiCheng45
Copy link
Collaborator Author

Now my GUI has the input field for time step, but it does not seem to find the same value that MDAnalysis found. Also, I manually changed the value of the time step from 1.0 to 0.048, but when I loaded the resulting trajectory, it still had 1.0 step, independent of what I set.

Thanks for that. It should be fixed now so it will pick up the timestep setting.

I'm not sure why MDTraj doesn't pick up the same numbers as MDAnalysis but I'm now a bit confused about why MDAnalysis picked up the 0.048 ps timestep when according to https://www.ccpbiosim.ac.uk/slim-md/slimmd-database/protein-membrane/human-dopamine-transporter-embedded-in-a-membrane-bound-to-mdma-250ns it should be 2.5 ns.

@ChiCheng45
Copy link
Collaborator Author

Apparently, DCD files are a bit of a nightmare mdtraj/mdtraj#1163. I think we might just have to accept that MDAnalysis and MDTraj might suggest different timesteps and leave it to the user to set a correct one.

Also, the 0.048 seems to come from some timefactor see mdtraj/mdtraj#1163 (comment).

@MBartkowiakSTFC
Copy link
Collaborator

I'm not sure why MDTraj doesn't pick up the same numbers as MDAnalysis but I'm now a bit confused about why MDAnalysis picked up the 0.048 ps timestep when according to https://www.ccpbiosim.ac.uk/slim-md/slimmd-database/protein-membrane/human-dopamine-transporter-embedded-in-a-membrane-bound-to-mdma-250ns it should be 2.5 ns.

According to our own DCD code, the DCD file stores time values in AKMA time units, which are also defined in MDAnalysis: https://userguide.mdanalysis.org/stable/units.html
If you divide 1 ps by 20.4548, you get the 0.04888 value. Of course, this only raises more questions. Why divide 1 ps by this factor? Is the information about the time values even in this DCD file?

Getting back to the main topic: thanks for the changes!

@MBartkowiakSTFC
Copy link
Collaborator

Another problem I have is that my atom mapping values are ignored by the converter. I tried converting a GROMACS trajectory of DNA from SlimMD. I changed some of the dummy atoms to Cr, and some of the phosphorus to Pb208 isotope, but the output trajectory still had the original composition.

@ChiCheng45
Copy link
Collaborator Author

Another problem I have is that my atom mapping values are ignored by the converter. I tried converting a GROMACS trajectory of DNA from SlimMD. I changed some of the dummy atoms to Cr, and some of the phosphorus to Pb208 isotope, but the output trajectory still had the original composition.

Thanks, nice one. I think it should be sorted now.

Copy link
Collaborator

@MBartkowiakSTFC MBartkowiakSTFC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we can set the time step and correct the atom types, I think that the converter works fine.

@MBartkowiakSTFC MBartkowiakSTFC merged commit f134bd3 into protos Jan 3, 2025
28 checks passed
@MBartkowiakSTFC MBartkowiakSTFC deleted the chi/md-traj-converter branch January 3, 2025 17:34
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

Successfully merging this pull request may close these issues.

2 participants