-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmoindex.c
41 lines (34 loc) · 812 Bytes
/
moindex.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// FILE: moindex.c
/*********************************************************************
* moindex.c
* ---------
* Contains routines for index MO integrals.
*
* By Christopher L Malbon
* Dept of Chemistry, The Johns Hopkins University
********************************************************************/
#include <stdio.h>
#include "moindex.h"
int index1e(int i, int j)
/* index1e
* -------
* Index 1-e integral. Lower-triangle packing.
*/
{
int result;
if (i > j)
result = (((i - 1) * i) / 2) + j;
else
result = (((j - 1) * j) / 2) + i;
return result;
}
int index2e(int i, int j, int k, int l)
/* index2e
* -------
* Index 2-e integral. Lower triangle packing.
*/
{
int result;
result = index1e(index1e(i, j), index1e(k, l));
return result;
}