~ubuntu-branches/ubuntu/vivid/psicode/vivid

« back to all changes in this revision

Viewing changes to src/bin/geom/geom.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2008-06-07 16:49:57 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080607164957-8pifvb133yjlkagn
Tags: 3.3.0-3
* debian/rules (DEB_MAKE_CHECK_TARGET): Do not abort test suite on
  failures.
* debian/rules (DEB_CONFIGURE_EXTRA_FLAGS): Set ${bindir} to /usr/lib/psi.
* debian/rules (install/psi3): Move psi3 file to /usr/bin.
* debian/patches/07_464867_move_executables.dpatch: New patch, add
  /usr/lib/psi to the $PATH, so that the moved executables are found.
  (closes: #464867)
* debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
  for (i=1, num_unparsed=0; i<argc; i++) {
157
157
    if (strcmp("-g", argv[i]) == 0) {
158
158
      InputType = PSI_GEOM;
159
 
      if ( (i+1 < argc) && (strchr(argv[i+1], '-') == NULL) ) 
 
159
      if ( (i+1 < argc) && (strchr(argv[i+1], '-') == NULL) ) {
160
160
        strcpy(geom_file, argv[i+1]) ;
 
161
        i++;
 
162
      }
161
163
    }
162
164
    else if (strcmp("-aces", argv[i]) == 0) {
163
165
      InputType = ACES2;
164
 
      if ( (i+1 < argc) && (strchr(argv[i+1], '-') == NULL) ) 
 
166
      if ( (i+1 < argc) && (strchr(argv[i+1], '-') == NULL) ) {
165
167
        strcpy(geom_file, argv[i+1]) ;
 
168
        i++;
 
169
      }
166
170
    }
167
171
    else if (strcmp("-qchem", argv[i]) == 0) {
168
172
      InputType = QCHEM;
169
173
      ang_in = 1;  /* QCHEM format is in Angstrom */
170
 
      if ( (i+1 < argc) && (strchr(argv[i+1], '-') == NULL) ) 
 
174
      if ( (i+1 < argc) && (strchr(argv[i+1], '-') == NULL) ) {
171
175
        strcpy(geom_file, argv[i+1]) ;
 
176
        i++;
 
177
      }
172
178
    }
173
179
    else if (strcmp("-xyz", argv[i]) == 0) {
174
180
      InputType = XYZ;
175
181
      ang_in = 1;  /* XYZ format is in Angstrom */
176
 
      if ( (i+1 < argc) && (strchr(argv[i+1], '-') == NULL) ) 
177
 
        strcpy(geom_file, argv[i+1]) ;
 
182
      if ( (i+1 < argc) && (strchr(argv[i+1], '-') == NULL) ) {
 
183
        strcpy(geom_file, argv[i+1]);
 
184
        i++;
 
185
      }
178
186
    }
179
187
    else if (strcmp("-oop", argv[i]) == 0) do_oop = 1;
180
188
    else if (strcmp("-a", argv[i]) == 0) print_all_dist = 1;
473
481
  center_of_mass(natom, M, X, Y, Z, CM) ;
474
482
  fprintf(fpo,"\nCenter of Mass Coords (bohr):\n   %12.7lf %12.7lf %12.7lf\n",
475
483
          CM[0], CM[1], CM[2]);
476
 
  fflush(fpo) ;
 
484
  fprintf(fpo,
 
485
        "\nCenter of Mass Coords (angstroms):\n   %12.7lf %12.7lf %12.7lf\n",
 
486
          CM[0]*_bohr2angstroms, CM[1]*_bohr2angstroms, CM[2]*_bohr2angstroms);
 
487
  fflush(fpo);
477
488
  
478
489
  /* translate the atomic coords rel to center of mass */
479
490
  calc_relative_coords(natom, X, Y, Z, &XR, &YR, &ZR, CM) ;
678
689
  return(tval);     
679
690
}
680
691
 
 
692
/*
 
693
   Function to compute the cross product of 2 Cartesian vectors
 
694
*/
 
695
 
 
696
void cross_prod(double *v1, double *v2, double *out)
 
697
{
 
698
   out[0] =     v1[1]*v2[2]-v1[2]*v2[1];
 
699
   out[1] =    -v1[0]*v2[2]+v1[2]*v2[0];
 
700
   out[2] =     v1[0]*v2[1]-v1[1]*v2[0];
 
701
   return;
 
702
}
681
703
 
682
704
/*
683
705
** CALC_TORS_ANGLES(): This function calculates the torsional angles
696
718
                      double BondAngles[MAXATOM][MAXATOM][MAXATOM], 
697
719
                      double **R, FILE *fpo)
698
720
{
699
 
  int i, j, k, l ;
700
 
  double cross1[3], cross2[3] ;
 
721
  int i, j, k, l, xyz ;
 
722
  double cross1[3], cross2[3], cross3[3] ;
701
723
  double tval, angle, phi2, phi3 ;
 
724
  double sign, norm3;
702
725
  
703
726
  fprintf(fpo, "\nTorsional Angles:\n") ;
704
727
  for (i=0; i<natom; i++) {
721
744
            if (tval > 0.99999) angle = 0.0000 ;
722
745
            else if (tval < -0.99999) angle = _pi ;
723
746
            else angle = acos(tval) ;
 
747
 
 
748
            /* compute the sign */
 
749
            cross_prod(cross1, cross2, cross3);
 
750
            norm3 = sqrt(dot_vect(cross3,cross3,3));
 
751
            sign = 1.0;
 
752
            if (fabs(norm3) > 0.00001) {
 
753
              for(xyz=0; xyz<3; ++xyz)
 
754
                cross3[xyz] *= 1.0/norm3;
 
755
              tval = dot_vect(cross3, E[j][k],3);
 
756
              if (tval < 0.0)
 
757
                sign = -1.0;
 
758
            }
 
759
 
724
760
            if ( ((R[i][j] < print_dist) && (R[j][k] < print_dist) &&
725
761
                  (R[k][l] < print_dist)) || print_all_dist) {
726
762
              fprintf(fpo, "%2d-%2d-%2d-%2d    %13.8lf\n",
727
 
                      i+1, j+1, k+1, l+1, angle * 180.0/_pi) ;
 
763
                      i+1, j+1, k+1, l+1, sign * angle * 180.0/_pi) ;
728
764
            }
729
765
          }
730
766
        }