Hi Henri,
Thanks very much for the help. You are right, I did misunderstood the returns from the interactive examples. As for the tutorial, there is no more errors shown after I rebuilt the ESPResSo (same version I used before).I can't even recover the errors myself, so I probably did something stupid when change the configurations to ran different scripts.
Cheers
Le
Dear Le, I'm very sorry but I can't reproduce your issue with the latest python branch. Here I show the steps I took to get the example working on my machine git clone https://github.com/espressomd/espresso.gitcd espresso mkdir build cd build cmake .. cp myconfig-sample.hpp myconfig.hpp # Uncomment features from your mailing in myconfig.hpp cmake .. make Then I run the tutorial script using ./pypresso ../doc/tutorials/python/06-active_matter/SOLUTIONS/enhanced_diffusion.py 1.0 and it works for me without errors. At the same time it seems like you are using a different version of ESPResSo to run the interactive example and the tutorial code, because the interactive example does not show any errors (The <espressomd.particle_data.ParticleHandle ...> bit is only a representation of the return value of system.part.add). Kind regards, Henri On Wed, 2017-10-25 at 17:15 -0400, Le Qiao wrote: Hi,
I’m trying add a self propelling particle with the swimming feature on by using the code example:
Examples -------- >>> import espressomd >>> >>> system = espressomd.System() >>> >>> # Usage with Langevin >>> system.part.add(id=0, pos=[1,0,0],swimming={'f_swim':0.03}) >>> >>> # Usage with LB >>> system.part.add(id=1, pos=[2,0,0],swimming={ >>> 'f_swim':0.01, 'mode':'pusher', 'dipole_length':2.0, 'rotational_friction':20})
However, it kept giving me errors:
$ ./pypresso Python 2.7.14 (default, Sep 25 2017, 09:54:19) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import espressomd system = espressomd.System() system.part.add(id=0, pos=[1,0,0],swimming={'f_swim':0.03})
<espressomd.particle_data.ParticleHandle object at 0x10947a8a0>
system.part.add(id=1, pos=[2,0,0],swimming={'f_swim':0.01, 'mode':'pusher',
'dipole_length':2.0, 'rotational_friction':20}) <espressomd.particle_data.ParticleHandle object at 0x10947aee0>
exit()
I also tried the example code from tutorial directory: doc/tutorials/python/06- active_matter/SOLUTIONS/enhanced_diffusion.py
I got following error: Traceback (most recent call last): File "enhanced_diffusion.py", line 87, in <module> system.part.add(pos=[5.0, 5.0, 5.0],swimming={ 'v_swim' : vel },rotation=[1,1,1]) File "espressomd/particle_data.pyx", line 1744, in espressomd.particle_data.ParticleList.add (/home/mbcx/project/Work/test/espresso/build/src/python/espressomd/particle_data.cpp:14337) File "espressomd/particle_data.pyx", line 1772, in espressomd.particle_data.ParticleList._place_new_particle (/home/mbcx/project/Work/test/espresso/build/src/python/espressomd/particle_data.cpp:14674) File "espressomd/particle_data.pyx", line 1476, in espressomd.particle_data.ParticleHandle.update (/home/mbcx/project/Work/test/espresso/build/src/python/espressomd/particle_data.cpp:10383) AttributeError: 'espressomd.particle_data.ParticleHandle' object has no attribute 'swimming'
But I did enable the engine feature, Does anyone know what is the cause of the errors?
Enabled features in myconfig.hpp #define CONSTRAINTS #define MASS #define ENGINE #define ROTATION #define ROTATIONAL_INERTIA #define LB #define LB_BOUNDARIES #define LENNARD_JONES
Cheers Le
|