After a lot of tinkering, I think I was able to get everything working and the project was done in such a way that elements 20+ could be added at a later time (without excessive code like before). I think I learned a lot about functions and iteration in this project and while the drawing itself is not super complex, I learned a lot about functions and debugging. I am also happy that this will be something that I could possibly use in teaching chemistry. |
||
---|---|---|
__pycache__ | ||
.commit_template | ||
README.md | ||
animation.py | ||
drawing.py | ||
drawing2.py | ||
kisspng-electron-configuration-electron-shell-valence-elec-carbon-5b25d50acd2d69.1674249615292060268404.png | ||
orbit_test.py | ||
poetry.lock | ||
pyproject.toml |
README.md
(Drawing project)
This is the description of my drawing project, which will be a Bohr model to show how electrons are arranged in an atom.
Description
For my drawing project, I am going to draw a Bohr model which shows how electrons are arranged in an atom. I selected this project because it ties in coding with my work as a chemistry teacher.
This project will require large circles of varying sizes, and dots/filled in circles for the electrons. Once an initial model has been created, I hope to animate the dots (electrons) to move around the rings in a circular path. Another goal I have would be to enter an input about the symbol of the atom and the animation creates the appropriate atom. I think the initial model and the animation are definitely manageable, and while I have some ideas for making the animation work for atoms with different numbers of electrons, based on user input, I think that may be too involved for this particular project. Here is an image of what I intend to make with the electrons in the rings then moving around the circular path.
Planning
I think my project could be best divided into 3 milestones.
The first would be to create the image of a Bohr model for carbon. This would be a still drawing and would resemble the still image submitted above. I imagine this would include various functions including a function for drawing a ring, a function for drawing the electrons, and a function for drawing the nucleus. Iteration can be included because the image will have multiple electrons, which are the same small filled in circle (dot) appearing over and over again. I may need some assistance here in how to draw a filled in circle, but I will check the turtle library first.
The second milestone will be to try to move the electrons using superturtle. I think this may be a bit trickier, but the drawing would still show the Bohr model even if the animation does not work. I plan to use some of the code used on the superturtle information page on the Making with Code website for this part.
The last milestone (which may be more of a long term goal) would be to add an option to input the name of the element and draw the appropriate drawing based on that. I think this would add quite a bit of complexity, so it may be something I would add later if I end up liking the animation. I think this would involve some if/elif/else statements based on user input, which I have a little bit of familiarity with. I would consider the project successful even if I don't reach this milestone becuase I view it more as an extension of the drawing project.
Feedback
Chris, I love this project and I think the milestone makes sense. For drawing filled shapes (and for other drawing features), make sure you check out the documentation for the turtle library.
I actually don't think that making the electrons move will be very challenging--once you have a function to draw a static representation of a ring with electrons in it, you can just call the function from within a rotation of the frame, as shown in the docs:
for frame in animate(frames=30):
with frame.rotate(0, 90):
square(100)
Let's meet if you get stuck!