CH332_16Jan
CH332_16Jan
Computational Chemistry
free format:
read(*,*)
write(*,*)
a user-defined
format:
Edit descriptor tells the system how to handle certain types of input/output values
Ø Format code in the read/write statement Ø Using a label read/write statement and
directly separately write the format code
Output: both “c” and “d” are written with 10 characters and
3 decimal points (look at the “fort.20” file formed
0.025 0.005
by these codes to understand it better
Different variants of edit descriptors of real numbers
Output:
0.025 0.005
0.02500 0.00500
0.025 0.005
0.250E-01 0.500E-02
0.250E-0001 0.500E-0002
Output:
24102 10
24102 10
24102 10
0000024102 0000000010
Output:
Test Hello
Test Hello World
Test Hello World
Test Hello World
Output:
Test Hello World
Test Hello World
Hello World Test
Hello World
Output:
24102
10
*** 10
3.14159265359
3.1416
3.14159274101
**********
vThe flowchart and pseudocode help programmers organize the proposed problem
and write/debug the program.
vThe flowchart and pseudocode are written from top to bottom in the way the program
flows
vWe use a few shapes to draw a flowchart: Some common shapes are
Let’s understand this by considering an example of A humanized version of the computer code
Ø Deciding what to do when approaching a stop light: Drive through it, slow down in preparation to stop, or stop
fully.
If the light is red, come to a quick
stop before the intersection
Your decision
depends upon Your thought If the light is green, drive through
process might go the intersection
which color the
light is. something like this:
If the light is yellow, slow down
and prepare to stop
Some rules (not so strict) of pseudocode
o The usual Fortran symbols are used for arithmetic operations (+, -, *, /, **).
o Certain Fortran keywords can be used, such as PRINT, WRITE, READ, etc.
FORTRAN Code:
Pseudocode of the above problem
Program find_num
Declare Integer limit, num, sumnum
Set num = 0
Set sumnum = 0
Stop
End Procedure
Flowchart of the above problem
Start
if sumnum
<= limit
Enter limit
True
False
increment
Initilize sum by 1
num=0 add num by
sumnum=0 sumnum
End
Flowchart and pseudocode
for single-alternative
selection (IF/THEN)
kà rate constant
Aà pre-exponential factor (frequency factor)
Eaà Activation energy
Rà gas constant
Tà Temperature
increase in T à increase in k
Calculation of activation energy
Kinetic data
#k(s-1) T(K)
0.022 1400
0.07 1460
0.21 1520
0.686 1580
1.578 1620
T1=1400 K
T2=1620 K
Ea = 366226.850979 J/Mol
Calculation of activation energy
Kinetic data
#k(s-1) T(K) Ea can also be calculated from the slope of the ln k versus
0.022 1400 1/T graph
0.07 1460
0.21 1520
0.686 1580
1.578 1620
# lnk 1/T
-3.816713 0.000714
-2.659260 0.000685
-1.560648 0.000658
-0.376878 0.000633
Using gnuplot package you can
0.456158 0.000617 fit these data
gnuplot
1
Raw data
Fitted line
0
−1
ln (k)
−2
−3
−4
6.0x10−4 6.4x10−4 6.8x10−4 7.2x10−4
1/T
Activation energy from this method:
m = -Ea/R = -43800.5 K
Ea = 364157.357 J/Mol
How to create a pdf file of the image in gnuplot?
o Plot datafile
o Set x/y-label; can be updated at a later stage
o save the above operations in a script with an extension “.par” and quit
gnuplot
o Open “.par” file and add these lines to save the output to a postscript
file
o set term enhanced post color
o set out “test.ps”
Process and Job-control
THANK YOU!