示例#1
0
void Confo_Back::Construct_Mol_II(XYZ pre,XYZ cur,XYZ nxt,double bend,double tort,double dist,XYZ &out)
{
	XYZ xyz;
	double x[3],y[3];
	double z[3];
	double cb1[3],cb2[3];
	xyz=nxt-cur;
	xyz.xyz2double(x);
	xyz=cur-pre;
	xyz.xyz2double(y);
	//check
	double angle=Vector_Angle(x,y,3);
	if(fabs(angle)<1.e-3||fabs(angle-M_PI)<1.e-3)
	{
		x[0]+=0.05;
		x[2]-=0.05;
		y[0]-=0.05;
		y[2]+=0.05;
	}
	//calc
	cross(z,x,y);
	Universal_Rotation(z,bend,Confo_Back_ROT_TOT);
	Vector_Multiply(cb1,Confo_Back_ROT_TOT,x);
	Universal_Rotation(x,tort,Confo_Back_ROT_TOT);
	Vector_Multiply(cb2,Confo_Back_ROT_TOT,cb1);
	Vector_Normalize(cb2,3);
	Vector_Dot(cb2,dist,cb2,3);
	out.double2xyz(cb2);
	out+=nxt;
}
示例#2
0
//--------------function------------//
//given CA+CB -> return dist,bend,tort
void Confo_Beta::Confo_Beta_CACB_To_Angle(XYZ *CA,XYZ *CB,int moln,double *bend,double *tort,double *dist)
{
	int i;
	double r,b,t;
	XYZ xyz;
	//process
	for(i=1;i<moln-1;i++)
	{
		//get_point
		xyz=(CA[i]-CA[i-1]);
		xyz.xyz2double(beta_v1);
		xyz=(CA[i+1]-CA[i]);
		xyz.xyz2double(beta_v2);
		xyz=(CB[i]-CA[i]);
		xyz.xyz2double(beta_y);
		//calc
		r=dot(beta_y,beta_y);
		if(r<1.e-3)
		{
			r=0.0;
			b=0.0;
			t=0.0;
		}
		else
		{
			//calc_bend
			b=Vector_Angle(beta_v1,beta_y,3);
			//calc_tort
			cross(beta_x1,beta_v1,beta_v2);
			cross(beta_x2,beta_v1,beta_y);
			t=Vector_Angle(beta_x1,beta_x2,3);
			if(dot(beta_x1,beta_y)<0.0)t*=-1.0;
		}
		//evaluate
		if(dist!=NULL)dist[i]=r;
		if(bend!=NULL)bend[i]=b;
		if(tort!=NULL)tort[i]=t;
	}
	//assign head_tail
	if(dist!=NULL)dist[0]=-1.0;
	if(bend!=NULL)bend[0]=0.0;
	if(tort!=NULL)tort[0]=0.0;
	if(dist!=NULL)dist[moln-1]=-1.0;
	if(bend!=NULL)bend[moln-1]=0.0;
	if(tort!=NULL)tort[moln-1]=0.0;
}
示例#3
0
//given CA -> return CB (Levitt's method)
void Confo_Beta::Confo_Beta_Levit_To_CACB(XYZ *CA,XYZ *CB,int moln,double *dist)
{
	int i,j;
	XYZ xyz;
	double beta,theta;

	//process
	theta=Confo_Beta_Levit_Angle;
	for(i=1;i<moln-1;i++) //omit head and tail
	{
		//init
		if(dist==NULL)beta=Confo_Beta_Levit_Radii;
		else beta=dist[i];
		if(beta<0.0)
		{
			CB[i]=CA[i];
			continue;
		}
		//calc
		xyz=(CA[i]-CA[i-1]);
		xyz.xyz2double(beta_v1);
		xyz=(CA[i]-CA[i+1]);
		xyz.xyz2double(beta_v2);
		Vector_Addition(beta_x1,beta_v1,beta_v2,3);
		Vector_Normalize(beta_x1,3);
		cross(beta_x2,beta_v1,beta_v2);
		Vector_Normalize(beta_x2,3);
		//evaluate
		CA[i].xyz2double(beta_ca);
		for(j=0;j<3;j++)beta_cb[j]=beta_ca[j]+beta*(cos(theta)*beta_x1[j]+sin(theta)*beta_x2[j]);
		CB[i].double2xyz(beta_cb);
	}
	//assign head_tail //this might be modified in the future...
	if(moln>1)
	{
		CB[0]=CB[1]-CA[1]+CA[0];
		CB[moln-1]=CB[moln-2]-CA[moln-2]+CA[moln-1];
	}
	else
	{
		CB[0]=CA[0];
		CB[moln-1]=CA[moln-1];
	}
}
示例#4
0
//given CA and dist,bend,tort -> return CB (Zheng & Liu's method)
void Confo_Beta::Confo_Beta_Angle_To_CACB(XYZ *CA,XYZ *CB,int moln,double *bend,double *tort,double *dist)
{
	int i,j;
	XYZ xyz;
	double beta,radii;
	//process
	for(i=1;i<moln-1;i++)
	{
		//init
		if(dist==NULL)beta=Confo_Beta_Levit_Radii;
		else beta=dist[i];
		if(beta<0.0)
		{
			CB[i]=CA[i];
			continue;
		}
		//calc
		xyz=(CA[i]-CA[i-1]);
		xyz.xyz2double(beta_v1);
		xyz=(CA[i+1]-CA[i]);
		xyz.xyz2double(beta_v2);
		cross(beta_y,beta_v1,beta_v2);
		Universal_Rotation(beta_y,bend[i],Confo_Beta_rotmat);
		Vector_Multiply(beta_x1,Confo_Beta_rotmat,beta_v1);
		Universal_Rotation(beta_v1,tort[i],Confo_Beta_rotmat);
		Vector_Multiply(beta_x2,Confo_Beta_rotmat,beta_x1);
		//evaluate
		radii=sqrt(dot(beta_x2,beta_x2));
		CA[i].xyz2double(beta_ca);
		for(j=0;j<3;j++)beta_cb[j]=beta_ca[j]+beta*beta_x2[j]/radii;
		CB[i].double2xyz(beta_cb);
	}
	//assign head_tail //this might be modified in the future...
	if(moln>1)
	{
		CB[0]=CB[1]-CA[1]+CA[0];
		CB[moln-1]=CB[moln-2]-CA[moln-2]+CA[moln-1];
	}
	else
	{
		CB[0]=CA[0];
		CB[moln-1]=CA[moln-1];
	}
}
示例#5
0
void Confo_Back::Construct_CB(XYZ N,XYZ Ca,XYZ C,double bend,double tort,double dist,XYZ &Cb)
{
	XYZ xyz;
	double x[3],y[3];
	double z[3];
	double cb1[3],cb2[3];
	xyz=C-Ca;
	xyz.xyz2double(x);
	xyz=Ca-N;
	xyz.xyz2double(y);
	cross(z,x,y);
	Universal_Rotation(z,-1.0*bend,Confo_Back_ROT_TOT);
	Vector_Multiply(cb1,Confo_Back_ROT_TOT,x);
	Universal_Rotation(x,-1.0*tort,Confo_Back_ROT_TOT);
	Vector_Multiply(cb2,Confo_Back_ROT_TOT,cb1);
	Vector_Normalize(cb2,3);
	Vector_Dot(cb2,dist,cb2,3);
	Cb.double2xyz(cb2);
	Cb+=Ca;
}
示例#6
0
//===================== Recon_Beta ==================//
//given CA+CB, and AMI_Dist, update SC
void Confo_Beta::Recon_Beta_1(XYZ *CA,XYZ *CB,int moln,char *ami)  //return SC
{
	int i;
	XYZ xyz;
	double radii;
	double multi;
	double v[3];
	for(i=0;i<moln;i++)
	{
		xyz=(CB[i]-CA[i]);
		xyz.xyz2double(v);
		radii=dot(v,v);
		if(radii<1.e-3)continue;
		Vector_Normalize(v,3);
		multi=CB_AMI_Dist[ami[i]-'A'];
		if(multi<0.0)continue;
		Vector_Dot(v,multi,v,3);
		xyz.double2xyz(v);
		CB[i]=CA[i]+xyz;
	}
}