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
|
using namespace std;
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
int main() {
int ID=0, ID1=0, CN=0, CN1=0, N1=0, N2=0, N3=0, N4=0, N5=0, N6=0, N7=0, N8=0, N9=0, N10=0, N11=0, N12=0;
int VoronoiIndex_3=0, VoronoiIndex_4=0, VoronoiIndex_5=0, VoronoiIndex_6=0, VoronoiIndex_7=0;
int V3=0, V4=0, V5=0, V6=0, V7=0, V8=0, type=0, atomsnumber=0;
double volume=0;
string line, line1, line2, namefile;
ifstream Data ("Data.txt");
if (Data.is_open()){
for (int linenox = 0; getline (Data,line) && linenox < 6; linenox++){
if (linenox == 1) Data>>VoronoiIndex_3>>VoronoiIndex_4>>VoronoiIndex_5>>VoronoiIndex_6>>VoronoiIndex_7;
if (linenox == 2) Data>>namefile;
if (linenox == 2) Data>>atomsnumber;
}
cout<<"VoronoiIndex_3: "<<VoronoiIndex_3<<" VoronoiIndex_4: "<<VoronoiIndex_4<<" VoronoiIndex_5: "<<VoronoiIndex_5<<" VoronoiIndex_6: "<<VoronoiIndex_6<<" VoronoiIndex_7: "<<VoronoiIndex_7<<endl;
cout<<namefile<<"\n";
Data.close();
}
ifstream Index_list_1 ("Index_list.txt");
ifstream nb_list ("nb_list.txt");
if (Index_list_1.is_open()){
ofstream NB_1;
NB_1.open ("NB.txt");
for (int linenox2 = 0; getline (Index_list_1,line1) && linenox2 < atomsnumber; linenox2++){
Index_list_1>>ID>>CN>>V3>>V4>>V5>>V6>>V7>>V8>>volume;
if (CN==12 && V5==12 )
{
for (int linenox1 = 0; getline (nb_list,line2) && linenox1 < atomsnumber; linenox1++){
nb_list>>ID1>>CN1>>N1>>N2>>N3>>N4>>N5>>N6>>N7>>N8>>N9>>N10>>N11>>N12;;
if (ID==ID1){
cout << ID << " " << ID1<< "\n";
NB_1 <<ID<<" "<<CN1<<" "<<N1<<" "<<N2<<" "<<N3<<" "<<N4<<" "<<N5<<" "<<N6<<" "<<N7<<" "<<N8<<" "<<N9<<" "<<N10<<" "<<N11<<" "<<N12<<" "<<"\n";
break;
}
}
}
}
NB_1.close();
}
else cout << "Unable to open file";
}
|