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

fix notebook so that it does not run out of filedescriptors #14

Open
orbeckst opened this issue Mar 15, 2017 · 0 comments
Open

fix notebook so that it does not run out of filedescriptors #14

orbeckst opened this issue Mar 15, 2017 · 0 comments
Assignees

Comments

@orbeckst
Copy link
Member

The code in the Li+ notebook

for i in sims:
    # make a protein Universe
    u = i.universe

    # select Li atoms
    ions = u.select_atoms('name LI')

    for ion in ions:
        # make radial distribution function
        df = pdbionsurvey.coordination.en(u, ion)
        
        # make directory if it doesn't exist
        i['coordination/LI/'].make()

        # store radial distribution function in .csv file
        df.to_csv(i['coordination/LI/{}.csv'.format(ion.number)].abspath)

will run out of open file descriptors if there are too many sims because the line

    u = i.universe

creates a MDAnalysis.Universe as a side effect and keeps it alive.

Instead do something like

u = mda.Universe(i.universedef.topology, i.universedef.filename)

This will ensure that the Universe is garbage-collected and with it the file descriptors will be released again.

Add a comment to the code and say why you're not using i.universe. It will also make it easier to make the code independent of MDS #13.

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

No branches or pull requests

2 participants