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

Share tool permabug #290

Open
EvanKomp opened this issue May 13, 2024 · 1 comment
Open

Share tool permabug #290

EvanKomp opened this issue May 13, 2024 · 1 comment

Comments

@EvanKomp
Copy link

Describe the bug
Error in complied code for 3.4.1 Darwin that I got from releases:
share/apbs/tools/manip/inputgen.py

To Reproduce
Run the setSmallest method of Psize with any input.

I don't know where this code is in the repo otherwise I would make a pull to make it look like the pdb2pwr code here https://pdb2pqr.readthedocs.io/en/v3.6.1/_modules/pdb2pqr/psize.html

Here is the current code:

    def setSmallest(self, n):
        """ Compute parallel division in case memory requirement above
        ceiling Find the smallest dimension and see if the number of
        grid points in that dimension will fit below the memory ceiling
        Reduce nsmall until an nsmall^3 domain will fit into memory """
        nsmall = []
        for i in range(3):
            nsmall.append(n[i])
        while 1:
            nsmem = 200.0 * nsmall[0] * nsmall[1] * nsmall[2] / 1024 / 1024
            if nsmem < self.constants["gmemceil"]:
                break
            else:
                i = nsmall.index(max(nsmall))
                nsmall[i] = 32 * ((nsmall[i] - 1) / 32 - 1) + 1
                if nsmall <= 0:
                    sys.stdout.write(
                        "You picked a memory ceiling that is too small\n"
                    )
                    sys.exit(0)

        self.nsmall = nsmall
        return nsmall

Line 174 if nsmall <= 0: perma raises with TypeError since nsmall is a list.

@sobolevnrm
Copy link
Member

Wow... that's really bad code and I'm not sure how it got in there. I don't think psize.py gets much use. The best solution might just be deleting this file from future releases.

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