I am working Monte Carlo simulation script over protein structure. I have never done before Monte Carlo scripting. I will extent this program at large scale. According to protein xyz coordinates I have to define the box size. This box will be divided into a grid of size 0.5 A. Based on distance and angle criteria I have to assign the point based on Boltzmann probability distribution.
My program should be move in each direction by taking grid of 0.5 A and generate the random point and check the condition of distance and angle. If satisfy the condition put point there otherwise discard that point based on Boltzmann probability distribution.
Here is my code for generation of random points
from __future__ import division
import math as mean
from numpy import *
import numpy as np
from string import *
from random import *
def euDist(cd1, cd2):# calculate distance
d2 = ((cd1[0]-cd2[0])**2 + (cd1[1]-cd2[1])**2 + (cd1[2]-cd2[2])**2)
d1 = d2 ** 0.5
return round(d1, 2)
def euvector(c2,c1):# generate vector
x_vec = (c2[0] - c1[0])
y_vec = (c2[1] - c1[1])
z_vec = (c2[2] - c1[2])
return (x_vec, y_vec, z_vec)
for arang in range(1000): # generate random point
arang = arang + 1
x,y,z = uacoord
#print x,y,z
x1,y1,z1 = (uniform(x-3.5,x+3.5), uniform(y-3.5,y+3.5), uniform(z-3.5,z+5))
pacord = [x1,y1,z1] # random point coordinates
print pacord
I am completely struck to generate the box size from the xyz coordinates of protein structure and how to define the grid of size 0.5. How to check every point in the box.
Any help will be appreciable.