intellectual property during paid research
I am not sure what discipline you are in, but I have been working on software development with a team of health, social, and computer science researchers and from what I have learned, maybe this can help. 

Basically, since the grant paid for your salary it is the institution that has the most stake in for the intellectual property, which covers the PI. For instance, I helped develop and test the software I mentioned at University A, but since then have transferred to University B. I still work with the same team from University A, but any work we do with the software at University B (even when collaborating with the same team from University A), I have to pay University A a licensing fee for use of the software. They do not charge me a lot, granted, but they still require it, because they view it as theirs. Even though, I was a major contributor to the software. 

By extension, the PI should have the right to any materials associated with the project. When you mentioned that you used your own software for the calculations, were you asked by the PI to purchase this or did you go out and get it on your own? If the latter, I suggest that in the future, when materials are needed for a project, simply explain to the PI that resources are needed for the work. You shouldn't pay for them out-of-pocket. If you still have questions about ownership of the work, the institution has lawyers that deal with intellectual property that can help you figure out what is who's. I have had to work with them for our software project to make sure that we are in the clear for doing work outside of University A with our product. Hope this helps!