← Back to team overview

yade-users team mailing list archive

Re: [Question #688690]: pack.SpherePack.save() function saved particles data format

 

Question #688690 on Yade changed:
https://answers.launchpad.net/yade/+question/688690

    Status: Needs information => Open

gaoxuesong gave more information on the question:
Sorry for that. Below is my MWE. 
1. the initial particles set saved by 
    sp = pack.SpherePack()
    sp.save('initial_spheres-before_translation-x.txt') 

Find file here, 
https://drive.google.com/file/d/1VIYd7qzb5b4iIAyldT49I1Fjko8XxjhI/view?usp=sharing 

2. the python script to translate those particles in x direction, 
    import numpy as np 

    data = np.loadtxt('initial_spheres-before-translation-x.txt',
delimiter=' ', skiprows=0)

    with open('initial_spheres_translate_x.txt','w') as fd:
        for i in range(len(data)):
             fd.write('%.9f %.9f %.9f %.5e %d\n' % (data[i,0]+0.5e-3, data[i,1], data[i,2], data[i,3], -1))

Find file here, 
https://drive.google.com/file/d/1P2kVPWFX0VoTzyqVD9uwruodb16Zof5s/view?usp=sharing 

3. The yade code to load the translated particles, 
    from yade import pack,geom,utils  

    sp = pack.SpherePack()
    sp.load('initial_spheres_translate_x.txt') 
### the initial particles before translation can be loaded ### 
    #sp.load('initial_spheres-before-translation-x.txt') 
    print('load initial_spheres')
    sp.toSimulation()


Thanks.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.