% 6.581 PS3 Qsn1 % loadComplx.m r = 0.4; % radius of ligand (radius of complex is 1) sepX = 1-r; % Receptor and Ligand charge locaitons Rcharges = [-0.8 0 0.5; 0 0.6 0.5; 0 -0.6 0.5; -0.8 0 -0.5; 0 0.6 -0.5; 0 -0.6 -0.5]; Lcharges = [-0.5 -0.5 0; -0.5 0.5 0; 0.5 0.5 0; 0.5 -0.5 0]; Lcharges = r*Lcharges; Lcharges(:,1) = Lcharges(:,1) + sepX; % visualize ligand and ligand-receptor complex [X,Y,Z] = sphere(20); [TH,PHI,R] = cart2sph(X,Y,Z); [XL,YL,ZL] = sph2cart(TH,PHI,r); XL = XL + sepX; surf(X,Y,Z) hold on surf(XL,YL,ZL,ones(size(Z))) shading interp alpha(0.3) th = linspace(0,2*pi,200); plot(r*cos(th)+sepX,r*sin(th),'r:','Linewidth',2) plot(cos(th),sin(th),'b:','Linewidth',2) plot3(Rcharges(:,1),Rcharges(:,2),Rcharges(:,3),'b.','MarkerSize',20) plot3(Lcharges(:,1),Lcharges(:,2),Lcharges(:,3),'r.','MarkerSize',20) hold off axis equal axis off text(sepX,0,'Ligand','FontSize',15,'Color','r','HorizontalAlignment','center') text(-sepX/2,0,'Receptor','FontSize',15,'Color','b','HorizontalAlignment','center')