exercises:2017_ethz_mmm:pythonmd
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| exercises:2017_ethz_mmm:pythonmd [2017/03/03 05:26] – dpasserone | exercises:2017_ethz_mmm:pythonmd [2020/08/21 10:15] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== 38 atom Lennard-Jones cluster: molecular dynamics with python ====== | ====== 38 atom Lennard-Jones cluster: molecular dynamics with python ====== | ||
| + | ===== | ||
| + | In this exercise you will perform molecular dynamics with a python program that you may inspect and modify directly. Then, you will perform the same kind of dynamics using cp2k and compare the performance. ===== | ||
| + | |||
| + | |||
| + | <note tip> | ||
| + | All files of this exercise be downloaded from the wiki: {{e2_bis.zip|}} | ||
| + | Download the exercise into your $HOME folder and unzip it. | ||
| + | |||
| + | < | ||
| + | you@eulerX ~$ wget http:// | ||
| + | you@eulerX ~$ unzip exercises: | ||
| + | you@eulerX ~$ cd exercise_2 | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | |||
| <note tip>The instructions for loading the appropriate modules in .bashrc: | <note tip>The instructions for loading the appropriate modules in .bashrc: | ||
| < | < | ||
| Line 21: | Line 37: | ||
| - | In the repository you will find the program “**md.py**” and the geometry file “**fcc.xyz**” | + | In the repository you will find the program “**md.py**” and the geometry file “**fcc_r.xyz**” |
| The program md.py can perform a MD simulation for a system of Ar atoms interacting via Lennard-Jones potential. | The program md.py can perform a MD simulation for a system of Ar atoms interacting via Lennard-Jones potential. | ||
| Line 59: | Line 75: | ||
| <note warning> | <note warning> | ||
| - | - Execute the program with input parameters: | + | - **TASK 1** Execute the program with input parameters: |
| * 0.5 as timestep | * 0.5 as timestep | ||
| * 1000 as total number of steps | * 1000 as total number of steps | ||
| Line 67: | Line 83: | ||
| Is the temperature of the system conserved? | Is the temperature of the system conserved? | ||
| - | - Execute the program with input parameters | + | - **TASK 2** Execute the program with input parameters |
| * 1.8 as timestep | * 1.8 as timestep | ||
| * 1000 as total number of steps | * 1000 as total number of steps | ||
| Line 96: | Line 112: | ||
| prints=“False”</ | prints=“False”</ | ||
| execute three or four times the program and write down the execution time that you get as the only output. | execute three or four times the program and write down the execution time that you get as the only output. | ||
| - | Now comment the lines for the “efficient” algorithm and uncomment the lines of the ”unefficient” one. Execute | + | Now comment the lines for the “efficient” algorithm and uncomment the lines of the ”unefficient” one. Execute 3-4 times. |
| Is the execution time longer? Why do you think you get such a result? | Is the execution time longer? Why do you think you get such a result? | ||
| <note warning> | <note warning> | ||
| - | - Initializing randomly the velocities of a finite system, the system will have a non zero total linear momentum and total angular momentum. | + | - **TASK 3** Initializing randomly the velocities of a finite system, the system will have a non zero total linear momentum and total angular momentum. |
| In the code we remove the total linear momentum after the initialization. | In the code we remove the total linear momentum after the initialization. | ||
| Line 106: | Line 122: | ||
| </ | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Molecular dynamics using CP2K ====== | ||
| + | In this second part of the exercise, the same kind of dynamics will be performed with **cp2k**. You will find in the repository (zip file) the input file **md.inp**, where the **& | ||
| + | |||
| + | < | ||
| + | &MOTION | ||
| + | |||
| + | & | ||
| + | &END | ||
| + | & | ||
| + | &EACH | ||
| + | MD 5000 | ||
| + | &END | ||
| + | &END | ||
| + | & | ||
| + | &EACH | ||
| + | MD 100 | ||
| + | &END | ||
| + | &END | ||
| + | &END | ||
| + | &MD | ||
| + | ENSEMBLE NVE | ||
| + | STEPS 10000 | ||
| + | TIMESTEP 0.5 | ||
| + | TEMPERATURE 10.0 | ||
| + | &END MD | ||
| + | &END MOTION | ||
| + | </ | ||
| + | |||
| + | <note important> | ||
| + | - Run the code | ||
| + | < | ||
| + | > cp2k.popt -i md.inp > md.out | ||
| + | </ | ||
| + | Compare the performance with the one of the python code. What do you notice? | ||
| + | Plot the energy by using the file **MD-1.ener** and **gnuplot** | ||
| + | - What is the value of the total energy? Is it conserved? | ||
| + | - Increase the time step to 3 fs, and run it again. What happens to the total energy? | ||
| + | - Note: to visualize a trajectory you can use the code (look inside it!) traj.py in the directory: | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | <note warning> | ||
exercises/2017_ethz_mmm/pythonmd.1488518792.txt.gz · Last modified: (external edit)
