Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
849ff70
Updated the maths operators lesson.
Jul 10, 2025
e5274ed
updated mathematical-operators lesson
Jul 10, 2025
9ebc4f8
fixed it
Jul 10, 2025
752f3b8
fixed it again
Jul 10, 2025
590f781
Removed import NumPy, added floored division, and cleaned.
Jul 11, 2025
12803d1
Pointed to info on importing modules
mParkesUCL Jul 11, 2025
804903b
Split comparisons and conditions and renamed files, updated TOC to re…
Jul 11, 2025
ee7883d
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Jul 11, 2025
2053c04
Split comparisons and conditions and finished editing. Created a new …
Jul 14, 2025
f3b3f61
Trim and proofread
m-rivera Jul 15, 2025
f3a6cae
Fixed some errors due to header levels
mParkesUCL Jul 15, 2025
689c049
Made code answers visible in dark mode, started editing for loops les…
Jul 15, 2025
d69b3dc
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Jul 15, 2025
f45288e
Updated the for loops lesson - added sections on range(), zip, enumer…
Jul 16, 2025
d322e15
Fixed some typos
mParkesUCL Jul 17, 2025
1dccd22
correct commit
Jul 17, 2025
1a97da1
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Jul 17, 2025
e1191ab
Clean up a few typos and formatting things
mParkesUCL Jul 17, 2025
a82453f
Updated functions lessons - added sections on multiple returns, multi…
Jul 21, 2025
8fdc89a
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Jul 21, 2025
9d887f7
Updated the reading files lesson to include split(), readline(), and …
Jul 28, 2025
fb6d181
Edit the writing files lesson. Include more explanation, examples usi…
Jul 30, 2025
6b15c84
formatted the mathematical operators lesson
Aug 1, 2025
c4b4fa8
formatted comparisons and conditional statements lessons
Aug 1, 2025
a94edf4
rename variables and close dropdowns
m-rivera Aug 4, 2025
809774b
Added links and fixed Header error (H1-H3)
mParkesUCL Aug 4, 2025
a56f6a4
Fixed anchor link
mParkesUCL Aug 4, 2025
0a91506
applied formatting to for loop lesson
Aug 4, 2025
c610f04
format for loop lesson
Aug 4, 2025
f12b932
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Aug 4, 2025
b12e137
Moved basics.md to more logical place
mParkesUCL Aug 4, 2025
b33445f
Added some more text on basics
mParkesUCL Aug 4, 2025
3469a7e
Updated installation of python
mParkesUCL Aug 4, 2025
83db84c
Neatened up file structure, expanded getting started to have more opt…
mParkesUCL Aug 4, 2025
1402008
More options on how to work with python
mParkesUCL Aug 4, 2025
f568726
Added code examples
mParkesUCL Aug 4, 2025
fe26fe5
some work on errors and debugging
Aug 4, 2025
979abd6
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Aug 4, 2025
f621695
edited the functions lesson, added formatting, corrected errors
Aug 5, 2025
5e5175b
format files and minor edits. created format guide.
Aug 6, 2025
ce817d7
argparse
Aug 6, 2025
880ebbf
argparse
Aug 6, 2025
226335b
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Aug 7, 2025
8cac158
minor edits
Aug 7, 2025
ac73525
Minor typos and wording
mParkesUCL Aug 8, 2025
f47e70f
edits
Aug 8, 2025
f1b6e43
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Aug 8, 2025
e7ed178
Fixed headers
mParkesUCL Aug 8, 2025
62c5a69
updated image for code in anaconda
mParkesUCL Aug 8, 2025
1e72231
Moved file into folder
mParkesUCL Aug 8, 2025
fd0662f
Created short explanation of how to install a library
mParkesUCL Aug 8, 2025
9b0ea0f
Expanded Navigator instructions for package management
mParkesUCL Aug 8, 2025
73cdf0c
typo
mParkesUCL Aug 8, 2025
81c2c03
Some minor corrections to math_opers
mParkesUCL Aug 18, 2025
22177f1
minor fixes and typos to conditional lesson
mParkesUCL Aug 18, 2025
5ad5157
Swapped enumerate and zipped to try and show why zipped might be useful
mParkesUCL Aug 18, 2025
a20141b
moved flowchart image into image folder
mParkesUCL Aug 18, 2025
76a7e5d
point image to correct place
mParkesUCL Aug 18, 2025
4c9953f
moved other images
mParkesUCL Aug 18, 2025
d83b611
fixed benzoate link
mParkesUCL Aug 18, 2025
7146c18
really fixed image link
mParkesUCL Aug 18, 2025
e37e319
Tweaks to while
mParkesUCL Aug 18, 2025
66d421d
minor tweaks functions
mParkesUCL Aug 18, 2025
91e71f6
more minor
mParkesUCL Aug 18, 2025
b97fd71
Filled in worked code example
mParkesUCL Aug 18, 2025
4b08e25
Added good function practise
mParkesUCL Aug 18, 2025
7e95ab9
Matplotlib updates
Aug 18, 2025
53dc8e2
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Aug 18, 2025
c2062db
Clean up of images
mParkesUCL Aug 19, 2025
e7493c7
Tidied up jupyter using and added prerequiste links to while loops
mParkesUCL Aug 19, 2025
cde1b53
Fixed download format
mParkesUCL Aug 19, 2025
fc69735
Finished matplotlib pyplot lesson.
Aug 20, 2025
1f80847
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Aug 20, 2025
9f1aefb
Moved download file
mParkesUCL Aug 21, 2025
e41125e
Added prerequistie link and download link for CV data
mParkesUCL Aug 21, 2025
ef2c388
file and file types lesson updated, diagrams and images added. for lo…
Aug 21, 2025
984281b
while loops, spelling checks, and almost finished style guide
Aug 22, 2025
4b06d3a
while loops, spelling checks, and almost finished style guide
Aug 22, 2025
696ed59
style
Aug 22, 2025
ec20d80
moved file
mParkesUCL Sep 3, 2025
5c4a5a3
Moved files
mParkesUCL Sep 3, 2025
ee54fbb
redirected toc to moved files
mParkesUCL Sep 3, 2025
7eb8456
Merging errors and debugging lessons
mParkesUCL Sep 3, 2025
0ecd78f
Add initial lessons
m-rivera Sep 3, 2025
7055572
remove debug from toc
mParkesUCL Sep 4, 2025
c8e1cec
Debugging example with vscode
mParkesUCL Sep 4, 2025
6df3861
Finished debugging with vscode
mParkesUCL Sep 4, 2025
5e0d07d
Typo and added prereq and outcomes
mParkesUCL Sep 4, 2025
0778dc3
Improved flow of writing example
mParkesUCL Sep 4, 2025
83c3027
Final move of files
mParkesUCL Sep 5, 2025
eff9744
redirect toc to moved files
mParkesUCL Sep 5, 2025
1e85186
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Sep 14, 2025
ee68ecb
Added some further info stuff
mParkesUCL Sep 15, 2025
9ca02e4
Add num errors title
mParkesUCL Sep 15, 2025
dd831bb
make initial lessons presentable
m-rivera Sep 22, 2025
b95b6f8
bringing in Miguel's variables lesson and linking
mParkesUCL Sep 22, 2025
3de0e9b
command line stuff
mParkesUCL Sep 23, 2025
6765857
cli tutorial
mParkesUCL Sep 23, 2025
6cb3631
Fixed some typos - backporting from UCL_lessons
mParkesUCL Oct 1, 2025
1767a99
fixed H and O instead of mass_H and mass_O
mParkesUCL Oct 1, 2025
3ba717a
correct Na Cl example
m-rivera Oct 1, 2025
f77976a
style + comments
Oct 7, 2025
cd189e7
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
Oct 7, 2025
6e6eac3
Added link to f string specifers
mParkesUCL Oct 8, 2025
963ef7f
Merge branch 'publish_lessons' of https://github.com/mParkesUCL/pytho…
mParkesUCL Oct 8, 2025
4833899
Sliding typo fixed
mParkesUCL Oct 8, 2025
ff73e0a
Added zip for file downloads
mParkesUCL Oct 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

