~ubuntu-branches/ubuntu/karmic/psicode/karmic

« back to all changes in this revision

Viewing changes to src/bin/optking/read_constraints.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* READ_CONSTRAINTS reads constraints from  "FIXED_INTCO" section of input
 
1
/*! \file
 
2
    \ingroup OPTKING
 
3
    \brief READ_CONSTRAINTS reads constraints from  "FIXED_INTCO" section of input
2
4
   or intco files, the constrained internals must already be present in the
3
5
   list of all of the simple internal coordinates
4
6
*/
5
7
 
6
 
#if HAVE_CMATH
7
 
# include <cmath>
8
 
#else
9
 
# include <math.h>
10
 
#endif
11
 
 
12
 
extern "C" {
13
 
#include <stdio.h>
 
8
#include <cmath>
 
9
#include <cstdio>
14
10
#include <libchkpt/chkpt.h>
15
 
#include <stdlib.h>
16
 
#include <string.h>
 
11
#include <cstdlib>
 
12
#include <cstring>
17
13
#include <libciomr/libciomr.h>
18
14
#include <libipv1/ip_lib.h>
19
15
#include <physconst.h>
20
 
}
21
16
 
22
17
#define EXTERN
23
18
#include "opt.h"
26
21
#include "internals.h"
27
22
#include "salc.h"
28
23
 
 
24
namespace psi { namespace optking {
 
25
 
29
26
int *read_constraints(internals &simples) {
30
 
  int num_type, i,j,a,b,c,d,cnt,*sign,id;
 
27
  int num_type, i,j,a,b,c,d,cnt,*sign,id, intco_type, sub_index, sub_index2;
31
28
  int iconstraints, *constraints;
32
29
 
33
30
  optinfo.constraints_present = 0;
34
31
  optinfo.nconstraints = 0;
35
32
  iconstraints = 0;
36
33
 
37
 
  fprintf(outfile,"Searching for geometrical constraints...");
 
34
  fprintf(outfile,"\nSearching for geometrical constraints...");
38
35
 
39
 
  if (ip_exist(":FIXED_INTCO",0)) {
 
36
  if ((ip_exist(":FIXED_INTCO",0)) || (optinfo.fix_interfragment) || (optinfo.fix_intrafragment)) {
40
37
    ip_cwk_clear(); /* search only fixed_intco */
41
38
    ip_cwk_add(":FIXED_INTCO");
42
39
 
198
195
          }
199
196
        }
200
197
      }
 
198
 
 
199
      if (optinfo.fix_interfragment) { /* freeze all interfragment coordinates */
 
200
        for (i=0; i<simples.frag.get_num(); ++i) {
 
201
          id = simples.frag.get_id(i);
 
202
          if (!cnt) {
 
203
            constraints[iconstraints++] = simples.id_to_index(id);
 
204
            if (iconstraints == 1) fprintf(outfile,"Coordinates to be constrained:\n");
 
205
            fprintf(outfile,"Fragment coordinate %d\n", id);
 
206
          } 
 
207
          else {
 
208
            optinfo.nconstraints++;
 
209
          } 
 
210
        }
 
211
      }
 
212
      else if (ip_exist("FRAG",0)) { /* freeze user-specified interfragment coordinates */
 
213
        num_type = 0;
 
214
        ip_count("FRAG",&num_type,0);
 
215
        for(i=0; i<num_type; ++i) {
 
216
          ip_data("FRAG","%d",&(id),2,i,0);
 
217
          if (!cnt) {
 
218
            constraints[iconstraints++] = simples.id_to_index(id);
 
219
            if (iconstraints == 1) fprintf(outfile,"Coordinates to be constrained:\n");
 
220
            fprintf(outfile,"Fragment coordinate %d\n", id);
 
221
          } 
 
222
          else {
 
223
            optinfo.nconstraints++;
 
224
          } 
 
225
        }
 
226
      }
 
227
 
 
228
      if (optinfo.fix_intrafragment) { /* fix everything EXCEPT interfragment coordinates */
 
229
        for (i=0; i<simples.get_num(); ++i) {
 
230
          id = simples.index_to_id(i);
 
231
          simples.locate_id(id, &intco_type, &sub_index, &sub_index2);
 
232
          if (intco_type != FRAG_TYPE) {
 
233
            if (!cnt) {
 
234
              constraints[iconstraints++] = simples.id_to_index(id);
 
235
              if (iconstraints == 1) fprintf(outfile,"Coordinates to be constrained:\n");
 
236
              if (iconstraints == 1) fprintf(outfile,"Simple coordinates:\n");
 
237
              fprintf(outfile," %d", id);
 
238
            }
 
239
            else { 
 
240
              optinfo.nconstraints++;
 
241
            } 
 
242
          }
 
243
        }
 
244
      }
 
245
 
201
246
      if (cnt) fprintf(outfile,"%d found.\n",optinfo.nconstraints);
202
247
    } /* end cnt loop */
203
248
 
224
269
 
225
270
  return constraints;
226
271
}
 
272
 
 
273
}} /* namespace psi::optking */
 
274