VasiliBaranov / packing-generation

Hard-sphere packing generation in C++ with the Lubachevsky–Stillinger, Jodrey–Tory, and force-biased algorithms and packing post-processing.
MIT License
106 stars 43 forks source link

Meaning of Generation Start 0 #21

Open mikroice opened 4 years ago

mikroice commented 4 years ago

Hi Mr Vasili, first of all the repository is wonderful and very helpful. I am using this for my master thesis in which I need to generate a porous material.

My question is, in the Sample Usage section when you went over FBA->LS->LSGD, did you change the generation start to 0? Would it possible for you to explain what exactly does the generation start 0 option do?

When I used one algorithm after another (changed the Generation start to 0 in 2nd step), it just showed me that the program opened the packing.nfo file. However, when I extracted the (re-scaled) diameters, they were same as the one generated in FBA step. I was expecting a different diameters and hence, different volume distribution.

To explain a bit further, I wanted to first use FBA (by supplying a diamters.txt file) to get an inital packing.xyzd and all the other files. The output is as follows:

PackingGeneration.exe -fba | tee log_fba4.txt
LittleEndian
The current working directory is PotatoPC/packing-generation-master/_Release.

N is 3599
dimensions are 450.000000 450.000000 450.000000
generation mode: start
seed 304
steps to write intermediate state 1000
boundaries mode is 1

Reading particle diameters from a file 'diameters'...
done.
Contraction rate is 0.000132891
Total volume of particles is 6.8699e+07
Theoretical porosity is 0.246101       
Global minimum is 0.0356581
Step 0. Inner diameter ratio is 0.085763173720225. Outer diameter ratio is 1.062587960302652. Writing int. packing state...Contraction rate: 1.328910e-04
done.
Step 1000. Inner diameter ratio is 0.781017125363508. Outer diameter ratio is 0.991979080343976. Writing int. packing state...Contraction rate: 1.328910e-04
done.
Checking...
Calc. porosity is 0.325781
Theoretical porosity is 0.246101
Checking min particle distance in a naive way...
Finish:
Calc. porosity is 0.325781246018898      
Theoretical porosity is 0.246101
Inner diameter ratio is 0.963450244506895
Time: 4.75 s, iterations are 1407        
Calculating contraction energies
PotatoPC\Packages\packing-generation-master\_Release>

I then wanted to use this data to refine my packing using LS algorithm.

PackingGeneration.exe -ls | tee log_ls4.txt   
LittleEndian
The current working directory is PotatoPC/Packages/packing-generation-master/_Release.

N is 3599
dimensions are 450.000000 450.000000 450.000000
generation mode: continue
seed 304
steps to write intermediate state 1000
boundaries mode is 1

file 'PotatoPC/Packages/packing-generation-master/_Release/packing.xyzd' was opened
PotatoPC\Packages\packing-generation-master\_Release>

Please excuse my naivety, I have very little coding experience and even less knowledge about sphere packing.

VasiliBaranov commented 4 years ago

Hi @mikroice ,

sorry for the long delay (it was the vacation time..).

I think there is a gap in my documentation and in the logging from the program: what one also has to do to make the second step (-ls) run is to delete or rename the packing.nfo file after the first -fba step. The packing.nfo file serves as a marker of whether the generation has been completed. So the -ls step sees it and doesn't proceed forward. Unfortunately, i didn't implement proper logging. So you need to delete/rename packing.nfo generated after the -fba run.

The meaning of the "generation start" parameter is the one that you presumed: "generation start: 1" means that generation has to be started from scratch, "generation start: 0" means that the program shall start generation with particle positions from the existing packing.xyzd (but it also requires that packing.nfo shall be absent).

Then you will see the output similar to what you see after the first -fba run.

Please note that you might need to fine-tune the compression rate for the LS algorithm (please see the last paragraph in this section: https://github.com/VasiliBaranov/packing-generation#14-note-on-final-diameters ).

In principle, if you just need any packing (not necessarily mechanically stable), you can just use the -fba algorithm, possibly with a lower compression rate. If the compression rate is very low, the packings will be almost mechanically stable (jammed). But you can of course fine-tune it with the LS algorithm as well (maybe in your field everyone uses the LS algorithm and no one knows the FBA one).

If you need real mechanical stability (jamming) of frictionless spheres, then you for sure need the final LSGD step. You can run it also directly after the -fba algorithm as well.

Hope this helps! I will update the documentation in the meantime..

Best Regards, Vasili