The last line of your function already calculates a center of mass for all atoms.
How can you separate out that calculation into its own (one-line) function? How can you send just a subset of your data to that new function? -- https://mail.python.org/mailman/listinfo/python-list