# Gaussian Tutorial

## Command Line Basics

| _Command_               | _Description_                                  |
| ----------------------- | ---------------------------------------------- |
| ls                      | list directories & files in current directory  |
| mkdir newDir            | makes a new directory in the current directory |
| cd ..                   | back up one directory                          |
| cd myDirectory/         | open myDirectory                               |
| nano file1              | opens file1 in nano editor                     |
|        Ctrl-o  ,  Enter |      In nano-saves edits                       |
|        Ctrl-X           |      Exits out of nano                         |

{% hint style="info" %}
The "cd" command is used to move into and out of directories (folders).  It's basically equivalent (in Windows Explorer) to clicking on a subfolder of the folder you are in (eg. "cd subfolder/")  or hitting the back arrow to move out of a folder into the previous one (eg. "cd .."). &#x20;
{% endhint %}

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LWCT1WnO4BCbb_OSsb5%2F-LWCqa3mtkDSB1rXfvF5%2FScreenshot%20\(160\).png?alt=media\&token=06af8d74-5216-400c-9c1c-04a03d784042)

## Getting Started

#### MobaXterm

MobaXterm can be freely downloaded here (use the Home Installer Edition): [https://mobaxterm.mobatek.net/download.html](https://mobaxterm.mobatek.net/download.html)

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LZ5lZSH1IvfaV92Tpna%2F-LZ60ioRTGigLtYMelnJ%2FScreenshot%20\(2-5\).png?alt=media\&token=c34aaf10-c967-4dc2-9f53-f3115b3430b8)

Open MobaX.

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LVoBHxwkXy6XXwwzgLP%2F-LVoHYCXkqTOSjeAplwp%2F\(10\)c.png?alt=media\&token=53a91d06-582d-4850-ae47-e42cc3acba29)

Log in to Lawrence (refer to the following code).

```
[user.name@ ~]$ ssh User.Name@Lawrence.usd.edu
Warning: Permanently added 'lawrence.usd.edu' (RSA) to the list of known hosts.
User.Name@Lawrence.usd.edu's password:
Last login: Wed Jan  9 13:14:19 2019 from 192.236.35.187
Welcome to the Lawrence Supercomputer at the University of South Dakota!
......

[user.name@usd.local@login ~]$
```

## Transferring Files (Lawrence to & from PC)

In MobaX, the file explorer/hierarchy is visible just to the left of the command line interface. Navigate into directories by clicking on them, and out of directories using the "parent directory" button.

{% hint style="warning" %}
Note: entering/exiting a directory in this area doesn't change your current directory in the command line (you'll still be in the same directory as before in the command line).  Use the cd command to navigate directories in the command line.
{% endhint %}

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LWqg828-be0KOaBVUvr%2F-LWqjjOEKy9f3YciDKd8%2FScreenshot%20\(10\).png?alt=media\&token=dd7dcaab-7ab3-4018-8080-87b0b72e9e31)

From this section of the MobaX window, you can drag and drop files between Lawrence and your PC as needed.

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LPatH8qBDqxS5oN7YZQ%2F-LPavGL1-BMDWPmTP8eG%2FmobaxMovingFile.png?alt=media\&token=f9aff36c-4c08-4e8f-be7a-0e9bcf0260ce)

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LOTYI8JBMO1-PfD6hLD%2F-LOU8kVxA06aDzRIZidX%2FScreenshot%20\(8\).png?alt=media\&token=d0eb309e-2b3d-400c-bd91-fa91e62fbc3a)

Once your files are in the proper directories, they can be handled in the same way as the example input files are handled in this tutorial (excluding the steps of copying the example input files into their respective directories).

## Interactive Jobs

Open MobaX and **log into Lawrence** (see section "Getting Started"). &#x20;

Make a directory in your home directory, and navigate into it:

```
[user.name@usd.local@login ~]$ mkdir myInteractiveDir
[user.name@usd.local@login ~]$ cd myInteractiveDir/
[user.name@usd.local@login myInteractiveDir]$
```

Connect to a node.

```
[user.name@usd.local@login myInteractiveDir]$ srun --pty bash
[user.name@usd.local@node56 myInteractiveDir]$
```

Copy the Gaussian test file into your myInteractiveDir directory.

```
[user.name@usd.local@node56 myInteractiveDir]$ cp /opt/examples/Gaussian/test.com ./test.com
[user.name@usd.local@node56 myInteractiveDir]$ ls
test.com
```

{% hint style="info" %}
If these commands don't make sense, go to the top section: "Command Line Basics".
{% endhint %}

To see the Gaussian modules available:

```
[user.name@usd.local@node56 myInteractiveDir]$ module avail gauss
---------------------------- /act/modulefiles -------------------------------- 
gaussian/09 gaussian/16
```

Load one of the Gaussian modules.

```
[user.name@usd.local@node56 myInteractiveDir]$ module load gaussian/16
[user.name@usd.local@node56 myInteractiveDir]$ module list
Currently Loaded Modulefiles:
  1) gaussian/16
```

Run Gaussian with an input file:

```
[user.name@usd.local@node56 myInteractiveDir]$ g16 <test.com >interactiveOutput.com
[user.name@usd.local@node56 myInteractiveDir]$
```

