mbuild icon indicating copy to clipboard operation
mbuild copied to clipboard

I think the mb.pattern.Pattern.apply method is not well tested or documented.

Open CalCraven opened this issue 4 months ago • 0 comments

Bug summary

What were you trying to do and what happened instead? Please copy and paste the stack output I was trying to take a Random2DPattern of points, and place copies of my compounds across this pattern in an orientation specified by the "up" port.

In general, I see no tests in test_pattern.py, and the documentation is lacking for some of these older functions. Might be handy to do a quick update on them, or add this feature so the orientation can be more easily set.

Code to reproduce the behavior

Please include a code snippet that can be used to reproduce this bug.

from mbuild.pattern import Random2DPattern
from mbuild.lib.atoms import H, C3

test_particle = C3()
pattern = Random2DPattern(100, seed=1, orientations={"up":[test_particle]}, scale=10) # I would like this to orient in the [0,0,1] direction.
cpd = H()
cpds = pattern.apply(cpd, orientation="up", compound_port="up")
top_cpd = mb.Compound()
top_cpd.add(cpds)
top_cpd.visualize()

Software versions

  • Which version of mBuild are you using? (python -c "import mbuild as mb; print(mb.__version__)") 0.18.0
  • Which version of Python (python --version)? 3.9
  • Which operating system? MacOS

CalCraven avatar Oct 08 '24 21:10 CalCraven