r/pythonhelp • • Nov 16 '20

Counting atoms with python

I wish to calculate partial charge in complex (im a chemist)

So my problem is that i have a list : ['H2O','OH','COOH'] for exemple

I need to know the number of occurrences of all atoms. So here 4 for H. My problem is that the number of occurrences is the number of occurrences of the letter describing the atom if no stoechiométric coefficient, and else the number of that coefficient, but the number could appear or not at any place except at position 0.

I don't see how can i make this with python and now i'm quite confused.

Do you have any tips for me?

Thanks for your help and time!

3 Upvotes

15 comments sorted by

View all comments

2

u/heirna Nov 16 '20

Thanks both for your help, I'm going to implement this in my programe and then post it here ,maybe tomorow, (I live in eu) and im quite a slow programer.

Once it's done i will think of how I can integrate double letter elements like Ge or Si.

This program will allow the calculation of the partial charge of any part of a complex according to the partial charge model.

This model allows us to predict the stability of the complex in solution, and if the partial charge is right condensation can occur.

Condensation in solution is used in chemistry to forme oxyde in a solution like glass (SiO2)

This process allows us to bypass the high temperature processe of glass and so we can integrate funny organic molecules in it. It is also verry usful in the formation of athin film like anti glare. We can also make nanoparticule out of this process !

2

u/ace6807 Nov 16 '20

Super cool. Glad to help. If you want me to throw in the lookup for double letters, I don't mind, just let me know. If you'd rather take a crack at implementing it, that's fine too!

1

u/heirna Nov 16 '20

I don't think this will be pertinent in this case since this model is quite simple and quite incorrect next to quantum model. But this makes me back into python and programtion and i will continue to do some compute chemestry with more accurate model ! Its very nice to find a lot of help in reddit !