Skip to content

natl/threespheres

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

threespheres module

Routines for calculating the intersection volume of three spheres.

In threespheres.py, there are two methods for calculating the volume intersected by three spheres. One is analytic and the second is a Monte Carlo estimation.

Analytic (Exact) value

This comes from a paper by Gibson and Scheraga (J. Phys. Chem., 1987). The paper suggests the method is general to all triple overlaps, however I have noticed that it fails for certain geometries where the centre of one circle is significantly inside both of the other two. In cases where this may occur, it is flagged and the default behaviour is to use Monte Carlo methods to estimate the overlap volume, to verify whether the analytic value is valid.

Usage:

from threespheres import triple_overlap

p1 = np.array([2. * np.cos(np.arccos(11. / 16.)),
               2. * np.sin(np.arccos(11. / 16.)), 0])
p2 = np.array([0, 0, 0])
p3 = np.array([4, 0, 0])

r1 = 1
r2 = 2
r3 = 3

print triple_overlap(p1, p2, p3, r1, r2, r3)

About

Python script to calculate the volume of three intersecting spheres

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages