Sampc

You might also like

Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 2

#include<iostream>

#include<fstream>
#include<cmath>
#include <cstdlib>
#include<ctime>
using namespace std;
int main()
{
int a[11820],b[11820];
double x[11630];
double y[11630];
double z[11630];
int dup1,dup2;
double dist;
ifstream
ifstream
ofstream
ofstream

in1;
in2;
out1;
out2;

in1.open("merged_bond.txt");
in2.open("in_coord.txt");
out1.open("out_bond.txt");
out2.open("out_dist2.txt");
if(!in1)
cout<<"File opening error\n";
else
cout<<"Reading the file \n";
for(int k=1;k<=11811;k++)
{
in1>>a[k];
in1>>b[k];
out1<<a[k]<<"\t"<<b[k]<<"\n";
}
if(!in2)
cout<<"File opening error\n";
else
cout<<"Reading the file \n";
for(int i=1;i<=11619;i++)
{
in2>>x[i];
in2>>y[i];
in2>>z[i];
//out<<x[k][j][i]<<"\t"<<y[k][j][i]<<"\t"<<z[k][j]
[i]<<"\n";
}
for(int h=1;h<=11811;h++)
{
cout<<h<<"\n";
dup1=a[h];
dup2=b[h];
dist=sqrt((x[dup1]-x[dup2])*(x[dup1]-x[dup2])+(y[dup1]y[dup2])*(y[dup1]-y[dup2])+(z[dup1]-z[dup2])*(z[dup1]-z[dup2]));

}
}

out2<<h<<"\t"<<dist<<"\n";

You might also like