A very simple question confussing me ...

Asked by JIPEIQI

I'm new to Yade and just getting started to learn it...
So when I was trying to run the examples with my hand typing codes like "gravity deposition" (https://yade-dem.org/doc/tutorial-examples.html#gravity-deposition), a error occurred which says :

"NewtonIntegrator(gravity=(0,0,-9.81),damping=0.2)

TypeError: list indices must be integers, not tuple"
I compared the origin examples and found nothing different. here is my typing codes:
#practice 2.
from yade import pack,plot
O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=31))
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(1,1,1),rMean=.05,rRelFuzz=.5)
sp.toSimulation()
O.engines[

ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),

InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],

[Ip2_FrictMat_FrictMat_FrictPhys()],

[Law2_ScGeom_FrictPhys_CundallStrack()]

),

NewtonIntegrator(gravity=(0,0,-9.81),damping=0.2)

]
O.dt=.5*PWaveTimeStep()

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Best Jan Stránský (honzik) said :
#1

Hello,

> I'm new to Yade

welcome :-)

> list indices must be integers, not tuple

exactly as the error says :-) In your code, it should be

O.engines = [... # assignment, note "=" symbol

and not O.engines[... # index access, not what you want

cheers
Jan

Revision history for this message
JIPEIQI (jpq-learning) said :
#2

Thank you so much. So I was trying to get the O.engines[sth] value instead of assigning it?
I found it difficult to type a long script. Sometimes you types a lot of mistake such as "ScGeom" to "SCgeom" .
Still a long way for me to go.
Thanks again

Revision history for this message
JIPEIQI (jpq-learning) said :
#3

Thanks Jan Stránský, that solved my question.