← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3448: Merge github.com:yade/trunk into chaoUnsat

 

Merge authors:
  Anton Gladky (gladky-anton)
  Anton Gladky (gladky-anton)
  Bruno Chareyre (bruno-chareyre)
  Christian Jakob (jakob-ifgt)
  Dominik Boemer (dominik-boemer)...

------------------------------------------------------------
revno: 3448 [merge]
committer: Chao Yuan <chaoyuan2012@xxxxxxxxx>
timestamp: Thu 2014-09-04 16:50:57 +0200
message:
  Merge github.com:yade/trunk into chaoUnsat
removed:
  NEWS
  py/3rd-party/mtTkinter-0.3/
  py/3rd-party/mtTkinter-0.3/mtTkinter.py
added:
  doc/sphinx/github.rst
  examples/clumps/clump-hopper-test.py
  py/3rd-party/mtTkinter-0.4/
  py/3rd-party/mtTkinter-0.4/gpl.txt
  py/3rd-party/mtTkinter-0.4/lgpl.txt
  py/3rd-party/mtTkinter-0.4/mtTkinter.py
  scripts/checks-and-tests/checks/checkClumpHopper.py
  scripts/checks-and-tests/checks/checkViscElPM.py
modified:
  ChangeLog
  core/BodyContainer.cpp
  doc/references.bib
  doc/sphinx/index-toctree.rst
  doc/sphinx/installation.rst
  doc/sphinx/prog.rst
  doc/sphinx/tutorial/06-periodic-triaxial-test.py
  pkg/common/ForceEngine.cpp
  pkg/common/ForceEngine.hpp
  pkg/dem/Shop.hpp
  pkg/dem/Shop_02.cpp
  pkg/dem/SpherePack.cpp
  pkg/dem/TriaxialStressController.cpp
  pkg/dem/TriaxialStressController.hpp
  pkg/dem/VTKRecorder.cpp
  pkg/dem/VTKRecorder.hpp
  pkg/dem/ViscoelasticPM.cpp
  pkg/pfv/FlowEngine.hpp.in
  py/3rd-party/README
  py/CMakeLists.txt
  py/_utils.cpp
  py/pack/_packSpheres.cpp
  py/utils.py
  scripts/checks-and-tests/checks/DEM-PFV-check.py
  scripts/checks-and-tests/checks/checkViscElEng.py


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'ChangeLog'
--- ChangeLog	2014-06-25 17:41:03 +0000
+++ ChangeLog	2014-08-04 16:55:34 +0000
@@ -1,4 +1,121 @@
 ==================================================
