QuantumY <- function (r, J){ ##With r being distance and J the spectral overlap Qo <- 0.60 ##Qo is the quantum yield of the donor in the absence of acceptor, this case GFP K2 <- 2/3 ##Dipole orientation factor, for free-flowing 2/3 is a valid assesment n <- 1.3355 ##Refractive index of 5% agarose gel Nav <- 6.02214179 *10^23 Ro6 <- (9*Qo*log(10, exp(1))*K2*J)/(128*pi^5*n^4*Nav) E <- 1/(1+(r^6/Ro6)) return(E) } r <- vector() r <- seq(0,1,0.1) J <- vector() J <- seq(0,30,1) QY <- matrix(nrow=length(r), ncol=length(J)) for (dist in 1:length(r)){ for (ovlp in 1:length(J)){ QY[dist,ovlp] <- QuantumY(r[dist], 10^J[ovlp]) } } persp(r, J, log(QY), col="lightgreen", theta=45, phi=30, ticktype="detail", main="Quantum Yield as a function of r and J", ylab="J=10^x", shade=0.5, sub="With r distance, and J overlap")