User Tools

Site Tools


exercises:2014_ethz_mmm:monte_carlo_ice

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
exercise:monte_carlo_ice [2014/05/23 12:38] – [Task 2: Gather more samplings] oschuettexercises:2014_ethz_mmm:monte_carlo_ice [2020/08/21 10:15] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Dielectric Constant of Ice ======+====== Properties of Ice from Monte Carlo Simulations ====== 
 +<note important> 
 +  - Add the line ''PRINT_COORDS .FALSE.'' in the ''TMC'' section. It disables the output of the coordinate trajectory and thus avoids the files-size problem. 
 +  - Add the line ''RND_DETERMINISTIC 42'' to the ''TMC'' section to choose a random number seed. You have to replace ''42'' with different values to obtain different samplings. 
 +</note> 
 In this exercise we will use Monte Carlo sampling to calculate the [[wp>Relative_permittivity|dielectric constant]] and the [[wp>Thermal_expansion#Coefficient_of_thermal_expansion| thermal expansion coefficient]] of the disordered hexagonal phase (Ih) of water ice. In order to speed up the calculation we are going to use the simple SPC/E water model. For more information see: [[doi>10.1063/1.1568337]]. A DFT-version of the calculation can be found here: [[doi>10.1021/jp4103355]]. In this exercise we will use Monte Carlo sampling to calculate the [[wp>Relative_permittivity|dielectric constant]] and the [[wp>Thermal_expansion#Coefficient_of_thermal_expansion| thermal expansion coefficient]] of the disordered hexagonal phase (Ih) of water ice. In order to speed up the calculation we are going to use the simple SPC/E water model. For more information see: [[doi>10.1063/1.1568337]]. A DFT-version of the calculation can be found here: [[doi>10.1021/jp4103355]].
  
Line 13: Line 18:
 The advantage of Monte Carlo is that we can employ special hydrogen reordering moves, which lead to an effective sampling of the dipole.  The advantage of Monte Carlo is that we can employ special hydrogen reordering moves, which lead to an effective sampling of the dipole. 
  
-Run the input-file ''tmc_exercise.inp''. It will create a file ''tmc_trajectory_T200.00.dip_cl'', which contains the dipole moment for each accepted step. Plot the histogram of the z-component of the dipole moment. The distribution should be symmetric, because the simulation cell is also symmetric in the z-direction.+Run the input-file ''mc_exercise.inp''. It will create a file ''tmc_trajectory_T200.00.dip_cl'', which contains the dipole moment for each accepted step. Plot the histogram of the z-component of the dipole moment. The distribution should be symmetric, because the simulation cell is also symmetric in the z-direction.
  
 The dielectric constant can then calculated from the dipole moments via: The dielectric constant can then calculated from the dipole moments via:
Line 43: Line 48:
 for fn in sys.argv[2:]: for fn in sys.argv[2:]:
     print "Reading: "+fn     print "Reading: "+fn
 +    assert(fn.endswith(".dip_cl"))
     raw_data = np.loadtxt(fn) # [C*Angstrom]     raw_data = np.loadtxt(fn) # [C*Angstrom]
     weights.append(raw_data[1:,0]-raw_data[:-1,0])     weights.append(raw_data[1:,0]-raw_data[:-1,0])
Line 56: Line 62:
 print "Mean cell volume: %.2f Angstrom^3"%V print "Mean cell volume: %.2f Angstrom^3"%V
  
-M_norm = np.sqrt(np.sum(np.square(M_vec), axis=1)) # take norm of dipol moment 
 M = np.sqrt(np.sum(np.square(M_vec), axis=1)) # take norm of dipol moment M = np.sqrt(np.sum(np.square(M_vec), axis=1)) # take norm of dipol moment
 var = np.average(np.square(M), weights=weights) - np.square(np.average(M, weights=weights)) var = np.average(np.square(M), weights=weights) - np.square(np.average(M, weights=weights))
Line 80: Line 85:
  
 ===== Task 2: Gather more samplings ===== ===== Task 2: Gather more samplings =====
-You can gather more samples by launching multiple independent runs in parallel. The python-script can process multiple trajectories:+You can gather more samples by launching multiple independent runs in parallel with different random number seeds. The seed is given by the ''RND_DETERMINISTIC'' keyword. The gathered trajectories can then be analyzed collectively with the python-script:
 <code> <code>
 you@brutusX ~$ ./calc_dielectric_constant.py 200 trj_1_T200.00.dip_cl trj_1_T200.00.dip_cl ... you@brutusX ~$ ./calc_dielectric_constant.py 200 trj_1_T200.00.dip_cl trj_1_T200.00.dip_cl ...
Line 88: Line 93:
 </note> </note>
 ===== Task 3: Calculate the thermal expansion coefficient ===== ===== Task 3: Calculate the thermal expansion coefficient =====
-Run the MC sampling again at temperatures of 150K and 250K. Plot the cell volume of each sampling. Read off the converged cell volume and plot it vs. the temperature. Determine the expansion coefficient via a linear fit.+Run the MC sampling again at temperature of 150K . Plot the cell volume of each sampling. Read off the converged cell volume and plot it vs. the temperature. Determine the expansion coefficient via a linear fit. Do you trust your result? Why (not)?
  
 ===== Required Files ===== ===== Required Files =====
 ==== Initial Coordinates ==== ==== Initial Coordinates ====
-{{:exercise:ice_ih_96.xyz.gz| Download here}}+{{ice_ih_96.xyz.gz| Download here}}
  
  
Line 106: Line 111:
 &MOTION &MOTION
   &TMC   &TMC
 +      RND_DETERMINISTIC 42 !<=== Change this number to obtain different samplings
 +      PRINT_COORDS .FALSE. !this avoids the file-size problem
       GROUP_CC_SIZE 0       GROUP_CC_SIZE 0
       NUM_MC_ELEM 100000       NUM_MC_ELEM 100000
exercises/2014_ethz_mmm/monte_carlo_ice.1400848716.txt.gz · Last modified: 2020/08/21 10:14 (external edit)