+yade-1.11.0
+Mon, 4 Aug 2014 18:54:00 +0200
+
+Alexander Eulitz (9):
+      small corrections of messed up indentations
+      another indentation fixed
+      rearranged compilation and installing procedure so that hints for multicore compilation are placed directly after the make command
+      typo fix
+      fixed --cores implementation and improved arg-parse argument documentation.
+      improved doc of betan and betas
+      replacing damping coefficient betan and betas by damping ratio betan and betas
+      rearranged indentation of examplarily folder structure for yade complation
+      Added hint about make errors during compilation     when user does not posses root priviledges.
+
+Anton Gladky (58):
+      Delete RELEASE file.
+      Add YADE_PTR_DYN_CAST to define dynamic_cast.
+      Remove all "using namespace std;"
+      Fix compilation with disabled openmp.
+      Roll back last 2 commits.
+      Remove most of "using namespace std;"
+      Replace math.h by cmath in includes.
+      Remove some more "using namespace std;"
+      Remove "using namespace std;" everywhere. Tests are failing.
+      Replace abs by std::abs.
+      Clean up in header inclusions.
+      First stage of C++11 implementing.
+      Add missing header.
+      Remove isIndexable and isFactorable.
+      Use boost::shared_ptr for C++11 as well.
+      Drop Qt3 workaround
+      Enable LBM by default.
+      Enable C++11 by default.
+      Do not consider Eigen3 like a feature.
+      Capitalize feature list.
+      Use double precision for VTKREcorder.
+      Do not use -DTYPEOF, use explicit decltype
+      Move definitions of YADE_PTR_CAST YADE_CAST YADE_PTR_DYN_CAST into     Math.hpp
+      Remove -std=c++0x definition for pygts.
+      Join [CohFrict]Mat, Phys and Ip2_.
+      Move Ip2_*_MindlinCapillaryPhys into HertzMindlin
+      Move Ip2_*_CapillaryPhys. into CapillaryPhys.
+      Move Ip2_FrictMat_* into FrictPhys
+      Move all NormalInelastic files into NormalInelasticPM
+      Join all InelastCohFrict files into InelastCohFrictPM.
+      Join all KinemC*Engine.* into KinemC__Engine.*
+      Set C++11 only for CXX-files, not C
+      Update LICENSE file, does not need exception any more
+      Cut off some header inclusions.
+      Disable reusing of removed body ids.
+      Fix compilation.
+      Replace nullptr by reset().
+      Join all Bo1_* into Bo1_Aabb
+      Remove some more .cpp-files.
+      Move many Gl1_* into Gl1_Primitives.
+      Remove some more small cpp-files.
+      Remove some warnings.
+      Remove LBMbody.cpp and LBMlink.cpp.
+      Remove Indexable.cpp
+      Exclude Indexable.cpp from CMakeLists.txt
+      Redirect --test output into stdout
+      Modify slightly description of save-loadVars
+      Change stderr to stdout in greeting message.
+      Update Vaclav`s occupation in sphinx-doc
+      Cut long line in HertzMindlin.hpp
+      Move some YADE_PLUGINS into common.cpp
+      Fix most of compilation warnings.
+      Return false in BubbleMat, if no penetration.
+      Fix and enable DEM-PFV-check.py.
+      Replace L3eom by SCgeom in stl and gts examples.
+      Use global interpreter lock (GIL) in OpenGLRenderer.
+      Update mtTkinter version.
+      Remove NEWS file (outdated).
+
+Bruno Chareyre (9):
+      Revert "Revert "Set minimal required Eigen3 version 3.2.1"" / Thanks Anton for uploading the backport
+      replace abs by std::abs (complement of https://github.com/yade/trunk/commit/1997c194c0aa759cae101a3dd0a559fcf049b29f)
+      +2 conf papers
+      Law2 return bool - fix https://bugs.launchpad.net/yade/+bug/1324190
+      add missing 'return bool' in some Law2's
+      Revert "implement more accurate porosity calculation..." (temporary required in order to revert 915fd94606af6 without conflict)"
+      Revert "fix typos and indents; cut long lines.. - please no formatting commits (+there is nothing wrong in long lines). Please reapply the documentation part."
+      make growParticles fatser for clumps
+      use Shop::growParticles in TriaxialStressController (fix https://bugs.launchpad.net/yade/+bug/1351275)
+
+Christian Jakob (5):
+      fix typos and indents; cut long lines in TriaxialStressController; bit more documentation of stressMask
+      implement more accurate porosity calculation for clumps in TriaxialStressController; inserted updateClumpProperties command in Triax tutorial
+      Merge branch 'master' of github.com:yade/trunk
+      make PFV compatible with clumps (clumps are treated as spheres with equivalent radius - valid for nearly spherical clumps)
+      reapply 9e512fd50083
+
+Francois (1):
+      Simplify the contact detection in Ig2_GridConnection_GridConnection_GridCoGridCoGeom.
+
+Jan Stransky (3):
+      fixed bug in export.VTKExporter.exportInteractions (question #250922)
+      modification of utils.UnstructuredMesh, added utils.polyhedron
+      fixed bug in MASK_ARBITRARY feature
+
+Jerome Duriez (7):
+      Correction of some broken sphinx links: yade._utils => yade.utils
+      Removal of a double :
+      Improvement of previous commit: there was no extra : but a missing blank line
+      Export principal stresses and directions in VTKRecorder
+      Some shortening in VTKRecorder, mainly according to http://www.mail-archive.com/yade-dev@xxxxxxxxxxxxxxxxxxx/msg10370.html
+      Revert sign convention in bstresses in VTKRecorder (tension=positiv now)
+      Slight modif in JCFpm doc. To better describe the logic of the code.
+
+Kubeu (1):
+      replaced "root" from last commit
+
+Nolan Dyck (2):
+      Update BubbleMat.hpp and BubbleMat.cpp
+      Update bubble example script.
+
+==================================================
 yade-1.10.0
 Wed, 25 Jun 2014 19:35:00 +0200
 

=== removed file 'NEWS'
--- NEWS	2011-10-23 14:16:33 +0000
+++ NEWS	1970-01-01 00:00:00 +0000
@@ -1,198 +0,0 @@
-vim:syntax=changelog
-
-2011-10-23 Anton Gladky <gladky.anton@xxxxxxxxx> revision around bzr2942
-	
-	* RELEASE 0.70.0, Bug-fix release.
-		
-	* some changes since 0.6
-		- Added HarmonicMotionEngine, WirePM 
-		- Added check-tests to detect regressions
-		- A lot of fixes in the code and documentation.
-
-2010-12-01 Václav Šmilauer <eu@xxxxxxxx> revision around bzr bzr2540
-	
-	* RELEASE 0.6:
-		 - https://launchpad.net/yade/trunk/0.60
-
-	* major changes since 0.5:
-		- use boost::serialization (faster, more reliable), use eigen instead of Wm3 (better supported, more flexible)
-		- qt4-based interface with on-the-fly inspection and editing of all internal variables
-		-  support compilation with clang++
-		- live plots
-		- periodic boundary conditions are much better tested now
-		- batch web interface substantially enhanced (including plots, logs, ...)
-		- extended attribute flags (readonly, noSave, hidden, ...)
-		- added --rebuild, --debug and --test options
-
-2010-04-20 Václav Šmilauer <eudoxos@xxxxxxxx> revision around bzr2150
-
-	* RELEASE: 0.5
-		- https://launchpad.net/yade/+milestone/0.5
-
-	* overall:
-		- yade main is now a python script, the c++ part is imported
-		- many classes renamed for the sake of consistency, while mostly keeping backward compatibility for scripts
-		- all classes (deriving from Serializable) are automatically exposed in python via automatically constructed wrappers, with full attribute access (https://bugs.launchpad.net/yade/+bug/544857)
-		- lot of old code removed (to be found in attic/)
-
-	* functionality:
-		- separated State and (possibly shared) Material for bodies
-		- InsertionSortCollider handles both periodic and aperiodic simulations now
-		- Cell can undergo arbitrary linear transformation during simulation
-		- VTKRecorder saves to VTK-compatible XML files; allows one to use Paraview for post-processing
-		- NewtonIntegrator features integration of rotation of non-spherical bodies
-		- callback functionality for interaction and body loop (InteractionDispatchers and NewtonIntegrator) (not yet fully done)
-		- body and interaction containers devirtualized (https://blueprints.launchpad.net/yade/+spec/devirtualize-containers)
-
-	* documentation:
-		- New website https://www.yade-dem.org
-		- Sphinx documentation https://www.yade-dem.org/sphinx/, containing both hand-written and automatically generated documentation
-		- All classes and attributes visible from python are documented now
-		- Drop doxygen documentation
-
-
-2009-08-31 Václav Šmilauer <eudoxos@xxxxxxxx> revision around bzr1740
-
-	* RELEASE: 0.20.0
-
-	* overall: 
-		- fix many crashers, including synchronization with openGL, GUI and python
-		- generate documentation for both python and c++ classes/functions automatically (http://yade.wikia.com/wiki/Reference_documentation)
-		- move away from SVN repository at berlios.de to bzr at http://www.launchpad.net/yade; bug tracking and other launchpad features are being used; mailing lists migrated to launchpad
-
-	* functionality enhancements (apart from performance-oriented changes):
-		- Facets (arbitrary triangulation elements) interacting with spheres, allowing to triangulate any surface
-		- support for GTS-compatible triangulated surfaces both as predicates and facet-triangulated simulation elements
-		- non-incremental sphere-sphere and sphere-facet contact geometry classes (Dem3DofGeom)
-		- ConstitutiveLawDispatcher, for having multiple constitutive laws operating on different interactions
-		- schedule to run multiple jobs at time, with different parameters (yade-multi, http://yade.wikia.com/wiki/ScriptParametricStudy)
-		- added PhysicalParameters::blockedDOFs
-		- periodic boundary conditions
-		- interaction logic cleaned up
-		- sphere packing generators (orthogonal, hexagonal, loose random, triaxially compacted; periodic coming soon)
-		- geometry predicates to clip packing, including boolean operations on predicates
-		- infrastructure for regression tests
-
-	* performance:
-		- consistent openMP support throughout the code (InteractionDispatchers, NewtonsDampedLaw, BexContainer) (http://yade.wikia.com/wiki/Performance_Tuning#openMP)
-		- InsertionSortCollider (PersistentSAPCollide removed) (http://yade.wikia.com/wiki/Colliders_performace)
-		- InteractionDispatchers that reduce number of loops over interactions to one (http://yade.wikia.com/wiki/Performance_Tuning#InteractionDispatchers)
-		- new fast container for interactions (InteractionVecMap) (http://yade.wikia.com/wiki/Performance_Tuning#Containers)
-		- caching dispatchers, avoiding repetitive multivirtual call resolution (http://yade.wikia.com/wiki/Performance_Tuning#Dispatcher_cache)
-		- runtime profiling information (http://yade.wikia.com/wiki/Speed_profiling_using_TimingInfo_and_TimingDeltas_classes)
-		- avoid running collision detection at every step (http://yade.wikia.com/wiki/Insertion_Sort_Collider_Stride)
-		- vector and quaternion classes are wrapped in python automatically (faster, avoids hand-written wrappers)
-		- removed many python proxy classes, resulting in big speedup of python (e.g. 40 × for some operations)
-
-	* building:
-		- yade can be optionally with one single plugin containing all packages. Speeds up full compilation considerably and reduces binary size several times.
-		- files in pkg/* are picked up automatically by the build system, including linking flags
-		- do not install headers, only plugins
-		- fix debian-package builds and document the procedure (http://yade.wikia.com/wiki/DebianPackages), special package for docs
-		- fix all (or most) compile-time warnings
-		- create new top-level py/ directory for python
-
-	* python:
-		- use natural syntax for class instance construction with attributes
-		- run telnet server to make yade accessible while running (from localhost only)
-		- save any python variables within the XML file, which will be resurrected next time (utils.saveVars, utils.loadVars)
-		- support saving simulation to memory temporarily
-		- functions from creating video from simulation (via snapshots, either during simulation or in the player)
-
-	* Documentation:
-		- Structurized content added http://yade.wikia.com/wiki/Structurized_content
-		- FAQ start to implement http://yade.wikia.com/wiki/FAQ
-
-
-2008-08-20 Janek Kozicki <cosurgi@xxxxxxxxx> revision 1579
-
-	* RELEASE: 0.12.1
-	
-		- several python interface improvements
-		- add code for plotting histogram of interaction directions
-		- added buttons for looking from different directions
-		- new contact algorithm for facets
-		- added python script for making videos
-		- added a TCP server on port 9000 with python console in it
-		- new dependency on python-numpy package, which allows faster math in python
-		- added a script for parametric studies
-
-
-2008-08-20 Janek Kozicki <cosurgi@xxxxxxxxx> revision 1486
-
-	* RELEASE: 0.12
-
-	* User interface:
-
-		- Refactored Qt3 interface: MDI with simulation running
-		  asynchronously, with python console
-
-		- Python wrapper and console with the ability to control most
-		  simulation aspects (including creating simulations,
-		  modifying, inspecting, running, recording data), some parts
-		  of the UI (setting view, configuring renderer); see
-		  scripts/simple-scene.py to get started
-		  (http://yade.wikia.com/wiki/SimpleSceneTutorial)
-
-		- Much enhanced simulation recorder and player, saving
-		  optionally to a single file (sqlite database), the ability to
-		  create video from simulation with one command (may be done
-		  offscreen as well): scripts/simple-scene-player.py,
-		  http://yade.wikia.com/wiki/New:Making_videos
-
-	* Graphical Viewer:
-
-		- up to 3 clipping planes in the GLViewer, can be manipulated,
-		  bound to each other, activated/deactivated
-
-		- saving view to view configurations inside MetaBody (Alt+7 --
-		  Alt+9), can be loaded later (from python as well)
-
-		- displacement and rotation scaling in GLViewer, using
-		  PhysicalParameters::refSe3
-
-	* Simulation features:
-
-		- New moment rotation law, fully tested and working
-
-		- All simulation aspects (dt, iteration, virtual time) are now
-		  inside MetaBody, i.e. are restored exactly as they were from
-		  .xml
-
-		- Much improved triaxial test
-
-		- Lattice model can now simulate concrete with steel fibres
-	
-	* New, experimental features:
-
-		- Selectively block any of 6 DOFs ( translation and rotation)
-		  for individual bodies (PhysicalParameters::blockedDOFs - not
-		  documented, not conveniently accessible from python
-		  yet)
-
-		- Plotting interface based on pylab see example in
-		  scripts/simple-scene-graph.py
-
-		- Sega's facets and vertices with stl import (for example
-		  import shapes from blender)
-	
-	* Serialization:
-
-		- Transparent support for compressed .xml.gz and .xml.bz2
-		  files; dropped support for binary format
-
-		- The (de)serializer now (un)escapes all control characters,
-		  using the &charname; format, arbitrary string values can be
-		  de/serialized now, including parentheses, quotations marks,
-		  newlines, tabs, <>.
-
-	* Compilation / Development:
-
-		- Compilation profiles allow separate option sets for scons;
-		  simultaneous compilation of multiple profiles is supported
-		  via the profile=a,b,c
-		
-		- QGLViewer source is now in our tree, no need to install it
-		  separately
-
-

=== modified file 'core/BodyContainer.cpp'
--- core/BodyContainer.cpp	2014-07-17 08:05:16 +0000
+++ core/BodyContainer.cpp	2014-09-01 09:53:04 +0000
@@ -29,34 +29,35 @@
 
 bool BodyContainer::erase(Body::id_t id, bool eraseClumpMembers){//default is false (as before)
 	if(!body[id]) return false;
-	
 	const shared_ptr<Body>& b=Body::byId(id);
-	
 	if ((b) and (b->isClumpMember())) {
-		const shared_ptr<Body>& clumpBody=Body::byId(b->clumpId);
+		const shared_ptr<Body> clumpBody=Body::byId(b->clumpId);
 		const shared_ptr<Clump> clump=YADE_PTR_CAST<Clump>(clumpBody->shape);
 		Clump::del(clumpBody, b);
-		
-		if (clump->members.size()==0) this->erase(b->clumpId,false);	//Clump has no members any more. Remove it
+		if (clump->members.size()==0) this->erase(clumpBody->id,false);	//Clump has no members any more. Remove it
 	}
 	
 	if ((b) and (b->isClump())){
 		//erase all members if eraseClumpMembers is true:
 		const shared_ptr<Clump>& clump=YADE_PTR_CAST<Clump>(b->shape);
 		std::map<Body::id_t,Se3r>& members = clump->members;
-		FOREACH(MemberMap::value_type& mm, members){
-			const Body::id_t& memberId=mm.first;
-			if (eraseClumpMembers) this->erase(memberId,false);	// erase members
-			//when the last members is erased, the clump will be erased automatically, see above
-			else Body::byId(memberId)->clumpId=Body::id_t(-1);	// make members standalones
+		std::vector<Body::id_t> idsToRemove;
+		FOREACH(MemberMap::value_type mm, members) idsToRemove.push_back(mm.first); // Prepare an array of ids, which need to be removed.
+		FOREACH(Body::id_t memberId, idsToRemove){
+			if (eraseClumpMembers) {
+				this->erase(memberId,false);	// erase members
+			} else {
+				//when the last members is erased, the clump will be erased automatically, see above
+				Body::byId(memberId)->clumpId=Body::ID_NONE; // make members standalones
+			}
 		}
+		body[id].reset();
+		return true;
 	}
 	const shared_ptr<Scene>& scene=Omega::instance().getScene();
 	for(Body::MapId2IntrT::iterator it=b->intrs.begin(),end=b->intrs.end(); it!=end; ++it) {  //Iterate over all body's interactions
 		scene->interactions->requestErase((*it).second);
 	}
-	
 	body[id].reset();
-	
 	return true;
 }

=== modified file 'doc/references.bib'
--- doc/references.bib	2014-07-28 06:24:36 +0000
+++ doc/references.bib	2014-08-19 13:59:12 +0000
@@ -735,3 +735,50 @@
 	pages={447-454},
 	language={English}
 }
+
+@article{Richarson1954,
+  author = {Richardson, J. F., and W. N. Zaki},
+  title = {Sedimentation and fluidization: Part i},
+  journal = {Trans. Instn. Chem. Engrs},
+  year = {1954},
+  volume = {32}
+}
+
+@article{RevilBaudard2013,
+  author = {Revil-Baudard, T. and Chauchat, J.},
+  title = {A two-phase model for sheet flow regime based on dense granular flow
+	rheology},
+  journal = {Journal of Geophysical Research: Oceans},
+  year = {2013},
+  volume = {118},
+  pages = {619--634},
+  number = {2}
+}
+
+@article{Schmeeckle2007,
+  author = {Schmeeckle, Mark W. and Nelson, Jonathan M. and Shreve, Ronald L.},
+  title = {Forces on stationary particles in near-bed turbulent flows},
+  journal = {Journal of Geophysical Research: Earth Surface},
+  year = {2007},
+  volume = {112},
+  number = {F2},
+  doi = {10.1029/2006JF000536},
+  url = {http://dx.doi.org/10.1029/2006JF000536}
+}
+
+@article{Wiberg1985,
+  author = {Wiberg, Patricia L. and Smith, J. Dungan},
+  title = {A theoretical model for saltating grains in water},
+  journal = {Journal of Geophysical Research: Oceans},
+  year = {1985},
+  volume = {90},
+  pages = {7341--7354},
+  number = {C4}
+}
+@book{Dallavalle1948,
+  title = {Micrometrics : The technology of fine particles},
+  publisher = {Pitman Pub. Corp},
+  year = {1948},
+  author = {J. M. DallaValle},
+  volume = {2nd edition}
+}

=== added file 'doc/sphinx/github.rst'
--- doc/sphinx/github.rst	1970-01-01 00:00:00 +0000
+++ doc/sphinx/github.rst	2014-08-18 15:34:10 +0000
@@ -0,0 +1,202 @@
+.. _yade-github-label:
+
+##############
+Yade on GitHub
+##############
+
+************************************************
+Fast checkout without GitHub account (read-only)
+************************************************
+ 
+Getting the source code without registering on GitHub can be done via a single command. It will not allow interactions with the remote repository, which you access the read-only way::
+
+ git clone https://github.com/yade/trunk.git
+
+***************************************************************************
+Using branches on GitHub (for frequent commits see git/trunk section below)
+***************************************************************************
+
+Most usefull commands are below. For more details, see for instance http://gitref.org/index.html and https://help.github.com/articles/set-up-git
+
+Setup
+=====
+
+1. Register on github.com
+
+2. Add your `SSH key <https://help.github.com/articles/generating-ssh-keys>`_ to GitHub:
+
+ On the GitHub site Click “Account Settings” (top right) > Click “SSH keys” > Click “Add SSH key”
+
+3. Set your username and email through terminal:
+
+ ::
+
+  git config --global user.name "Firstname Lastname"
+  git config --global user.email "your_email@xxxxxxxxxxxxx"
+
+4. `Fork a repo <https://help.github.com/articles/fork-a-repo>`_:
+
+ Click the “Fork” button on the https://github.com/yade/trunk
+
+5. Set Up Your Local Repo through terminal:
+
+ ::
+
+  git clone git@xxxxxxxxxx:username/trunk.git
+
+ This creates a new folder, named trunk, that contains the whole code.
+
+6. Configure remotes
+
+ ::
+
+  cd to/newly/created/folder
+  git remote add upstream git@xxxxxxxxxx:yade/trunk.git
+  git fetch upstream
+
+ Now, your "trunk" folder is linked with the code hosted on github.com. Through appropriate commands explained below, you will be able to update your code to include changes commited by others, or to commit yourself changes that others can get.
+
+Retrieving older Commits
+========================
+
+In case you want to work with, or compile, an older version of Yade which is not tagged, you can create your own (local) branch of the corresponding daily build. Look `here <https://answers.launchpad.net/yade/+question/235867>`_ for details.
+
+Committing and updating 
+========================
+
+For those used to other version control systems, note that the commit mechanisms in Git significantly differs from that of `Bazaar <http://bazaar.canonical.com/en/>`_ or `SVN <https://subversion.apache.org/>`_. Therefore, don't expect to find a one-to-one command replacement. In some cases, however, the equivalent bazaar command is indicated below to ease the transition.
+
+Inspecting changes
+------------------
+
+You may start by inspecting your changes with a few commands. For the "diff" command, it is convenient to copy from the output of "status" instead of typing the path to modified files. ::
+
+ git status
+ git diff path/to/modified/file.cpp
+
+Committing changes
+------------------
+
+Then you proceed to commit through terminal::
+
+ git add path/to/new/file.cpp  #Version a newly created file: equivalent of "bzr add"
+ git commit path/to/new_or_modified/file.cpp -m'Commit message'``  #Validate a change. It can be done several times after every sufficient change. No equivalent in bzr, it's like commiting to your own local repository
+ git push  #Push your changes into GitHub. Equivalent of "bzr commit", except that your are commiting to your own remote branch
+
+Changes will be pushed to your personal "fork", If you have tested your changes and you are ready to push them into the main trunk, just do a "pull request" [5] or create a patch from your commit via::
+
+ git format-patch origin  #create patch file in current folder)
+
+and send to the developers maililng list (yade-dev@xxxxxxxxxxxxxxxxxxx) as attachment. In either way, after reviewing your changes they will be added to the main trunk.
+
+When the pull request has been reviewed and accepted, your changes are integrated in the main trunk. Everyone will get them via ``git fetch``.
+
+Updating
+--------
+
+You may want to get changes done by others::
+
+ git fetch upstream  #Pull new updates from the upstream to your branch. Eq. of "bzr update", updating the remote branch from the upstream yade/trunk
+ git merge upstream/master  #Merge upstream changes into your master-branch (eq. of "bzr update", updating your local repository from the remote branch)
+
+Alternatively, this will do fetch+merge all at once (discouraged if you have uncommited changes)::
+
+ git pull
+
+****************************************************************
+Working directly on git/trunk (recommended for frequent commits)
+****************************************************************
+
+This direct access to trunk will sound more familiar to `bzr <http://bazaar.canonical.com/en/>`_ or `svn <https://subversion.apache.org/>`_ users. It is only possible for members of the git team "developpers". Send an email at yade-dev@xxxxxxxxxxxxxxxxxxx to join this team (don't forget to tell your git account name).
+
+* Get trunk:
+
+ ::
+
+  git clone git@xxxxxxxxxx:yade/trunk.git
+
+ This creates a new folder, named trunk, that contains the whole code.
+
+* Update
+
+ ::
+
+  git pull
+
+* Commit to local repository
+
+ ::
+
+  git commit filename1 filename2 ...
+
+* Push changes to remote trunk
+
+ ::
+
+  git push
+
+ Now, the changes you made are included in the on-line code, and can be get back by every user.
+
+To avoid confusing logs after each commit/pull/push cycle, it is better to setup automatic rebase::
+
+ git config --global branch.autosetuprebase always
+
+Now your file ~/.gitconfig should include:
+
+ [branch]
+   autosetuprebase = always
+
+Check also .git/config file in your local trunk folder (rebase = true):
+
+ [branch "master"]
+   remote = origin
+   merge = refs/heads/master
+   rebase = true
+
+Auto-rebase may have unpleasant side effects by blocking "pull" if you have uncommited changes. In this case you can use "git stash"::
+
+ git pull
+ lib/SConscript: needs update
+ refusing to pull with rebase: your working tree is not up-to-date
+ git stash #hide the uncommited changes away
+ git pull  #now it's ok
+ git push  #push the commited changes
+ git stash pop #get uncommited changes back
+
+********************************************
+General guidelines for pushing to yade/trunk
+********************************************
+
+1. Set autorebase once on the computer! (see above)
+
+2. Inspect the diff to make sure you will not commit junk code (typically some "cout<<" left here and there), using in terminal:
+
+ ::
+
+  git diff file1
+
+ Or, alternatively, any GUI for git: gitg, git-cola... 
+
+3. Commit selectively:
+
+ ::
+
+  git commit file1 file2 file3 -m "message" # is good
+  git commit -a -m "message"                # is bad. It is the best way to commit things that should not be commited
+
+4. Be sure to work with an up-to-date version launching:
+
+ ::
+
+  git pull
+
+5. Make sure it compiles and that regression tests pass: try "yade --test" and "yade --check".
+
+6. You can finally let all Yade-users enjoy your work:
+
+ ::
+
+  git push
+
+
+**Thanks a lot for your cooperation to Yade!**

=== modified file 'doc/sphinx/index-toctree.rst'
--- doc/sphinx/index-toctree.rst	2013-03-21 19:28:57 +0000
+++ doc/sphinx/index-toctree.rst	2014-08-18 15:34:10 +0000
@@ -29,6 +29,8 @@
 
   installation.rst
 
+  github.rst
+
   formulation.rst
 
   yade.wrapper.rst

=== modified file 'doc/sphinx/installation.rst'
--- doc/sphinx/installation.rst	2014-07-25 08:01:21 +0000
+++ doc/sphinx/installation.rst	2014-08-18 15:34:10 +0000
@@ -90,8 +90,7 @@
 
 		git clone git@xxxxxxxxxx:yade/trunk.git
 
-will download the whole code repository of ``trunk``. Check out `Yade on github
-<https://www.yade-dem.org/wiki/Yade_on_github>`_ wiki page for more.
+will download the whole code repository of ``trunk``. Check out :ref:`yade-github-label` for more.
 
 Alternatively, a read-only checkout is possible via https without a GitHub account (easier if you don't want to modify the main Yade branch)::
 

=== modified file 'doc/sphinx/prog.rst'
--- doc/sphinx/prog.rst	2014-05-27 11:24:16 +0000
+++ doc/sphinx/prog.rst	2014-08-21 08:51:47 +0000
@@ -106,7 +106,7 @@
 which is used for source code, bug tracking, planning, package downloads and more. 
 
 The versioning software used is `GIT <http://git-scm.com/>`__, for which a short
-tutorial can be found in a `Yade's wiki pages <https://www.yade-dem.org/wiki/Yade_on_github>`__. 
+tutorial can be found in :ref:`yade-github-label`. 
 GIT is a distributed revision control system. It is available packaged for all major linux distributions.
 
 The source code is hosted on `GitHub <https://github.com/yade/>`__ , which is periodically

=== modified file 'doc/sphinx/tutorial/06-periodic-triaxial-test.py'
--- doc/sphinx/tutorial/06-periodic-triaxial-test.py	2013-03-08 15:05:59 +0000
+++ doc/sphinx/tutorial/06-periodic-triaxial-test.py	2014-09-03 15:59:54 +0000
@@ -35,10 +35,6 @@
 if 0:
 	## uniform distribution
 	sp.makeCloud((0,0,0),(2,2,2),rMean=.1,rRelFuzz=.3,periodic=True)
-elif 0:
-	## per-fraction distribution
-	## passing: cummulative percentage
-	sp.particleSD2(radii=[.09,.1,.2],passing=[40,80,100],periodic=True,numSph=1000)
 else:
 	## create packing from clumps
 	# configuration of one clump

=== added file 'examples/clumps/clump-hopper-test.py'
--- examples/clumps/clump-hopper-test.py	1970-01-01 00:00:00 +0000
+++ examples/clumps/clump-hopper-test.py	2014-08-12 19:46:58 +0000
@@ -0,0 +1,79 @@
+# -*- coding: utf-8
+
+from yade import pack,export,qt,geom
+import itertools
+from numpy import *
+
+
+kinEnergyMax = 100000
+# Parameters
+tc=0.001# collision time 
+en=.3  # normal restitution coefficient
+es=.3  # tangential restitution coefficient
+frictionAngle=radians(35)# 
+density=2700
+# facets material
+facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,tc=tc,en=en,et=es))
+# default spheres material
+dfltSpheresMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle,tc=tc,en=en,et=es)) 
+
+O.dt=.05*tc # time step
+
+Rs=0.05 # particle radius
+
+# Create geometry
+
+x0=0.; y0=0.; z0=0.; ab=.7; at=2.; h=1.; hl=h; al=at*3
+
+zb=z0;   x0b=x0-ab/2.; y0b=y0-ab/2.; x1b=x0+ab/2.; y1b=y0+ab/2.
+zt=z0+h; x0t=x0-at/2.; y0t=y0-at/2.; x1t=x0+at/2.; y1t=y0+at/2.
+zl=z0-hl;x0l=x0-al/2.; y0l=y0-al/2.; x1l=x0+al/2.; y1l=y0+al/2.
+
+vibrationPlate = O.bodies.append(geom.facetBunker((x0,y0,z0),
+  dBunker=ab*4.0,dOutput=ab*1.7,hBunker=ab*3,hOutput=ab,hPipe=ab/3.0,
+  wallMask=4,segmentsNumber=10,material=facetMat))
+
+# Create engines
+O.engines=[
+	ForceResetter(),
+	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
+	InteractionLoop(
+		[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
+		[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
+		[Law2_ScGeom_ViscElPhys_Basic()],
+	),
+	DomainLimiter(lo=(-4,-4,-1),hi=(4,4,4),iterPeriod=5000,label='domLim'),
+	NewtonIntegrator(damping=0, gravity=[0,0,-9.81]),
+	PyRunner(iterPeriod=6500,command='addBodies()',nDo=7,label='addb'),
+	PyRunner(iterPeriod=1000,command='state()',label='state'),
+]
+
+numSphereGen = 0
+def addBodies():
+	global numSphereGen
+	# Create clumps...
+	clumpColor=(0.0, 0.5, 0.5)
+	for k,l in itertools.product(arange(0,10),arange(0,10)):
+		clpId,sphId=O.bodies.appendClumped([sphere(Vector3(x0t+Rs*(k*4+2),y0t+Rs*(l*4+2),i*Rs*2+zt+ab*3),Rs,color=clumpColor,material=dfltSpheresMat) for i in xrange(4)])
+		numSphereGen += len(sphId)
+
+	# ... and spheres
+	spheresColor=(0.4, 0.4, 0.4)
+	for k,l in itertools.product(arange(0,9),arange(0,9)):
+		sphAloneId=O.bodies.append( [sphere( Vector3(x0t+Rs*(k*4+4),y0t+Rs*(l*4+4),i*Rs*2.3+zt+ab*3),Rs,color=spheresColor,material=dfltSpheresMat) for i in xrange(4) ] )
+		numSphereGen += len(sphAloneId)
+
+def state():
+	global numSphereGen
+	print "Iter %d: Total number of generated spheres %d, removed particles %d, current particles %d, kinEnergy %g"%(O.iter, numSphereGen, domLim.nDeleted, numSphereGen-domLim.nDeleted, utils.kineticEnergy())
+	if (utils.kineticEnergy() > kinEnergyMax):
+		print "Kinetic energy is over a threshold value! Error!"
+
+addBodies()
+
+
+from yade import qt
+qt.View()
+O.saveTmp()
+
+#O.run(50001)

=== modified file 'pkg/common/ForceEngine.cpp'
--- pkg/common/ForceEngine.cpp	2011-04-20 15:52:11 +0000
+++ pkg/common/ForceEngine.cpp	2014-08-19 13:59:12 +0000
@@ -1,6 +1,6 @@
 // 2004 © Janek Kozicki <cosurgi@xxxxxxxxxx> 
 // 2009 © Václav Šmilauer <eudoxos@xxxxxxxx> 
-
+// 2014 © Raphael Maurin <raphael.maurin@xxxxxxxxx> 
 
 #include"ForceEngine.hpp"
 #include<yade/core/Scene.hpp>
@@ -11,7 +11,11 @@
 #include<yade/core/IGeom.hpp>
 #include<yade/core/IPhys.hpp>
 
-YADE_PLUGIN((ForceEngine)(InterpolatingDirectedForceEngine)(RadialForceEngine)(DragEngine)(LinearDragEngine));
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/normal_distribution.hpp>
+#include <boost/random/variate_generator.hpp>
+
+YADE_PLUGIN((ForceEngine)(InterpolatingDirectedForceEngine)(RadialForceEngine)(DragEngine)(LinearDragEngine)(HydroForceEngine));
 
 void ForceEngine::action(){
 	FOREACH(Body::id_t id, ids){
@@ -77,3 +81,90 @@
 		}
 	}
 }
+
+void HydroForceEngine::action(){
+	/* Velocity fluctuation determination (not usually done at each dt, that is why it not placed in the other loop) */
+	if (velFluct == true){
+		/* check size */
+		size_t size=vFluct.size();
+		if(size<scene->bodies->size()){
+			size=scene->bodies->size();
+			vFluct.resize(size);
+		}
+		/* reset stored values to zero */
+		memset(& vFluct[0],0,sizeof(Vector2r)*size);
+	
+		/* Create a random number generator rnd() with a gaussian distribution of mean 0 and stdev 1.0 */
+		/* see http://www.boost.org/doc/libs/1_55_0/doc/html/boost_random/reference.html and the chapter 7 of Numerical Recipes in C, second edition (1992) for more details */
+		static boost::minstd_rand0 randGen((int)TimingInfo::getNow(true));
+		static boost::normal_distribution<Real> dist(0.0, 1.0);
+		static boost::variate_generator<boost::minstd_rand0&,boost::normal_distribution<Real> > rnd(randGen,dist);
+
+		double rand1 = 0.0;
+		double rand2 = 0.0;
+		/* Attribute a fluid velocity fluctuation to each body above the bed elevation */
+		FOREACH(Body::id_t id, ids){
+			Body* b=Body::byId(id,scene).get();
+			if (!b) continue;
+			if (!(scene->bodies->exists(id))) continue;
+			const Sphere* sphere = dynamic_cast<Sphere*>(b->shape.get());
+			if (sphere){
+				Vector3r posSphere = b->state->pos;//position vector of the sphere
+				int p = floor((posSphere[2]-zRef)/deltaZ); //cell number in which the particle is
+				// if the particle is inside the water and above the bed elevation, so inside the turbulent flow, evaluate a turbulent fluid velocity fluctuation which will be used to apply the drag.
+				if ((p<nCell)&&(posSphere[2]-zRef>bedElevation)) { 
+					Real uStar2 = simplifiedReynoldStresses[p];
+					if (uStar2>0.0){
+						Real uStar = sqrt(uStar2);
+						rand1 = rnd();
+						rand2 = -rand1 + rnd();
+						vFluct[id] = Vector2r(rand1*uStar,rand2*uStar);
+					}
+				}
+			}
+			
+		}
+		velFluct = false;
+	}
+	
+	/* Application of hydrodynamical forces */
+	FOREACH(Body::id_t id, ids){
+		Body* b=Body::byId(id,scene).get();
+		if (!b) continue;
+		if (!(scene->bodies->exists(id))) continue;
+		const Sphere* sphere = dynamic_cast<Sphere*>(b->shape.get());
+		if (sphere){
+			Vector3r posSphere = b->state->pos;//position vector of the sphere
+			int p = floor((posSphere[2]-zRef)/deltaZ); //cell number in which the particle is
+			if ((p<nCell)&&(p>0)) {
+				Vector3r liftForce = Vector3r::Zero();
+				Vector3r dragForce = Vector3r::Zero();
+				Vector2r fluctVelBody = vFluct[id];//fluid velocity fluctuation associated to the particle's position considered.
+				Vector3r vFluid(vxFluid[p]+fluctVelBody.x(),0.0,fluctVelBody.y()); //fluid velocity at the particle's position
+				Vector3r vPart = b->state->vel;//particle velocity
+				Vector3r vRel = vFluid - vPart;//fluid-particle relative velocity
+
+				//Drag force calculation
+				Real Rep = vRel.norm()*sphere->radius*2*rhoFluid/viscoDyn; //particles reynolds number
+				Real A = sphere->radius*sphere->radius*Mathr::PI;	//Crossection of the sphere
+				if (vRel.norm()!=0.0) {
+					Real hindranceF = pow(1-phiPart[p],-expoRZ); //hindrance function
+					Real Cd = (0.44 + 24.4/Rep)*hindranceF; //drag coefficient
+					dragForce = 0.5*rhoFluid*A*Cd*vRel.squaredNorm()*vRel.normalized();
+				}
+				//lift force calculation due to difference of fluid pressure between top and bottom of the particle
+				int intRadius = floor(sphere->radius/deltaZ);
+				if ((p+intRadius<nCell)&&(p-intRadius>0)&&(lift==true)) {
+					Real vRelTop = vxFluid[p+intRadius] - vPart[0]; // relative velocity of the fluid wrt the particle at the top of the particle
+					Real vRelBottom = vxFluid[p-intRadius] - vPart[0]; // same at the bottom
+					liftForce[2] = 0.5*rhoFluid*A*Cl*(vRelTop*vRelTop-vRelBottom*vRelBottom);
+				}
+				//buoyant weight force calculation
+				Vector3r buoyantForce = -4.0/3.0*Mathr::PI*sphere->radius*sphere->radius*sphere->radius*rhoFluid*gravity;
+				//add the hydro forces to the particle
+				scene->forces.addForce(id,dragForce+liftForce+buoyantForce);		
+			}
+		}
+	}
+}
+

=== modified file 'pkg/common/ForceEngine.hpp'
--- pkg/common/ForceEngine.hpp	2011-04-20 15:52:11 +0000
+++ pkg/common/ForceEngine.hpp	2014-08-19 13:59:12 +0000
@@ -1,5 +1,6 @@
 // 2004 © Janek Kozicki <cosurgi@xxxxxxxxxx> 
 // 2009 © Václav Šmilauer <eudoxos@xxxxxxxx> 
+// 2014 © Raphael Maurin <raphael.maurin@xxxxxxxxx> 
 
 #pragma once
 
@@ -67,3 +68,29 @@
 	);
 };
 REGISTER_SERIALIZABLE(LinearDragEngine);
