Introduction
Introduction Statistics Contact Development Disclaimer Help
tcreated cond2linear, a function that bonds two particles randomly - sphere - G…
git clone git://src.adamsgaard.dk/sphere
Log
Files
Refs
LICENSE
---
commit 6a632c21a2d8291d75b9afa1ed852334d7089fd8
parent f6f8a54343a9f6d208f5fa75da0f03d2140be761
Author: Anders Damsgaard <[email protected]>
Date: Mon, 11 Mar 2013 23:17:17 +0100
created cond2linear, a function that bonds two particles randomly
Diffstat:
M python/sphere.py | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/python/sphere.py b/python/sphere.py
t@@ -706,8 +706,24 @@ class Spherebin:
print(x_ij_length); print(dist_ij)
raise Exception("Error, something went wrong in createBondPair")
-
-
+ def random2bonds(self, ratio=0.3, spacing=-0.1):
+ """ Bond an amount of particles in two-particle clusters
+ @param ratio: The amount of particles to bond, values in ]0.0;1.0] (fl…
+ @param spacing: The distance relative to the sum of radii between bond…
+ particles, neg. values denote an overlap. Values in ]0.0,inf[ (float).
+ The particles should be initialized beforehand.
+ Note: The actual number of bonds is likely to be somewhat smaller than
+ specified, due to the random selection algorithm.
+ """
+
+ bondparticles = numpy.unique(numpy.random.random_integers(0, high=self…
+ if (bondparticles.size % 2 > 0):
+ bondparticles = bondparticles[:-1].copy()
+ bondparticles.reshape(int(bondparticles.size/2), 2)
+ self.nb0[0] = bonds_i.size/2
+
+ for n in numpy.arange(self.nb0):
+ createBondPair(bondparticles[n,0], bondparticles[n,1], spacing)
def zeroKinematics(self):
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.