exercises:2017_ethz_mmm:lennard_jones_cluster
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
exercises:2017_ethz_mmm:lennard_jones_cluster [2017/02/22 06:14] – external edit 127.0.0.1 | exercises:2017_ethz_mmm:lennard_jones_cluster [2020/08/21 10:15] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== 38 atom Lennard-Jones cluster ====== | ====== 38 atom Lennard-Jones cluster ====== | ||
+ | |||
+ | {{: | ||
<note warning> | <note warning> | ||
TO USE THE FUNCTION LIBRARY (VERSION UP TO DATE) IN THE INTERACTIVE SHELL: | TO USE THE FUNCTION LIBRARY (VERSION UP TO DATE) IN THE INTERACTIVE SHELL: | ||
Line 16: | Line 18: | ||
</ | </ | ||
- | **and to submit the job:** | + | **and to submit the job (note: since all the examples of this week are ultrafast, we will run them interactively, |
< | < | ||
- | you@eulerX ~$ bsub < jobname | + | you@eulerX ~$ cp2k.popt -i file.inp -o file.out |
</ | </ | ||
</ | </ | ||
Line 31: | Line 33: | ||
<note tip> | <note tip> | ||
- | All files of this exercise | + | All files of this exercise be downloaded from the wiki: {{exercise_1.1.zip|}} |
</ | </ | ||
- | In this exercise you will test the Lennard-Jones potential. Login to euler using your nethz credentials. | + | In this exercise you will test the Lennard-Jones potential. |
- | Then go to the directory " | + | <note tip> |
+ | </ | ||
+ | Login to euler using your nethz credentials. | ||
+ | Then go to the directory " | ||
< | < | ||
- | you@eulerX ~$ cd exercise_1.1/38/ | + | you@eulerX ~$ cd exercise_1.1 |
- | </ | + | |
- | The input file structure of the template is the following: | + | |
- | <code - c2h2.inp.templ> | ||
- | & | ||
- | METHOD FIST ! Using Molecular Mechanics | ||
- | &MM | ||
- | & | ||
- | parm_file_name c2h2.top | ||
- | ! This file contains force field parameters (topology file) | ||
- | parmtype AMBER | ||
- | & | ||
- | EMAX_SPLINE 15.0 ! Specify the maximum value of the potential up to which splines will be constructed | ||
- | &END | ||
- | &END FORCEFIELD | ||
- | & | ||
- | & | ||
- | EWALD_TYPE SPME ! Smooth particle mesh using beta-Euler splines | ||
- | ALPHA .36 | ||
- | GMAX 128 ! Number of grid points | ||
- | &END EWALD | ||
- | &END POISSON | ||
- | & | ||
- | & | ||
- | &END | ||
- | & | ||
- | &END | ||
- | &END | ||
- | &END MM | ||
- | & | ||
- | & | ||
- | ABC 50 50 50 ! Lengths of the cell vectors A, B, and C | ||
- | &END CELL | ||
- | & | ||
- | H 0 0 0 | ||
- | C | ||
- | C | ||
- | H | ||
- | & | ||
- | & | ||
- | CHARGE_BETA | ||
- | CONNECTIVITY AMBER ! Use AMBER topology file for reading connectivity | ||
- | CONN_FILE_NAME c2h2.top | ||
- | ! This file contains connectivity data | ||
- | &END TOPOLOGY | ||
- | |||
- | & | ||
- | AMBER_INFO | ||
- | &END | ||
- | &END | ||
- | &END SUBSYS | ||
- | &END FORCE_EVAL | ||
- | & | ||
- | PRINT_LEVEL LOW ! Global print level | ||
- | PROJECT c2h2 ! Name of the project. This word will appear as part of a name of all ouput files (except main ouput file, specified with -o option) | ||
- | RUN_TYPE ENERGY | ||
- | &END GLOBAL | ||
</ | </ | ||
+ | ===== Geometry optimization | ||
+ | In this first part you will perform a simple energy optimization, | ||
- | The script to modify the C-C distance in the input and generate | + | The input file structure of the template |
- | + | ||
- | <code bash c2h2.chain> | + | |
- | # | + | |
- | # task 2.1 C2H2 bond strength | + | |
- | # | + | |
- | # the distances of equilibrium | + | |
- | # and increment delta | + | |
- | # | + | |
- | dist_cc0=1.181 | + | |
- | dist_hc=1.066 | + | |
- | delta=0.0002 | + | |
- | + | ||
- | # | + | |
- | # loads the functions | + | |
- | # this script uses the functions: m_change m_replace m_getcolumn m_sum m_list | + | |
- | # | + | |
- | module load cp2k | + | |
- | . / | + | |
- | + | ||
- | + | ||
- | # | + | |
- | # deletes old output file | + | |
- | # | + | |
- | rm curve.amber.c2h2 | + | |
- | + | ||
- | # | + | |
- | # loop over all values of n | + | |
- | # | + | |
- | + | ||
- | for n in `m_list -5 5` | + | |
- | do | + | |
- | dist_cc=`m_change $dist_cc0 $n $delta` | + | |
- | c2=`m_sum $dist_hc $dist_cc` | + | |
- | h2=`m_sum $c2 $dist_hc ` | + | |
- | # | + | |
- | # replaces coordinates in the input | + | |
- | # | + | |
- | m_replace _C1_ $dist_hc < c2h2.inp.templ | m_replace _C2_ $c2 | m_replace _H2_ $h2 > c2h2.$dist_cc.inp | + | |
- | # | + | |
- | # Runs cp2k | + | |
- | # | + | |
- | echo RUNNING cp2k with the input c2h2.$dist_cc.inp | + | |
- | # bsub -n 1 mpirun cp2k.popt -i c2h2.$dist_cc.inp > c2h2.$dist_cc.out | + | |
- | cp2k.popt -i c2h2.$dist_cc.inp > c2h2.$dist_cc.out | + | |
- | # | + | |
- | # gets the energy from the output (in a.u.) | + | |
- | # | + | |
- | energy=` m_getcolumn ' | + | |
- | echo $dist_cc $energy | + | |
- | # | + | |
- | # loop over n | + | |
- | # | + | |
- | done | + | |
- | + | ||
- | # | + | |
- | # Cleaning... | + | |
- | # | + | |
- | mkdir Logs | + | |
- | mv c2h2.*.inp c2h2.*.out Logs | + | |
- | rm RUN* *restart* | + | |
+ | <code - geo_opt.inp> | ||
+ | &GLOBAL | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | &END GLOBAL | ||
+ | &MOTION | ||
+ | & | ||
+ | OPTIMIZER BFGS | ||
+ | MAX_ITER | ||
+ | MAX_DR | ||
+ | RMS_DR | ||
+ | MAX_FORCE 0.0001 | ||
+ | RMS_FORCE 0.00003 | ||
+ | &BFGS | ||
+ | | ||
+ | &END BFGS | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | | ||
+ | & | ||
+ | GEO_OPT 1 | ||
+ | & | ||
+ | &END TRAJECTORY | ||
+ | & | ||
+ | &END MOTION | ||
+ | & | ||
+ | | ||
+ | | ||
+ | & | ||
+ | & | ||
+ | &CHARGE | ||
+ | ATOM Ar | ||
+ | CHARGE 0.0 | ||
+ | &END | ||
+ | & | ||
+ | & | ||
+ | atoms Ar Ar | ||
+ | EPSILON 119.8 | ||
+ | SIGMA 3.405 | ||
+ | RCUT 8.4 | ||
+ | &END LENNARD-JONES | ||
+ | &END NONBONDED | ||
+ | &CHARGE | ||
+ | ATOM Kr | ||
+ | CHARGE 0.0 | ||
+ | &END CHARGE | ||
+ | &END FORCEFIELD | ||
+ | & | ||
+ | | ||
+ | & | ||
+ | EWALD_TYPE none | ||
+ | & | ||
+ | &END POISSON | ||
+ | |||
+ | & | ||
+ | SPLINE_DATA | ||
+ | SPLINE_INFO | ||
+ | & | ||
+ | &END PRINT | ||
+ | & | ||
+ | & | ||
+ | &FORCES off | ||
+ | &END FORCES | ||
+ | & | ||
+ | &END GRID_INFORMATION | ||
+ | & | ||
+ | & | ||
+ | GEO_OPT 1 | ||
+ | & | ||
+ | &END PROGRAM_RUN_INFO | ||
+ | & | ||
+ | & | ||
+ | GEO_OPT 1 | ||
+ | & | ||
+ | &END STRESS_TENSOR | ||
+ | & | ||
+ | & | ||
+ | &CELL | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | &END CELL | ||
+ | & | ||
+ | COORD_FILE_NAME in.xyz | ||
+ | COORDINATE xyz | ||
+ | &END | ||
+ | |||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | &END PRINT | ||
+ | & | ||
+ | &END FORCE_EVAL | ||
+ | | ||
</ | </ | ||
+ | <note important> | ||
+ | **1 Hartree=27.2114 eV**. | ||
+ | In the input file, the epsilon value (depth of the well) is expressed in KT units, namely, in " | ||
+ | </ | ||
+ | <note tip> | ||
+ | - load the module with the special m_* bash functions and initialize the module: < | ||
+ | - randomize the coordinate files **fcc.xyz** | ||
+ | - extract the q4 order parameter from **fcc.xyz** and from **fcc_rand.xyz** and compare the values.< | ||
+ | python stein.py file.xyz </ | ||
+ | - before running the simulation, copy the input coordinate file into in.xyz < | ||
+ | - run cp2k < | ||
+ | - in the output file, note the final energy, **transform it in the unit of the paper (epsilon units)** | ||
+ | - load vmd module and play with the optimization trajectory < | ||
+ | - apply the script **myq4** to the optimization trajectory: this generates a list of q4 and energies for the whole trajectory. < | ||
+ | - plot q4 and energies with **gnuplot** (ask the teacher) | ||
+ | - have a look at the myq4 script < | ||
+ | - repeat for the ico.xyz starting point, don't forget to first copy/remove the files appropriately. For example: < | ||
+ | - finally, run the bash script < | ||
+ | </ | ||
- | At this point submit the job grid, first loading the module for cp2k entering | ||
- | < | ||
- | you@eulerX c2h2$ module load cp2k | ||
- | you@eulerX c2h2$ bsub < c2h2.chain | ||
- | </ | ||
- | |||
- | |||
- | |||
- | Finally, the gnuplot code to fit the curve to a parabolic function - and to extract the parameters of the bond interaction is the following | ||
- | |||
- | < | ||
- | you@eulerX c2h2$ gnuplot fit.gnu | ||
- | </ | ||
- | |||
- | <code - fit.gnu> | ||
- | # | ||
- | f(x)=k*(x-x0)*(x-x0)+e0 | ||
- | delta = 0.002 # | ||
- | e0=0.007720330647107 | ||
- | k = 500 # initial value of k | ||
- | x0=1 # initial value of x0 | ||
- | #a0 = 1.3327436840 | ||
- | set xlabel 'd (Angstrom)' | ||
- | set ylabel 'E (kcal/ | ||
- | set title "c2h2 triple bond" | ||
- | |||
- | fit f(x) ' | ||
- | # fitting procedure | ||
- | # ^ function to be fitted | ||
- | # ^ take data from the file curve.a.c2h2 | ||
- | # and use the first column as X and the second one | ||
- | # ax Y (all values of the second column are multiplied by 627. 1 Hartree = 627 kcal/mol) | ||
- | # ^ k, x0, e0 - are parameters to be adjusted | ||
- | |||
- | plot ' | ||
- | # ^ take data for the first plot from the file curve.a.c2h2 | ||
- | # ^ use the firts column as X and the second as Y | ||
- | # ^ title of the first plot: computed AMBER | ||
- | # ^ draw points and lines | ||
- | # ^ line width = 2 | ||
- | # ^ point size = 2 | ||
- | # ^ point type = 7 | ||
- | # ^ plot function f(x)-e0 | ||
- | # ^ title of the second plot: k*(x-x0)^2 | ||
- | # ^ draw only line | ||
- | # ^ line width = 2 | ||
- | |||
- | |||
- | pause mouse # exit by right-clicking on the plot window | ||
- | # EOF | ||
- | </ | ||
- | |||
- | Compare the values that you obtain with the ones listed in the "human readable" | ||
- | |||
- | Now, perform the same exercise in another directory for the molecule C2H4. | ||
- | < | ||
- | you@eulerX c2h2$ cd ../c2h4 | ||
- | </ | ||
- | |||
- | * The new input c2h4.inp.templ is similar to the previous one, only with different project name (C2H4) and coordinates: | ||
- | |||
- | <code coo.ch4> | ||
- | H 0 3.06 0 | ||
- | H 0 4.94 0 | ||
- | C _C1_ 4.0 0 | ||
- | C _C2_ 4.0 0 | ||
- | H _H3_ 3.06 0 | ||
- | H _H3_ 4.94 0 | ||
- | </ | ||
- | |||
- | * The script to modify the bond lengths changes slightly as well | ||
- | |||
- | <code bash c2h4.chain> | ||
- | # | ||
- | # task 2.2 C2H4 bond strength | ||
- | # | ||
- | # the initial deltax of C, C, H, H | ||
- | # and increment delta | ||
- | # | ||
- | dist_hcx=0.560 | ||
- | dist_cc0=1.324 | ||
- | delta=0.002 | ||
- | |||
- | # | ||
- | # loads the functions | ||
- | # this script uses the functions: m_change m_replace m_getcolumn m_sum m_list | ||
- | # | ||
- | module load cp2k | ||
- | #. ~/ | ||
- | . / | ||
- | |||
- | |||
- | # | ||
- | # deletes old output file | ||
- | # | ||
- | rm curve.amber.c2h4 | ||
- | |||
- | # | ||
- | # loop over all values of n | ||
- | # | ||
- | |||
- | for n in `m_list -5 5` | ||
- | do | ||
- | dist_cc=`m_change $dist_cc0 $n $delta` | ||
- | c2=`m_sum $dist_hcx $dist_cc` | ||
- | h3=`m_sum $c2 $dist_hcx ` | ||
- | # | ||
- | # replaces coordinates in the input | ||
- | # | ||
- | m_replace _C1_ $dist_hcx < c2h4.inp.templ | m_replace _C2_ $c2 | m_replace _H3_ $h3 > c2h4.$dist_cc.inp | ||
- | # | ||
- | # Runs cp2k | ||
- | # | ||
- | echo RUNNING cp2k with the input c2h4.$dist_cc.inp | ||
- | cp2k.popt -i c2h4.$dist_cc.inp > c2h4.$dist_cc.out | ||
- | # | ||
- | # gets the energy from the output (in a.u.) | ||
- | # | ||
- | energy=` m_getcolumn ' | ||
- | echo $dist_cc $energy | ||
- | # | ||
- | # loop over n | ||
- | # | ||
- | done | ||
- | |||
- | # | ||
- | # Cleaning... | ||
- | # | ||
- | mkdir Logs | ||
- | mv c2h4.*.inp c2h4.*.out Logs | ||
- | rm RUN* *restart* | ||
- | |||
- | | ||
- | </ | ||
- | * Use a fitting gnuplot script to verify the value of the parameters. What has changed with respect to the C2H2 case? Why? | ||
<note tip> | <note tip> | ||
- | - Report the values | + | - Report the energy |
- | - Discuss | + | - Plot q4 vs. energy and q4 vs. optimization steps, for the two cases. |
+ | - Report the value of the order parameter | ||
+ | - Use " | ||
</ | </ |
exercises/2017_ethz_mmm/lennard_jones_cluster.1487744045.txt.gz · Last modified: 2020/08/21 10:15 (external edit)