+
+
+class HydroForceEngine: public PartialEngine{
+	private:
+		vector<Vector2r> vFluct;
+	public:
+		virtual void action();
+	YADE_CLASS_BASE_DOC_ATTRS(HydroForceEngine,PartialEngine,"Apply drag and lift due to a fluid flow vector (1D) to each sphere + the buoyant weight.\n The applied drag force reads\n\n.. math:: F_{d}=\\frac{1}{2} C_d A\\rho^f|\\vec{v_f - v}| vec{v_f - v} \n\n where $\\rho$ is the medium density (:yref:`density<HydroForceEngine.rhoFluid>`), $v$ is particle's velocity,  $v_f$ is the velocity of the fluid at the particle center,  $A$ is particle projected area (disc), $C_d$ is the drag coefficient. The formulation of the drag coefficient depends on the local particle reynolds number and the solid volume fraction. The formulation of the drag is [Dallavalle1948]_ [RevilBaudard2013]_ with a correction of Richardson-Zaki [Richardson1954]_ to take into account the hindrance effect. This law is classical in sediment transport. It is possible to activate a fluctuation of the drag force for each particle which account for the turbulent fluctuation of the fluid velocity (:yref:`velFluct`). The model implemented for the turbulent velocity fluctuation is a simple discrete random walk which takes as input the reynolds stress tensor Re_{xz} in function of the depth and allows to recover the main property of the fluctuations by imposing <u_x'u_z'> (z) = <Re>(z)/rho^f. It requires as input <Re>(z)/rho^f called :yref:`simplifiedReynoldStresses` in the code. \n The formulation of the lift is taken from [Wiberg1985]_ and is such that : \n\n.. math:: F_{L}=\\frac{1}{2} C_L A\\rho^f((v_f - v)^2{top} - (v_f - v)^2{bottom}) \n\n Where the subscript top and bottom means evaluated at the top (respectively the bottom) of the sphere considered. This formulation of the lift account for the difference of pressure at the top and the bottom of the particle inside a turbulent shear flow. As this formulation is controversial when approaching the threshold of motion [Schmeeckle2007]_ it is possible to desactivate it with the variable :yref:`lift`.\n The buoyancy is taken into account through the buoyant weight : \n\n.. math:: F_{buoyancy}= - rho^f V^p g \n\n, where g is the gravity vector along the vertical, and V^p is the volume of the particle.",
+		((Real,rhoFluid,1000,,"Density of the fluid, by default - density of water"))
+		((Real,viscoDyn,1e-3,,"Dynamic viscosity of the fluid, by default - viscosity of water"))
+		((Real,zRef,,,"Position of the reference point which correspond to the first value of the fluid velocity"))
+		((Real,nCell,,,"Size of the vector of the fluid velocity"))
+		((Real,deltaZ,,,"width of the discretization cell "))
+		((Real,expoRZ,3.1,,"Value of the Richardson-Zaki exponent, for the correction due to hindrance"))
+                ((bool,lift,true,,"Option to activate or not the evaluation of the lift"))
+		((Real,Cl,0.2,,"Value of the lift coefficient taken from [Wiberg1985]_"))
+                ((Vector3r,gravity,,,"Gravity vector (may depend on the slope)."))
+		((vector<Real>,vxFluid,,,"Discretized streamwise fluid velocity profile in function of the depth"))
+		((vector<Real>,phiPart,,,"Discretized solid volume fraction profile in function of the depth"))
+		((bool,velFluct,false,,"If true, activate the determination of turbulent fluid velocity fluctuation at the position of each particle, using a simple discrete random walk model based on the Reynolds stresses :yref:`turbStress<HydroForceEngine.squaredAverageTurbfluct>`"))
+		((vector<Real>,simplifiedReynoldStresses,,,"Vector of size equal to :yref:`turbStress<HydroForceEngine.nCell>` containing the Reynolds stresses divided by the fluid density in function of the depth. simplifiedReynoldStresses(z) =  <u_x'u_z'>(z)^2 "))
+		((Real,bedElevation,,,"Elevation of the bed above which the fluid flow is turbulent and the particles undergo turbulent velocity fluctuation."))
+	);
+};
+REGISTER_SERIALIZABLE(HydroForceEngine);
+

=== modified file 'pkg/dem/Shop.hpp'
--- pkg/dem/Shop.hpp	2014-08-01 17:25:38 +0000
+++ pkg/dem/Shop.hpp	2014-09-03 17:34:07 +0000
@@ -119,7 +119,7 @@
 		
 		//! Function to compute overall ("macroscopic") stress.
 		static Matrix3r getStress(Real volume=0);
-		static Matrix3r getCapillaryStress(Real volume=0);
+		static Matrix3r getCapillaryStress(Real volume=0, bool mindlin=false);
 		static Matrix3r stressTensorOfPeriodicCell() { LOG_WARN("Shop::stressTensorOfPeriodicCelli is DEPRECATED: use getStress instead"); return Shop::getStress(); }
 		//! Compute overall ("macroscopic") stress of periodic cell, returning 2 tensors
 		//! (contribution of normal and shear forces)

=== modified file 'pkg/dem/Shop_02.cpp'
--- pkg/dem/Shop_02.cpp	2014-08-01 17:25:38 +0000
+++ pkg/dem/Shop_02.cpp	2014-09-03 17:34:07 +0000
@@ -32,6 +32,7 @@
 
 #include<yade/pkg/dem/ScGeom.hpp>
 #include<yade/pkg/dem/FrictPhys.hpp>
+#include<yade/pkg/dem/HertzMindlin.hpp>
 
 #include<yade/pkg/common/Grid.hpp>
 
@@ -366,7 +367,7 @@
 	return stressTensor/volume;
 }
 
-Matrix3r Shop::getCapillaryStress(Real volume){
+Matrix3r Shop::getCapillaryStress(Real volume, bool mindlin){
 	Scene* scene=Omega::instance().getScene().get();
 	if (volume==0) volume = scene->isPeriodic?scene->cell->hSize.determinant():1;
 	Matrix3r stressTensor = Matrix3r::Zero();
@@ -375,10 +376,10 @@
 		if (!I->isReal()) continue;
 		shared_ptr<Body> b1 = Body::byId(I->getId1(),scene);
 		shared_ptr<Body> b2 = Body::byId(I->getId2(),scene);
-		CapillaryPhys* nsi=YADE_CAST<CapillaryPhys*> ( I->phys.get() );
+		Vector3r fCap = mindlin? YADE_CAST<MindlinCapillaryPhys*> (I->phys.get())->fCap : YADE_CAST<CapillaryPhys*> (I->phys.get())->fCap;
 		Vector3r branch=b1->state->pos -b2->state->pos;
 		if (isPeriodic) branch-= scene->cell->hSize*I->cellDist.cast<Real>();
-		stressTensor += (nsi->fCap)*branch.transpose();
+		stressTensor += fCap*branch.transpose();
 	}
 	return stressTensor/volume;
 }

=== modified file 'pkg/dem/SpherePack.cpp'
--- pkg/dem/SpherePack.cpp	2014-07-03 07:16:58 +0000
+++ pkg/dem/SpherePack.cpp	2014-09-03 15:59:54 +0000
@@ -272,156 +272,21 @@
 	return py::make_tuple(edges,cumm);
 }
 
-/* possible enhacement: proportions parameter, so that the domain is not cube, but box with sides having given proportions */
+
 long SpherePack::particleSD2(const vector<Real>& radii, const vector<Real>& passing, int numSph, bool periodic, Real cloudPorosity, int seed){
-	typedef Eigen::Matrix<Real,Eigen::Dynamic,Eigen::Dynamic> MatrixXr;
-	typedef Eigen::Matrix<Real,Eigen::Dynamic,1> VectorXr;
-	
-	int dim=radii.size()+1;
-	if(passing.size()!=radii.size()) throw std::invalid_argument("SpherePack.particleSD2: radii and passing must have the same length.");
-	MatrixXr M=MatrixXr::Zero(dim,dim);
-	VectorXr rhs=VectorXr::Zero(dim);
-	/*
-	
-	We know percentages for each fraction (Δpi) and their radii (ri), and want to find
-	the number of sphere for each fraction Ni and total solid volume Vs. For each fraction,
-	we know that the volume is equal to Ni*(4/3*πri³), which must be equal to Vs*Δpi (Δpi is
-	relative solid volume of the i-th fraction).
-
-	The last equation says that total number of particles (sum of fractions) is equal to N,
-	which is the total number of particles requested by the user.
-
-	   N1     N2     N3    Vs       rhs
-
-	4/3πr₁³   0      0     -Δp₁   | 0
-	  0     4/3πr₂³  0     -Δp₂   | 0
-	  0       0    4/3πr₃³ -Δp₃   | 0
-     1       1      1      0     | N
-
-	*/
-	for(int i=0; i<dim-1; i++){
-		M(i,i)=(4/3.)*Mathr::PI*pow(radii[i],3);
-		M(i,dim-1)=-(passing[i]-(i>0?passing[i-1]:0))/100.;
-		M(dim-1,i)=1;
-	}
-	rhs[dim-1]=numSph;
-	// NumsVs=M^-1*rhs: number of spheres and volume of solids
-	VectorXr NumsVs(dim); NumsVs=M.inverse()*rhs;
-	Real Vs=NumsVs[dim-1]; // total volume of solids
-	Real Vtot=Vs/(1-cloudPorosity); // total volume of cell containing the packing
-	Vector3r cellSize=pow(Vtot,1/3.)*Vector3r().Ones(); // for now, assume always cubic sample
-	Real rMean=pow(Vs/(numSph*(4/3.)*Mathr::PI),1/3.); // make rMean such that particleSD will compute the right Vs (called a bit confusingly Vtot anyway) inversely
-	// cerr<<"Vs="<<Vs<<", Vtot="<<Vtot<<", rMean="<<rMean<<endl;
-	// cerr<<"cellSize="<<cellSize<<", rMean="<<rMean<<", numSph="<<numSph<<endl;
-	return particleSD(Vector3r::Zero(),cellSize,rMean,periodic,"",numSph,radii,passing,false);
+	//deprecated (https://bugs.launchpad.net/yade/+bug/1024443)
+	LOG_ERROR("particleSD2() has been removed. Please use makeCloud() instead.");
 };
 