To view the output, open "interactiveOutput.com" with nano or another editor.

```
[user.name@usd.local@node56 myInteractiveDir]$ nano interactiveOutput.com
```

{% hint style="info" %}
To get back out of nano, use the instructions at the bottom of the command line screen, or see "Command Line Basics".
{% endhint %}

Navigate out of "myInteractiveDir" into your home directory:

```
[user.name@usd.local@node56 myInteractiveDir]$ cd ..
[user.name@usd.local@node56 ~]$ 
```

Exit the node.

```
[user.name@usd.local@node56 ~]$ exit
[user.name@usd.local@login ~]$ 
```

## Batch Jobs

If entering the tutorial at this point, open MobaX and log into Lawrence (see the second half of "Getting Started").

Make a directory in your home directory, and navigate into it:

```
[user.name@usd.local@login ~]$ mkdir myBatchDir
[user.name@usd.local@login ~]$ cd myBatchDir
[user.name@usd.local@login myBatchDir]$
```

{% hint style="info" %}
If these commands don't make sense, go to the top section: "Command Line Basics".
{% endhint %}

Copy the Gaussian batch job template files into your myBatchDir directory.

```
[user.name@usd.local@login myBatchDir]$ cp -r /opt/examples/Gaussian/. ./
[user.name@usd.local@login myBatchDir]$ ls
gaussianBatchTemplate.sh  output.txt  test.com
```

Open the file "gaussianBatchTemplate.sh" using nano (or another editor, if you prefer) and note the features described in the image below.

```
[user.name@usd.local@login myBatchDir]$ nano gaussianBatchTemplate.sh
```

Open the file "test.com" (you will have to exit viewing gaussianBatchTemplate.sh in nano to do this in the same terminal).

```
[user.name@usd.local@login myBatchDir]$ nano test.com
```

In the last line, "**test.com**" is the **input** file name and the slurm ID followed by ".out" is the **output** file name.  Also note that the number of CPUs (**ntasks**) requested **matches** the **%nprocshared** (or **%nprocs**) in the input file.

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LZAknLTjb12gvZZmP2Z%2F-LZArVsZk7__4yIravMD%2FbatchGaussianTemplate3.png?alt=media\&token=9253e015-1bad-4d82-aec9-fb264b8bbf26)

{% hint style="warning" %}
\--ntasks in batch file should equal %nprocshared in input file
{% endhint %}

Exit nano (Ctrl-x), then run the batch job:

```
[user.name@usd.local@login myBatchDir]$ sbatch gaussianBatchTemplate.sh
Submitted batch job 12345
[user.name@usd.local@login myBatchDir]$ 
```

Show the list of jobs running on Lawrence:

```
[user.name@usd.local@login myBatchDir]$ squeue
             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
             12345     nodes gaussian     user2 R       0:22      1 node40
             48469     nodes     bash     user1 R       3:04      1 node56
             48467     nodes     bash     user3 R      23:07      5 node[25-29]
             48458     nodes     bash     user4 R      23:41      1 node21
             48459     nodes     bash     user4 R      23:41      1 node22
             48460     nodes     bash     user4 R      23:41      1 node24
             48457     nodes     bash     user4 R      25:14      1 node11
             48449     nodes     bash     user4 R      25:18      1 node13
             48450     nodes     bash     user4 R      25:18      1 node17

```

Show only your jobs:

```
[user.name@usd.local@login myBatchDir]$ squeue -u user.name
             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
             12345     nodes gaussian   user.n  R    2:34:52      1 node43
```

When your job is complete, it will not appear on squeue.  To see the output of your job when completed, open the ".out" file.

```
[user.name@usd.local@login myBatchDir]$ nano 12345.out
```

To see how the job went, and look at any errors, open the slurm file.

```
[user.name@usd.local@login myBatchDir]$ nano slurm-12345.out
```

{% hint style="info" %}
Note: the number 12345 in slurm-12345.out corresponds to the number of the batch job above.
{% endhint %}

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LWqTkDhCdFux99b2dM1%2F-LWq_7ue2lty2XEZIoaZ%2Fslurm-%23%23%23%23.png?alt=media\&token=a29a94b3-b95d-4b6e-a1bc-007081ad5f07)

## Graphical User Interface Jobs

If entering the tutorial at this point, open MobaX and log into Lawrence (for help, see the section "Getting Started").

### **Starting the GUI**

Log into a node

```
[user.name@usd.local@login ~]$ srun --pty bash 
[user.name@usd.local@node51 ~]$ 
```

Load the Gaussian module:

```
[user.name@usd.local@node51 ~]$ module load gaussian/16 
[user.name@usd.local@node51 ~]$ module list
Currently Loaded Modulefiles:  
1) gaussian/16
```

Launch the Gaussian GUI:

```
[user.name@usd.local@node51 ~]$ srun gview
```

The GUI will open:

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LkPWh-8OX0EZmeb1LZN%2F-LkPeSwU88q2rphziPWV%2FsrunGaussian.png?alt=media\&token=e633f828-ad38-41d4-9bc5-432bd3d046b1)

