yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #28709
Re: [Question #704035]: O.save/O.load problem
Question #704035 on Yade changed:
https://answers.launchpad.net/yade/+question/704035
Status: Open => Answered
Karol Brzezinski proposed the following answer:
Hi Roxana,
I don't have your full code, so I cannot run exactly the same example. But maybe you could try my previous idea to store only the parameters you need, and then load it in the second script. I prepared an example for storing Fv and Fn, but you can add the parameters you need.
###### put this at the end of the first script
import pandas as pd
intrState = pd.DataFrame(columns = ['id1','id2','Fn','Fv'])
for ii in O.interactions:
iiState = pd.DataFrame({'id1':[ii.id1],'id2':[ii.id2],'Fn':[ii.phys.Fn],'Fv':[ii.phys.Fv]})
intrState = intrState.append(iiState,ignore_index = True)
intrState.to_csv('tmpIntrState.csv')
### put this in the second script before run
import pandas as pd
intrState = pd.read_csv('tmpIntrState.csv')
for i in range(len(intrState)):
iiSaved = intrState.iloc[i]
ii = O.interactions[int(iiSaved.id1), int(iiSaved.id2)]
ii.phys.Fn = iiSaved.Fn
ii.phys.Fv = iiSaved.Fv
####
Cheers,
Karol
--
You received this question notification because your team yade-users is
an answer contact for Yade.