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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<string>
#include<fstream>
#include<iomanip>
#include<cmath>
#include"comparison.h"
using namespace std;
void comparison(ifstream *t, ifstream *r);
void reference(ifstream *r, int residues);
char* argv[5];
int main(int argc, char* argv[]){
typedef struct ATOM { string atm; double x; double y; double z;} atom;
int count = 0;
/* Here is the input part, input files must be in XYZ format */
if (argc < 6)
{
cout << "Missing Informations !" << endl << endl << "Input must be : ./eulertrj input_file ref_structure Natoms Nframes output_file" << endl <<
endl;
exit(1);
}
ifstream t(argv[1]); // Trajectory File
ifstream r(argv[2]); // Reference Structure File
ofstream o(argv[5]); // Output File
int natoms = atoi(argv[3]);
int nframes = atoi(argv[4]);
int rtmp;
int ttmp;
int residues = (natoms-2)/7;
/* Make a comparison between reference structure and input file, number of atoms and atom sequence MUST be the same, function for comparison in included in comparison.h file*/
comparison(&t,&r);
t.seekg(0, ios::beg); // Rewind trajectory file
r.seekg(0, ios::beg); // Rewind Reference file
reference(&r,residues);
return 0 ;
}
void reference(ifstream *r, int residues)
{
int rtmp;
int xht, yht, zht;
int xtmp, ytmp, ztmp;
double x,y;
string ht2;
string c;
string d;
r[0] >> rtmp >> c >> c >> c;
cout << rtmp << endl;
/* In order to obtain the same number of atoms in residue, there is the need to skip one terminal hydrogen (HT2) */
r[0] >> ht2 >> xht >> yht >> zht;
for(int count = 0; count <= residues; count++)
{
r[0] >> c >> rtmp >> rtmp >> rtmp; /* Read Structure, 7 atoms per residue */
if(count==0){ cout << endl << "Sequence Structure is: " << c << ", ";}
r[0] >> c >> rtmp >> rtmp >> rtmp;
if(count==0){ cout << c << ", ";}
r[0] >> c >> rtmp >> rtmp >> rtmp;
if(count==0){ cout << c << ", ";}
r[0] >> c >> rtmp >> rtmp >> rtmp;
if(count==0){ cout << c << ", ";}
r[0] >> c >> rtmp >> rtmp >> rtmp;
if(count==0){ cout << c << ", ";}
r[0] >> c >> rtmp >> rtmp >> rtmp;
if(count==0){ cout << c << ", ";}
r[0] >> c >> rtmp >> rtmp >> rtmp;
if(count==0){ cout << c << ", " << endl << endl;}
}
}
|