-// TODO: header, python wrapper, default params
-
 // Discrete particle size distribution
 long SpherePack::particleSD(Vector3r mn, Vector3r mx, Real rMean, bool periodic, string name, int numSph, const vector<Real>& radii, const vector<Real>& passing, bool passingIsNotPercentageButCount, int seed){
-	vector<Real> numbers;
-	if(!passingIsNotPercentageButCount){
-		Real Vtot=numSph*4./3.*Mathr::PI*pow(rMean,3.); // total volume of the packing (computed with rMean)
-		
-		// calculate number of spheres necessary per each radius to match the wanted psd
-		// passing has to contain increasing values
-		for (size_t i=0; i<radii.size(); i++){
-			Real volS=4./3.*Mathr::PI*pow(radii[i],3.);
-			if (i==0) {numbers.push_back(passing[i]/100.*Vtot/volS);}
-			else {numbers.push_back((passing[i]-passing[i-1])/100.*Vtot/volS);} // 
-			cout<<"fraction #"<<i<<" ("<<passing[i]<<"%, r="<<radii[i]<<"): "<<numbers[i]<<" spheres, fraction/cloud volumes "<<volS<<"/"<<Vtot<<endl;
-		}
-	} else {
-		FOREACH(Real p, passing) numbers.push_back(p);
-	}
-
-	static boost::minstd_rand randGen(seed!=0?seed:(int)TimingInfo::getNow(true));
-	static boost::variate_generator<boost::minstd_rand&, boost::uniform_real<> > rnd(randGen, boost::uniform_real<>(0,1));
-
-	const int maxTry=1000;
-	Vector3r size=mx-mn;
-	if(periodic)(cellSize=size);
-	for (int ii=(int)radii.size()-1; ii>=0; ii--){
-		Real r=radii[ii]; // select radius
-		for(int i=0; i<numbers[ii]; i++) { // place as many spheres as required by the psd for the selected radius into the free spot
-			int t;
-			for(t=0; t<maxTry; ++t){
-				Vector3r c;
-				if(!periodic) { for(int axis=0; axis<3; axis++) c[axis]=mn[axis]+r+(size[axis]-2*r)*rnd(); }
-				else { for(int axis=0; axis<3; axis++) c[axis]=mn[axis]+size[axis]*rnd(); }
-				size_t packSize=pack.size(); bool overlap=false;
-				if(!periodic){
-					for(size_t j=0; j<packSize; j++){ if(pow(pack[j].r+r,2) >= (pack[j].c-c).squaredNorm()) { overlap=true; break; } }
-				} else {
-					for(size_t j=0; j<packSize; j++){
-						Vector3r dr;
-						for(int axis=0; axis<3; axis++) dr[axis]=min(cellWrapRel(c[axis],pack[j].c[axis],pack[j].c[axis]+size[axis]),cellWrapRel(pack[j].c[axis],c[axis],c[axis]+size[axis]));
-						if(pow(pack[j].r+r,2)>= dr.squaredNorm()){ overlap=true; break; }
-					}
-				}
-				if(!overlap) { pack.push_back(Sph(c,r)); break; }
-			}
-			if (t==maxTry) {
-				if(numbers[ii]>0) LOG_WARN("Exceeded "<<maxTry<<" tries to insert non-overlapping sphere to packing. Only "<<i<<" spheres were added, although you requested "<<numbers[ii]<<" with radius "<<radii[ii]);
-				return i;
-			}
-		}
-	}
-	return pack.size();
+	//deprecated (https://bugs.launchpad.net/yade/+bug/1024443)
+	LOG_ERROR("particleSD() has been removed. Please use makeCloud() instead.");
 }
 
-// 2d function
 long SpherePack::particleSD_2d(Vector2r mn, Vector2r mx, Real rMean, bool periodic, string name, int numSph, const vector<Real>& radii, const vector<Real>& passing, bool passingIsNotPercentageButCount, int seed){
-	vector<Real> numbers;
-	if(!passingIsNotPercentageButCount){
-		Real Vtot=numSph*4./3.*Mathr::PI*pow(rMean,3.); // total volume of the packing (computed with rMean)
-		
-		// calculate number of spheres necessary per each radius to match the wanted psd
-		// passing has to contain increasing values
-		for (size_t i=0; i<radii.size(); i++){
-			Real volS=4./3.*Mathr::PI*pow(radii[i],3.);
-			if (i==0) {numbers.push_back(passing[i]/100.*Vtot/volS);}
-			else {numbers.push_back((passing[i]-passing[i-1])/100.*Vtot/volS);} // 
-			cout<<"fraction #"<<i<<" ("<<passing[i]<<"%, r="<<radii[i]<<"): "<<numbers[i]<<" spheres, fraction/cloud volumes "<<volS<<"/"<<Vtot<<endl;
-		}
-	} else {
-		FOREACH(Real p, passing) numbers.push_back(p);
-	}
-
-	static boost::minstd_rand randGen(seed!=0?seed:(int)TimingInfo::getNow(true));
-	static boost::variate_generator<boost::minstd_rand&, boost::uniform_real<> > rnd(randGen, boost::uniform_real<>(0,1));
-
-	const int maxTry=1000;
-	Vector2r size=mx-mn; 
-	//if(periodic)(cellSize=size); in this case, it must be defined in py script as cell needs the third dimension
-	for (int ii=(int)radii.size()-1; ii>=0; ii--){
-		Real r=radii[ii]; // select radius
-		for(int i=0; i<numbers[ii]; i++) { // place as many spheres as required by the psd for the selected radius into the free spot
-			int t;
-			for(t=0; t<maxTry; ++t){
-				Vector3r c;
-				if(!periodic) { for(int axis=0; axis<2; axis++) c[axis]=mn[axis]+r+(size[axis]-2*r)*rnd(); }
-				else { for(int axis=0; axis<2; axis++) c[axis]=mn[axis]+size[axis]*rnd(); }
-				size_t packSize=pack.size(); bool overlap=false;
-				if(!periodic){
-					for(size_t j=0; j<packSize; j++){ if(pow(pack[j].r+r,2) >= (pack[j].c-c).squaredNorm()) { overlap=true; break; } }
-				} else {
-					for(size_t j=0; j<packSize; j++){
-						Vector3r dr=Vector3r::Zero();
-						for(int axis=0; axis<2; axis++) dr[axis]=min(cellWrapRel(c[axis],pack[j].c[axis],pack[j].c[axis]+size[axis]),cellWrapRel(pack[j].c[axis],c[axis],c[axis]+size[axis]));
-						if(pow(pack[j].r+r,2)>= dr.squaredNorm()){ overlap=true; break; }
-					}
-				}
-				if(!overlap) { pack.push_back(Sph(c,r)); break; }
-			}
-			if (t==maxTry) {
-				if(numbers[ii]>0) LOG_WARN("Exceeded "<<maxTry<<" tries to insert non-overlapping sphere to packing. Only "<<i<<" spheres were added, although you requested "<<numbers[ii]<<" with radius "<<radii[ii]);
-				return i;
-			}
-		}
-	}
-	return pack.size();
+	//deprecated (https://bugs.launchpad.net/yade/+bug/1024443)
+	LOG_ERROR("particleSD_2d() has been removed. Please use makeCloud() instead.");
 }
 
 long SpherePack::makeClumpCloud(const Vector3r& mn, const Vector3r& mx, const vector<shared_ptr<SpherePack> >& _clumps, bool periodic, int num, int seed){

=== modified file 'pkg/dem/TriaxialStressController.cpp'
--- pkg/dem/TriaxialStressController.cpp	2014-08-01 17:27:01 +0000
+++ pkg/dem/TriaxialStressController.cpp	2014-08-13 13:31:41 +0000
@@ -103,7 +103,7 @@
 	depth = p_front->se3.position.z() - p_back->se3.position.z() - thickness;
 
 	boxVolume = height * width * depth;
-	if (first) {
+	if ( (first) || (updatePorosity) ) {
 		BodyContainer::iterator bi = scene->bodies->begin();
 		BodyContainer::iterator biEnd = scene->bodies->end();
 
@@ -121,6 +121,7 @@
 			}
 		}
 		first = false;
+		updatePorosity = false;
 	}
 	max_vel1=3 * width /(height+width+depth)*max_vel;
 	max_vel2=3 * height /(height+width+depth)*max_vel;

=== modified file 'pkg/dem/TriaxialStressController.hpp'
--- pkg/dem/TriaxialStressController.hpp	2014-08-01 15:37:51 +0000
+++ pkg/dem/TriaxialStressController.hpp	2014-08-13 13:31:41 +0000
@@ -116,6 +116,7 @@
 		((Real,meanStress,0,Attr::readonly,"Mean stress in the packing. |yupdate|"))
 		((Real,volumetricStrain,0,Attr::readonly,"Volumetric strain (see :yref:`TriaxialStressController::strain`).|yupdate|"))
 		((Real,externalWork,0,Attr::readonly,"Energy provided by boundaries.|yupdate|"))
+		((bool,updatePorosity,false,,"If true porosity calculation will be updated once (will automatically reset to false after one calculation step). Can be used, when volume of particles changes during the simulation (e.g. when particles are erased or when clumps are created)."))
 		,
 		/* deprecated */
 		((sigma1,goal1,"renamed 'goal1', it can now also be a strain depending on stressMask"))

=== modified file 'pkg/dem/VTKRecorder.cpp'
--- pkg/dem/VTKRecorder.cpp	2014-07-17 08:39:25 +0000
+++ pkg/dem/VTKRecorder.cpp	2014-08-20 13:03:23 +0000
@@ -59,6 +59,7 @@
 			recActive[REC_CLUMPID]=true;
 			recActive[REC_MATERIALID]=true;
 			recActive[REC_STRESS]=true;
+			recActive[REC_FORCE]=true;
 			if (scene->isPeriodic) { recActive[REC_PERICELL]=true; }
 		}
 		else if(rec=="spheres") recActive[REC_SPHERES]=true;
@@ -75,6 +76,7 @@
 		else if((rec=="clumpids") || (rec=="clumpId")) recActive[REC_CLUMPID]=true;
 		else if(rec=="materialId") recActive[REC_MATERIALID]=true;
 		else if(rec=="stress") recActive[REC_STRESS]=true;
+		else if(rec=="force") recActive[REC_FORCE]=true;
 		else if(rec=="jcfpm") recActive[REC_JCFPM]=true;
 		else if(rec=="cracks") recActive[REC_CRACKS]=true;
 		else if(rec=="pericell" && scene->isPeriodic) recActive[REC_PERICELL]=true;
@@ -211,6 +213,22 @@
 	spheresMaterialId->SetNumberOfComponents(1);
 	spheresMaterialId->SetName("materialId");
 
+	vtkSmartPointer<vtkDoubleArray> spheresForceVec = vtkSmartPointer<vtkDoubleArray>::New();
+	spheresForceVec->SetNumberOfComponents(3);
+	spheresForceVec->SetName("forceVec");
+
+	vtkSmartPointer<vtkDoubleArray> spheresForceLen = vtkSmartPointer<vtkDoubleArray>::New();
+	spheresForceLen->SetNumberOfComponents(1);
+	spheresForceLen->SetName("forceLen");
+
+	vtkSmartPointer<vtkDoubleArray> spheresTorqueVec = vtkSmartPointer<vtkDoubleArray>::New();
+	spheresTorqueVec->SetNumberOfComponents(3);
+	spheresTorqueVec->SetName("torqueVec");
+
+	vtkSmartPointer<vtkDoubleArray> spheresTorqueLen = vtkSmartPointer<vtkDoubleArray>::New();
+	spheresTorqueLen->SetNumberOfComponents(1);
+	spheresTorqueLen->SetName("torqueLen");
+
 	// facets
 	vtkSmartPointer<vtkPoints> facetsPos = vtkSmartPointer<vtkPoints>::New();
 	vtkSmartPointer<vtkCellArray> facetsCells = vtkSmartPointer<vtkCellArray>::New();
@@ -218,13 +236,13 @@
 	facetsColors->SetNumberOfComponents(3);
 	facetsColors->SetName("color");
 	
-	vtkSmartPointer<vtkDoubleArray> facetsForceVec = vtkSmartPointer<vtkDoubleArray>::New();
-	facetsForceVec->SetNumberOfComponents(3);
-	facetsForceVec->SetName("stressVec");
+	vtkSmartPointer<vtkDoubleArray> facetsStressVec = vtkSmartPointer<vtkDoubleArray>::New();
+	facetsStressVec->SetNumberOfComponents(3);
+	facetsStressVec->SetName("stressVec");
 	
-	vtkSmartPointer<vtkDoubleArray> facetsForceLen = vtkSmartPointer<vtkDoubleArray>::New();
-	facetsForceLen->SetNumberOfComponents(1);
-	facetsForceLen->SetName("stressLen");
+	vtkSmartPointer<vtkDoubleArray> facetsStressLen = vtkSmartPointer<vtkDoubleArray>::New();
+	facetsStressLen->SetNumberOfComponents(1);
+	facetsStressLen->SetName("stressLen");
 	
 	vtkSmartPointer<vtkDoubleArray> facetsMaterialId = vtkSmartPointer<vtkDoubleArray>::New();
 	facetsMaterialId->SetNumberOfComponents(1);
@@ -234,6 +252,22 @@
 	facetsMask->SetNumberOfComponents(1);
 	facetsMask->SetName("mask");
 
+	vtkSmartPointer<vtkDoubleArray> facetsForceVec = vtkSmartPointer<vtkDoubleArray>::New();
+	facetsForceVec->SetNumberOfComponents(3);
+	facetsForceVec->SetName("forceVec");
+
+	vtkSmartPointer<vtkDoubleArray> facetsForceLen = vtkSmartPointer<vtkDoubleArray>::New();
+	facetsForceLen->SetNumberOfComponents(1);
+	facetsForceLen->SetName("forceLen");
+
+	vtkSmartPointer<vtkDoubleArray> facetsTorqueVec = vtkSmartPointer<vtkDoubleArray>::New();
+	facetsTorqueVec->SetNumberOfComponents(3);
+	facetsTorqueVec->SetName("torqueVec");
+
+	vtkSmartPointer<vtkDoubleArray> facetsTorqueLen = vtkSmartPointer<vtkDoubleArray>::New();
+	facetsTorqueLen->SetNumberOfComponents(1);
+	facetsTorqueLen->SetName("torqueLen");
+
 	// boxes
 	vtkSmartPointer<vtkPoints> boxesPos = vtkSmartPointer<vtkPoints>::New();
 	vtkSmartPointer<vtkCellArray> boxesCells = vtkSmartPointer<vtkCellArray>::New();
@@ -241,13 +275,13 @@
 	boxesColors->SetNumberOfComponents(3);
 	boxesColors->SetName("color");
 	
-	vtkSmartPointer<vtkDoubleArray> boxesForceVec = vtkSmartPointer<vtkDoubleArray>::New();
-	boxesForceVec->SetNumberOfComponents(3);
-	boxesForceVec->SetName("stressVec");
+	vtkSmartPointer<vtkDoubleArray> boxesStressVec = vtkSmartPointer<vtkDoubleArray>::New();
+	boxesStressVec->SetNumberOfComponents(3);
+	boxesStressVec->SetName("stressVec");
 	
-	vtkSmartPointer<vtkDoubleArray> boxesForceLen = vtkSmartPointer<vtkDoubleArray>::New();
-	boxesForceLen->SetNumberOfComponents(1);
-	boxesForceLen->SetName("stressLen");
+	vtkSmartPointer<vtkDoubleArray> boxesStressLen = vtkSmartPointer<vtkDoubleArray>::New();
+	boxesStressLen->SetNumberOfComponents(1);
+	boxesStressLen->SetName("stressLen");
 	
 	vtkSmartPointer<vtkDoubleArray> boxesMaterialId = vtkSmartPointer<vtkDoubleArray>::New();
 	boxesMaterialId->SetNumberOfComponents(1);
@@ -257,6 +291,22 @@
 	boxesMask->SetNumberOfComponents(1);
 	boxesMask->SetName("mask");
 
+	vtkSmartPointer<vtkDoubleArray> boxesForceVec = vtkSmartPointer<vtkDoubleArray>::New();
+	boxesForceVec->SetNumberOfComponents(3);
+	boxesForceVec->SetName("forceVec");
+
+	vtkSmartPointer<vtkDoubleArray> boxesForceLen = vtkSmartPointer<vtkDoubleArray>::New();
+	boxesForceLen->SetNumberOfComponents(1);
+	boxesForceLen->SetName("forceLen");
+
+	vtkSmartPointer<vtkDoubleArray> boxesTorqueVec = vtkSmartPointer<vtkDoubleArray>::New();
+	boxesTorqueVec->SetNumberOfComponents(3);
+	boxesTorqueVec->SetName("torqueVec");
+
+	vtkSmartPointer<vtkDoubleArray> boxesTorqueLen = vtkSmartPointer<vtkDoubleArray>::New();
+	boxesTorqueLen->SetNumberOfComponents(1);
+	boxesTorqueLen->SetName("torqueLen");
+
 	// interactions
 	vtkSmartPointer<vtkPoints> intrBodyPos = vtkSmartPointer<vtkPoints>::New();
 	vtkSmartPointer<vtkCellArray> intrCells = vtkSmartPointer<vtkCellArray>::New();
