# getting the center of mass of each part of a molecule

```On Thursday, May 18, 2017 at 2:44:54 PM UTC-7, qasi... at gmail.com wrote:
> Yes, I wrote: "The atoms of the first part/half according to the main COM of the ligand are C2, C7, C8 and C9. As for the second part they are C3, C4, C5 and C6 atoms." It was just an example. In fact, I don't know which atoms belong to each half. The code should do it of course.
>
> That is, I gave it as an example. I thought someone can understand what the two parts of molecule are and what I am trying to do if I give such an example.

We are going in circles.

Do you want your code to AUTOMATICALLY make the decision that atoms 2, 7, 8, and 9 comprise one "half" of your molecule, and atoms 3, 4, 5, and 6 comprise the other "half"?  Then you need criteria, that you can turn into code.

You said you wanted to exclude "the" atom which is nearest to the center of mass from either subset.  (What if there's a tie?  As in fact there could be, if you allowed for all the possible rotamers in the C2-C7 and C7-C8 bonds?)  You also stated that you wanted the code "to find which atoms belong to each half."  You still don't say HOW you choose halves.  ONE example is obviously not enough to determine a general pattern.  There is no "right" answer to the question, "which half of the molecule is this?"  A human can't figure it out.  A computer can't figure it out.  If you don't know what you mean, we can't help you.

(This link is relevant: http://dilbert.com/strip/2006-01-29)

Where are you getting this problem?  Do you have a reference of any kind?  I am actually interested in your problem, because I do computational chemistry as well as program in Python.

Alternately: could a user manually enter the subset information into the computer at a prompt?  Then, you don't need code to do anything except select the subsets that the user wants.  That's considerably easier.

Maybe you should start there.  Write code which lets the user name the atoms in the two subsets (possibly after automatically excluding "the central atom").  Make the code modular, so that you can go back later and add a function to automatically create the two subsets -- once you know what you actually want.

```