CE 400 Honors Seminar Molecular Simulation

advertisement

CE 400 Honors Seminar

Molecular Simulation

Class 3

Prof. Kofke

Department of Chemical Engineering

University at Buffalo, State University of New York

Dimensions and Units 1. Magnitudes

• Typical simulation size very small

– 100 - 1000 atoms

• Important extensive quantities small in magnitude

– when expressed in macroscopic units

• Small numbers are inconvenient

• Two ways to magnify them

– work with atomic-scale units

• ps, amu, nm or Å

– make dimensionless with characteristic values

• model values of size, energy, mass

2

Dimensions and Units 2. Scaling

• Scaling by model parameters

– size s

– energy e

– mass m

• Choose values for one atom/molecule pair potential arbitrarily

• Other model parameters given in terms of reference values

– e.g., e

2

/ e

1

= 1.2

• Physical magnitudes less transparent

• Sometimes convenient to scale coordinates differently

3

D & U 3. Corresponding States

• Lennard-Jones potential in dimensionless form u * ( r *)

4

1 r *

12

1 r *

6

• Parameter independent!

• Dimensionless properties must also be parameter independent

– convenient to report properties in this form, e.g. P*( r

*,T*)

– select model values to get actual values of properties

– Basis of corresponding states

• Equivalent to selecting unit value for parameters

4

Dimensions and Units 4.

• Corresponding States Example

– Want pressure for methane at 0.0183 mol/cm 3 and 167 K

– LJ model parameters are s

= 0.3790 nm, e

/k = 142.1 K

– Dimensionless state parameters

• r

* = rs

3 = (0.0183 mol/cm 3 )(3.790

10 -8 cm) 3 (6.022

10 23 molecules/mole) = 0.6

T* = T/( e

/k) = (167 K)/(142.1 K) = 1.174

– From LJ equation of state

• P* = P s

3 / e

= 0.146

– Corresponding to a pressure

• P = 0.146 (142.1 K)(13.8 MPaÅ 3 /molecule )/(3.790Å) 3 = 5.3 MPa

• 53 bars

5

Units in Etomica 1.

• All internal calculations are based on a consistent set of units

– Mass: amu or Dalton, 1/N

A grams = 1.66

– Length: Angstrom, 10 -10 meters

10 -24 grams

– Time: picosecond, 10 -12 seconds

• Conversion to other units is done for input or output by a

Device or Display

• Default action is to perform no conversion

– Temperature is given as k

B

T, in units of amu-A 2 /ps 2

• Default I/O unit system can be changed

– MKS (CGS, English, atomic, etc. to be defined)

– Lennard-Jones

– At beginning of simulation, use (for example)

• setUnitSystem(etomica.units.UnitSystem.MKS);

6

Units in Etomica. 2.

• A Unit class has the information needed to perform conversions

• Unit formed from two elements

– Prefix: milli, kilo, mega, nano, pico, etc.

– BaseUnit: meter, gram, second, etc.

– For example:

• import etomica.units;

• new Unit(Prefix.KILO, Gram.UNIT);

– Can construct without prefix specified (none by default)

• Display/Device units specified with setUnit method

• setUnit(new Unit(Second.UNIT));

• Lennard-Jones units use size and energy scales for conversions

– By default, s

= 3 Angstroms, e

/k = 300K

7

Units and Spatial Dimensions

• Most often we simulate 2-dimensions systems

– Easier to visualize

• Some physical quantities have units defined exclusively for

3-dimensional systems

– Pressure: pounds per square inch, bars, mm Hg, etc.

– Volume: cubic centimeters, liters, gallons, etc.

• Etomica offers two approaches

– Report in appropriate 2-D units

• pounds per inch, Newtons per meter, square centimeters, etc.

– Ascribe an artificial “depth” to the simulation

• Volume = (depth)

(area)

• Presently

– LJ UnitSystem will report in appropriate 2-D units

– MKS UnitSystem ignores the problem (a bug!)

8

Notes About Etomica

• Version now in use was completed in early June

• Much development/debugging of API proceeded over summer

– Etomica GUI hasn’t yet been brought up-to-date

– Progress now being made with it, and expected to become available

Real Soon Now

– In the meantime, please be patient!

• Etomica crashes in two known circumstances:

– Assembly of incompatible components

• Soft potential with hard integrator, for example

– Jamming of molecules with hard integrator

9

Equations of State 1.

• The “equation of state” is the pressure-volume-temperature behavior of a fluid (or solid)

• Consider:

– What happens to the pressure as the volume decreases (density increases) at fixed temperature?

– What happens to the density as temperature increases at fixed pressure?

– Must it always happen this way?

• What is the law relating pressure, temperature, density?

– Is it exact, like the law F = ma?

10

Equations of State 1.

• The “equation of state” is the pressure-volume-temperature behavior of a fluid (or solid)

• Consider:

– What happens to the pressure as the volume decreases (density increases) at fixed temperature?

• It increases, always.

– What happens to the density as temperature increases at fixed pressure?

• It decreases (hot expands), usually.

– Must it always happen this way?

• Yes and no.

• What is the law relating pressure, temperature, density?

– PV = nRT, the ideal gas law

– Is it exact, like the law F = ma?

• No! (nor is F = ma, for that matter).

11

Equations of State 2.

• The ideal-gas law is, well, an idealization

– Appropriate at low density, and (less so) at high temperature

• Real materials deviate from ideal-gas behavior

– Repulsions between molecules tend to increase pressure above ideal

– Attractions tend to decrease pressure below ideal

• Here’s an empirical equation of state for the 2-D hard sphere model

PA

NkT r

1 0.356780

r 

0.021447

r 2

1 1.775171

r 

0.787808

r 2

– Note the adherence to ideal-gas behavior at low density

– It is hard to make good, general-purpose equations of state for real materials

12

Monte Carlo Simulation: Buffon’s Needle

• Consider a grid of equally spaced lines, separated by a distance d

• Take a needle of length l , and repeatedly toss it at random on the grid

• Record the number of “hits”, times that the needle touches a line, and “misses”, times that it doesn’t

– OK, do it!

13

Monte Carlo Simulation: Buffon’s Needle

• Consider a grid of equally spaced lines, separated by a distance d

• Take a needle of length l , and repeatedly toss it at random on the grid

• Record the number of “hits”, times that the needle touches a line, and “misses”, times that it doesn’t

• Buffon showed that the probability of a “hit” is

P

2 l

 d

• This “experiment” provides a means to evaluate pi

 

2 l

Pd

14

Monte Carlo Simulation: Area of Circle

• Consider selecting many points at random in a unit square

1

1

• What is the fraction of the selections that lie in the unit circle?

15

Monte Carlo Simulation: Area of Circle

• Fraction falling in circle is given by the ratio of their areas

P

 area of circle area of square

(1/ 2)

1

2

2

4

• This gives another experiment to measure pi

   number in circle number of trials

• Let’s try it!

16

Random Number Generation

• Random number generators

– subroutines that provide a new random deviate with each call

– basic generators give value on (0,1) with uniform probability

– uses a deterministic algorithm (of course)

• usually involves multiplication and truncation of leading bits of a number

X n

1

( aX n

 c ) mod m linear congruential sequence

• Returns set of numbers that meet many statistical measures of randomness

– histogram is uniform

– no systematic correlation of deviates

• no idea what next value will be from knowledge of present value (without knowing generation algorithm)

• but eventually, the series must end up repeating

Plot of successive deviates (X n

,X n+1

)

• Some famous failures

– be careful to use a good quality generator

Not so random!

17

Download