Attachment '2H2O.py'
Download 1 from math import cos, sin, pi
2
3 from ASE import ListOfAtoms, Atom
4 from ASE.Visualization.RasMol import RasMol
5 from ASE.Dynamics.ConjugateGradient import ConjugateGradient
6 from ASE.Trajectories import NetCDFTrajectory
7 from Dacapo import Dacapo
8
9
10 d = 2.0
11 r = 0.9575
12 t = pi / 180 * 104.51
13 dimer = ListOfAtoms([Atom('O', (0, 0, 0)),
14 Atom('H', (-r * cos(t / 2), r * sin(t / 2), 0)),
15 Atom('H', (-r * cos(t / 2), -r * sin(t / 2), 0)),
16 Atom('O', (d + r, 0, 0)),
17 Atom('H', (d, 0, 0)),
18 Atom('H', (d + r - r * cos(t), 0, r * sin(t)))],
19 cell=(9, 6, 7))
20 dimer.SetCartesianPositions(dimer.GetCartesianPositions() + (4, 3, 3.5))
21 plot = RasMol(dimer, (2, 2, 2))
22 calc = Dacapo(nbands=12,
23 planewavecutoff=340,
24 densitycutoff=500,
25 out='2H2O.nc')
26 calc.StayAliveOff()
27 dimer.SetCalculator(calc)
28 traj = NetCDFTrajectory('2H2O.traj', dimer)
29 cg = ConjugateGradient(dimer, fmax=0.05)
30
31 cg.Attach(traj)
32 cg.Attach(plot)
33 cg.Converge()
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.