title: Python in Chemistry
author: The Python in Chemistry Community
copyright: "2025"

# logo: ./logo/logo.png

# Force re-execution of notebooks on each build.
Expand Down
41 changes: 29 additions & 12 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,53 @@ root: intro
parts:
- caption: Python Lessons
chapters:
- file: lessons/basics.md
- file: lessons/basics/basics.md
sections:
- file: lessons/basics/write_run_python.md
- file: lessons/basics/notebook.md
- file: lessons/manipulating_variables.md
- file: lessons/basics/using_jupyter_notebook.md
- file: lessons/basics/python_introduction.ipynb
- file: lessons/variables/manipulating_variables.md
sections:
- file: lessons/variables/Variable_data_types.ipynb
- file: lessons/variables/mathematical-operators.ipynb
- file: lessons/variables/Conditions.ipynb
- file: lessons/organising_code.md
- file: lessons/variables/lists_and_indexing.ipynb
- file: lessons/variables/mathematical_operators.ipynb
- file: lessons/variables/Comparisons.ipynb
- file: lessons/loops_functions/organising_code.md
sections:
- file: lessons/loops_functions/For_Loop_Lesson.ipynb
- file: lessons/loops_functions/PyinC_while_loops_WIP.ipynb
- file: lessons/loops_functions/conditional_statements.ipynb
- file: lessons/loops_functions/for_loops.ipynb
- file: lessons/loops_functions/while_loops.ipynb
- file: lessons/loops_functions/functions_and_scope.ipynb
- file: lessons/files.md
- file: lessons/loops_functions/tut_import_mod.ipynb
- file: lessons/files/files.md
sections:
- file: lessons/files/files_file_types.ipynb
- file: lessons/files/reading_files.ipynb
- file: lessons/files/writing_files.ipynb
- file: lessons/common_libraries.md
- file: lessons/solving_problems/solving-problems.md
sections:
- file: lessons/common_libs/python-in-chem_pyplot_basics_SM.ipynb
- file: lessons/solving_problems/errors_and_debug.ipynb
- file: lessons/solving_problems/writing_a_program.ipynb
- file: lessons/solving_problems/version_control.ipynb
- file: lessons/solving_problems/command_line.md
- file: lessons/solving_problems/flowcharts.ipynb
- file: lessons/solving_problems/style-and-comments.ipynb
- file: lessons/common_libs/common_libraries.md
sections:
- file: lessons/common_libs/matplotlib_pyplot_basics.ipynb
- file: lessons/common_libs/Matplotlib_Documentation.ipynb
- file: lessons/common_libs/Introduction_to_NumPy.ipynb
- file: lessons/common_libs/NumPy_axes_operations.ipynb
- file: lessons/common_libs/argparse.ipynb
- file: lessons/common_libs/intro_to_pandas.ipynb
- file: lessons/advanced_libraries.md
- file: lessons/advanced_libs/advanced_libraries.md
sections:
- file: lessons/advanced_libs/Intro_to_ASE.ipynb
- file: lessons/advanced_libs/PiC_scipy.ipynb
- file: lessons/advanced_libs/RDKit_drawing.ipynb
- file: lessons/further_info/further_info.md
sections:
- file: lessons/further_info/numerical_errors.ipynb
- caption: Teaching Python in Chemistry Meeting Blogs
chapters:
- file: 2025-meeting
Expand Down
2 changes: 1 addition & 1 deletion lessons/advanced_libs/Intro_to_ASE.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "1639ee9d-703b-4c01-9a65-45d2a84cf4b0",
"metadata": {},
"source": [
"## The Atomic Simulation Environment, ASE"
"# The Atomic Simulation Environment, ASE"
]
},
{
Expand Down
84 changes: 84 additions & 0 deletions lessons/advanced_libs/RDKit_drawing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,90 @@
"Draw.MolToImage(m)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-success\"><b>Task 5: Using loops</b> \n",
"\n",
"When chemists want to store molecular structures in a computer they can store in an encoded way called SMILES strings. You don't need to understand what these mean but just to know that libraries that can handle chemical structure can read them. The code below will import the RDKit package and print the structure of benzoic acid. The code works by passing the SMILES string for benzoic acid to the function display_molecule that then draws it out. Check out the functions lesson if you want to understand more about functions, but for this lesson all you just need to follow the syntax below.\n",
"\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from rdkit import Chem\n",
"\n",
"def display_molecule (smiles_string):\n",
" mol = Chem.MolFromSmiles(smiles_string)\n",
" img=Chem.Draw.MolToImage(mol)\n",
" display(img)\n",
"\n",
"# display the structure of benzoic acid\n",
"benzoic_acid_miles = \"C1=CC=C(C=C1)C(=O)O\"\n",
"display_molecule(benzoic_acid_miles)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-success\"><b>Task 5 continued</b> \n",
"Now you know how to print one molecule lets use your understanding of for loops to print lots of molecules. Here are a list of the smiles strings of some interesting molecules, Dolutegravir a very important anti-hiv drug, Atovaquone which treats malaria and paclitaxol that is an important \n",
"\n",
"\n",
"<div>\n",
"<ul>\n",
"<li>C[C@@H]1CCO[C@@H]2N1C(=O)C3=C(C(=O)C(=CN3C2)C(=O)NCC4=C(C=C(C=C4)F)F)O\n",
"<li>C1CC(CCC1C2=CC=C(C=C2)Cl)C3=C(C4=CC=CC=C4C(=O)C3=O)O\n",
"<li>CC1=C2[C@H](C(=O)[C@@]3([C@H](C[C@@H]4[C@]([C@H]3[C@@H]([C@@](C2(C)C)(C[C@@H]1OC(=O)[C@@H]([C@H](C5=CC=CC=C5)NC(=O)C6=CC=CC=C6)O)O)OC(=O)C7=CC=CC=C7)(CO4)OC(=O)C)O)C)OC(=O)C\n",
"</ul>\n",
" \n",
"</div>\n",
"\n",
"Using the concepts above write a for loop that will draw the structrue of all 3 molecules. You need to:\n",
"- define a list of the smiles strings\n",
"- loop through the list and display each molecule using the display_molecule function\n",
"\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"molecule_smiles = ['C[C@@H]1CCO[C@@H]2N1C(=O)C3=C(C(=O)C(=CN3C2)C(=O)NCC4=C(C=C(C=C4)F)F)O',\n",
"'C1CC(CCC1C2=CC=C(C=C2)Cl)C3=C(C4=CC=CC=C4C(=O)C3=O)O',\n",
"'CC1=C2[C@H](C(=O)[C@@]3([C@H](C[C@@H]4[C@]([C@H]3[C@@H]([C@@](C2(C)C)(C[C@@H]1OC(=O)[C@@H]([C@H](C5=CC=CC=C5)NC(=O)C6=CC=CC=C6)O)O)OC(=O)C7=CC=CC=C7)(CO4)OC(=O)C)O)C)OC(=O)C']\n",
"\n",
"for smiles in molecule_smiles:\n",
" display_molecule(smiles)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<details><summary {style='color:beige;font-weight:bold'}> Click here to see a possible solution to Task 5 </summary>\n",
"\n",
"\n",
"```Python\n",
"molecule_smiles = ['C[C@@H]1CCO[C@@H]2N1C(=O)C3=C(C(=O)C(=CN3C2)C(=O)NCC4=C(C=C(C=C4)F)F)O',\n",
"'C1CC(CCC1C2=CC=C(C=C2)Cl)C3=C(C4=CC=CC=C4C(=O)C3=O)O',\n",
"'CC1=C2[C@H](C(=O)[C@@]3([C@H](C[C@@H]4[C@]([C@H]3[C@@H]([C@@](C2(C)C)(C[C@@H]1OC(=O)[C@@H]([C@H]>>>(C5=CC=CC=C5)NC(=O)C6=CC=CC=C6)O)O)OC(=O)C7=CC=CC=C7)(CO4)OC(=O)C)O)C)OC(=O)C']\n",
"\n",
"for smiles in molecule_smiles:\n",
" display_molecule(smiles)\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down
3 changes: 0 additions & 3 deletions lessons/basics.md

This file was deleted.

9 changes: 9 additions & 0 deletions lessons/basics/basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Getting Started with Python

Here, you will find how to start running Python.

## What is Python

[Python](https://en.wikipedia.org/wiki/Python_(programming_language)) is a high-level interpreted language that is widely used. This means it is written in a way that is close to standard English, reducing complexity for the programmer.

Due to this popularity there are many ways to install and to use it. In the following sections we will guide you on how to install and use Python
Loading