User Tools

Site Tools


exercises:2016_uzh_cmest:first_simulation_run

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
exercises:2016_uzh_cmest:first_simulation_run [2016/09/22 13:44] tmuellerexercises:2016_uzh_cmest:first_simulation_run [2020/08/21 10:15] (current) – external edit 127.0.0.1
Line 18: Line 18:
 Additonal parameters for Neon (Ne) and combination rules to obtain new parameters are provided in  Part III and IV. Additonal parameters for Neon (Ne) and combination rules to obtain new parameters are provided in  Part III and IV.
  
-You are expected to hand in the respective plots plus answers to the questions. The format can be either a proper PDF or directly in the email with the plots attached (as pictures in pngjpg, or pdf format). +You are expected to hand in the respective plots by email, either as one PDF or as one file per plot (PNGJPEG, or PDF format).
 ===== Part I:  Single Point (Energy) calculation ===== ===== Part I:  Single Point (Energy) calculation =====
  
Line 44: Line 43:
   &MM                    ! specification of MM parameters    &MM                    ! specification of MM parameters 
     &FORCEFIELD          ! parameters needed to describe the potential      &FORCEFIELD          ! parameters needed to describe the potential 
-    &SPLINE +      &SPLINE 
-    EMAX_SPLINE 10000    ! numeric parameter to ensure calculation stability. Should not be changed +        EMAX_SPLINE 10000    ! numeric parameter to ensure calculation stability. Should not be changed 
-    &END +      &END SPLINE 
-        &NONBONDED       ! parameters for the non bonded interactions +      &NONBONDED       ! parameters for the non bonded interactions 
-          &LENNARD-JONES ! Lennard-Jones parameters +        &LENNARD-JONES ! Lennard-Jones parameters 
-          atoms Kr Kr+          ATOMS Kr Kr
           EPSILON    [K_e] 164.56           EPSILON    [K_e] 164.56
           SIGMA [angstrom]   3.601           SIGMA [angstrom]   3.601
Line 61: Line 60:
     &END FORCEFIELD     &END FORCEFIELD
     &POISSON              ! solver for non periodic calculations     &POISSON              ! solver for non periodic calculations
-     PERIODIC NONE+      PERIODIC NONE
       &EWALD       &EWALD
         EWALD_TYPE none         EWALD_TYPE none
Line 69: Line 68:
   &SUBSYS                 ! system description    &SUBSYS                 ! system description 
     &CELL     &CELL
-     ABC [angstrom] 10 10 10   +      ABC [angstrom] 10 10 10   
-     PERIODIC NONE+      PERIODIC NONE
     &END CELL     &END CELL
     &COORD                     &COORD                
Line 77: Line 76:
       Kr  4 0 0       Kr  4 0 0
     &END COORD     &END COORD
-   &END SUBSYS+  &END SUBSYS
 &END FORCE_EVAL &END FORCE_EVAL
 </code> </code>
 +
 +<note tip>Instructions starting with an ampersand ''&'' start a //section// and **must** be terminated with an ''&END SECTION-NAME''. Other instructions are called //keywords//. The indentation is ignored but recommended for readability.</note>
  
 === 2. Step === === 2. Step ===
Line 103: Line 104:
   **** **  *******  **  PROGRAM STARTED IN          /data/students/studentXX/ex1   **** **  *******  **  PROGRAM STARTED IN          /data/students/studentXX/ex1
 [...] [...]
-  ENERGY| Total FORCE_EVAL ( FIST ) energy (a.u.):           0.003617048870059+  ENERGY| Total FORCE_EVAL ( FIST ) energy (a.u.):          -0.000518941408898
 [...] [...]
  
Line 117: Line 118:
  
 If you get the closing banner you know that CP2K finished. If you get the closing banner you know that CP2K finished.
- 
-<note warning>Always check the number of warnings by looking at the <code>The number of warnings for this run is : ...</code> line. If that number is not zero you **must** check the rest of the output for warnings and act accordingly.</note> 
  
 The following line tells you the result: The following line tells you the result:
Line 131: Line 130:
 To convert from //Kelvin// to //Hartree// you have to multiply with the Boltzmann constant $ k_\text{b} = 3.1668154 \cdot 10^{-6} \frac{E_\text{H}}{\text{K}} $ . To convert from //Kelvin// to //Hartree// you have to multiply with the Boltzmann constant $ k_\text{b} = 3.1668154 \cdot 10^{-6} \frac{E_\text{H}}{\text{K}} $ .
  
 +<note warning>Always check the number of warnings by looking at the line: <code>The number of warnings for this run is : ...</code>  If that number is not zero you **must** check the rest of the output for warnings and act accordingly, otherwise you may work with wrong results.</note>
 ===== Part II: Computation of the LJ energy curve ===== ===== Part II: Computation of the LJ energy curve =====
    
