#ifndef __PDBFILE_H__
#define __PDBFILE_H__


#include "vec3D.h"

#define UNKNOWN_TYPE		0
#define HN_TYPE   			10
#define H_TYPE   			11
#define N_TYPE   			12
#define O_TYPE  			13
#define C_TYPE   			14
#define CA_TYPE				15
#define CB_TYPE  			16
#define CG_TYPE  			17
#define HA_TYPE				18
#define HA2_TYPE			19
#define OXT_TYPE			20

#define BACKBONE			1
#define SIDECHAIN			2

#define ATOM_COORD_NA -1000000.0
	// A spatial coordinate for an atom indicating that it's location is not specified.
	// Added by David Arndt, Apr 26, 2007.

// Modes for getNextAtomIndex():
#define GET_ATOM_ANY_RES 100 // Get atom from residue containing nth atom, or later.
#define GET_ATOM_SAME_RES 101 // Get atom from the same residue as the nth atom.
#define GET_ATOM_NEXT_RES 102 // Get atom from the residue following the nth atom.

typedef struct Atom {
  Vec3D point;
  int type;
  int resNum; // Residue ID
  int  origResNum; // add 2011.08.24
  char insCode;    // add 2011.08.24
  char name[5]; // 4-letter atom abbreviation plus a NULL terminator.
  char resName[4];
  char *line;
} Atom;

typedef struct PDBFile {
  int numRes;
  int numAtoms;
  int capacity;
  Atom *atoms;
} PDBFile;

/* PROTOTYPES */
void freePDBFile(PDBFile *pdb);
//int atomIsCA(Atom *a);
//void getAtomPosition(Atom *a, double pos[3]);
int parsePDBFile(char *name, PDBFile *pdb, char chain);
int getNextAtomIndex(PDBFile *pdb, int n, char *atom_name, int mode);
int getNextAtomOfType(PDBFile *pdb, int n, int type);
char res_str_to_char(char *three_letter_abbrev);
char *char_to_res_str(char single_letter_abbrev);
int getFirstAtomOfResidue(PDBFile *pdb, int resNum);
void trim_PDB_file(char *input_PDB_filename, char *trimmed_PDB_filename, int remove_H_atoms);

#endif