@@ -521,6 +571,19 @@
 					spheresShearStressVec->InsertNextTupleValue(s);
 					spheresNormalStressNorm->InsertNextValue(stress.norm());
 				}
+				if(recActive[REC_FORCE]){
+					scene->forces.sync();
+					const Vector3r& f = scene->forces.getForce(b->getId());
+					const Vector3r& t = scene->forces.getTorque(b->getId());
+					Real ff[3] = { (Real)  f[0], (Real) f[1], (Real) f[2] };
+					Real tt[3] = { (Real)  t[0], (Real) t[1], (Real) t[2] };
+					Real fn = f.norm();
+					Real tn = t.norm();
+					spheresForceVec->InsertNextTupleValue(ff);
+					spheresForceLen->InsertNextValue(fn);
+					spheresTorqueVec->InsertNextTupleValue(tt);
+					spheresTorqueLen->InsertNextValue(tn);
+				}
 				
 				if (recActive[REC_CPM]){
 					cpmDamage->InsertNextValue(YADE_PTR_CAST<CpmState>(b->state)->normDmg);
@@ -574,8 +637,21 @@
 				if(recActive[REC_STRESS]){
 					const Vector3r& stress = bodyStates[b->getId()].normStress+bodyStates[b->getId()].shearStress;
 					Real s[3] = { (Real) stress[0], (Real) stress[1], (Real) stress[2] };
-					facetsForceVec->InsertNextTupleValue(s);
-					facetsForceLen->InsertNextValue(stress.norm());
+					facetsStressVec->InsertNextTupleValue(s);
+					facetsStressLen->InsertNextValue(stress.norm());
+				}
+				if(recActive[REC_FORCE]){
+					scene->forces.sync();
+					const Vector3r& f = scene->forces.getForce(b->getId());
+					const Vector3r& t = scene->forces.getTorque(b->getId());
+					Real ff[3] = { (Real)  f[0], (Real) f[1], (Real) f[2] };
+					Real tt[3] = { (Real)  t[0], (Real) t[1], (Real) t[2] };
+					Real fn = f.norm();
+					Real tn = t.norm();
+					facetsForceVec->InsertNextTupleValue(ff);
+					facetsForceLen->InsertNextValue(fn);
+					facetsTorqueVec->InsertNextTupleValue(tt);
+					facetsTorqueLen->InsertNextValue(tn);
 				}
 				if (recActive[REC_MATERIALID]) facetsMaterialId->InsertNextValue(b->material->id);
 				if (recActive[REC_MASK]) facetsMask->InsertNextValue(GET_MASK(b));
@@ -585,6 +661,21 @@
 		if (recActive[REC_BOXES]){
 			const Box* box = dynamic_cast<Box*>(b->shape.get()); 
 			if (box){
+
+				if(recActive[REC_FORCE]){
+					scene->forces.sync();
+					const Vector3r& f = scene->forces.getForce(b->getId());
+					const Vector3r& t = scene->forces.getTorque(b->getId());
+					Real ff[3] = { (Real)  f[0], (Real) f[1], (Real) f[2] };
+					Real tt[3] = { (Real)  t[0], (Real) t[1], (Real) t[2] };
+					Real fn = f.norm();
+					Real tn = t.norm();
+					boxesForceVec->InsertNextTupleValue(ff);
+					boxesForceLen->InsertNextValue(fn);
+					boxesTorqueVec->InsertNextTupleValue(tt);
+					boxesTorqueLen->InsertNextValue(tn);
+				}
+
 				Vector3r pos(scene->isPeriodic ? scene->cell->wrapShearedPt(b->state->pos) : b->state->pos);
 				Vector3r ext(box->extents);
 				vtkSmartPointer<vtkQuad> boxes = vtkSmartPointer<vtkQuad>::New();
@@ -626,8 +717,8 @@
 					if(recActive[REC_STRESS]){
 						const Vector3r& stress = bodyStates[b->getId()].normStress+bodyStates[b->getId()].shearStress;
 						Real s[3] = { (Real) stress[0], (Real) stress[1], (Real) stress[2] };
-						boxesForceVec->InsertNextTupleValue(s);
-						boxesForceLen->InsertNextValue(stress.norm());
+						boxesStressVec->InsertNextTupleValue(s);
+						boxesStressLen->InsertNextValue(stress.norm());
 					}
 					if (recActive[REC_MATERIALID]) boxesMaterialId->InsertNextValue(b->material->id);
 					if (recActive[REC_MASK]) boxesMask->InsertNextValue(GET_MASK(b));
@@ -701,6 +792,12 @@
 			spheresUg->GetPointData()->AddArray(spheresShearStressVec);
 			spheresUg->GetPointData()->AddArray(spheresNormalStressNorm);
 		}
+		if (recActive[REC_FORCE]){
+			spheresUg->GetPointData()->AddArray(spheresForceVec);
+			spheresUg->GetPointData()->AddArray(spheresForceLen);
+			spheresUg->GetPointData()->AddArray(spheresTorqueVec);
+			spheresUg->GetPointData()->AddArray(spheresTorqueLen);
+		}
 		if (recActive[REC_CPM]){
 			spheresUg->GetPointData()->AddArray(cpmDamage);
 			spheresUg->GetPointData()->AddArray(cpmStress);
@@ -743,8 +840,14 @@
 		facetsUg->SetCells(VTK_TRIANGLE, facetsCells);
 		if (recActive[REC_COLORS]) facetsUg->GetCellData()->AddArray(facetsColors);
 		if (recActive[REC_STRESS]){
+			facetsUg->GetCellData()->AddArray(facetsStressVec);
+			facetsUg->GetCellData()->AddArray(facetsStressLen);
+		}
+		if (recActive[REC_FORCE]){
 			facetsUg->GetCellData()->AddArray(facetsForceVec);
 			facetsUg->GetCellData()->AddArray(facetsForceLen);
+			facetsUg->GetCellData()->AddArray(facetsTorqueVec);
+			facetsUg->GetCellData()->AddArray(facetsTorqueLen);
 		}
 		if (recActive[REC_MATERIALID]) facetsUg->GetCellData()->AddArray(facetsMaterialId);
 		if (recActive[REC_MASK]) facetsUg->GetCellData()->AddArray(facetsMask);
@@ -771,8 +874,14 @@
 		boxesUg->SetCells(VTK_QUAD, boxesCells);
 		if (recActive[REC_COLORS]) boxesUg->GetCellData()->AddArray(boxesColors);
 		if (recActive[REC_STRESS]){
+			boxesUg->GetCellData()->AddArray(boxesStressVec);
+			boxesUg->GetCellData()->AddArray(boxesStressLen);
+		}
+		if (recActive[REC_FACETS]){
 			boxesUg->GetCellData()->AddArray(boxesForceVec);
 			boxesUg->GetCellData()->AddArray(boxesForceLen);
+			boxesUg->GetCellData()->AddArray(boxesTorqueVec);
+			boxesUg->GetCellData()->AddArray(boxesTorqueLen);
 		}
 		if (recActive[REC_MATERIALID]) boxesUg->GetCellData()->AddArray(boxesMaterialId);
 		if (recActive[REC_MASK]) boxesUg->GetCellData()->AddArray(boxesMask);
@@ -881,7 +990,7 @@
 		crackUg->GetPointData()->AddArray(iter);
 		crackUg->GetPointData()->AddArray(crackType);
 		crackUg->GetPointData()->AddArray(crackSize);
-		crackUg->GetPointData()->AddArray(crackNorm); //orientation of 2D glyphs does not match this direction (some work to do in order to have the good orientation) 
+		crackUg->GetPointData()->AddArray(crackNorm); //see https://www.mail-archive.com/paraview@xxxxxxxxxxxx/msg08166.html to obtain Paraview 2D glyphs conforming to this normal 
 		
 		vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
 		if(compress) writer->SetCompressor(compressor);

=== modified file 'pkg/dem/VTKRecorder.hpp'
--- pkg/dem/VTKRecorder.hpp	2014-07-17 08:39:25 +0000
+++ pkg/dem/VTKRecorder.hpp	2014-08-08 09:26:21 +0000
@@ -11,7 +11,7 @@
 
 class VTKRecorder: public PeriodicEngine {
 	public:
-  enum {REC_SPHERES=0,REC_FACETS,REC_BOXES,REC_COLORS,REC_MASS,REC_CPM,REC_INTR,REC_VELOCITY,REC_ID,REC_CLUMPID,REC_SENTINEL,REC_MATERIALID,REC_STRESS,REC_MASK,REC_RPM,REC_JCFPM,REC_CRACKS,REC_WPM,REC_PERICELL,REC_LIQ,REC_BSTRESS};
+  enum {REC_SPHERES=0,REC_FACETS,REC_BOXES,REC_COLORS,REC_MASS,REC_CPM,REC_INTR,REC_VELOCITY,REC_ID,REC_CLUMPID,REC_SENTINEL,REC_MATERIALID,REC_STRESS,REC_MASK,REC_RPM,REC_JCFPM,REC_CRACKS,REC_WPM,REC_PERICELL,REC_LIQ,REC_BSTRESS,REC_FORCE};
 		virtual void action();
 		void addWallVTK (vtkSmartPointer<vtkQuad>& boxes, vtkSmartPointer<vtkPoints>& boxesPos, Vector3r& W1, Vector3r& W2, Vector3r& W3, Vector3r& W4);
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR(VTKRecorder,PeriodicEngine,"Engine recording snapshots of simulation into series of \\*.vtu files, readable by VTK-based postprocessing programs such as Paraview. Both bodies (spheres and facets) and interactions can be recorded, with various vector/scalar quantities that are defined on them.\n\n:yref:`PeriodicEngine.initRun` is initialized to ``True`` automatically.",
@@ -23,7 +23,7 @@
 			((bool,multiblock,false,,"Use multi-block (``.vtm``) files to store data, rather than separate ``.vtu`` files."))
 		#endif
 		((string,fileName,"",,"Base file name; it will be appended with {spheres,intrs,facets}-243100.vtu (unless *multiblock* is ``True``) depending on active recorders and step number (243100 in this case). It can contain slashes, but the directory must exist already."))
-		((vector<string>,recorders,vector<string>(1,string("all")),,"List of active recorders (as strings). ``all`` (the default value) enables all base and generic recorders.\n\n.. admonition:: Base recorders\n\n\tBase recorders save the geometry (unstructured grids) on which other data is defined. They are implicitly activated by many of the other recorders. Each of them creates a new file (or a block, if :yref:`multiblock <VTKRecorder.multiblock>` is set).\n\n\t``spheres``\n\t\tSaves positions and radii (``radii``) of :yref:`spherical<Sphere>` particles.\n\t``facets``\n\t\tSave :yref:`facets<Facet>` positions (vertices).\n\t``boxes``\n\t\tSave :yref:`boxes<Box>` positions (edges).\n\t``intr``\n\t\tStore interactions as lines between nodes at respective particles positions. Additionally stores magnitude of normal (``forceN``) and shear (``absForceT``) forces on interactions (the :yref:`geom<Interaction.geom> must be of type :yref:`NormShearPhys`). \n\n.. admonition:: Generic recorders\n\n\tGeneric recorders do not depend on specific model being used and save commonly useful data.\n\n\t``id``\n\t\tSaves id's (field ``id``) of spheres; active only if ``spheres`` is active.\n\t``mass``\n\t\tSaves masses (field ``mass``) of spheres; active only if ``spheres`` is active.\n\t``clumpId``\n\t\tSaves id's of clumps to which each sphere belongs (field ``clumpId``); active only if ``spheres`` is active.\n\t``colors``\n\t\tSaves colors of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>` (field ``color``); only active if ``spheres`` or ``facets`` are activated.\n\t``mask``\n\t\tSaves groupMasks of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>` (field ``mask``); only active if ``spheres`` or ``facets`` are activated.\n\t``materialId``\n\t\tSaves materialID of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>`; only active if ``spheres`` or ``facets`` are activated.\n\t``velocity``\n\t\tSaves linear and angular velocities of spherical particles as Vector3 and length(fields ``linVelVec``, ``linVelLen`` and ``angVelVec``, ``angVelLen`` respectively``); only effective with ``spheres``.\n\t``stress``\n\t\tSaves stresses of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>`  as Vector3 and length; only active if ``spheres`` or ``facets`` are activated.\n\t``pericell``\n\t\tSaves the shape of the cell (simulation has to be periodic).\n\t``bstresses``\n\t\tSaves per-particle principal stresses (sigI >= sigII >= sigIII) and associated principal directions (dirI/II/III). Per-particle stress tensors are given by :yref:`bodyStressTensors<yade.utils.bodyStressTensors>` (positive values for tensile states).\n\n.. admonition:: Specific recorders\n\n\tThe following should only be activated in appropriate cases, otherwise crashes can occur due to violation of type presuppositions.\n\n\t``cpm``\n\t\tSaves data pertaining to the :yref:`concrete model<Law2_ScGeom_CpmPhys_Cpm>`: ``cpmDamage`` (normalized residual strength averaged on particle), ``cpmStress`` (stress on particle); ``intr`` is activated automatically by ``cpm``\n\t``wpm``\n\t\tSaves data pertaining to the :yref:`wire particle model<Law2_ScGeom_WirePhys_WirePM>`: ``wpmForceNFactor`` shows the loading factor for the wire, e.g. normal force divided by threshold normal force.\n\t``jcfpm``\n\t\tSaves data pertaining to the :yref:`rock (smooth)-jointed model<Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM>`: ``damage`` is defined by :yref:`JCFpmState.tensBreak` + :yref:`JCFpmState.shearBreak`; ``intr`` is activated automatically by ``jcfpm``, and :yref:`on joint<JCFpmPhys.isOnJoint>` or :yref:`cohesive<JCFpmPhys.isCohesive>` interactions can be vizualized.\n\t``cracks``\n\t\tSaves other data pertaining to the :yref:`rock model<Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM>`: ``cracks`` shows locations where cohesive bonds failed during the simulation, with their types (0/1  for tensile/shear breakages), their sizes (0.5*(R1+R2)), and their normal directions. The :yref:`corresponding attribute<Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM.recordCracks>` has to be activated, and Key attributes have to be consistent.\n\n"))
+		((vector<string>,recorders,vector<string>(1,string("all")),,"List of active recorders (as strings). ``all`` (the default value) enables all base and generic recorders.\n\n.. admonition:: Base recorders\n\n\tBase recorders save the geometry (unstructured grids) on which other data is defined. They are implicitly activated by many of the other recorders. Each of them creates a new file (or a block, if :yref:`multiblock <VTKRecorder.multiblock>` is set).\n\n\t``spheres``\n\t\tSaves positions and radii (``radii``) of :yref:`spherical<Sphere>` particles.\n\t``facets``\n\t\tSave :yref:`facets<Facet>` positions (vertices).\n\t``boxes``\n\t\tSave :yref:`boxes<Box>` positions (edges).\n\t``intr``\n\t\tStore interactions as lines between nodes at respective particles positions. Additionally stores magnitude of normal (``forceN``) and shear (``absForceT``) forces on interactions (the :yref:`geom<Interaction.geom> must be of type :yref:`NormShearPhys`). \n\n.. admonition:: Generic recorders\n\n\tGeneric recorders do not depend on specific model being used and save commonly useful data.\n\n\t``id``\n\t\tSaves id's (field ``id``) of spheres; active only if ``spheres`` is active.\n\t``mass``\n\t\tSaves masses (field ``mass``) of spheres; active only if ``spheres`` is active.\n\t``clumpId``\n\t\tSaves id's of clumps to which each sphere belongs (field ``clumpId``); active only if ``spheres`` is active.\n\t``colors``\n\t\tSaves colors of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>` (field ``color``); only active if ``spheres`` or ``facets`` are activated.\n\t``mask``\n\t\tSaves groupMasks of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>` (field ``mask``); only active if ``spheres`` or ``facets`` are activated.\n\t``materialId``\n\t\tSaves materialID of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>`; only active if ``spheres`` or ``facets`` are activated.\n\t``velocity``\n\t\tSaves linear and angular velocities of spherical particles as Vector3 and length(fields ``linVelVec``, ``linVelLen`` and ``angVelVec``, ``angVelLen`` respectively``); only effective with ``spheres``.\n\t``stress``\n\t\tSaves stresses of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>`  as Vector3 and length; only active if ``spheres`` or ``facets`` are activated.\n\t``force``\n\t\tSaves force and torque of :yref:`spheres<Sphere>`, :yref:`facets<Facet>` and :yref:`boxes<Box>` as Vector3 and length (norm); only active if ``spheres``, ``facets`` or ``boxes`` are activated.\n\t``pericell``\n\t\tSaves the shape of the cell (simulation has to be periodic).\n\t``bstresses``\n\t\tSaves per-particle principal stresses (sigI >= sigII >= sigIII) and associated principal directions (dirI/II/III). Per-particle stress tensors are given by :yref:`bodyStressTensors<yade.utils.bodyStressTensors>` (positive values for tensile states).\n\n.. admonition:: Specific recorders\n\n\tThe following should only be activated in appropriate cases, otherwise crashes can occur due to violation of type presuppositions.\n\n\t``cpm``\n\t\tSaves data pertaining to the :yref:`concrete model<Law2_ScGeom_CpmPhys_Cpm>`: ``cpmDamage`` (normalized residual strength averaged on particle), ``cpmStress`` (stress on particle); ``intr`` is activated automatically by ``cpm``\n\t``wpm``\n\t\tSaves data pertaining to the :yref:`wire particle model<Law2_ScGeom_WirePhys_WirePM>`: ``wpmForceNFactor`` shows the loading factor for the wire, e.g. normal force divided by threshold normal force.\n\t``jcfpm``\n\t\tSaves data pertaining to the :yref:`rock (smooth)-jointed model<Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM>`: ``damage`` is defined by :yref:`JCFpmState.tensBreak` + :yref:`JCFpmState.shearBreak`; ``intr`` is activated automatically by ``jcfpm``, and :yref:`on joint<JCFpmPhys.isOnJoint>` or :yref:`cohesive<JCFpmPhys.isCohesive>` interactions can be vizualized.\n\t``cracks``\n\t\tSaves other data pertaining to the :yref:`rock model<Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM>`: ``cracks`` shows locations where cohesive bonds failed during the simulation, with their types (0/1  for tensile/shear breakages), their sizes (0.5*(R1+R2)), and their normal directions. The :yref:`corresponding attribute<Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM.recordCracks>` has to be activated, and Key attributes have to be consistent.\n\n"))
 		((string,Key,"",,"Necessary if :yref:`recorders<VTKRecorder.recorders>` contains 'cracks'. A string specifying the name of file 'cracks___.txt' that is considered in this case (see :yref:`corresponding attribute<Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM.Key>`)."))
 		((int,mask,0,,"If mask defined, only bodies with corresponding groupMask will be exported. If 0, all bodies will be exported.")),
 		/*ctor*/

=== modified file 'pkg/dem/ViscoelasticPM.cpp'
--- pkg/dem/ViscoelasticPM.cpp	2014-07-18 18:18:50 +0000
+++ pkg/dem/ViscoelasticPM.cpp	2014-08-26 14:53:06 +0000
@@ -170,7 +170,8 @@
 		mass2 = mass1;
 	}
 	
-	const Real massR = 2*mass1*mass2/(mass1+mass2);
+	// See [Pournin2001, just below equation (19)]
+	const Real massR = mass1*mass2/(mass1+mass2);
 	
 	GenericSpheresContact* sphCont=YADE_CAST<GenericSpheresContact*>(interaction->geom.get());
 	Real R1=sphCont->refR1>0?sphCont->refR1:sphCont->refR2;
@@ -187,12 +188,19 @@
 		const Real Tc = (tc) ? (*tc)(mat1->id,mat2->id) : (mat1->tc+mat2->tc)/2.0;
 		const Real En = (en) ? (*en)(mat1->id,mat2->id) : (mat1->en+mat2->en)/2.0;
 		const Real Et = (et) ? (*et)(mat1->id,mat2->id) : (mat1->et+mat2->et)/2.0;
-		
-		kn1 = kn2 = 1/Tc/Tc * ( Mathr::PI*Mathr::PI + pow(log(En),2) )*massR;
-		cn1 = cn2 = -2.0 /Tc * log(En)*massR;
-		ks1 = ks2 = 2.0/7.0 /Tc/Tc * ( Mathr::PI*Mathr::PI + pow(log(Et),2) )*massR;
-		cs1 = cs2 = -2.0/7.0 /Tc * log(Et)*massR;
-	
+    
+    // Factor 2 at the end of each expression is necessary, because we calculate
+    // individual kn1, kn2, ks1, ks2 etc., because kn1 = 2*kn, ks1 = 2*ks
+    // http://www.mail-archive.com/yade-users@xxxxxxxxxxxxxxxxxxx/msg08778.html
+    kn1 = kn2 = 1/Tc/Tc * ( Mathr::PI*Mathr::PI + pow(log(En),2) )*massR*2;
+    cn1 = cn2 = -2.0 /Tc * log(En)*massR*2;
+    ks1 = ks2 = 2.0/7.0 /Tc/Tc * ( Mathr::PI*Mathr::PI + pow(log(Et),2) )*massR*2;
+    cs1 = cs2 = -4.0/7.0 /Tc * log(Et)*massR*2;
+    //           ^^^
+    // It seems to be an error in [Pournin2001] (22) Eq.4, missing factor 2
+    // Thanks to Dominik Boemer for pointing this out
+    // http://www.mail-archive.com/yade-users@xxxxxxxxxxxxxxxxxxx/msg08741.html
+
 		if (std::abs(cn1) <= Mathr::ZERO_TOLERANCE ) cn1=0;
 		if (std::abs(cn2) <= Mathr::ZERO_TOLERANCE ) cn2=0;
 		if (std::abs(cs1) <= Mathr::ZERO_TOLERANCE ) cs1=0;

=== modified file 'pkg/pfv/FlowEngine.hpp.in'
--- pkg/pfv/FlowEngine.hpp.in	2014-08-01 11:16:21 +0000
+++ pkg/pfv/FlowEngine.hpp.in	2014-09-03 15:59:54 +0000
@@ -225,7 +225,7 @@
 		((double, sineMagnitude, 0,, "Pressure value (amplitude) when sinusoidal pressure is applied (p )"))
 		((double, sineAverage, 0,,"Pressure value (average) when sinusoidal pressure is applied"))
 		((bool, debug, false,,"Activate debug messages"))
-		((double, wallThickness,0.001,,"Walls thickness"))
+		((double, wallThickness,0,,"Walls thickness"))
 		((double,pZero,0,,"The value used for initializing pore pressure. It is useless for incompressible fluid, but important for compressible model."))
 		((double,tolerance,1e-06,,"Gauss-Seidel tolerance"))
 		((double,relax,1.9,,"Gauss-Seidel relaxation"))

=== modified file 'py/3rd-party/README'
--- py/3rd-party/README	2011-01-29 22:47:18 +0000
+++ py/3rd-party/README	2014-08-04 16:38:31 +0000
@@ -19,7 +19,7 @@
 	license: Boost software license 1.0
 	note: only headers are copied here
 
-mtTkinter-0.3:
+mtTkinter-0.4:
 	homepage: http://tkinter.unpythonic.net/wiki/mtTkinter
-	source: http://tkinter.unpythonic.net/attach//mtTkinter/attachments/mtTkinter-0.3.tar.gz
-	license: unspecified
+	source: http://tkinter.unpythonic.net/wiki/mtTkinter?action=AttachFile&do=get&target=mtTkinter-0.4.tar.gz
+	license: gpl lgpl

=== removed directory 'py/3rd-party/mtTkinter-0.3'
=== removed file 'py/3rd-party/mtTkinter-0.3/mtTkinter.py'
--- py/3rd-party/mtTkinter-0.3/mtTkinter.py	2010-07-06 11:31:29 +0000
+++ py/3rd-party/mtTkinter-0.3/mtTkinter.py	1970-01-01 00:00:00 +0000
@@ -1,227 +0,0 @@
-'''Thread-safe version of Tkinter.
-
-Usage:
-
-    import mtTkinter as Tkinter
-    # Use "Tkinter." as usual.
-
-or
-
-    from mtTkinter import *
-    # Use Tkinter module definitions as usual.
-
-This module modifies the original Tkinter module in memory, making all
-functionality thread-safe. It does this by wrapping the Tk class' tk
-instance with an object that diverts calls through an event queue when
-the call is issued from a thread other than the thread in which the Tk
-instance was created. The events are processed in the creation thread
-via an 'after' event.
-
-The modified Tk class accepts two additional keyword parameters on its
-__init__ method:
-    mtDebug:
-        0 = No debug output (default)
-        1 = Minimal debug output
-        ...
-        9 = Full debug output
-    mtCheckPeriod:
-        Amount of time in milliseconds (default 100) between checks for
-        out-of-thread events when things are otherwise idle. Decreasing
-        this value can improve GUI responsiveness, but at the expense of
-        consuming more CPU cycles.
-
-Note that, because it modifies the original Tkinter module (in memory),
-other modules that use Tkinter (e.g., Pmw) reap the benefits automagically
-as long as mtTkinter is imported at some point before extra threads are
-created.
-
-Author: Allen B. Taylor, a.b.taylor@xxxxxxxxx
-'''
-
-from Tkinter import *
-import threading
-import Queue
-
-class _Tk(object):
-    """
-    Wrapper for underlying attribute tk of class Tk.
-    """
-
-    def __init__(self, tk, mtDebug = 0, mtCheckPeriod = 10):
-        self._tk = tk
-
-        # Create the incoming event queue.
-        self._eventQueue = Queue.Queue(1)
-
-        # Identify the thread from which this object is being created so we can
-        # tell later whether an event is coming from another thread.
-        self._creationThread = threading.currentThread()
-
-        # Store remaining values.
-        self._debug = mtDebug
-        self._checkPeriod = mtCheckPeriod
-
-    def __getattr__(self, name):
-        # Divert attribute accesses to a wrapper around the underlying tk
-        # object.
-        return _TkAttr(self, getattr(self._tk, name))
-
-class _TkAttr(object):
-    """
-    Thread-safe callable attribute wrapper.
-    """
-
-    def __init__(self, tk, attr):
-        self._tk = tk
-        self._attr = attr
-
-    def __call__(self, *args, **kwargs):
-        """
-        Thread-safe method invocation.
-        Diverts out-of-thread calls through the event queue.
-        Forwards all other method calls to the underlying tk object directly.
-        """
-
-        # Check if we're in the creation thread.
-        if threading.currentThread() == self._tk._creationThread:
-            # We're in the creation thread; just call the event directly.
-            if self._tk._debug >= 8 or \
-               self._tk._debug >= 3 and self._attr.__name__ == 'call' and \
-               len(args) >= 1 and args[0] == 'after':
-                print 'Calling event directly:', \
-                    self._attr.__name__, args, kwargs
-            return self._attr(*args, **kwargs)
-        else:
-            # We're in a different thread than the creation thread; enqueue
-            # the event, and then wait for the response.
-            responseQueue = Queue.Queue(1)
-            if self._tk._debug >= 1:
-                print 'Marshalling event:', self._attr.__name__, args, kwargs
-            self._tk._eventQueue.put((self._attr, args, kwargs, responseQueue))
-            isException, response = responseQueue.get()
-
-            # Handle the response, whether it's a normal return value or
-            # an exception.
-            if isException:
-                exType, exValue, exTb = response
-                raise exType, exValue, exTb
-            else:
-                return response
-
-# Define a hook for class Tk's __init__ method.
-def _Tk__init__(self, *args, **kwargs):
-    # We support some new keyword arguments that the original __init__ method
-    # doesn't expect, so separate those out before doing anything else.
-    new_kwnames = ('mtCheckPeriod', 'mtDebug')
-    new_kwargs = {}
-    for name, value in kwargs.items():
-        if name in new_kwnames:
-            new_kwargs[name] = value
-            del kwargs[name]
-
-    # Call the original __init__ method, creating the internal tk member.
-    self.__original__init__mtTkinter(*args, **kwargs)
-
-    # Replace the internal tk member with a wrapper that handles calls from
-    # other threads.
-    self.tk = _Tk(self.tk, **new_kwargs)
-
-    # Set up the first event to check for out-of-thread events.
-    self.after_idle(_CheckEvents, self)
-
-# Replace Tk's original __init__ with the hook.
-Tk.__original__init__mtTkinter = Tk.__init__
-Tk.__init__ = _Tk__init__
-
-def _CheckEvents(tk):
-    "Event checker event."
-
-    used = False
-    try:
-        # Process all enqueued events, then exit.
-        while True:
-            try:
-                # Get an event request from the queue.
-                method, args, kwargs, responseQueue = \
-                    tk.tk._eventQueue.get_nowait()
-            except:
-                # No more events to process.
-                break
-            else:
-                # Call the event with the given arguments, and then return
-                # the result back to the caller via the response queue.
-                used = True
-                if tk.tk._debug >= 2:
-                    print 'Calling event from main thread:', \
-                        method.__name__, args, kwargs
-                try:
-                    responseQueue.put((False, method(*args, **kwargs)))
-                except SystemExit, ex:
-                    raise SystemExit, ex
-                except Exception, ex:
-                    # Calling the event caused an exception; return the
-                    # exception back to the caller so that it can be raised
-                    # in the caller's thread.
-                    from sys import exc_info
-                    exType, exValue, exTb = exc_info()
-                    responseQueue.put((True, (exType, exValue, exTb)))
-    finally:
-        # Schedule to check again. If we just processed an event, check
-        # immediately; if we didn't, check later.
-        if used:
-            tk.after_idle(_CheckEvents, tk)
-        else:
-            tk.after(tk.tk._checkPeriod, _CheckEvents, tk)
-
-# Test thread entry point.
-def _testThread(root):
-    text = "This is Tcl/Tk version %s" % TclVersion
-    if TclVersion >= 8.1:
-        try:
-            text = text + unicode("\nThis should be a cedilla: \347",
-                                  "iso-8859-1")
-        except NameError:
-            pass # no unicode support
-    try:
-        if root.globalgetvar('tcl_platform(threaded)'):
-            text = text + "\nTcl is built with thread support"
-        else:
-            raise RuntimeError
-    except:
-        text = text + "\nTcl is NOT built with thread support"
-    text = text + "\nmtTkinter works with or without Tcl thread support"
-    label = Label(root, text=text)
-    label.pack()
-    button = Button(root, text="Click me!",
-              command=lambda root=root: root.button.configure(
-                  text="[%s]" % root.button['text']))
-    button.pack()
-    root.button = button
-    quit = Button(root, text="QUIT", command=root.destroy)
-    quit.pack()
-    # The following three commands are needed so the window pops
-    # up on top on Windows...
-    root.iconify()
-    root.update()
-    root.deiconify()
-    # Simulate button presses...
-    button.invoke()
-    root.after(1000, _pressOk, root, button)
-
-# Test button continuous press event.
-def _pressOk(root, button):
-    button.invoke()
-    try:
-        root.after(1000, _pressOk, root, button)
-    except:
-        pass # Likely we're exiting
-
-# Test. Mostly borrowed from the Tkinter module, but the important bits moved
-# into a separate thread.
-if __name__ == '__main__':
-    import threading
-    root = Tk(mtDebug = 1)
-    thread = threading.Thread(target = _testThread, args=(root,))
-    thread.start()
-    root.mainloop()
-    thread.join()

=== added directory 'py/3rd-party/mtTkinter-0.4'
=== added file 'py/3rd-party/mtTkinter-0.4/gpl.txt'
--- py/3rd-party/mtTkinter-0.4/gpl.txt	1970-01-01 00:00:00 +0000
+++ py/3rd-party/mtTkinter-0.4/gpl.txt	2014-08-04 16:38:31 +0000
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.

=== added file 'py/3rd-party/mtTkinter-0.4/lgpl.txt'
--- py/3rd-party/mtTkinter-0.4/lgpl.txt	1970-01-01 00:00:00 +0000
+++ py/3rd-party/mtTkinter-0.4/lgpl.txt	2014-08-04 16:38:31 +0000
@@ -0,0 +1,165 @@
+                   GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions.
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version.
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.

=== added file 'py/3rd-party/mtTkinter-0.4/mtTkinter.py'
--- py/3rd-party/mtTkinter-0.4/mtTkinter.py	1970-01-01 00:00:00 +0000
+++ py/3rd-party/mtTkinter-0.4/mtTkinter.py	2014-08-04 16:38:31 +0000
@@ -0,0 +1,242 @@
+'''Thread-safe version of Tkinter.
+
+Copyright (c) 2009, Allen B. Taylor
+
+This module is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser Public License for more details.
+
+You should have received a copy of the GNU Lesser Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Usage:
+
+    import mtTkinter as Tkinter
+    # Use "Tkinter." as usual.
+
+or
+
+    from mtTkinter import *
+    # Use Tkinter module definitions as usual.
+
+This module modifies the original Tkinter module in memory, making all
+functionality thread-safe. It does this by wrapping the Tk class' tk
+instance with an object that diverts calls through an event queue when
+the call is issued from a thread other than the thread in which the Tk
+instance was created. The events are processed in the creation thread
+via an 'after' event.
+
+The modified Tk class accepts two additional keyword parameters on its
+__init__ method:
+    mtDebug:
+        0 = No debug output (default)
+        1 = Minimal debug output
+        ...
+        9 = Full debug output
+    mtCheckPeriod:
+        Amount of time in milliseconds (default 100) between checks for
+        out-of-thread events when things are otherwise idle. Decreasing
+        this value can improve GUI responsiveness, but at the expense of
+        consuming more CPU cycles.
+
+Note that, because it modifies the original Tkinter module (in memory),
+other modules that use Tkinter (e.g., Pmw) reap the benefits automagically
+as long as mtTkinter is imported at some point before extra threads are
+created.
+
+Author: Allen B. Taylor, a.b.taylor@xxxxxxxxx
+'''
+
+from Tkinter import *
+import threading
+import Queue
+
+class _Tk(object):
+    """
+    Wrapper for underlying attribute tk of class Tk.
+    """
+
+    def __init__(self, tk, mtDebug = 0, mtCheckPeriod = 10):
+        self._tk = tk
+
+        # Create the incoming event queue.
+        self._eventQueue = Queue.Queue(1)
+
+        # Identify the thread from which this object is being created so we can
+        # tell later whether an event is coming from another thread.
+        self._creationThread = threading.currentThread()
+
+        # Store remaining values.
+        self._debug = mtDebug
+        self._checkPeriod = mtCheckPeriod
+
+    def __getattr__(self, name):
+        # Divert attribute accesses to a wrapper around the underlying tk
+        # object.
+        return _TkAttr(self, getattr(self._tk, name))
+
+class _TkAttr(object):
+    """
+    Thread-safe callable attribute wrapper.
+    """
+
+    def __init__(self, tk, attr):
+        self._tk = tk
+        self._attr = attr
+
+    def __call__(self, *args, **kwargs):
+        """
+        Thread-safe method invocation.
+        Diverts out-of-thread calls through the event queue.
+        Forwards all other method calls to the underlying tk object directly.
+        """
+
+        # Check if we're in the creation thread.
+        if threading.currentThread() == self._tk._creationThread:
+            # We're in the creation thread; just call the event directly.
+            if self._tk._debug >= 8 or \
+               self._tk._debug >= 3 and self._attr.__name__ == 'call' and \
+               len(args) >= 1 and args[0] == 'after':
+                print 'Calling event directly:', \
+                    self._attr.__name__, args, kwargs
+            return self._attr(*args, **kwargs)
+        else:
+            # We're in a different thread than the creation thread; enqueue
+            # the event, and then wait for the response.
+            responseQueue = Queue.Queue(1)
+            if self._tk._debug >= 1:
+                print 'Marshalling event:', self._attr.__name__, args, kwargs
+            self._tk._eventQueue.put((self._attr, args, kwargs, responseQueue))
+            isException, response = responseQueue.get()
+
+            # Handle the response, whether it's a normal return value or
+            # an exception.
+            if isException:
+                exType, exValue, exTb = response
+                raise exType, exValue, exTb
+            else:
+                return response
+
+# Define a hook for class Tk's __init__ method.
+def _Tk__init__(self, *args, **kwargs):
+    # We support some new keyword arguments that the original __init__ method
+    # doesn't expect, so separate those out before doing anything else.
+    new_kwnames = ('mtCheckPeriod', 'mtDebug')
+    new_kwargs = {}
+    for name, value in kwargs.items():
+        if name in new_kwnames:
+            new_kwargs[name] = value
+            del kwargs[name]
+
+    # Call the original __init__ method, creating the internal tk member.
+    self.__original__init__mtTkinter(*args, **kwargs)
+
+    # Replace the internal tk member with a wrapper that handles calls from
+    # other threads.
+    self.tk = _Tk(self.tk, **new_kwargs)
+
+    # Set up the first event to check for out-of-thread events.
+    self.after_idle(_CheckEvents, self)
+
+# Replace Tk's original __init__ with the hook.
+Tk.__original__init__mtTkinter = Tk.__init__
+Tk.__init__ = _Tk__init__
+
+def _CheckEvents(tk):
+    "Event checker event."
+
+    used = False
+    try:
+        # Process all enqueued events, then exit.
+        while True:
+            try:
+                # Get an event request from the queue.
+                method, args, kwargs, responseQueue = \
+                    tk.tk._eventQueue.get_nowait()
+            except:
+                # No more events to process.
+                break
+            else:
+                # Call the event with the given arguments, and then return
+                # the result back to the caller via the response queue.
+                used = True
+                if tk.tk._debug >= 2:
+                    print 'Calling event from main thread:', \
+                        method.__name__, args, kwargs
+                try:
+                    responseQueue.put((False, method(*args, **kwargs)))
+                except SystemExit, ex:
+                    raise SystemExit, ex
+                except Exception, ex:
+                    # Calling the event caused an exception; return the
+                    # exception back to the caller so that it can be raised
+                    # in the caller's thread.
+                    from sys import exc_info
+                    exType, exValue, exTb = exc_info()
+                    responseQueue.put((True, (exType, exValue, exTb)))
+    finally:
+        # Schedule to check again. If we just processed an event, check
+        # immediately; if we didn't, check later.
+        if used:
+            tk.after_idle(_CheckEvents, tk)
+        else:
+            tk.after(tk.tk._checkPeriod, _CheckEvents, tk)
+
+# Test thread entry point.
+def _testThread(root):
+    text = "This is Tcl/Tk version %s" % TclVersion
+    if TclVersion >= 8.1:
+        try:
+            text = text + unicode("\nThis should be a cedilla: \347",
+                                  "iso-8859-1")
+        except NameError:
+            pass # no unicode support
+    try:
+        if root.globalgetvar('tcl_platform(threaded)'):
+            text = text + "\nTcl is built with thread support"
+        else:
+            raise RuntimeError
+    except:
+        text = text + "\nTcl is NOT built with thread support"
+    text = text + "\nmtTkinter works with or without Tcl thread support"
+    label = Label(root, text=text)
+    label.pack()
+    button = Button(root, text="Click me!",
+              command=lambda root=root: root.button.configure(
+                  text="[%s]" % root.button['text']))
+    button.pack()
+    root.button = button
+    quit = Button(root, text="QUIT", command=root.destroy)
+    quit.pack()
+    # The following three commands are needed so the window pops
+    # up on top on Windows...
+    root.iconify()
+    root.update()
+    root.deiconify()
+    # Simulate button presses...
+    button.invoke()
+    root.after(1000, _pressOk, root, button)
+
+# Test button continuous press event.
+def _pressOk(root, button):
+    button.invoke()
+    try:
+        root.after(1000, _pressOk, root, button)
+    except:
+        pass # Likely we're exiting
+
+# Test. Mostly borrowed from the Tkinter module, but the important bits moved
+# into a separate thread.
+if __name__ == '__main__':
+    import threading
+    root = Tk(mtDebug = 1)
+    thread = threading.Thread(target = _testThread, args=(root,))
+    thread.start()
+    root.mainloop()
+    thread.join()

=== modified file 'py/CMakeLists.txt'
--- py/CMakeLists.txt	2013-10-15 16:14:46 +0000
+++ py/CMakeLists.txt	2014-08-04 16:38:31 +0000
@@ -21,7 +21,7 @@
 FILE(GLOB filesPY "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
 SET(filesPY "${filesPY};${CMAKE_CURRENT_SOURCE_DIR}/pack/pack.py")
 INSTALL(FILES ${filesPY} DESTINATION ${YADE_PY_PATH}/yade)
-INSTALL(FILES 3rd-party/mtTkinter-0.3/mtTkinter.py DESTINATION ${YADE_LIB_PATH}/py)
+INSTALL(FILES 3rd-party/mtTkinter-0.4/mtTkinter.py DESTINATION ${YADE_LIB_PATH}/py)
 FILE(GLOB filesPYTests "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.py")
 INSTALL(FILES ${filesPYTests} DESTINATION ${YADE_PY_PATH}/yade/tests)
 FILE(GLOB filesPYPerf "${CMAKE_CURRENT_SOURCE_DIR}/../examples/test/performance/*")

=== modified file 'py/_utils.cpp'
--- py/_utils.cpp	2014-08-01 17:25:38 +0000
+++ py/_utils.cpp	2014-09-03 17:34:07 +0000
@@ -488,7 +488,7 @@
 	py::def("fabricTensor",Shop__fabricTensor,(py::args("splitTensor")=false,py::args("revertSign")=false,py::args("thresholdForce")=NaN),"Compute the fabric tensor of the periodic cell. The original paper can be found in [Satake1982]_.\n\n:param bool splitTensor: split the fabric tensor into two parts related to the strong and weak contact forces respectively.\n\n:param bool revertSign: it must be set to true if the contact law's convention takes compressive forces as positive.\n\n:param Real thresholdForce: if the fabric tensor is split into two parts, a threshold value can be specified otherwise the mean contact force is considered by default. It is worth to note that this value has a sign and the user needs to set it according to the convention adopted for the contact law. To note that this value could be set to zero if one wanted to make distinction between compressive and tensile forces.");
 	py::def("bodyStressTensors",Shop__getStressLWForEachBody,"Compute and return a table with per-particle stress tensors. Each tensor represents the average stress in one particle, obtained from the contour integral of applied load as detailed below. This definition is considering each sphere as a continuum. It can be considered exact in the context of spheres at static equilibrium, interacting at contact points with negligible volume changes of the solid phase (this last assumption is not restricting possible deformations and volume changes at the packing scale).\n\nProof: \n\nFirst, we remark the identity:  $\\sigma_{ij}=\\delta_{ik}\\sigma_{kj}=x_{i,k}\\sigma_{kj}=(x_{i}\\sigma_{kj})_{,k}-x_{i}\\sigma_{kj,k}$.\n\nAt equilibrium, the divergence of stress is null: $\\sigma_{kj,k}=\\vec{0}$. Consequently, after divergence theorem: $\\frac{1}{V}\\int_V \\sigma_{ij}dV = \\frac{1}{V}\\int_V (x_{i}\\sigma_{kj})_{,k}dV = \\frac{1}{V}\\int_{\\partial V}x_i\\sigma_{kj}n_kdS = \\frac{1}{V}\\sum_bx_i^bf_j^b$.\n\nThe last equality is implicitely based on the representation of external loads as Dirac distributions whose zeros are the so-called *contact points*: 0-sized surfaces on which the *contact forces* are applied, located at $x_i$ in the deformed configuration.\n\nA weighted average of per-body stresses will give the average stress inside the solid phase. There is a simple relation between the stress inside the solid phase and the stress in an equivalent continuum in the absence of fluid pressure. For porosity $n$, the relation reads: $\\sigma_{ij}^{equ.}=(1-n)\\sigma_{ij}^{solid}$.\n\nThis last relation may not be very useful if porosity is not homogeneous. If it happens, one can define the equivalent bulk stress a the particles scale by assigning a volume to each particle. This volume can be obtained from :yref:`TesselationWrapper` (see e.g. [Catalano2014a]_)");
 	py::def("getStress",Shop::getStress,(py::args("volume")=0),"Compute and return Love-Weber stress tensor:\n\n $\\sigma_{ij}=\\frac{1}{V}\\sum_b f_i^b l_j^b$, where the sum is over all interactions, with $f$ the contact force and $l$ the branch vector (joining centers of the bodies). Stress is negativ for repulsive contact forces, i.e. compression. $V$ can be passed to the function. If it is not, it will be equal to one in non-periodic cases, or equal to the volume of the cell in periodic cases.");
-	py::def("getCapillaryStress",Shop::getCapillaryStress,(py::args("volume")=0),"Compute and return Love-Weber capillary stress tensor:\n\n $\\sigma^{cap}_{ij}=\\frac{1}{V}\\sum_b l_i^b f^{cap,b}_j$, where the sum is over all interactions, with $l$ the branch vector (joining centers of the bodies) and $f^{cap}$ is the capillary force. $V$ can be passed to the function. If it is not, it will be equal to one in non-periodic cases, or equal to the volume of the cell in periodic cases. Only the CapillaryPhys interaction type is supported presently.");
+	py::def("getCapillaryStress",Shop::getCapillaryStress,(py::args("volume")=0,py::args("mindlin")=false),"Compute and return Love-Weber capillary stress tensor:\n\n $\\sigma^{cap}_{ij}=\\frac{1}{V}\\sum_b l_i^b f^{cap,b}_j$, where the sum is over all interactions, with $l$ the branch vector (joining centers of the bodies) and $f^{cap}$ is the capillary force. $V$ can be passed to the function. If it is not, it will be equal to one in non-periodic cases, or equal to the volume of the cell in periodic cases. Only the CapillaryPhys interaction type is supported presently. Using this function with physics MindlinCapillaryPhys needs to pass True as second argument.");
 	py::def("getBodyIdsContacts",Shop__getBodyIdsContacts,(py::args("bodyID")=0),"Get a list of body-ids, which contacts the given body.");
 	py::def("maxOverlapRatio",maxOverlapRatio,"Return maximum overlap ration in interactions (with :yref:`ScGeom`) of two :yref:`spheres<Sphere>`. The ratio is computed as $\\frac{u_N}{2(r_1 r_2)/r_1+r_2}$, where $u_N$ is the current overlap distance and $r_1$, $r_2$ are radii of the two spheres in contact.");
 	py::def("shiftBodies",shiftBodies,(py::arg("ids"),py::arg("shift")),"Shifts bodies listed in ids without updating their velocities.");

=== modified file 'py/pack/_packSpheres.cpp'
--- py/pack/_packSpheres.cpp	2014-05-23 13:03:50 +0000
+++ py/pack/_packSpheres.cpp	2014-09-03 15:59:54 +0000
@@ -15,17 +15,19 @@
 		.def("load",&SpherePack::fromFile,(boost::python::arg("fileName")),"Load packing from external text file (current data will be discarded).")
 		.def("save",&SpherePack::toFile,(boost::python::arg("fileName")),"Save packing to external text file (will be overwritten).")
 		.def("fromSimulation",&SpherePack::fromSimulation,"Make packing corresponding to the current simulation. Discards current data.")
+		//The basic sphere generator
 		.def("makeCloud",&SpherePack::makeCloud,(boost::python::arg("minCorner")=Vector3r(Vector3r::Zero()),boost::python::arg("maxCorner")=Vector3r(Vector3r::Zero()),boost::python::arg("rMean")=-1,boost::python::arg("rRelFuzz")=0,boost::python::arg("num")=-1,boost::python::arg("periodic")=false,boost::python::arg("porosity")=0.65,boost::python::arg("psdSizes")=vector<Real>(),boost::python::arg("psdCumm")=vector<Real>(),boost::python::arg("distributeMass")=false,boost::python::arg("seed")=0,boost::python::arg("hSize")=Matrix3r(Matrix3r::Zero())),"Create random loose packing enclosed in a parallelepiped (also works in 2D if minCorner[k]=maxCorner[k] for one coordinate)."
 		"\nSphere radius distribution can be specified using one of the following ways:\n\n#. *rMean*, *rRelFuzz* and *num* gives uniform radius distribution in *rMean×(1 ± rRelFuzz)*. Less than *num* spheres can be generated if it is too high.\n#. *rRelFuzz*, *num* and (optional) *porosity*, which estimates mean radius so that *porosity* is attained at the end.  *rMean* must be less than 0 (default). *porosity* is only an initial guess for the generation algorithm, which will retry with higher porosity until the prescibed *num* is obtained.\n#. *psdSizes* and *psdCumm*, two arrays specifying points of the `particle size distribution <http://en.wikipedia.org/wiki/Particle_size_distribution>`__ function. As many spheres as possible are generated.\n#. *psdSizes*, *psdCumm*, *num*, and (optional) *porosity*, like above but if *num* is not obtained, *psdSizes* will be scaled down uniformly, until *num* is obtained (see :yref:`appliedPsdScaling<yade._packSpheres.SpherePack.appliedPsdScaling>`).\n\nBy default (with ``distributeMass==False``), the distribution is applied to particle radii. The usual sense of \"particle size distribution\" is the distribution of *mass fraction* (rather than particle count); this can be achieved with ``distributeMass=True``."
 		"\n\nIf *num* is defined, then sizes generation is deterministic, giving the best fit of target distribution. It enables spheres placement in descending size order, thus giving lower porosity than the random generation."
 		"\n\n:param Vector3 minCorner: lower corner of an axis-aligned box\n:param Vector3 maxCorner: upper corner of an axis-aligned box\n:param Matrix3 hSize: base vectors of a generalized box (arbitrary parallelepiped, typically :yref:`Cell::hSize`), superseeds minCorner and maxCorner if defined. For periodic boundaries only.\n:param float rMean: mean radius or spheres\n:param float rRelFuzz: dispersion of radius relative to rMean\n:param int num: number of spheres to be generated. If negavite (default), generate as many as possible with stochastic sizes, ending after a fixed number of tries to place the sphere in space, else generate exactly *num* spheres with deterministic size distribution.\n:param bool periodic: whether the packing to be generated should be periodic\n:param float porosity: initial guess for the iterative generation procedure (if *num*>1). The algorithm will be retrying until the number of generated spheres is *num*. The first iteration tries with the provided porosity, but next iterations increase it if necessary (hence an initialy high porosity can speed-up the algorithm). If *psdSizes* is not defined, *rRelFuzz* ($z$) and *num* ($N$) are used so that the porosity given ($\\rho$) is approximately achieved at the end of generation, $r_m=\\sqrt[3]{\\frac{V(1-\\rho)}{\\frac{4}{3}\\pi(1+z^2)N}}$. The default is $\\rho$=0.5. The optimal value depends on *rRelFuzz* or  *psdSizes*.\n:param psdSizes: sieve sizes (particle diameters) when particle size distribution (PSD) is specified\n:param psdCumm: cummulative fractions of particle sizes given by *psdSizes*; must be the same length as *psdSizes* and should be non-decreasing\n:param bool distributeMass: if ``True``, given distribution will be used to distribute sphere's mass rather than radius of them.\n:param seed: number used to initialize the random number generator.\n:returns: number of created spheres, which can be lower than *num* depending on the method used.\n")
 		.def("psd",&SpherePack::psd,(boost::python::arg("bins")=50,boost::python::arg("mass")=true),"Return `particle size distribution <http://en.wikipedia.org/wiki/Particle_size_distribution>`__ of the packing.\n:param int bins: number of bins between minimum and maximum diameter\n:param mass: Compute relative mass rather than relative particle count for each bin. Corresponds to :yref:`distributeMass parameter for makeCloud<yade.pack.SpherePack.makeCloud>`.\n:returns: tuple of ``(cumm,edges)``, where ``cumm`` are cummulative fractions for respective diameters  and ``edges`` are those diameter values. Dimension of both arrays is equal to ``bins+1``.")
-		// new psd
-		.def("particleSD",&SpherePack::particleSD,(boost::python::arg("minCorner"),boost::python::arg("maxCorner"),boost::python::arg("rMean"),boost::python::arg("periodic")=false,boost::python::arg("name"),boost::python::arg("numSph"),boost::python::arg("radii")=vector<Real>(),boost::python::arg("passing")=vector<Real>(),boost::python::arg("passingIsNotPercentageButCount")=false, boost::python::arg("seed")=0),"Create random packing enclosed in box given by minCorner and maxCorner, containing numSph spheres. Returns number of created spheres, which can be < num if the packing is too tight. The computation is done according to the given psd.")
-		.def("particleSD2",&SpherePack::particleSD2,(boost::python::arg("radii"),boost::python::arg("passing"),boost::python::arg("numSph"),boost::python::arg("periodic")=false,boost::python::arg("cloudPorosity")=.8,boost::python::arg("seed")=0),"Create random packing following the given particle size distribution (radii and volume/mass passing for each fraction) and total number of particles *numSph*. The cloud size (periodic or aperiodic) is computed from the PSD and is always cubic.")
-		.def("particleSD_2d",&SpherePack::particleSD_2d,(boost::python::arg("minCorner"),boost::python::arg("maxCorner"),boost::python::arg("rMean"),boost::python::arg("periodic")=false,boost::python::arg("name"),boost::python::arg("numSph"),boost::python::arg("radii")=vector<Real>(),boost::python::arg("passing")=vector<Real>(),boost::python::arg("passingIsNotPercentageButCount")=false,boost::python::arg("seed")=0),"Create random packing on XY plane, defined by minCorner and maxCorner, containing numSph spheres. Returns number of created spheres, which can be < num if the packing is too tight. The computation is done according to the given psd.")
-
+		//The variant for clumps
 		.def("makeClumpCloud",&SpherePack::makeClumpCloud,(boost::python::arg("minCorner"),boost::python::arg("maxCorner"),boost::python::arg("clumps"),boost::python::arg("periodic")=false,boost::python::arg("num")=-1,boost::python::arg("seed")=0),"Create random loose packing of clumps within box given by *minCorner* and *maxCorner*. Clumps are selected with equal probability. At most *num* clumps will be positioned if *num* is positive; otherwise, as many clumps as possible will be put in space, until maximum number of attempts to place a new clump randomly is attained.\n:param seed: number used to initialize the random number generator.")
+		// old unmaintained stuff, kept for the moment so it at least returns an error message
+		.def("particleSD",&SpherePack::particleSD,(boost::python::arg("minCorner"),boost::python::arg("maxCorner"),boost::python::arg("rMean"),boost::python::arg("periodic")=false,boost::python::arg("name"),boost::python::arg("numSph"),boost::python::arg("radii")=vector<Real>(),boost::python::arg("passing")=vector<Real>(),boost::python::arg("passingIsNotPercentageButCount")=false, boost::python::arg("seed")=0),"Not working. Use makeCloud instead.")
+		.def("particleSD2",&SpherePack::particleSD2,(boost::python::arg("radii"),boost::python::arg("passing"),boost::python::arg("numSph"),boost::python::arg("periodic")=false,boost::python::arg("cloudPorosity")=.8,boost::python::arg("seed")=0),"Not working. Use makeCloud instead.")
+		.def("particleSD_2d",&SpherePack::particleSD_2d,(boost::python::arg("minCorner"),boost::python::arg("maxCorner"),boost::python::arg("rMean"),boost::python::arg("periodic")=false,boost::python::arg("name"),boost::python::arg("numSph"),boost::python::arg("radii")=vector<Real>(),boost::python::arg("passing")=vector<Real>(),boost::python::arg("passingIsNotPercentageButCount")=false,boost::python::arg("seed")=0),"Not working. Use makeCloud instead.")
+		
 		//
 		.def("aabb",&SpherePack::aabb_py,"Get axis-aligned bounding box coordinates, as 2 3-tuples.")
 		.def("dim",&SpherePack::dim,"Return dimensions of the packing in terms of aabb(), as a 3-tuple.")

=== modified file 'py/utils.py'
--- py/utils.py	2014-07-22 17:23:17 +0000
+++ py/utils.py	2014-08-21 14:31:08 +0000
@@ -391,7 +391,7 @@
 	return b
 
 def polyhedron(vertices,dynamic=True,fixed=False,wire=True,color=None,highlight=False,noBound=False,material=-1,mask=1,chain=-1):
-	"""Create tetrahedron (actually simple Polyhedra) with given parameters.
+	"""Create polyhedron with given parameters.
 
 	:param [Vector3,Vector3,Vector3,Vector3] vertices: coordinates of vertices in the global coordinate system.
 

=== modified file 'scripts/checks-and-tests/checks/DEM-PFV-check.py'
--- scripts/checks-and-tests/checks/DEM-PFV-check.py	2014-07-28 06:50:17 +0000
+++ scripts/checks-and-tests/checks/DEM-PFV-check.py	2014-08-07 13:38:16 +0000
@@ -5,7 +5,8 @@
 
 if ('PFVFLOW' in features):
 	errors=0
-	tolerance=0.01
+	toleranceWarning =0.01
+	toleranceCritical=0.10
 
 	from yade import pack
 	num_spheres=100# number of spheres
@@ -77,9 +78,11 @@
 	modulus = 1000./abs(e22)
 
 	target=252759.905803
-	if abs((modulus-target)/target)>tolerance :
+	if abs((modulus-target)/target)>toleranceWarning:
 		print "DEM-PFV: difference in bulk modulus:", modulus, "vs. target ",target
-		errors+=1
+		if (abs((modulus-target)/target)>toleranceCritical):
+			errors+=1
+			print "The difference is more, than the critical tolerance!"
 
 	#B. Activate flow engine and set boundary conditions in order to get permeability
 	flow.dead=0
@@ -103,9 +106,11 @@
 		errors+=1
 
 	target=0.040399916554
-	if abs((permeability-target)/target)>tolerance :
+	if abs((permeability-target)/target)>toleranceWarning:
 		print "DEM-PFV: difference in permeability:",permeability," vs. target ",target
-		errors+=1
+		if (abs((permeability-target)/target)>toleranceCritical):
+			errors+=1
+			print "The difference is more, than the critical tolerance!"
 
 	#C. now the oedometer test, drained at the top, impermeable at the bottom plate
 	flow.bndCondIsPressure=[0,0,0,1,0,0]
@@ -121,13 +126,19 @@
 	O.run(3000,1)
 
 	target=628.314160434
-	if abs((flow.getPorePressure((0.5,0.1,0.5))-target)/target)>tolerance :
+	if abs((flow.getPorePressure((0.5,0.1,0.5))-target)/target)>toleranceWarning:
 		print "DEM-PFV: difference in final pressure:",flow.getPorePressure((0.5,0.1,0.5))," vs. target ",target
-		errors+=1
+		if (abs((flow.getPorePressure((0.5,0.1,0.5))-target)/target)>toleranceCritical):
+			errors+=1
+			print "The difference is more, than the critical tolerance!"
+
 	target=0.00258113045083
-	if abs((triax.strain[1]-zeroe22-target)/target)>tolerance :
+	if abs((triax.strain[1]-zeroe22-target)/target)>toleranceWarning:
 		print "DEM-PFV: difference in final deformation",triax.strain[1]-zeroe22," vs. target ",target
-		errors+=1
+		if (abs((triax.strain[1]-zeroe22-target)/target)>toleranceCritical):
+			errors+=1
+			print "The difference is more, than the critical tolerance!"
+
 
 	if (float(flow.execTime)/float(sum([e.execTime for e in O.engines])))>0.6 :
 		print "(INFO) DEM-PFV: More than 60\% of cpu time in FlowEngine (",100.*(float(flow.execTime)/float(sum([e.execTime for e in O.engines]))) ,"%). Should not happen with efficient libraries (check blas/lapack/cholmod implementations)"

=== added file 'scripts/checks-and-tests/checks/checkClumpHopper.py'
--- scripts/checks-and-tests/checks/checkClumpHopper.py	1970-01-01 00:00:00 +0000
+++ scripts/checks-and-tests/checks/checkClumpHopper.py	2014-08-18 22:44:44 +0000
@@ -0,0 +1,80 @@
+# -*- coding: utf-8
+# This script is used in --check to keep the functionality of adding/removal
+# of particles and clumps functional
+
+import itertools
+from numpy import *
+
+
+kinEnergyMax = 100000
+# Parameters
+tc=0.001# collision time 
+en=.3  # normal restitution coefficient
+es=.3  # tangential restitution coefficient
+frictionAngle=radians(35)# 
+density=2700
+# facets material
+facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,tc=tc,en=en,et=es))
+# default spheres material
+dfltSpheresMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle,tc=tc,en=en,et=es)) 
+
+O.dt=.05*tc # time step
+
+Rs=0.05 # particle radius
+
+# Create geometry
+
+x0=0.; y0=0.; z0=0.; ab=.7; at=2.; h=1.; hl=h; al=at*3
+
+zb=z0;   x0b=x0-ab/2.; y0b=y0-ab/2.; x1b=x0+ab/2.; y1b=y0+ab/2.
+zt=z0+h; x0t=x0-at/2.; y0t=y0-at/2.; x1t=x0+at/2.; y1t=y0+at/2.
+zl=z0-hl;x0l=x0-al/2.; y0l=y0-al/2.; x1l=x0+al/2.; y1l=y0+al/2.
+
+vibrationPlate = O.bodies.append(geom.facetBunker((x0,y0,z0),
+  dBunker=ab*4.0,dOutput=ab*1.7,hBunker=ab*3,hOutput=ab,hPipe=ab/3.0,
+  wallMask=4,segmentsNumber=10,material=facetMat))
+
+# Create engines
+O.engines=[
+	ForceResetter(),
+	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
+	InteractionLoop(
+		[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
+		[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
+		[Law2_ScGeom_ViscElPhys_Basic()],
+	),
+	DomainLimiter(lo=(-4,-4,-1),hi=(4,4,4),iterPeriod=5000,label='domLim'),
+	NewtonIntegrator(damping=0, gravity=[0,0,-9.81]),
+	PyRunner(iterPeriod=6500,command='addBodies()',nDo=7,label='addb'),
+	PyRunner(iterPeriod=10000,command='state()',label='state'),
+]
+
+numSphereGen = 0
+def addBodies():
+	global numSphereGen
+	# Create clumps...
+	clumpColor=(0.0, 0.5, 0.5)
+	for k,l in itertools.product(arange(0,10),arange(0,10)):
+		clpId,sphId=O.bodies.appendClumped([sphere(Vector3(x0t+Rs*(k*4+2),y0t+Rs*(l*4+2),i*Rs*2+zt+ab*3),Rs,color=clumpColor,material=dfltSpheresMat) for i in xrange(4)])
+		numSphereGen += len(sphId)
+
+	# ... and spheres
+	spheresColor=(0.4, 0.4, 0.4)
+	for k,l in itertools.product(arange(0,9),arange(0,9)):
+		sphAloneId=O.bodies.append( [sphere( Vector3(x0t+Rs*(k*4+4),y0t+Rs*(l*4+4),i*Rs*2.3+zt+ab*3),Rs,color=spheresColor,material=dfltSpheresMat) for i in xrange(4) ] )
+		numSphereGen += len(sphAloneId)
+
+def state():
+	global numSphereGen
+	global resultStatus
+	print "Iter %d: Total number of generated spheres %d, removed particles %d, current particles %d, kinEnergy %g"%(O.iter, numSphereGen, domLim.nDeleted, numSphereGen-domLim.nDeleted, utils.kineticEnergy())
+	if (utils.kineticEnergy() > kinEnergyMax):
+		print "Kinetic energy is over a threshold value! Error!"
+		resultStatus += 1
+		O.pause()
+
+addBodies()
+O.run(10, True)
+O.bodies.erase(64, True)
+
+O.run(50002, True)

=== modified file 'scripts/checks-and-tests/checks/checkViscElEng.py'
--- scripts/checks-and-tests/checks/checkViscElEng.py	2014-04-02 15:33:41 +0000
+++ scripts/checks-and-tests/checks/checkViscElEng.py	2014-08-26 14:53:06 +0000
@@ -45,8 +45,8 @@
 
   if v0<=0 and v>0:
     en=-v/v0
-    print ("Precalculated en value %f" % 0.736356797441)
-    print ("Obtained en value %f" % en)
+    print ("Precalculated en value %.12f" % 0.736356797441)
+    print ("Obtained en value %.12f" % en)
     O.pause()
   v0=v
 

=== added file 'scripts/checks-and-tests/checks/checkViscElPM.py'
--- scripts/checks-and-tests/checks/checkViscElPM.py	1970-01-01 00:00:00 +0000
+++ scripts/checks-and-tests/checks/checkViscElPM.py	2014-08-27 18:41:41 +0000
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+################################################################################
+# CONSTITUTIVE LAW TESTING: Law2_ScGeom_ViscElPhys_Basic()
+#
+# Two spheres with velocities (v,0,0) and (-v,0,0) collide.
+# This script checks if:
+#  - the numerical displacement equals the analytical displacement at a certain
+#    time before the spheres separate, for instance in t = 0.05 s
+#    This also implies the consistency of the results in terms of velocity
+#    (and acceleration).
+#  - the normal stiffness and normal damping coefficients have been calculated
+#    correctly in function of the normal coefficient (en) of restitution and the
+#    impact time (tc); this is a consequence of the previous condition.
+#
+# Notice that:
+#  - this script only checks the displacement before the separation because the
+#    analytical solution (given below) supposes that the damping term is still
+#    present, when the spheres separate.  This is however not true in the
+#    numerical model (see source code, prevent appearing of attraction forces
+#    due to a viscous component).
+#  - this script does not check the tangential (or shear) behaviour of
+#    the constitutive law.
+#
+
+from yade import plot,ymport
+import math
+
+
+################################################################################
+# MATERIAL
+
+rho = 2000 # [kg/m^3] density
+mu  = 0.75 # [-]      friction coefficient
+tc  = 0.2  # [s]      contact time
+en  = 0.3  # [-]      normal restitution coefficient
+et  = 0.2  # [-]      tangential restitution coefficient
+
+frictionAngle = math.atan(mu)
+mat = O.materials.append(ViscElMat(tc=tc,en=en,et=et,
+                                   frictionAngle=frictionAngle,density=rho))
+
+
+################################################################################
+# GEOMETRY
+
+r   = 0.1  # [m] sphere radius
+
+b1 = O.bodies.append(utils.sphere(center=(2*r,0,0),radius=r,material=mat))
+b2 = O.bodies.append(utils.sphere(center=(0,0,0),radius=r,material=mat))
+
+
+################################################################################
+# SIMULATION
+
+O.dt = 1e-5 # [s]   fixed time step
+v    = 2    # [m/s] velocity along x-axis
+
+O.bodies[b1].state.vel[0] = -v
+O.bodies[b2].state.vel[0] =  v
+
+O.engines=[
+  ForceResetter(),
+  InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
+  InteractionLoop(
+    [Ig2_Sphere_Sphere_ScGeom(),
+     Ig2_Facet_Sphere_ScGeom(),
+     Ig2_Wall_Sphere_ScGeom()],
+    [Ip2_ViscElMat_ViscElMat_ViscElPhys()],
+    [Law2_ScGeom_ViscElPhys_Basic()]
+  ),
+
+  NewtonIntegrator(damping=0)
+]
+
+
+################################################################################
+# RUN
+
+O.run(5001,True)
+
+
+################################################################################
+# COMPARE ANALYTICAL AND NUMERICAL SOLUTIONS
+
+m = 4./3. * math.pi * r**3 * rho # [kg] mass of the sphere
+
+
+# Normal stiffness and damping coefficients according to [Pournin2001]
+meff = m/2
+kn   = 2.0 * meff/tc**2 * (math.pi**2 + math.log(en)**2)
+cn   = -4.0 * meff/tc * math.log(en)
+
+
+# Analytical solution of a linear spring damper system
+omega0      = math.sqrt(kn/m)
+zeta        = cn / (2 * math.sqrt(kn * m))
+omegad      = omega0 * math.sqrt(1 - zeta**2)
+xAnalytical = v/omegad * math.exp(-zeta*omega0*O.time) * math.sin(omegad*O.time)
+
+
+# Comparison (if ok, resultStatus is not incremented)
+tolerance = 0.0001
+
+xNumerical = O.bodies[b2].state.pos[0]
+
+if ((abs(xNumerical-xAnalytical)/xAnalytical)>tolerance):
+  resultStatus += 1
+