-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetpdbcrds.cc
executable file
·88 lines (65 loc) · 2.5 KB
/
getpdbcrds.cc
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
$Id: getpdbcrds.cc,v 1.4 2007/04/27 06:01:48 garrett Exp $
AutoDock
Copyright (C) 1989-2007, Garrett M. Morris, David S. Goodsell, Ruth Huey, Arthur J. Olson,
All Rights Reserved.
AutoDock is a Trade Mark of The Scripps Research Institute.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "getpdbcrds.h"
extern FILE *logFile;
extern char *programname;
int getpdbcrds( char rms_ref_crds_FN[MAX_CHARS],
Real ref_crds[MAX_ATOMS][SPACE] )
{
int ii=0;
int natoms=0;
char line[LINE_LEN];
char str[4][WORDLEN];
char rec5[5];
FILE *rms_ref_FilePtr;
if ( !openfile( rms_ref_crds_FN, "r", &rms_ref_FilePtr )) {
fprintf( logFile, "%s: ERROR! Sorry, could not open file \"%s\" for reading.\n", programname, rms_ref_crds_FN );
return -1;
}
pr (logFile, "\nRMS Reference Coordinates from \"%s\":-\n\n", rms_ref_crds_FN);
while ( fgets(line, LINE_LEN, rms_ref_FilePtr) != NULL ) {
for (ii = 0; ii < 4; ii++) {
rec5[ii] = (char)tolower( (int)line[ii] );
}
if (equal(rec5,"atom",4) || equal(rec5,"heta",4)) {
if (natoms < MAX_ATOMS) {
sscanf( &line[30], "%s %s %s", str[X], str[Y], str[Z] );
ref_crds[natoms][X] = atof( str[X] );
ref_crds[natoms][Y] = atof( str[Y] );
ref_crds[natoms][Z] = atof( str[Z] );
pr (logFile, "Atom %5d, x,y,z = %8.3f %8.3f %8.3f\n", natoms+1, ref_crds[natoms][X], ref_crds[natoms][Y], ref_crds[natoms][Z]);
} else {
fprintf( logFile, "%s: ERROR! Sorry, too many atoms in file \"%s\"\n", programname, rms_ref_crds_FN );
return -1;
}
++natoms;
} /* End if "atom" or "heta" */
} /* End while there's a line to read... */
/* Close the reference coordinates file... */
(void) fclose(rms_ref_FilePtr);
return natoms;
}
/* EOF */