Skip to content

Commit

Permalink
Added examples for Exercise 1 (not final)
Browse files Browse the repository at this point in the history
  • Loading branch information
psd committed Feb 19, 2024
1 parent cdd643c commit e3fa5fb
Show file tree
Hide file tree
Showing 11 changed files with 3,637 additions and 0 deletions.
Binary file added Exercise_1/Ag-eos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Exercise_1/Ag.traj
Binary file not shown.
305 changes: 305 additions & 0 deletions Exercise_1/Cu_u3.eam

Large diffs are not rendered by default.

Binary file added Exercise_1/Ni.traj
Binary file not shown.
713 changes: 713 additions & 0 deletions Exercise_1/cnt_atom.data

Large diffs are not rendered by default.

713 changes: 713 additions & 0 deletions Exercise_1/cnt_cu.data

Large diffs are not rendered by default.

850 changes: 850 additions & 0 deletions Exercise_1/exercise-1-solution.ipynb

Large diffs are not rendered by default.

838 changes: 838 additions & 0 deletions Exercise_1/exercise-1-workbook.ipynb

Large diffs are not rendered by default.

126 changes: 126 additions & 0 deletions Exercise_1/exercise9_solution.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f94243a4378b446689751ca2143e94f2",
"version_major": 2,
"version_minor": 0
},
"text/plain": []
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"from ase import Atom\n",
"from ase.io import read\n",
"from ase.visualize import view\n",
"import matplotlib.pyplot as plt\n",
"import nglview as nv"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"def view_structure(system):\n",
" t = nv.ASEStructure(system) \n",
" w = nv.NGLWidget(t, gui=True)\n",
" # w.add_spacefill()\n",
" return w"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"def view_trajectory(trajectory):\n",
" t2 = nv.ASETrajectory(trajectory)\n",
" w2 = nv.NGLWidget(t2, gui=True)\n",
" w2.add_spacefill()\n",
" return w2"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ec427b547fc64fe19a5ca976707664a8",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"NGLWidget()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9c5a2de3e42a48b7993e952c09b76687",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Tab(children=(Box(children=(Box(children=(Box(children=(Label(value='step'), IntSlider(value=1, min=-100)), la…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"struc_38 = read(\"38atoms.xyz\")\n",
"traj_38 = read(\"production_38-pos-1.xyz\")\n",
"view_structure(struc_38) #this works\n",
"#view_trajectory(traj_38) #this not"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
46 changes: 46 additions & 0 deletions Exercise_1/input.lammps
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Initialisation

units metal
atom_style molecular
boundary p p p
pair_style airebo 2.5 1 1
read_data cnt_atom.data
pair_coeff * * CH.airebo C

change_box all x final -40 40 y final -40 40 z final -80 80

group carbon_atoms type 1
variable carbon_xcm equal -1*xcm(carbon_atoms,x)
variable carbon_ycm equal -1*xcm(carbon_atoms,y)
variable carbon_zcm equal -1*xcm(carbon_atoms,z)
displace_atoms carbon_atoms move ${carbon_xcm} ${carbon_ycm} ${carbon_zcm}

variable zmax equal bound(carbon_atoms,zmax)+2.5
variable zmin equal bound(carbon_atoms,zmin)-2.5
region rtop block INF INF INF INF ${zmax} INF
region rbot block INF INF INF INF INF ${zmin}
region rmid block INF INF INF INF ${zmin} ${zmax}
group carbon_top region rtop
group carbon_bot region rbot
group carbon_mid region rmid

# velocity carbon_mid create ${T} 48455 mom yes rot yes

# delete_atoms random fraction 0.005 yes all NULL 482793

fix mynve all nve
compute Tmid carbon_mid temp
fix myber carbon_mid temp/berendsen 1 1000 0.1
fix_modify myber temp Tmid

dump mydmp all atom 1000 dump.lammpstrj

thermo 100
thermo_modify temp Tmid

timestep 0.0005
#run 5000

# 0.15 A/ps = 30 m/s
#velocity carbon_top set NULL NULL 1.5
run 100000
46 changes: 46 additions & 0 deletions Exercise_1/inputcu.lammps
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Initialisation

units metal
atom_style molecular
boundary p p p
pair_style eam
read_data cnt_cu.data
pair_coeff * * Cu_u3.eam

change_box all x final -71.4286 71.4286 y final -71.4286 71.4286 z final -142.8572 142.8572

group carbon_atoms type 1
variable carbon_xcm equal -1*xcm(carbon_atoms,x)
variable carbon_ycm equal -1*xcm(carbon_atoms,y)
variable carbon_zcm equal -1*xcm(carbon_atoms,z)
displace_atoms carbon_atoms move ${carbon_xcm} ${carbon_ycm} ${carbon_zcm}

variable zmax equal bound(carbon_atoms,zmax)+2.5
variable zmin equal bound(carbon_atoms,zmin)-2.5
region rtop block INF INF INF INF ${zmax} INF
region rbot block INF INF INF INF INF ${zmin}
region rmid block INF INF INF INF ${zmin} ${zmax}
group carbon_top region rtop
group carbon_bot region rbot
group carbon_mid region rmid

# velocity carbon_mid create ${T} 48455 mom yes rot yes

# delete_atoms random fraction 0.005 yes all NULL 482793

fix mynve all nve
compute Tmid carbon_mid temp
fix myber carbon_mid temp/berendsen 1 200 0.1
fix_modify myber temp Tmid

dump mydmp all atom 1000 dump.lammpstrj

thermo 100
thermo_modify temp Tmid

timestep 0.0005
#run 5000

# 0.15 A/ps = 30 m/s
#velocity carbon_top set NULL NULL 1.5
run 100000

0 comments on commit e3fa5fb

Please sign in to comment.