lib/PDB.rb
# Model contains many molecules derived from PDB File
# define global variables
Model contains many molecules derived from PDB File
define global variables
Model contains many molecules derived from PDB File define global variables
def convert_to_bead_model(dmax, bead_radius, atoms)
    radius = dmax*0.5
    limit = radius + radius*0.23
    inv_bead_radius = 1.0/bead_radius
    klimit = (limit*inv_bead_radius*3.0/2.0*invsqrt6)
    count=0
    inv3 = 1.0/3
    sqrt6 = Math.sqrt(6)
    beads=[]
    count=1
    for k in -klimit..klimit
      dz = 2.0*inv3*sqrt6*k
      if (dz*bead_radius > limit)
        break
      end
      inv3kmod2 = inv3*k.modulo(2)
      for j in -klimit..klimit
        dy = sqrt3*(j + inv3kmod2)
        if (dy*bead_radius <= limit)
          jkmod2 = (j+k).modulo(2)
          for i in -klimit..klimit
            dx = 2*i + jkmod2
            distance = bead_radius*Math.sqrt(dx*dx + dy*dy + dz*dz)
            if (distance <= limit)
              beads << PDB::Bead.new(bead_radius, dx*bead_radius, dy*bead_radius, dz*bead_radius, count)
              count+=1
            end
          end 
        end
      end 
    end 
  end
def convert_to_bead_model ( dmax , bead_radius , atoms ) radius = dmax * 0.5 limit = radius + radius * 0.23 inv_bead_radius = 1.0 / bead_radius klimit = ( limit * inv_bead_radius * 3.0 / 2.0 * invsqrt6 ) count = 0 inv3 = 1.0 / 3 sqrt6 = Math . sqrt ( 6 ) beads = [ ] count = 1 for k in - klimit .. klimit dz = 2.0 * inv3 * sqrt6 * k if ( dz * bead_radius > limit ) break end inv3kmod2 = inv3 * k . modulo ( 2 ) for j in - klimit .. klimit dy = sqrt3 * ( j + inv3kmod2 ) if ( dy * bead_radius <= limit ) jkmod2 = ( j + k ) . modulo ( 2 ) for i in - klimit .. klimit dx = 2 * i + jkmod2 distance = bead_radius * Math . sqrt ( dx * dx + dy * dy + dz * dz ) if ( distance <= limit ) beads << PDB :: Bead . new ( bead_radius , dx * bead_radius , dy * bead_radius , dz * bead_radius , count ) count += 1 end end end end end end
Model contains many molecules derived from PDB File
define global variables
Model contains many molecules derived from PDB File define global variables
# atoms should be centered #create HCP lattice # end of i loop # end of j loop # end of k loop
dmax
<not_specific>
bead_radius
<not_specific>
atoms
<not_specific>