Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
introductory_examples [2020/06/11 18:17] – external edit 127.0.0.1 | introductory_examples [2024/01/08 13:24] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Introductory examples ====== | ||
+ | |||
+ | This section explains some very simple calculations in order to help the new user to understand how easy things can be. | ||
+ | |||
+ | ===== Using the molpro command ===== | ||
+ | |||
+ | |||
+ | Perform a simple SCF calculation for molecular hydrogen. The input is typed in directly and the output is sent to the terminal: | ||
+ | < | ||
+ | molpro <<! | ||
+ | basis=vdz; | ||
+ | geometry={angstrom; | ||
+ | hf | ||
+ | ! | ||
+ | </ | ||
+ | The same calculation, | ||
+ | < | ||
+ | molpro h2.inp | ||
+ | </ | ||
+ | h2.inp contains: | ||
+ | <code - examples/ | ||
+ | ***,H2 | ||
+ | file, | ||
+ | punch, | ||
+ | basis=vdz; | ||
+ | geometry={angstrom; | ||
+ | hf | ||
+ | </ | ||
+ | As before, but the file '' | ||
+ | < | ||
+ | molpro -W /tmp/wfu h2.inp | ||
+ | </ | ||
+ | |||
+ | ===== Simple SCF calculations ===== | ||
+ | |||
+ | The first example does an SCF calculation for H$_2$O, using all possible defaults. | ||
+ | |||
+ | <code - examples/ | ||
+ | ***, | ||
+ | r=1.85, | ||
+ | geometry={O; | ||
+ | H1,O,r; | ||
+ | H2, | ||
+ | hf !closed-shell scf | ||
+ | </ | ||
+ | |||
+ | In the above example, the default basis set ('' | ||
+ | basis_input# | ||
+ | ===== Geometry optimizations ===== | ||
+ | |||
+ | Now we can also do a geometry optimization, | ||
+ | |||
+ | <code - examples/ | ||
+ | ***, | ||
+ | r=1.85, | ||
+ | geometry={O; | ||
+ | H1,O,r; | ||
+ | H2, | ||
+ | basis=6-31g** | ||
+ | hf !closed-shell scf | ||
+ | optg !do scf geometry optimization | ||
+ | </ | ||
+ | |||
+ | ===== CCSD(T) ===== | ||
+ | |||
+ | The following job does a CCSD(T) calculation using a larger ('' | ||
+ | |||
+ | <code - examples/ | ||
+ | ***, | ||
+ | r=1.85, | ||
+ | geometry={O; | ||
+ | H1,O,r; | ||
+ | H2, | ||
+ | basis=VTZ | ||
+ | hf !closed-shell scf | ||
+ | ccsd(t) | ||
+ | </ | ||
+ | |||
+ | ===== CASSCF and MRCI ===== | ||
+ | |||
+ | Perhaps you want to do a CASSCF and subsequent MRCI for comparison. The following uses the full valence active space in the CASSCF and MRCI reference function. | ||
+ | |||
+ | <code - examples/ | ||
+ | ***, | ||
+ | r=1.85, | ||
+ | geometry={o; | ||
+ | h1,O,r; | ||
+ | h2, | ||
+ | basis=vtz | ||
+ | hf !closed-shell scf | ||
+ | ccsd(t) | ||
+ | casscf | ||
+ | mrci !do mrci calculation | ||
+ | </ | ||
+ | |||
+ | ===== Simplified input ===== | ||
+ | |||
+ | It is possible to use the '' | ||
+ | The general input is | ||
+ | |||
+ | < | ||
+ | geometry={...} | ||
+ | basis=... | ||
+ | run, | ||
+ | </ | ||
+ | |||
+ | where '' | ||
+ | mp4sdq, ccsd, ccsd(t), bccd, bccd(t), qcisd, qcisd(t), rccsd, rccsd(t), uccsd, uccsd(t), | ||
+ | mp2-f12, rmp2-f12, ccsd-f12, ccsd(t)-f12, | ||
+ | |||
+ | In case of DFT calculations ('' | ||
+ | Optionally, '' | ||
+ | |||
+ | |||
+ | Examples: | ||
+ | |||
+ | <code - examples/ | ||
+ | geometry=h2o.xyz | ||
+ | basis=vtz | ||
+ | run, | ||
+ | </ | ||
+ | |||
+ | <code - examples/ | ||
+ | geometry=h2o.xyz | ||
+ | basis=vtz | ||
+ | run, | ||
+ | </ | ||
+ | |||
+ | <code - examples/ | ||
+ | geometry=h2o.xyz | ||
+ | basis=vtz | ||
+ | run, | ||
+ | </ | ||
+ | |||
+ | <code - examples/ | ||
+ | geometry=h2o.xyz | ||
+ | basis=vtz | ||
+ | run, | ||
+ | </ | ||
+ | |||
+ | <code - examples/ | ||
+ | geometry=h2o.xyz | ||
+ | basis=vtz | ||
+ | run, | ||
+ | </ | ||
+ | |||
+ | At the end of the output, each of these procedures prints a table with the most important results, for example: | ||
+ | |||
+ | <code - examples/ | ||
+ | geometry=h2o.xyz | ||
+ | basis=vtz-f12 | ||
+ | run, | ||
+ | </ | ||
+ | |||
+ | produces: | ||
+ | < | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | <code - examples/ | ||
+ | geometry=h2o.xyz | ||
+ | basis=vtz | ||
+ | run, | ||
+ | </ | ||
+ | |||
+ | produces: | ||
+ | < | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ===== Tables ===== | ||
+ | |||
+ | You may now want to print a summary of all results in a table. To do so, you must store the computed energies in variables: | ||
+ | |||
+ | <code - examples/ | ||
+ | ***, | ||
+ | r=1.85, | ||
+ | geometry={o; | ||
+ | h1,O,r; | ||
+ | h2, | ||
+ | basis=vtz | ||
+ | hf !closed-shell scf | ||
+ | e(1)=energy | ||
+ | method(1)=program | ||
+ | |||
+ | ccsd(t) | ||
+ | e(2)=energy | ||
+ | method(2)=program | ||
+ | |||
+ | casscf | ||
+ | e(3)=energy | ||
+ | method(3)=program | ||
+ | mrci !do mrci calculation | ||
+ | e(4)=energy | ||
+ | method(4)=program | ||
+ | |||
+ | table, | ||
+ | title, | ||
+ | </ | ||
+ | |||
+ | <code - examples/ | ||
+ | ***,h2o scf (C2v) | ||
+ | file, | ||
+ | file, | ||
+ | |||
+ | theta=104 | ||
+ | basis={ | ||
+ | sp, | ||
+ | s, | ||
+ | } | ||
+ | |||
+ | symmetry, | ||
+ | geometry={ | ||
+ | o | ||
+ | h,, | ||
+ | h,, | ||
+ | r=[1.85, | ||
+ | |||
+ | do i=1,#r | ||
+ | {hf; | ||
+ | expec,qm} | ||
+ | e(i)=energy | ||
+ | de(i)=(e(i)-e(1))*tokcal | ||
+ | dip(i)=dmz(1) | ||
+ | quadx(i)=qmxx(1) | ||
+ | quady(i)=qmyy(1) | ||
+ | quadz(i)=qmzz(1) | ||
+ | enddo | ||
+ | |||
+ | {table, | ||
+ | save, | ||
+ | title,Using defaults | ||
+ | head, | ||
+ | } | ||
+ | |||
+ | {table, | ||
+ | save, | ||
+ | ftyp, | ||
+ | digits, | ||
+ | title,Using ftyp=f, | ||
+ | head, | ||
+ | } | ||
+ | |||
+ | {table, | ||
+ | save, | ||
+ | format, | ||
+ | title,Using explicit format=(5x, | ||
+ | head, | ||
+ | } | ||
+ | --- | ||
+ | </ | ||
+ | |||
+ | This job produces the following table: | ||
+ | |||
+ | < | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | ===== Procedures ===== | ||
+ | |||
+ | You could simplify this job by defining a procedure '' | ||
+ | |||
+ | <code - examples/ | ||
+ | ***, | ||
+ | |||
+ | proc save_e | ||
+ | if(#i.eq.0) i=0 | ||
+ | i=i+1 | ||
+ | e(i)=energy | ||
+ | method(i)=program | ||
+ | endproc | ||
+ | |||
+ | |||
+ | r=1.85, | ||
+ | geometry={o; | ||
+ | h1,O,r; | ||
+ | h2, | ||
+ | basis=vtz | ||
+ | hf !closed-shell scf | ||
+ | save_e | ||
+ | |||
+ | ccsd(t) | ||
+ | save_e | ||
+ | |||
+ | casscf | ||
+ | save_e | ||
+ | |||
+ | mrci !do mrci calculation | ||
+ | save_e | ||
+ | |||
+ | table, | ||
+ | title, | ||
+ | </ | ||
+ | |||
+ | The job produces the same table as before. | ||
+ | |||
+ | For more details about procedures and further examples see [[program_control# | ||
+ | |||
+ | ===== Do loops ===== | ||
+ | |||
+ | Now you have the idea that one geometry is not enough. Why not compute the whole surface? '' | ||
+ | |||
+ | <code - examples/ | ||
+ | ***,H2O potential | ||
+ | symmetry, | ||
+ | geometry={ | ||
+ | | ||
+ | | ||
+ | | ||
+ | basis=vdz | ||
+ | angles=[100, | ||
+ | distances=[1.6, | ||
+ | i=0 | ||
+ | do ith=1,# | ||
+ | do ir1=1,# | ||
+ | do ir2=1, | ||
+ | i=i+1 | ||
+ | r1(i)=distances(ir1) | ||
+ | r2(i)=distances(ir2) | ||
+ | theta(i)=angles(ith) | ||
+ | hf; !do SCF calculation | ||
+ | escf(i)=energy | ||
+ | ccsd(t); | ||
+ | eccsd(i)=energc | ||
+ | eccsdt(i)=energy | ||
+ | enddo !end of do loop ith | ||
+ | enddo !end of do loop ir1 | ||
+ | enddo !end of do loop ir2 | ||
+ | {table, | ||
+ | head, r1, | ||
+ | save, | ||
+ | title, | ||
+ | sort, | ||
+ | </ | ||
+ | |||
+ | This produces the following table. | ||
+ | |||
+ | < | ||
+ | | ||
+ | |||
+ | | ||
+ | 1.6 | ||
+ | 1.7 | ||
+ | 1.7 | ||
+ | ... | ||
+ | 2.0 | ||
+ | 2.0 | ||
+ | </ | ||
+ | You can use also use '' | ||
+ | |||
+ | <code - examples/ | ||
+ | ***,h2o benchmark | ||
+ | $method=[hf, | ||
+ | qci, | ||
+ | basis=dz | ||
+ | geometry={o; | ||
+ | r=1 ang, theta=104 | ||
+ | do i=1,# | ||
+ | $method(i); | ||
+ | e(i)=energy | ||
+ | enddo | ||
+ | escf=e(1) | ||
+ | efci=e(2) | ||
+ | table, | ||
+ | !Title for table: | ||
+ | title, | ||
+ | </ | ||
+ | |||
+ | This calculation produces the following table. | ||
+ | |||
+ | < | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | One can do even more fancy things, like, for instance, using macros, stored as string variables, see [[variables# | ||