Advertisement
CasualGamer

COPHY_Functions

Jan 10th, 2021
1,354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. import numpy as np
  2.  
  3. def combinationRuleEpsilon(sig1, sig2):
  4.     return (sig1*sig2)**0.5 #Berthelot
  5.  
  6. def combinationRuleSigma(eps1, eps2):
  7.     return (eps1+eps2)*0.5 #Lorentz
  8.  
  9. def averageClusterSize(cluster_array):
  10.     sum_particles = 0
  11.     for c in cluster_array:
  12.         sum_particles = sum_particles + c[1].size()
  13.     if len(cluster_array)>0:
  14.         return sum_particles/len(cluster_array)
  15.     else:
  16.         return 0;
  17.  
  18. def addParticles(particleTypes,system):
  19.     for type in particleTypes:
  20.         for i in range(int(type.n)):
  21.             temp=np.random.random(3)
  22.             system.part.add(type=type.type, dip=temp/np.linalg.norm(temp)*type.dipoleMoment, pos=np.random.random(3) * system.box_l)
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement