LeMonADE-project / plainExamples

Template repository to start with the LeMonADE-project
MIT License
0 stars 4 forks source link

Simulating end-linked polymer networks using BFM #4

Open devosmita opened 6 months ago

devosmita commented 6 months ago

Hello,

I am trying to simulate an end-linked polymer network using the bond fluctuation model. I would like to first construct a simulation box with polymer chains in it, equilibrate this system, then add in the crosslinkers and re-equilibrate to form the final end-linked network. I looked through some of the example files, but I am unable to identify the appropriate functions of this C++ library required for simulating multiple polymer chains and end-linked networks. I would greatly appreciate your help in this regard.

Thank you.

tonimueller commented 6 months ago

Hi, did you already run the example lemonade_example_main ? In this example, chains are randomly created in a box and equilibrated afterwards. There is a BFM writer as well which continusly writes out the positions after nMCS MonteCarloSteps:

 TaskManager taskManager;
  taskManager.addUpdater(new UpdaterAddLinearChains<IngredientsType>(ingredients, nChains,chainLength,type1,type1),0);
  taskManager.addUpdater(new UpdaterSimpleSimulator<IngredientsType,MoveLocalSc>(ingredients,nMCS));
  taskManager.addAnalyzer(new AnalyzerWriteBfmFile<IngredientsType>("config.bfm",ingredients,AnalyzerWriteBfmFile<IngredientsType>::APPEND));

  taskManager.initialize();
  taskManager.run(nRuns);
  taskManager.cleanup();

The updater UpdaterAddLinearChainsis executed only once (0 after the comma) in the beginning of the taskmanager, which runs nRuns times the UpdaterSimpleSimulator (which runs nMCS). After each run of the UpdaterSimpleSimulator the AnalyzerWriteBfmFile appends the conformation to the file.

With this example you can simulate a melt of ideal chains (without excluded volume). For end-linked networks I usually add some monomeric unit (chains of length 1) to the melt and connect the chain ends to the monomeric units. For that purpose you could use the UpdaterSimpleConnection.

Did this answer your question?

devosmita commented 6 months ago

Hi, Thanks a lot for your reply. I managed to simulate a melt of ideal chains, and added in crosslinkers using the following code snippet:

  TaskManager taskManager;
  taskManager.addUpdater(new UpdaterAddLinearChains<IngredientsType>(ingredients, nChains,chainLength,type1,type1),0);
  taskManager.addUpdater(new UpdaterAddLinearChains<IngredientsType>(ingredients, nCrosslinks,1,type2,type2),0);
  taskManager.addUpdater(new UpdaterSimpleConnection<IngredientsType,MoveLocalSc,MoveLocalSc>(ingredients,nMCS));
  taskManager.addUpdater(new UpdaterSimpleSimulator<IngredientsType,MoveLocalSc>(ingredients,nMCS));
  taskManager.addAnalyzer(new AnalyzerWriteBfmFile<IngredientsType>("config.bfm",ingredients,AnalyzerWriteBfmFile<IngredientsType>::APPEND));

However, the config.bfm output file does not contain any information regarding the bonds under the !bonds heading. I am attaching the .txt version of my output file for your reference. config_txt.txt

My aim is to get the connectivity information between the crosslinkers in the network. How can I extract this information from this output file format?

I am also not sure about the ConnectionMoveType (parameters 3 of UpdaterSimpleConnection). I tried using MoveConnectSc, however, ran into an error saying

/MoveConnectSc.h:108:24: error: 'const class Ingredients<ConfigureSystem<Vector3D<in                                                          t>, Loki::Typelist<FeatureMoleculesIO, Loki::Typelist<FeatureAttributes<>, Loki::Nul                                                          lType> >, 4> >' has no member named 'getIdFromLattice'
  108 |   this->setPartner(ing.getIdFromLattice(ing.getMolecules()[this->getIndex()]                                                          +randomDir) );

I would really appreciate your help in this regard.

Thank you.

Bondoki commented 6 months ago

Hi,

you're on the right track! I assume you want to create a solution of linear chains (type1) together with a bunch of cross-linker (type2) under good solvent condition? Then, after equilibration only the end-monomers of the linear chains should react with the free valency of the cross-linker to form a end-linked polymer network? Also, some kind of information between the reaction event and reaction partners. As Tony already stated the UpdaterSimpleConnection is the way to go, but needs some improvements: at the moment only bonds between reactive types will be established regardless of their types.

