51 points = (
double *) calloc(4 *
n,
sizeof(
double));
66 memset((
void *)
points, 0, 4 *
n *
sizeof(
double));
129 x.push_back((
float)
points[4*i]);
130 y.push_back((
float)
points[4*i + 1]);
131 z.push_back((
float)
points[4*i + 2]);
178 struct stat filestat;
179 stat(file, &filestat);
185 FILE *fp = fopen(file,
"r");
187 fprintf(stderr,
"ERROR in PDBReader::read_pdb(): cannot open file %s\n",file);
193 while ((fgets(s, 200, fp) != NULL)) {
195 if ((strncmp(s,
"ENDMDL", 6) == 0) && (
ter_stop==0)){
199 if (strncmp(s,
"END", 6) == 0){
206 if (strncmp(s,
"ATOM", 4) != 0) {
207 if (count == 0) {
head.push_back(s);}
208 else {
tail.push_back(s);}
215 if (
pWords[count].size()>78)
222 sscanf(&s[6],
"%d", &an);
223 sscanf(&s[23],
"%d %f %f %f %*f %f", &sn, &
x, &
y, &
z, &tf);
232 points[4 * count + 3] = tf;
281 FILE *fp = fopen(file,
"w");
283 for (
size_t i =0; i<
lines.size(); i++) {
285 strcpy (liner,
lines[i].c_str());
286 if (strncmp(liner,
"ATOM", 4) != 0) {
287 fprintf (fp,
"%s", liner);
292 mid = curr.substr(12, 10);
293 final = curr.substr(76,2);
295 strcpy(mid2, mid.c_str());
297 strcpy(final2,
final.c_str());
310for (
unsigned int i=0; i<
n; i++) {
311 ret.push_back((
float)
points[i*4]);
312 ret.push_back((
float)
points[i*4+1]);
313 ret.push_back((
float)
points[i*4+2]);
321 for (
unsigned int i = 0; i < 4 *
n; i += 4) {
335 remove(
"thisFile3.txt");
PointArray defines a double array of points with values in a 3D space.
bool read_from_pdb(const char *file)
Reads and parses all information from file.
vector< string > elementSym
vector< int > get_resNum()
void save_to_pdb(const char *file) const
Saves all atom information into a pdb in the official format.
PointArray * makePointArray(const PDBReader &p)
vector< string > atomName
void set_number_points(size_t nn)
void right_transform(const Transform &transform)
Does Transform*v as opposed to v*Transform (as in the transform function)
vector< float > get_points()
Returns all x,y,z triplets packed into a vector<float>
void set_points_array(double *p)
Allows the user to set the double array of points.
vector< string > get_resName()
double * get_points_array()
Returns the double array of points.
PDBReader & operator=(PDBReader &pa)
vector< string > residueName
size_t get_number_points() const
vector< string > get_atomName()
PointArray defines a double array of points with values in a 3D space.
bool read_from_pdb(const char *file, const vector< int > &lines=vector< int >())