Line 169: Line 169:
 ^ Input file      ^ Distance (Å)   ^ Energy   (Eh)       ^ ^ Input file      ^ Distance (Å)   ^ Energy   (Eh)       ^
 | energy_dist1A.inp    | 1      | ...        | | energy_dist1A.inp    | 1      | ...        |
-| energy_dist1.5A.inp  | 1.5    | ...        | 
 | energy_dist2A.inp    | 2      | ...        | | energy_dist2A.inp    | 2      | ...        |
-| energy_dist2.5A.inp  | 2.5    | ...        | 
 | energy_dist3A.inp    | 3      | ...        | | energy_dist3A.inp    | 3      | ...        |
 | ...                  | ...    | ...        | | ...                  | ...    | ...        |
Line 178: Line 176:
  
 By using any plotting program you can now get a representation of the energy profile. By using any plotting program you can now get a representation of the energy profile.
 +Choose a an appropriate minimum distance and step size.
  
 === 3. Step === === 3. Step ===
  
-Here are reported the LJ parameters for Ne atoms. Those are to replace the Kr parameters in the input file, along with your Ne coordinates that have to replace the Kr coordinates. A new LJ curve for Ne atoms can be now generated.+Now we do the same for Ne atoms: use the previous input file as a template and update the parameters according to the following:
  
 <code> <code>
          &NONBONDED             &NONBONDED   
-          &LENNARD-JONES ! Lennard-Jones Ne parameters +           &LENNARD-JONES ! Lennard-Jones Ne parameters 
-           atoms Ne Ne  +             ATOMS Ne Ne  
-           EPSILON    [K_e] 36.831  +             EPSILON    [K_e] 36.831  
-           SIGMA [angstrom]  2.775 +             SIGMA [angstrom]  2.775 
-           RCUT  [angstrom] 25.0 +             RCUT  [angstrom] 25.0 
-          &END LENNARD-JONES+             &END LENNARD-JONES
          &END NONBONDED          &END NONBONDED
          &CHARGE          &CHARGE
-          ATOM Ne +           ATOM Ne 
-          CHARGE 0.0+           CHARGE 0.0
          &END CHARGE          &END CHARGE
 </code> </code>
 +
 +Plot the energy curve again.
  
 === 4. Step === === 4. Step ===
-Here are reported the combination rules for pairs unlike pairs, i.e. for pairs of non identical atoms. \\  + 
-Once generated the ε and σ parameters for the couple Kr/Ne, generate once more the LJ dissociation curve. \\ +Finally we look at the curve for Kr-Ne
-Compare the "mixed" curve to the two "pure" curves and report the position and depth of the minimum. \\+ 
 +The epsilon and sigma for the Lennard-Jones potential between Kr and Ne can be calculated using the parameters from the Kr-Kr and Ne-Ne interaction:
  
 $$ \sigma_{ij}= \sqrt{\sigma_i\sigma_j}$$ \\ $$ \sigma_{ij}= \sqrt{\sigma_i\sigma_j}$$ \\
 $$ \epsilon_{ij}= \sqrt{\epsilon_i\epsilon_j}$$ $$ \epsilon_{ij}= \sqrt{\epsilon_i\epsilon_j}$$
  
-<note tip> +Please note:
-Remember that you are running  with two different atom types. For this reason some of the input sections MUST BE REPLICATED for the two kinds of atoms present +
-</note>+
  
-  * The LENNARD-JONES section must be present for all the three possible couples: Kr-Kr, Ne-Ne and Ne-Kr.  Example+  * The ''LENNARD-JONES'' section must be present for all the three possible couples now: Kr-Kr, Ne-Ne and Ne-Kr: 
  
 <code> <code>
       &LENNARD-JONES ! Lennard-Jones parameters for Ar-Ar interaction       &LENNARD-JONES ! Lennard-Jones parameters for Ar-Ar interaction
-          atoms Kr Kr +        ATOMS Kr Kr 
-          EPSILON    [K_e] 164.56 +        EPSILON    [K_e] 164.56 
-          SIGMA [angstrom]  3.601 +        SIGMA [angstrom]  3.601 
-          RCUT  [angstrom]  25.0+        RCUT  [angstrom]  25.0
       &END LENNARD-JONES       &END LENNARD-JONES
       &LENNARD-JONES ! Lennard-Jones Ne-Ne parameters       &LENNARD-JONES ! Lennard-Jones Ne-Ne parameters
