####################################################################### # # # Example: Find optimum step size # # # ####################################################################### # # # XMD requires the user to choose a time step size when doing # # dynamics. The best step size is the largest one that is still # # stable. This optimum value can be found by trial and error. # # # # This is done by running molecular dynamics with the # # configuration and temperature that one wants to simulate. A # # small time step is used initially, and after 20 steps or so this # # time step size is double. This doubling repeats 5 times in the # # following example. # # # # Meanwhile, during the molecular dynamics run, the clamp is set # # to -1, and the energy is written out at every step. This clamp # # setting results in an adiabatic simulation, which means that the # # total energy will remain constant for a stable time step. When # # the time step becomes too large, the total energy will instead # # drift upward. # # # # You can see the value of the total energy by using the ESAVE # # command, writing the energies out to a file at every step. ESAVE # # saves the energies in a text file. In this example, the name of # # the file is timestep.e. Inside this text file, the first column # # holds the step number, the second holds the total energy. The # # next two columns hold the potential and kinetic energy # # respectively, which add together to give the total energy. # # # ####################################################################### # Trial and error to find optimum time step size # Read potential for nial read ../nial.txt # Use old neighbor search algorithm to accomodate small atomic array nsearch sort # Make repeating box and lattice (in units of a0) box 6 6 6 particle 2 1 0.25 0.25 0.25 2 0.75 0.75 0.75 dup 5 1 0 0 dup 5 0 1 0 dup 5 0 0 1 # Scale up to units of angstroms (2.8712 unit cell) scale 2.8712 # Save energies from every dynamics step in file "timestep.e' esave 1 timestep.e # Set particle masses (in atomic mass units) select type 1 mass 58.71 select type 2 mass 26.982 # Set adiabtic simulation at starting temperature of 200K clamp -1 itemp 200 # Vary time step # Set initial timestep size variable calc STEPSIZE = 4e-16 # Do 6 separate runs of 20 steps each repeat 6 # Set timestep size using dtime command dtime STEPSIZE # 20 steps of dynamics (energies are written to tempstep.e file) cmd 20 # Double the time step size calc STEPSIZE = 2 * STEPSIZE end