~ubuntu-branches/ubuntu/quantal/psicode/quantal

« back to all changes in this revision

Viewing changes to src/lib/libchkpt/ict.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2006-09-10 14:01:33 UTC
  • Revision ID: james.westby@ubuntu.com-20060910140133-ib2j86trekykfsfv
Tags: upstream-3.2.3
ImportĀ upstreamĀ versionĀ 3.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*!
 
2
  \file ict.c
 
3
  \ingroup (CHKPT)
 
4
*/
 
5
 
 
6
#include <stdio.h>
 
7
#include <stdlib.h>
 
8
#include "chkpt.h"
 
9
#include <psifiles.h>
 
10
#include <libpsio/psio.h>
 
11
 
 
12
/*!
 
13
** chkpt_rd_ict():  Reads the transformation properties of the nuclei
 
14
**     under the operations allowed for the particular symmetry point group 
 
15
**     in which the molecule is considered.
 
16
**
 
17
**   takes no arguments.
 
18
**
 
19
**   returns: ict = a matrix of integers. Each row corresponds 
 
20
**     to a particular symmetry operation, while each column corresponds to
 
21
**     a particular atom.  The value of ict[2][1], then, should be interpreted 
 
22
**     in the following manner: under the third symmetry operation of the 
 
23
**     relavant point group, the second atom is placed in the location
 
24
**     originally occupied by the atom with the index ict[2][1].
 
25
** \ingroup (CHKPT)
 
26
*/
 
27
 
 
28
int **chkpt_rd_ict(void)
 
29
{
 
30
  int i, natom, nirreps;
 
31
  int **ict;
 
32
  psio_address ptr;
 
33
  char *key;
 
34
 
 
35
  nirreps = chkpt_rd_nirreps();
 
36
  natom = chkpt_rd_natom();
 
37
 
 
38
  ptr = PSIO_ZERO;
 
39
  ict = (int **) malloc(sizeof(char *) * nirreps);
 
40
  key = chkpt_build_keyword("ICT Table");
 
41
  for(i=0; i < nirreps; i++) {
 
42
    ict[i] = (int *) malloc(sizeof(int) * natom);
 
43
    psio_read(PSIF_CHKPT, key, (char *) ict[i], natom*sizeof(int), ptr, &ptr);
 
44
  }
 
45
  free(key);
 
46
 
 
47
  return ict;
 
48
}
 
49
 
 
50
 
 
51
/*!
 
52
** chkpt_wt_ict():  Reads the transformation properties of the nuclei
 
53
**     under the operations allowed for the particular symmetry point group 
 
54
**     in which the molecule is considered.
 
55
**
 
56
**   arguments:
 
57
**   \param ict = a matrix of integers. Each row corresponds 
 
58
**     to a particular symmetry operation, while each column corresponds to
 
59
**     a particular atom.  The value of ict[2][1], then, should be interpreted 
 
60
**     in the following manner: under the third symmetry operation of the 
 
61
**     relavant point group, the second atom is placed in the location
 
62
**     originally occupied by the atom with the index ict[2][1].
 
63
**
 
64
**   returns: none
 
65
** \ingroup (CHKPT)
 
66
*/
 
67
 
 
68
void chkpt_wt_ict(int **ict)
 
69
{
 
70
  int i, natom, nirreps;
 
71
  psio_address ptr;
 
72
  char *key;
 
73
 
 
74
  nirreps = chkpt_rd_nirreps();
 
75
  natom = chkpt_rd_natom();
 
76
 
 
77
  key = chkpt_build_keyword("ICT Table");
 
78
  ptr = PSIO_ZERO;
 
79
  for(i=0; i < nirreps; i++)
 
80
    psio_write(PSIF_CHKPT, key, (char *) ict[i], natom*sizeof(int), 
 
81
               ptr, &ptr);
 
82
  free(key);
 
83
}