mosdef-hub / mbuild

A hierarchical, component based molecule builder
https://mbuild.mosdef.org
Other
171 stars 79 forks source link

add variable in the box packing functions to allow more packmol iterations #1185

Closed bc118 closed 2 months ago

bc118 commented 3 months ago

This is in the https://github.com/mosdef-hub/mbuild/blob/0.13.1/mbuild/packing.py file.

Packing fails in much larger systems unless the packing is not that dense, add the below variables would give the users more flexibility.

### Error from Packmol packing a 60^3 box with water with 80% actual density [so ~(65 Ang)^3 actual packing space)

The forced point was writen to the output file: /tmp/tmp6sgmm0c0.xyz_FORCED

If you want that the packing procedure continues for a longer time, add the following keyword to the input file:

nloop [integer] (ex: nloop 200)

The default nloop value is 50 for each molecule.

chrisjonesBSU commented 3 months ago

This would be great. Overall, I think we need more control over the interface with PACKMOL. There are a lot of parameters that could be tweaked. A long long time ago I started a PR to work on this: https://github.com/mosdef-hub/mbuild/pull/787. At this point it might be easiest to start it again from scratch.

chrisjonesBSU commented 3 months ago

At this point it might be easiest to start it again from scratch.

I take that back, the conflicts weren't as bad as I thought. I merged in upstream, maybe we can revisit this PR and get it merged soon.

chrisjonesBSU commented 3 months ago

@bc118 here is an example how this looks using the changes in #787

import mbuild as mb

methane = mb.load("C", smiles=True)
filled = mb.fill_box(
    compound=methane,
    n_compounds=100, 
    box=[10, 10, 10],
    packmol_args={"maxit": 500, "movebadrandom": "", "nloop": 500}
)