-           atoms Ne Ne  +        ATOMS Ne Ne  
-           EPSILON    [K_e] 36.831  +        EPSILON    [K_e] 36.831  
-           SIGMA [angstrom]  2.775 +        SIGMA [angstrom]  2.775 
-           RCUT  [angstrom] 25.0 +        RCUT  [angstrom] 25.0 
-       &END LENNARD-JONES+      &END LENNARD-JONES
       &LENNARD-JONES ! Lennard-Jones parameters for Kr-Ne interaction       &LENNARD-JONES ! Lennard-Jones parameters for Kr-Ne interaction
-          atoms Kr Ne +        ATOMS Kr Ne 
-          EPSILON    [K_e] YOUR EPSILON +        EPSILON    [K_e] YOUR EPSILON 
-          SIGMA [angstrom]  YOUR SIGMA +        SIGMA [angstrom]  YOUR SIGMA 
-          RCUT  [angstrom]  25.0 +        RCUT  [angstrom]  25.0 
-        &END LENNARD-JONES +      &END LENNARD-JONES 
 </code> </code>
  
-  * The CHARGE section must be also duplicated: +  * The ''CHARGE'' section must be also duplicated: 
  
 <code> <code>
          &CHARGE          &CHARGE
-          ATOM Ne +           ATOM Ne 
-          CHARGE 0.0+           CHARGE 0.0
          &END CHARGE          &END CHARGE
          &CHARGE          &CHARGE
-          ATOM Kr +           ATOM Kr 
-          CHARGE 0.0+           CHARGE 0.0
          &END CHARGE          &END CHARGE
                    
 </code> </code>
  
-===== Questions ===== +  * one of the atom kinds in the ''&COORD'' section must be set to Kr, the other to Ne. 
-  * Sketch the LJ energy curve for the two set of parameters ($\sigma$ and $\epsilon$provided.  + 
-  * Report, for both curves, the minimum energy distance and the depth of the minimum+Plot again the energy curve. 
-  * What are the major differences between the curves? How do they relate to the sets of parameters provided?+ 
 +====== Tips & Tricks ====== 
 + 
 +===== Parsing the output ===== 
 + 
 +Many times you will have to get some value out of a simulation output, in this case, the energy. 
 +This can achieved in a number of ways: 
 + 
 +  * Using the ''grep'' command:<code> 
 +$ grep "Total FORCE_EVAL" energy.out 
 +</code>which gives you:<code> 
 + ENERGY| Total FORCE_EVAL FIST energy (a.u.):             -0.000250281091139 
 +</code> 
 +  * Using the ''awk'' tool:<code> 
 +$ awk '/Total FORCE_EVAL/ { print $9; }' energy.out 
 +</code>which returns:<code> 
 +-0.000250281091139 
 +</code>''awk'' reads a given file line-by-line and splits a line into multiple fields (using whitespace as delimiter). The command above tells ''awk'' to look for the string ''Total FORCE_EVAL'' in a line and if found, print field number 9 of it, effectively returning the energy
 + 
 +===== Generating input files ===== 
 + 
 +Many times you will have to run the same simulation with different parameters (here the distance). 
 + 
 +A simple way to generate the different input files is using shell scripting in combination with ''sed'' (the stream editor): 
 + 
 +<code> 
 +for d in $(seq 2 0.1 4); do 
 +  sed -e "s|4 0 0|${d} 0 0|" energy.inp > energy_${d}A.inp 
 +  cp2k.sopt -i energy_${d}A.inp -o energy_${d}A.out 
 +  awk '/Total FORCE_EVAL/ { print $9; }' energy_${d}A.out 
 +done 
 +</code>
  
 +  * The command ''seq 2 0.1 4'' generates the numbers ''2.0'', ''2.1'', ''2.2'', ... , ''4.0'' (try it out!)
 +  * With ''for d in $(seq 2 0.1 4); do'' we use the shell to run all commands which follow once for every number (stored in ''$d'')
 +  * ''sed -e "s|4 0 0|$d 0 0|" energy.inp'' looks for ''4 0 0'' in the file ''energy.inp'' (the original file from above) and replaces ''4 0 0'' by ''$d 0 0'' (that is: ''2.0'', ''2.1'', ''2.2'', ...)
 +  * ... and using ''> energy_${d}A.out'' we redirect the output of the ''sed'' command to new files ''energy_2.0A.out'', ''energy_2.1A.out'', etc.
 +  * Then we run ''cp2k.sopt'' as shown before on those new input files and write the output to new output files as well
 +  * Using ''awk'' we extract the energy from the output file
exercises/2016_uzh_cmest/first_simulation_run.1474551857.txt.gz · Last modified: 2020/08/21 10:15 (external edit)