I provided a short example project with a main concerning your request and also provide an updated version of the Updater dealing with different types and provide a simplistic output of the reaction progress.

I also advice you to split the main into 3 separated programs following the Unix philosophy "One application per task" : (1) creation, (2) labeling of types - setting the reactivity and (3) run the connection procedure. It's especially important if you have to rerun/continue your cross-linking procedure in (3) to achieve high conversion (extend of reaction).

Hope this helps :)

devosmita commented 6 months ago

Hi, Thank you very much for your reply. I am able to compile and run the program lemonade_example_main_exvol_crosslinking.cpp. However, I am not able to get enough number of crosslinkers to react with the chains. For the given parameters in the file, and a few other parameters I tried, I am able to get only one reacted bond (even for nReactiveRuns=10000), limiting the extent of reaction to a very small value. Am I missing some crucial step here? Or do I just have to run the crosslinking step for higher number iterations? Also, it would be great if you could kindly provide an estimate of the number of iterations of the MC step and the number of runs typically required for simulating a network with extent of reaction>95%.

Thanks a lot!

devosmita commented 6 months ago

Update: I changed the move type for the crosslinking reaction from MoveConnectSc to MoveConnectScReactive, and included the appropriate headers, and the code works now. It is creating bonds between chain ends and crosslinkers iteratively throughout the MC algorithm. Thanks a lot for your help!

Bondoki commented 6 months ago

Sounds good, that you managed to compile and run the lemonade_example_main_exvol_crosslinking.cpp .

Can you provide more information about your system setup e.g. number of chains, number of crosslinker, box size, and simulation time? Which types should react? Only the crosslinker with chain ends?

In the file lemonade_example_main_exvol_crosslinking.cpp , there are two example setups:

1) 10 linear chains with 64 monomers each and 50 tetra-functional cross-linker for illustrative purpose. This is a quite small system and not in any stoichiometric ratio. Therefore only 10*2=20 bonds are possible between the chain ends and the tetra-functional cross-linker, and a lot of cross-linker will not be able to react.

2) n=254 linear chains a N=64 monomers with m=127 tetra-functional cross-linker in dense state c=8(25464+127)/64³=0.5 is more appropriate to simulate polymer network formation. For full conversion 2n=4m a total of maximum 4m=508 bond can be established, but usually an extend of reaction p=#numberbonds/508~95% with 482 bonds is sufficient to form a network.

In both cases, try to increase the number of total MCS(=nReactiveMCS*nReactiveRuns) e.g. 10000000 MCS [-> nReactiveMCS(10000), nReactiveRuns(1000)] or even more (50E6 MCS) to be on the safe side.

Best

devosmita commented 6 months ago

Hi, Thanks a lot for your reply. I am able to simulate crosslinked networks with different volume fractions. However, I am not sure how this volume fraction relates to the actual concentration of the polymer chains in the simulation? Since concentration is related to the volume fraction through the molar volume, how can I estimate the molar volume being used in the simulation? Alternatively, what is the length of one cell on the lattice in nanometer units? This would help me directly relate the volume fraction (fraction of occupied lattice sites) to the actual experimental concentration (in mole/litre) being simulated in the system.

Thanks a lot.

Bondoki commented 5 months ago

Hi,

to directly relate experimental values to your coarse-grained simulation you will need some kind of mapping between the bond-fluctuation-model (BFM) with the physical world. In most cases it is done by relating the experimental Kuhn length and Kuhn monomers of your polymer to the intrinsic effective bond-length of the BFM. I recommend to look at the papers by Wittmer, et al.; "Intramolecular long-range correlations in polymer melts: The segmental size distribution and its moments", Physical Review E (2007), Vol. 76, p. 011803 and Müller; Wittmer;Cates, "Topological effects in ring polymers. II. Influence of persistence length"; Physical Review E (2000), Vol. 61p. 4078-4089 and Tries, Paul, Baschnagel, Binder, "Modeling polyethylene with the bond fluctuation model"; J. Chem. Phys (1997), Vol. 106, No. 2, p. 738-748. A simple estimate for PE is given here: 1 lattice unit ~ 0.4nm

As a rough estimate, usually one lattice unit (length of monomer cube ) corresponds to length of order of 0.1nm - 0.5nm in the BFM.

Best

devosmita commented 5 months ago

Thanks for your reply. This helps a lot!