Dannnno / Chemistry

Simulation of organic chemistry reactions has been moved here
https://github.com/PyCAOS/CAOS
Other
16 stars 7 forks source link

More scientific representation of bonds/atoms #25

Closed Dannnno closed 9 years ago

Dannnno commented 9 years ago

Right now I am just using dictionaries to store bonds and atoms in a compound. It is working alright so far, but I'd like to have methods as well. I want to adjust to a system like

self.atoms = {'a1': Element('H'), 'a2': Element('O'), 'a3': Element('H')}
self.bonds = {'b1': Bond('a1', 'a2', order=1), 'b2': Bond('a2, 'a3', order=1)}
self.node = {'a1': 'H', 'a2': 'O', 'a3': 'H'}
self.edge = {'a1': {'a2': {key='b1'}}, 'a2': {'a1': {key='b1'}, 'a3': {key='b2'}}, 'a3': {'a2': {key='b2'}}}

where Element and Bond are objects that have all the necessary data and methods.

I'd also like to avoid creating copies of all the periodic table information in each Element instance. I propose using __getattr__ here or using properties that fetch from some global variable

Dannnno commented 9 years ago

Fixed a while back.