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]) ;
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]) ;
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]) ;
173
179
else if (strcmp("-xyz", argv[i]) == 0) {
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]);
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]);
485
"\nCenter of Mass Coords (angstroms):\n %12.7lf %12.7lf %12.7lf\n",
486
CM[0]*_bohr2angstroms, CM[1]*_bohr2angstroms, CM[2]*_bohr2angstroms);
478
489
/* translate the atomic coords rel to center of mass */
479
490
calc_relative_coords(natom, X, Y, Z, &XR, &YR, &ZR, CM) ;
693
Function to compute the cross product of 2 Cartesian vectors
696
void cross_prod(double *v1, double *v2, double *out)
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];
683
705
** CALC_TORS_ANGLES(): This function calculates the torsional angles
696
718
double BondAngles[MAXATOM][MAXATOM][MAXATOM],
697
719
double **R, FILE *fpo)
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 ;
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) ;
748
/* compute the sign */
749
cross_prod(cross1, cross2, cross3);
750
norm3 = sqrt(dot_vect(cross3,cross3,3));
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);
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) ;