osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getting the center of mass of each part of a molecule


On Monday, May 15, 2017 at 10:23:12 PM UTC-7, qasi... at gmail.com wrote:
> @Cameron:
> Thanks, I will try what you suggest. I am not sure that I'll tackle it because I am new to python.

I teach programming to people with varying levels of expertise, from middle-school students to working professionals.  Do you program in any other languages?  What do you know how to do?  Can you write loops?

Why do you have a function named heavy_atoms() which takes all of your data and parses it internally, when you know that you sometimes want to work with subsets of that data?

Also, can you show us the rest of the program?  Right now you define a function that is never called, and it never returns anything either.

One final point: I think you have complicated your task by jumping straight into using Numpy arrays.  You may need to understand Numpy's vectorized function calls (the last line of your code).  If you want to select subsets of data from Numpy arrays, you could use Numpy's fancy indexing, but you have to understand that.