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

lipid_unwrap.py #62

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

lipid_unwrap.py #62

wants to merge 7 commits into from

Conversation

krb0073
Copy link

@krb0073 krb0073 commented Sep 27, 2021

Hi Alan,
I placed the lipid_unwrap.py code that I have been working on in loos/Pacakges/Pyloos. Let me know anything that you need me to do and thank you again for all of your help. This code is used ofr simulation that hav rectaulgar boxes to unwrapp the P.B of the simulation. This should work for any selection but is intended to work for lipids. There is one assumption that the lenght of the P.B. is no greater than 1000 which should be fine for most systems. (I could add in a flag to change this if needed). I am also unsure about the change from outputting the x,y,z of each lipid center into the raidus of each point to the center of mass. If you rather have it in the x,y,z for the output I do still have a version of that code. My thinking whne doing that is that now all the points takin in the mostion of the center of mass of the system. Let me know what you need done.
Kyle

@agrossfield agrossfield self-requested a review September 28, 2021 12:48
@agrossfield agrossfield self-assigned this Sep 28, 2021
@agrossfield
Copy link
Member

This is connected to Discussion #61

Copy link
Member

@agrossfield agrossfield left a comment

Choose a reason for hiding this comment

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

Overall, this looks good, but there are some changes needed:

  1. The "#!/usr/bin/env python3" line needs to be the first line of the file. Please remove that opening block of comments.
  2. Compose an appropriate top-level comment to replace the one that's there (lines 11-14 in the current numbering)
  3. Fix typos in the full help message (spaces before "." and "," instead of after. Write out periodic box. Add something saying why you would use this program (in preparation for calculating diffusion coefficients). Line 49 has an incomplete sentence. In general, you might want to run the text through a spellcheck. Check your comments too.
  4. I suggest running the code through a linter (eg black, autopep8). This will clean up stuff like missing blank lines before a function, etc.
  5. The algorithm you're using in findFix is really ugly. I need to think about whether there's a cleaner way to do it. All of those ifs are going to be really slow, too.
  6. The main body of the program should be protected by if __name__ == 'main':
  7. Please separate blocks of code with blank lines. Please don't double and triple the "#"
  8. Can you explain what you're trying to accomplish with lines 204-214? Add comments explaining it. Also, 1000 Ang probably isn't big enough to be safe -- there are already people running martini sims that are that big.
  9. Lines 216-220: why are you working with a copy of the system instead of just making the pdb from the current AtomicGroup? Why remove the bonds?

I'm sure I'll think of more comments --- I really want to clean up findFix somehow --- but this is enough to get you started.

Cheers,

Alan

Added a top commnet for what the file does. Changed the a,b...f to one dictonary that was all the values of the tracker to the fix. added if __name__ in main . Spelling fixed(not well). Commneted on what i am doin in the trajectory making stuff. removed so silly thing about making the pdb . incresed the number of the new PBC Box
Used the code given to me by Dr.Grossfeild That moved all no function calls to after the if name in main. editted if name in main to "__main__".  Removed old commnet that did not apply anymore around line 215, Added an arugment to not recenter the unwrapped trajectory. Made a 2D array instead of buibling one from scratch over time.
@krb0073
Copy link
Author

krb0073 commented Oct 12, 2021

Alan,
Thanks for all the help, it's really nice to get feed back on what I can do to imporve my coding. I removed the comments that were not relavent after pulling everything to the find_fix function, the length function just as well as doing the math by hand, line 232 was modified to have the user choose if they want it to be recentered (defults to yes), and line 259 was fixed by using a 2D martix of size (number of lipids , number of frames). I was wondering if we should do the M.S.D also in this code since the matirx is already in memory?

Kyle

added a commnet for the fullhelp for the no_center flag
removed old way of getting the matrix for the corrianted of the lipid centers.
Fixed whitespace error
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