diff --git a/doc/src/create_atoms.rst b/doc/src/create_atoms.rst index 7b8280b07b..492253bffc 100644 --- a/doc/src/create_atoms.rst +++ b/doc/src/create_atoms.rst @@ -51,10 +51,12 @@ Syntax name = name of variable to set with x, y, or z atom position *radscale* value = factor factor = scale factor for setting atom radius - *radthresh* value = radius (distance units) - radius = threshold value for *mesh* to determine when to split triangles - *quasirandom* value = number density (inverse distance squared units) - number density = minimum number density for particles placed on *mesh* triangles + *meshmode* values = mode arg + mode = *bisect* or *qrand* + *bisect* arg = radthresh + radthresh = threshold value for *mesh* to determine when to split triangles (distance units) + *qrand* arg = density + density = minimum number density for atoms place on *mesh* triangles (inverse distance squared units) *rotate* values = theta Rx Ry Rz theta = rotation angle for single molecule (degrees) Rx,Ry,Rz = rotation vector for single molecule @@ -77,7 +79,8 @@ Examples create_atoms 3 single 0 0 5 create_atoms 1 box var v set x xpos set y ypos create_atoms 2 random 50 12345 NULL overlap 2.0 maxtry 50 - create_atoms 1 mesh funnel.stl units box radscale 0.9 radthresh 4.0 + create_atoms 1 mesh open_box.stl meshmode qrand 0.1 units box + create_atoms 1 mesh funnel.stl meshmode bisect 4.0 units box radscale 0.9 Description """"""""""" @@ -138,24 +141,28 @@ For the *mesh* style, a file with a triangle mesh in `ASCII STL format and one or more particles are placed into the area of each triangle. Binary STL files (e.g. as frequently offered for 3d-printing) can be converted to ASCII with the :ref:`stl_bin2txt tool `. The -use of the *units box* option is required. A particle is created at the -center of each triangle unless the average distance of the triangle -vertices from its center is larger than the *radthresh* value. This -value defaults to the lattice spacing in x direction, but can be set as -an optional keyword. In case the triangle size is over the threshold, -it is split into two halves along the its longest side and each of those -two triangles considered for particle insertion. This operation is -repeated recursively until the condition is met. There will be at least -one sphere per triangle. If the atom style in use allows to set a -per-atom radius this radius is set to the average distance of the -triangle vertices from its center times the value of the *radscale* -keyword (default: 1.0). -The *mesh* style also has a *quasirandom* option which uses a quasirandom -sequence to distribute particles on mesh triangles using an approach -by :ref:`(Roberts) `. This option takes a minimal number -density as an argument. Particles are added to the triangle until this -number density is met or exceeded such that every triangle will have -at least one particle. +use of the *units box* option is required. There are two algorithms for +placing atoms available: *bisect* and *qrand*. They can be selected via +the *meshmode* option; *bisect* is the default. If the atom style allows +to set a per-atom radius this radius is set to the average +distance of the triangle vertices from its center times the value of the +*radscale* keyword (default: 1.0). If the atom style supports it, the +atoms created from the mesh are assigned a new molecule ID. + +In *bisect* mode a particle is created at the center of each triangle +unless the average distance of the triangle vertices from its center is +larger than the *radthresh* value (default is lattice spacing in +x-direction). In case the average distance is over the threshold, the +triangle is recursively split into two halves along the the longest side +until the threshold is reached. There will be at least one sphere per +triangle. The value of *radthresh* is set as argument to *meshmode +bisect*. + +In *qrand* mode a quasirandom sequence is used to distribute particles +on mesh triangles using an approach by :ref:`(Roberts) `. +Particles are added to the triangle until minimum number density is met +or exceeded such that every triangle will have at least one particle. +The minimum number density is set as argument to the *qrand* option. .. note:: diff --git a/examples/mesh/in.mesh_box b/examples/mesh/in.mesh_box index 28ce2031f9..b9266eb1aa 100644 --- a/examples/mesh/in.mesh_box +++ b/examples/mesh/in.mesh_box @@ -11,7 +11,8 @@ region lid block 100 110 50 250 50 250 units box group mobile type 1 set type 1 diameter 7.0 -create_atoms 2 mesh open_box.stl units box radthresh 4.0 +# create_atoms 2 mesh open_box.stl meshmode bisect 4.0 units box +create_atoms 2 mesh open_box.stl meshmode qrand 0.1 units box group mesh type 2 pair_style lj/cut 8.76 diff --git a/examples/mesh/log.8May22.marble_race.g++.1 b/examples/mesh/log.11May22.marble_race.g++.1 similarity index 85% rename from examples/mesh/log.8May22.marble_race.g++.1 rename to examples/mesh/log.11May22.marble_race.g++.1 index b5f5d1c2d0..def4a9d724 100644 --- a/examples/mesh/log.8May22.marble_race.g++.1 +++ b/examples/mesh/log.11May22.marble_race.g++.1 @@ -20,7 +20,7 @@ group mobile type 1 create_atoms 2 mesh race_track.stl units box Reading STL object Georgs Murmelbahn from file race_track.stl - read 9472 triangles with 1.00 atoms per triangle + read 9472 triangles with 1.00 atoms per triangle added in recursive bisection mode Created 9472 atoms using box units in orthogonal box = (-110 -30 -90) to (60 220 130) create_atoms CPU = 0.040 seconds @@ -66,7 +66,7 @@ Per MPI rank memory allocation (min/avg/max) = 4.803 | 4.803 | 4.803 Mbytes Step Temp E_pair E_mol TotEng Press Volume 0 0 737062.81 0 737062.81 21986.781 9350000 67 0 -2063.91 0 -2063.91 -5.0227698 9350000 -Loop time of 0.518872 on 1 procs for 67 steps with 13073 atoms +Loop time of 0.517938 on 1 procs for 67 steps with 13073 atoms 99.8% CPU use with 1 MPI tasks x 1 OpenMP threads @@ -82,12 +82,12 @@ Minimization stats: MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.38371 | 0.38371 | 0.38371 | 0.0 | 73.95 -Neigh | 0.038019 | 0.038019 | 0.038019 | 0.0 | 7.33 -Comm | 0.001586 | 0.001586 | 0.001586 | 0.0 | 0.31 +Pair | 0.38475 | 0.38475 | 0.38475 | 0.0 | 74.28 +Neigh | 0.037593 | 0.037593 | 0.037593 | 0.0 | 7.26 +Comm | 0.0015299 | 0.0015299 | 0.0015299 | 0.0 | 0.30 Output | 0 | 0 | 0 | 0.0 | 0.00 -Modify | 0.033492 | 0.033492 | 0.033492 | 0.0 | 6.45 -Other | | 0.06206 | | | 11.96 +Modify | 0.032572 | 0.032572 | 0.032572 | 0.0 | 6.29 +Other | | 0.0615 | | | 11.87 Nlocal: 13073 ave 13073 max 13073 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -126,20 +126,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.678 | 3.678 | 3.678 Mbytes 8000 404.7304 -2144.8541 0 2198.2739 43.134333 9350000 9000 435.75368 -2180.3183 0 2495.7179 53.466409 9350000 10000 457.96804 -2194.6681 0 2719.7486 64.521177 9350000 -Loop time of 12.1468 on 1 procs for 10000 steps with 13073 atoms +Loop time of 12.1711 on 1 procs for 10000 steps with 13073 atoms -Performance: 71.130 ns/day, 0.337 hours/ns, 823.265 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 70.988 ns/day, 0.338 hours/ns, 821.617 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 9.4112 | 9.4112 | 9.4112 | 0.0 | 77.48 -Neigh | 1.1197 | 1.1197 | 1.1197 | 0.0 | 9.22 -Comm | 0.042153 | 0.042153 | 0.042153 | 0.0 | 0.35 -Output | 0.00041578 | 0.00041578 | 0.00041578 | 0.0 | 0.00 -Modify | 1.2618 | 1.2618 | 1.2618 | 0.0 | 10.39 -Other | | 0.3115 | | | 2.56 +Pair | 9.4572 | 9.4572 | 9.4572 | 0.0 | 77.70 +Neigh | 1.1196 | 1.1196 | 1.1196 | 0.0 | 9.20 +Comm | 0.04293 | 0.04293 | 0.04293 | 0.0 | 0.35 +Output | 0.00042467 | 0.00042467 | 0.00042467 | 0.0 | 0.00 +Modify | 1.241 | 1.241 | 1.241 | 0.0 | 10.20 +Other | | 0.31 | | | 2.55 Nlocal: 13073 ave 13073 max 13073 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/mesh/log.8May22.marble_race.g++.4 b/examples/mesh/log.11May22.marble_race.g++.4 similarity index 84% rename from examples/mesh/log.8May22.marble_race.g++.4 rename to examples/mesh/log.11May22.marble_race.g++.4 index a728e292cf..38305a38b2 100644 --- a/examples/mesh/log.8May22.marble_race.g++.4 +++ b/examples/mesh/log.11May22.marble_race.g++.4 @@ -20,10 +20,10 @@ group mobile type 1 create_atoms 2 mesh race_track.stl units box Reading STL object Georgs Murmelbahn from file race_track.stl - read 9472 triangles with 1.00 atoms per triangle + read 9472 triangles with 1.00 atoms per triangle added in recursive bisection mode Created 9472 atoms using box units in orthogonal box = (-110 -30 -90) to (60 220 130) - create_atoms CPU = 0.069 seconds + create_atoms CPU = 0.036 seconds group mesh type 2 9472 atoms in group mesh @@ -73,9 +73,9 @@ Per MPI rank memory allocation (min/avg/max) = 4.506 | 4.54 | 4.57 Mbytes Step Temp E_pair E_mol TotEng Press Volume 0 0 737062.81 0 737062.81 21986.781 9350000 67 0 -2063.91 0 -2063.91 -5.0227698 9350000 -Loop time of 0.375696 on 4 procs for 67 steps with 13073 atoms +Loop time of 0.373091 on 4 procs for 67 steps with 13073 atoms -99.0% CPU use with 4 MPI tasks x 1 OpenMP threads +98.7% CPU use with 4 MPI tasks x 1 OpenMP threads Minimization stats: Stopping criterion = linesearch alpha is zero @@ -89,12 +89,12 @@ Minimization stats: MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.0026793 | 0.10176 | 0.30773 | 39.0 | 27.09 -Neigh | 0.0083945 | 0.011206 | 0.01705 | 3.3 | 2.98 -Comm | 0.0076602 | 0.21941 | 0.32088 | 27.2 | 58.40 +Pair | 0.0023911 | 0.098676 | 0.3067 | 39.6 | 26.45 +Neigh | 0.0054604 | 0.0097001 | 0.017713 | 4.9 | 2.60 +Comm | 0.0072159 | 0.22319 | 0.32344 | 27.2 | 59.82 Output | 0 | 0 | 0 | 0.0 | 0.00 -Modify | 0.0035482 | 0.0090038 | 0.018889 | 6.2 | 2.40 -Other | | 0.03432 | | | 9.13 +Modify | 0.003044 | 0.0084861 | 0.018696 | 6.5 | 2.27 +Other | | 0.03304 | | | 8.86 Nlocal: 3268.25 ave 4314 max 2222 min Histogram: 2 0 0 0 0 0 0 0 0 2 @@ -133,20 +133,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.481 | 3.598 | 3.711 Mbytes 8000 404.7304 -2144.8541 0 2198.2739 43.134332 9350000 9000 435.7537 -2180.3187 0 2495.7178 53.466393 9350000 10000 457.96586 -2194.6411 0 2719.7522 64.522003 9350000 -Loop time of 4.62401 on 4 procs for 10000 steps with 13073 atoms +Loop time of 4.60636 on 4 procs for 10000 steps with 13073 atoms -Performance: 186.851 ns/day, 0.128 hours/ns, 2162.627 timesteps/s -99.3% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 187.567 ns/day, 0.128 hours/ns, 2170.909 timesteps/s +99.2% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 2.0661 | 2.4819 | 2.9751 | 25.5 | 53.67 -Neigh | 0.18188 | 0.2993 | 0.52875 | 25.5 | 6.47 -Comm | 0.40938 | 1.17 | 1.736 | 51.7 | 25.30 -Output | 0.00028188 | 0.00049757 | 0.0006548 | 0.0 | 0.01 -Modify | 0.22514 | 0.32517 | 0.53165 | 21.2 | 7.03 -Other | | 0.3472 | | | 7.51 +Pair | 2.0632 | 2.4782 | 2.963 | 25.3 | 53.80 +Neigh | 0.18255 | 0.30042 | 0.52984 | 25.5 | 6.52 +Comm | 0.40668 | 1.1595 | 1.7224 | 51.6 | 25.17 +Output | 0.00032705 | 0.00053493 | 0.00067573 | 0.0 | 0.01 +Modify | 0.22563 | 0.32471 | 0.53003 | 21.1 | 7.05 +Other | | 0.3429 | | | 7.44 Nlocal: 3268.25 ave 6890 max 1643 min Histogram: 1 2 0 0 0 0 0 0 0 1 diff --git a/examples/mesh/log.11May22.mesh_box.g++.1 b/examples/mesh/log.11May22.mesh_box.g++.1 new file mode 100644 index 0000000000..80edcf5ac8 --- /dev/null +++ b/examples/mesh/log.11May22.mesh_box.g++.1 @@ -0,0 +1,147 @@ +LAMMPS (4 May 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task + +units real +atom_style hybrid sphere bond +WARNING: Atom style hybrid defines both, per-type and per-atom masses; both must be set, but only per-atom masses will be used (src/atom_vec_hybrid.cpp:130) + +lattice sc 5.0 +Lattice spacing in x,y,z = 5 5 5 +region box block 50 250 50 250 50 250 units box +create_box 2 box +Created orthogonal box = (50 50 50) to (250 250 250) + 1 by 1 by 1 MPI processor grid +region particles block 110 190 110 190 110 190 units box +create_atoms 1 region particles +Created 4913 atoms + using lattice units in orthogonal box = (50 50 50) to (250 250 250) + create_atoms CPU = 0.001 seconds +region lid block 100 110 50 250 50 250 units box +group mobile type 1 +4913 atoms in group mobile +set type 1 diameter 7.0 +Setting atom values ... + 4913 settings made for diameter + +# create_atoms 2 mesh open_box.stl meshmode bisect 4.0 units box +create_atoms 2 mesh open_box.stl meshmode qrand 0.1 units box +Reading STL object Open Box from file open_box.stl + read 10 triangles with 500.00 atoms per triangle added in quasi-random mode +Created 5000 atoms + using box units in orthogonal box = (50 50 50) to (250 250 250) + create_atoms CPU = 0.001 seconds +group mesh type 2 +5000 atoms in group mesh + +pair_style lj/cut 8.76 +pair_coeff 1 1 0.2339 3.504 +pair_coeff 1 2 0.2339 7.008 $(7.008*2^(1.0/6.0)) +pair_coeff 1 2 0.2339 7.008 7.8662140345520858986 +pair_coeff 2 2 0.0 1.0 +mass * 39.95 + +neigh_modify exclude type 2 2 + +timestep 1.0 + +run 0 post no +WARNING: No fixes with time integration, atoms won't move (src/verlet.cpp:60) +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 10.76 + ghost atom cutoff = 10.76 + binsize = 5.38, bins = 38 38 38 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.64 | 5.64 | 5.64 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 0 -1778.6527 0 -1778.6527 -27.271044 +Loop time of 1.514e-06 on 1 procs for 0 steps with 9913 atoms + + +fix dir mobile oneway 10 lid x +fix move mobile nve +fix load all balance 1000 1.1 shift xyz 10 1.01 weight neigh 0.5 weight group 2 mesh 0.1 mobile 1.0 +fix rot mesh move rotate 150.0 150.0 150.0 1.0 0.0 0.0 500000.0 units box + +reset_timestep 0 time 0.0 +velocity mobile create 150.0 54634234 + +compute ptemp mobile temp +thermo_modify temp ptemp +WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:520) + +thermo 200 +compute ke all ke/atom +#dump 2 all movie 200 mesh.mkv c_ke radius size 960 1440 zoom 1.5 box no 0.0 view 120 180 +#dump_modify 2 bitrate 4000 framerate 12 color orange 1.0 0.5 0.0 amap min max cf 0.0 6 min blue 0.1 fuchsia 0.2 red 0.4 orange 0.6 yellow max white +#dump 1 all custom 500 open_box.lammpstrj id type mol x y z vx vy vz + + +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 6.155 | 6.155 | 6.155 Mbytes + Step Temp E_pair E_mol TotEng Press Volume + 0 150 -1778.6527 0 417.60814 -14.721534 8000000 + 200 179.67539 -2344.2923 0 286.46789 14.546173 8000000 + 400 181.6261 -2331.1731 0 328.14895 15.522647 8000000 + 600 183.6116 -2362.5284 0 325.86464 14.828678 8000000 + 800 187.69451 -2422.3021 0 325.87189 14.99914 8000000 + 1000 186.32256 -2393.187 0 334.89931 14.49224 8000000 + 1200 186.57797 -2406.6141 0 325.21184 15.514285 8000000 + 1400 188.39717 -2403.2075 0 355.25478 14.282381 8000000 + 1600 185.774 -2391.15 0 328.90446 16.025507 8000000 + 1800 186.95292 -2423.2897 0 314.02613 15.51055 8000000 + 2000 186.0637 -2414.6095 0 309.68668 14.894421 8000000 + 2200 187.03262 -2409.2253 0 329.25754 14.90094 8000000 + 2400 186.66862 -2409.987 0 323.16626 15.497536 8000000 + 2600 184.98646 -2386.3118 0 322.21161 14.935837 8000000 + 2800 185.83051 -2392.5258 0 328.35604 14.863905 8000000 + 3000 184.68382 -2397.8429 0 306.24943 15.696458 8000000 + 3200 187.56974 -2409.8941 0 336.45315 14.352166 8000000 + 3400 187.5721 -2425.0188 0 321.36292 14.7297 8000000 + 3600 185.97304 -2391.4399 0 331.52886 15.586758 8000000 + 3800 185.40034 -2401.6336 0 312.94973 15.742308 8000000 + 4000 187.71377 -2409.3588 0 339.09729 15.102297 8000000 + 4200 186.4676 -2394.1921 0 336.01789 15.312368 8000000 + 4400 186.98262 -2396.3842 0 341.36649 14.764489 8000000 + 4600 185.98808 -2397.7342 0 325.45468 15.379472 8000000 + 4800 187.6927 -2422.0727 0 326.07474 14.252141 8000000 + 5000 188.21075 -2428.1325 0 327.60023 14.694135 8000000 +Loop time of 9.49245 on 1 procs for 5000 steps with 9913 atoms + +Performance: 45.510 ns/day, 0.527 hours/ns, 526.734 timesteps/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 5.3698 | 5.3698 | 5.3698 | 0.0 | 56.57 +Bond | 0.00036337 | 0.00036337 | 0.00036337 | 0.0 | 0.00 +Neigh | 3.0911 | 3.0911 | 3.0911 | 0.0 | 32.56 +Comm | 0.039329 | 0.039329 | 0.039329 | 0.0 | 0.41 +Output | 0.0010197 | 0.0010197 | 0.0010197 | 0.0 | 0.01 +Modify | 0.86293 | 0.86293 | 0.86293 | 0.0 | 9.09 +Other | | 0.1279 | | | 1.35 + +Nlocal: 9913 ave 9913 max 9913 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 97756 ave 97756 max 97756 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 97756 +Ave neighs/atom = 9.8613941 +Ave special neighs/atom = 0 +Neighbor list builds = 375 +Dangerous builds = 1 + +Total wall time: 0:00:09 diff --git a/examples/mesh/log.11May22.mesh_box.g++.4 b/examples/mesh/log.11May22.mesh_box.g++.4 new file mode 100644 index 0000000000..efb58b1751 --- /dev/null +++ b/examples/mesh/log.11May22.mesh_box.g++.4 @@ -0,0 +1,147 @@ +LAMMPS (4 May 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task + +units real +atom_style hybrid sphere bond +WARNING: Atom style hybrid defines both, per-type and per-atom masses; both must be set, but only per-atom masses will be used (src/atom_vec_hybrid.cpp:130) + +lattice sc 5.0 +Lattice spacing in x,y,z = 5 5 5 +region box block 50 250 50 250 50 250 units box +create_box 2 box +Created orthogonal box = (50 50 50) to (250 250 250) + 1 by 2 by 2 MPI processor grid +region particles block 110 190 110 190 110 190 units box +create_atoms 1 region particles +Created 4913 atoms + using lattice units in orthogonal box = (50 50 50) to (250 250 250) + create_atoms CPU = 0.001 seconds +region lid block 100 110 50 250 50 250 units box +group mobile type 1 +4913 atoms in group mobile +set type 1 diameter 7.0 +Setting atom values ... + 4913 settings made for diameter + +# create_atoms 2 mesh open_box.stl meshmode bisect 4.0 units box +create_atoms 2 mesh open_box.stl meshmode qrand 0.1 units box +Reading STL object Open Box from file open_box.stl + read 10 triangles with 2000.00 atoms per triangle added in quasi-random mode +Created 5000 atoms + using box units in orthogonal box = (50 50 50) to (250 250 250) + create_atoms CPU = 0.001 seconds +group mesh type 2 +5000 atoms in group mesh + +pair_style lj/cut 8.76 +pair_coeff 1 1 0.2339 3.504 +pair_coeff 1 2 0.2339 7.008 $(7.008*2^(1.0/6.0)) +pair_coeff 1 2 0.2339 7.008 7.8662140345520858986 +pair_coeff 2 2 0.0 1.0 +mass * 39.95 + +neigh_modify exclude type 2 2 + +timestep 1.0 + +run 0 post no +WARNING: No fixes with time integration, atoms won't move (src/verlet.cpp:60) +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 10.76 + ghost atom cutoff = 10.76 + binsize = 5.38, bins = 38 38 38 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.455 | 5.474 | 5.491 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 0 -1778.6527 0 -1778.6527 -27.271044 +Loop time of 2.8725e-06 on 4 procs for 0 steps with 9913 atoms + + +fix dir mobile oneway 10 lid x +fix move mobile nve +fix load all balance 1000 1.1 shift xyz 10 1.01 weight neigh 0.5 weight group 2 mesh 0.1 mobile 1.0 +fix rot mesh move rotate 150.0 150.0 150.0 1.0 0.0 0.0 500000.0 units box + +reset_timestep 0 time 0.0 +velocity mobile create 150.0 54634234 + +compute ptemp mobile temp +thermo_modify temp ptemp +WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:520) + +thermo 200 +compute ke all ke/atom +#dump 2 all movie 200 mesh.mkv c_ke radius size 960 1440 zoom 1.5 box no 0.0 view 120 180 +#dump_modify 2 bitrate 4000 framerate 12 color orange 1.0 0.5 0.0 amap min max cf 0.0 6 min blue 0.1 fuchsia 0.2 red 0.4 orange 0.6 yellow max white +#dump 1 all custom 500 open_box.lammpstrj id type mol x y z vx vy vz + + +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 6.011 | 6.046 | 6.072 Mbytes + Step Temp E_pair E_mol TotEng Press Volume + 0 150 -1778.6527 0 417.60814 -14.721534 8000000 + 200 178.90737 -2298.4303 0 321.08483 15.681113 8000000 + 400 182.18748 -2339.8994 0 327.64208 13.983929 8000000 + 600 182.78421 -2363.0316 0 313.24702 15.533691 8000000 + 800 185.27077 -2397.561 0 315.12532 14.162041 8000000 + 1000 185.59249 -2394.3379 0 323.05898 14.45888 8000000 + 1200 184.9041 -2365.2474 0 342.07022 14.281891 8000000 + 1400 186.59058 -2397.5471 0 334.46342 15.095686 8000000 + 1600 184.44411 -2386.6701 0 313.91242 16.825132 8000000 + 1800 188.29985 -2432.366 0 324.6713 15.109591 8000000 + 2000 187.05565 -2423.8405 0 314.97946 15.67693 8000000 + 2200 187.02332 -2411.5557 0 326.79085 14.702305 8000000 + 2400 185.67262 -2386.3932 0 332.17677 15.796702 8000000 + 2600 185.97931 -2411.0423 0 312.01823 16.15444 8000000 + 2800 187.2186 -2403.7584 0 337.44748 15.197009 8000000 + 3000 185.18778 -2388.9601 0 322.51107 16.289848 8000000 + 3200 186.38078 -2396.9152 0 332.02344 15.860688 8000000 + 3400 184.95984 -2386.3632 0 321.77041 16.513329 8000000 + 3600 187.94957 -2408.3205 0 343.58806 13.931044 8000000 + 3800 187.1454 -2413.0585 0 327.07559 14.801401 8000000 + 4000 186.12517 -2394.4218 0 330.77436 14.257144 8000000 + 4200 186.91955 -2407.2113 0 329.61591 14.869086 8000000 + 4400 184.72142 -2382.9411 0 321.70176 15.898793 8000000 + 4600 186.8458 -2408.8059 0 326.94154 14.766765 8000000 + 4800 187.28977 -2397.6811 0 344.56676 15.301534 8000000 + 5000 185.17839 -2378.709 0 332.62466 16.043707 8000000 +Loop time of 3.41925 on 4 procs for 5000 steps with 9913 atoms + +Performance: 126.344 ns/day, 0.190 hours/ns, 1462.309 timesteps/s +99.3% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.011 | 1.4158 | 1.8652 | 31.9 | 41.41 +Bond | 0.00026998 | 0.00029559 | 0.00031513 | 0.0 | 0.01 +Neigh | 0.60535 | 0.82114 | 1.0415 | 21.6 | 24.02 +Comm | 0.19046 | 0.88593 | 1.5316 | 63.7 | 25.91 +Output | 0.00067893 | 0.00085803 | 0.001033 | 0.0 | 0.03 +Modify | 0.20164 | 0.23804 | 0.27649 | 6.5 | 6.96 +Other | | 0.05722 | | | 1.67 + +Nlocal: 2478.25 ave 2954 max 2037 min +Histogram: 1 1 0 0 0 0 0 0 1 1 +Nghost: 1043.25 ave 1146 max 940 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 24605.8 ave 32065 max 17721 min +Histogram: 2 0 0 0 0 0 0 0 1 1 + +Total # of neighbors = 98423 +Ave neighs/atom = 9.9286795 +Ave special neighs/atom = 0 +Neighbor list builds = 371 +Dangerous builds = 0 + +Total wall time: 0:00:03 diff --git a/examples/mesh/log.8May22.mesh_box.g++.1 b/examples/mesh/log.8May22.mesh_box.g++.1 deleted file mode 100644 index ba8ab1935d..0000000000 --- a/examples/mesh/log.8May22.mesh_box.g++.1 +++ /dev/null @@ -1,146 +0,0 @@ -LAMMPS (4 May 2022) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) - using 1 OpenMP thread(s) per MPI task - -units real -atom_style hybrid sphere bond -WARNING: Atom style hybrid defines both, per-type and per-atom masses; both must be set, but only per-atom masses will be used (src/atom_vec_hybrid.cpp:130) - -lattice sc 5.0 -Lattice spacing in x,y,z = 5 5 5 -region box block 50 250 50 250 50 250 units box -create_box 2 box -Created orthogonal box = (50 50 50) to (250 250 250) - 1 by 1 by 1 MPI processor grid -region particles block 110 190 110 190 110 190 units box -create_atoms 1 region particles -Created 4913 atoms - using lattice units in orthogonal box = (50 50 50) to (250 250 250) - create_atoms CPU = 0.001 seconds -region lid block 100 110 50 250 50 250 units box -group mobile type 1 -4913 atoms in group mobile -set type 1 diameter 7.0 -Setting atom values ... - 4913 settings made for diameter - -create_atoms 2 mesh open_box.stl units box radthresh 4.0 -Reading STL object Open Box from file open_box.stl - read 10 triangles with 512.00 atoms per triangle -Created 5120 atoms - using box units in orthogonal box = (50 50 50) to (250 250 250) - create_atoms CPU = 0.001 seconds -group mesh type 2 -5120 atoms in group mesh - -pair_style lj/cut 8.76 -pair_coeff 1 1 0.2339 3.504 -pair_coeff 1 2 0.2339 7.008 $(7.008*2^(1.0/6.0)) -pair_coeff 1 2 0.2339 7.008 7.8662140345520858986 -pair_coeff 2 2 0.0 1.0 -mass * 39.95 - -neigh_modify exclude type 2 2 - -timestep 1.0 - -run 0 post no -WARNING: No fixes with time integration, atoms won't move (src/verlet.cpp:60) -Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 10.76 - ghost atom cutoff = 10.76 - binsize = 5.38, bins = 38 38 38 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 5.641 | 5.641 | 5.641 Mbytes - Step Temp E_pair E_mol TotEng Press - 0 0 -1778.6527 0 -1778.6527 -27.271044 -Loop time of 1.544e-06 on 1 procs for 0 steps with 10033 atoms - - -fix dir mobile oneway 10 lid x -fix move mobile nve -fix load all balance 1000 1.1 shift xyz 10 1.01 weight neigh 0.5 weight group 2 mesh 0.1 mobile 1.0 -fix rot mesh move rotate 150.0 150.0 150.0 1.0 0.0 0.0 500000.0 units box - -reset_timestep 0 time 0.0 -velocity mobile create 150.0 54634234 - -compute ptemp mobile temp -thermo_modify temp ptemp -WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:520) - -thermo 200 -compute ke all ke/atom -#dump 2 all movie 200 mesh.mkv c_ke radius size 960 1440 zoom 1.5 box no 0.0 view 120 180 -#dump_modify 2 bitrate 4000 framerate 12 color orange 1.0 0.5 0.0 amap min max cf 0.0 6 min blue 0.1 fuchsia 0.2 red 0.4 orange 0.6 yellow max white -#dump 1 all custom 500 open_box.lammpstrj id type mol x y z vx vy vz - - -run 5000 -Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule -Per MPI rank memory allocation (min/avg/max) = 6.157 | 6.157 | 6.157 Mbytes - Step Temp E_pair E_mol TotEng Press Volume - 0 150 -1778.6527 0 417.60814 -14.721534 8000000 - 200 179.71663 -2353.7693 0 277.59468 14.591893 8000000 - 400 181.98778 -2346.3965 0 318.22101 14.694157 8000000 - 600 183.48983 -2373.9255 0 312.68467 15.032091 8000000 - 800 183.99836 -2366.1103 0 327.94574 15.154418 8000000 - 1000 186.19063 -2405.1258 0 321.02886 14.881141 8000000 - 1200 185.74206 -2396.0437 0 323.54307 15.729931 8000000 - 1400 188.03786 -2424.6865 0 328.5147 15.077756 8000000 - 1600 187.4202 -2437.7998 0 306.35792 16.323387 8000000 - 1800 186.98057 -2417.0238 0 320.69695 14.445045 8000000 - 2000 185.81788 -2404.4322 0 316.26462 15.382214 8000000 - 2200 185.60774 -2386.4973 0 331.12284 15.033058 8000000 - 2400 187.14304 -2409.5005 0 330.5991 15.226519 8000000 - 2600 186.63304 -2410.3607 0 322.27162 15.010459 8000000 - 2800 185.96347 -2421.8039 0 301.02465 15.577503 8000000 - 3000 185.22976 -2387.0491 0 325.03669 16.111731 8000000 - 3200 186.32095 -2414.4926 0 313.5702 14.41138 8000000 - 3400 186.75847 -2414.3018 0 320.16692 15.224392 8000000 - 3600 184.82282 -2391.1485 0 314.97889 15.96507 8000000 - 3800 185.71262 -2381.6131 0 337.54256 14.870266 8000000 - 4000 186.58931 -2399.6637 0 332.32827 14.434356 8000000 - 4200 185.27225 -2400.3577 0 312.35024 15.429373 8000000 - 4400 183.90694 -2367.1261 0 325.59133 16.558529 8000000 - 4600 185.84295 -2403.8288 0 317.23517 14.371372 8000000 - 4800 184.58178 -2359.4293 0 343.16897 15.516075 8000000 - 5000 186.15467 -2412.7678 0 312.86031 15.366761 8000000 -Loop time of 9.53365 on 1 procs for 5000 steps with 10033 atoms - -Performance: 45.313 ns/day, 0.530 hours/ns, 524.458 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 5.3496 | 5.3496 | 5.3496 | 0.0 | 56.11 -Bond | 0.00036644 | 0.00036644 | 0.00036644 | 0.0 | 0.00 -Neigh | 3.1301 | 3.1301 | 3.1301 | 0.0 | 32.83 -Comm | 0.03837 | 0.03837 | 0.03837 | 0.0 | 0.40 -Output | 0.0010388 | 0.0010388 | 0.0010388 | 0.0 | 0.01 -Modify | 0.88529 | 0.88529 | 0.88529 | 0.0 | 9.29 -Other | | 0.1289 | | | 1.35 - -Nlocal: 10033 ave 10033 max 10033 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 98536 ave 98536 max 98536 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 98536 -Ave neighs/atom = 9.8211901 -Ave special neighs/atom = 0 -Neighbor list builds = 374 -Dangerous builds = 0 - -Total wall time: 0:00:09 diff --git a/examples/mesh/log.8May22.mesh_box.g++.4 b/examples/mesh/log.8May22.mesh_box.g++.4 deleted file mode 100644 index a255fdd55c..0000000000 --- a/examples/mesh/log.8May22.mesh_box.g++.4 +++ /dev/null @@ -1,146 +0,0 @@ -LAMMPS (4 May 2022) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) - using 1 OpenMP thread(s) per MPI task - -units real -atom_style hybrid sphere bond -WARNING: Atom style hybrid defines both, per-type and per-atom masses; both must be set, but only per-atom masses will be used (src/atom_vec_hybrid.cpp:130) - -lattice sc 5.0 -Lattice spacing in x,y,z = 5 5 5 -region box block 50 250 50 250 50 250 units box -create_box 2 box -Created orthogonal box = (50 50 50) to (250 250 250) - 1 by 2 by 2 MPI processor grid -region particles block 110 190 110 190 110 190 units box -create_atoms 1 region particles -Created 4913 atoms - using lattice units in orthogonal box = (50 50 50) to (250 250 250) - create_atoms CPU = 0.001 seconds -region lid block 100 110 50 250 50 250 units box -group mobile type 1 -4913 atoms in group mobile -set type 1 diameter 7.0 -Setting atom values ... - 4913 settings made for diameter - -create_atoms 2 mesh open_box.stl units box radthresh 4.0 -Reading STL object Open Box from file open_box.stl - read 10 triangles with 512.00 atoms per triangle -Created 5120 atoms - using box units in orthogonal box = (50 50 50) to (250 250 250) - create_atoms CPU = 0.000 seconds -group mesh type 2 -5120 atoms in group mesh - -pair_style lj/cut 8.76 -pair_coeff 1 1 0.2339 3.504 -pair_coeff 1 2 0.2339 7.008 $(7.008*2^(1.0/6.0)) -pair_coeff 1 2 0.2339 7.008 7.8662140345520858986 -pair_coeff 2 2 0.0 1.0 -mass * 39.95 - -neigh_modify exclude type 2 2 - -timestep 1.0 - -run 0 post no -WARNING: No fixes with time integration, atoms won't move (src/verlet.cpp:60) -Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 10.76 - ghost atom cutoff = 10.76 - binsize = 5.38, bins = 38 38 38 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 5.457 | 5.476 | 5.493 Mbytes - Step Temp E_pair E_mol TotEng Press - 0 0 -1778.6527 0 -1778.6527 -27.271044 -Loop time of 3.34625e-06 on 4 procs for 0 steps with 10033 atoms - - -fix dir mobile oneway 10 lid x -fix move mobile nve -fix load all balance 1000 1.1 shift xyz 10 1.01 weight neigh 0.5 weight group 2 mesh 0.1 mobile 1.0 -fix rot mesh move rotate 150.0 150.0 150.0 1.0 0.0 0.0 500000.0 units box - -reset_timestep 0 time 0.0 -velocity mobile create 150.0 54634234 - -compute ptemp mobile temp -thermo_modify temp ptemp -WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:520) - -thermo 200 -compute ke all ke/atom -#dump 2 all movie 200 mesh.mkv c_ke radius size 960 1440 zoom 1.5 box no 0.0 view 120 180 -#dump_modify 2 bitrate 4000 framerate 12 color orange 1.0 0.5 0.0 amap min max cf 0.0 6 min blue 0.1 fuchsia 0.2 red 0.4 orange 0.6 yellow max white -#dump 1 all custom 500 open_box.lammpstrj id type mol x y z vx vy vz - - -run 5000 -Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule -Per MPI rank memory allocation (min/avg/max) = 5.998 | 6.028 | 6.059 Mbytes - Step Temp E_pair E_mol TotEng Press Volume - 0 150 -1778.6527 0 417.60814 -14.721534 8000000 - 200 178.85669 -2312.6876 0 306.08541 15.832907 8000000 - 400 182.01107 -2334.4183 0 330.54024 14.457841 8000000 - 600 183.04428 -2348.8534 0 331.23317 15.166984 8000000 - 800 185.68203 -2396.0112 0 322.69659 14.155191 8000000 - 1000 185.58372 -2376.7148 0 340.55362 14.125122 8000000 - 1200 184.96212 -2401.9634 0 306.20372 14.791738 8000000 - 1400 186.67578 -2392.327 0 340.93097 14.859731 8000000 - 1600 186.98761 -2418.1463 0 319.67739 15.173567 8000000 - 1800 188.23692 -2431.082 0 325.03382 15.02044 8000000 - 2000 184.29434 -2378.8865 0 319.50307 16.504785 8000000 - 2200 187.1493 -2395.48 0 344.71119 14.464979 8000000 - 2400 186.60933 -2409.0279 0 323.25719 15.165523 8000000 - 2600 185.29773 -2391.0001 0 322.08084 15.967212 8000000 - 2800 185.05884 -2376.7398 0 332.84337 14.263097 8000000 - 3000 185.03409 -2385.6071 0 323.61377 15.053931 8000000 - 3200 185.37823 -2400.0415 0 314.21823 16.076039 8000000 - 3400 187.03675 -2424.3537 0 314.18955 14.596162 8000000 - 3600 185.55628 -2397.9284 0 318.93826 14.036493 8000000 - 3800 187.10605 -2408.018 0 331.54002 14.527143 8000000 - 4000 186.2403 -2410.4382 0 316.44375 15.342402 8000000 - 4200 187.32974 -2389.1104 0 353.72276 13.931896 8000000 - 4400 189.27742 -2435.0111 0 336.33944 14.316321 8000000 - 4600 189.26108 -2453.7231 0 317.38821 15.615617 8000000 - 4800 187.9187 -2429.9397 0 321.51688 15.226135 8000000 - 5000 186.91414 -2428.2233 0 308.52478 15.780318 8000000 -Loop time of 3.39374 on 4 procs for 5000 steps with 10033 atoms - -Performance: 127.293 ns/day, 0.189 hours/ns, 1473.303 timesteps/s -99.3% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.0734 | 1.4274 | 1.7321 | 24.7 | 42.06 -Bond | 0.00031015 | 0.00032026 | 0.00033017 | 0.0 | 0.01 -Neigh | 0.65409 | 0.83138 | 1.0016 | 17.4 | 24.50 -Comm | 0.33062 | 0.82642 | 1.379 | 52.2 | 24.35 -Output | 0.00070506 | 0.00086089 | 0.0010669 | 0.0 | 0.03 -Modify | 0.21589 | 0.24797 | 0.28078 | 5.5 | 7.31 -Other | | 0.05935 | | | 1.75 - -Nlocal: 2508.25 ave 2930 max 2111 min -Histogram: 2 0 0 0 0 0 0 0 1 1 -Nghost: 1038.5 ave 1110 max 985 min -Histogram: 2 0 0 0 0 0 1 0 0 1 -Neighs: 24668.2 ave 32893 max 17327 min -Histogram: 1 1 0 0 0 0 0 1 0 1 - -Total # of neighbors = 98673 -Ave neighs/atom = 9.834845 -Ave special neighs/atom = 0 -Neighbor list builds = 371 -Dangerous builds = 0 - -Total wall time: 0:00:03 diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index b84e9c6710..0b3a14403c 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -56,8 +56,9 @@ enum { BOX, REGION, SINGLE, RANDOM, MESH }; enum { ATOM, MOLECULE }; enum { COUNT, INSERT, INSERT_SELECTED }; enum { NONE, RATIO, SUBSET }; -enum { TRICENTER, QUASIRANDOM }; +enum { BISECTION, QUASIRANDOM }; +static constexpr const char *mesh_name[] = {"recursive bisection", "quasi-random"}; /* ---------------------------------------------------------------------- */ CreateAtoms::CreateAtoms(LAMMPS *lmp) : Command(lmp), basistype(nullptr) {} @@ -89,7 +90,6 @@ void CreateAtoms::command(int narg, char **arg) ntype = utils::inumeric(FLERR, arg[0], false, lmp); const char *meshfile; - radthresh = 1.0; int iarg; if (strcmp(arg[1], "box") == 0) { style = BOX; @@ -138,7 +138,6 @@ void CreateAtoms::command(int narg, char **arg) int scaleflag = 1; remapflag = 0; - mesh_style = TRICENTER; mode = ATOM; int molseed; ranmol = nullptr; @@ -152,7 +151,8 @@ void CreateAtoms::command(int narg, char **arg) maxtry = DEFAULT_MAXTRY; radscale = 1.0; radthresh = domain->lattice->xlattice; - + mesh_style = BISECTION; + mesh_density = 1.0; nbasis = domain->lattice->nbasis; basistype = new int[nbasis]; for (int i = 0; i < nbasis; i++) basistype[i] = ntype; @@ -261,31 +261,27 @@ void CreateAtoms::command(int narg, char **arg) maxtry = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (maxtry <= 0) error->all(FLERR, "Illegal create_atoms command"); iarg += 2; + } else if (strcmp(arg[iarg], "meshmode") == 0) { + if (style != MESH) + error->all(FLERR, "Create_atoms meshmode can only be used with mesh style"); + if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "create_atoms meshmode", error); + if (strcmp(arg[iarg + 1], "bisect") == 0) { + mesh_style = BISECTION; + radthresh = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + } else if (strcmp(arg[iarg + 1], "qrand") == 0) { + mesh_style = QUASIRANDOM; + mesh_density = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + } else + error->all(FLERR, "Unknown create_atoms meshmode {}", arg[iarg + 2]); + iarg += 3; } else if (strcmp(arg[iarg], "radscale") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_atoms radscale", error); - if (style != MESH) - error->all(FLERR, "Create_atoms radscale can only be used with mesh style"); - if (mesh_style != TRICENTER) - error->all(FLERR, "Create_atoms radscale can only be used with tricenter mesh style"); + if ((style != MESH) && (mesh_style != BISECTION)) + error->all(FLERR, "Create_atoms radscale can only be used with mesh style in bisect mode"); if (!atom->radius_flag) error->all(FLERR, "Must have atom attribute radius to set radscale factor"); radscale = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg], "radthresh") == 0) { - if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_atoms radthresh", error); - if (style != MESH) - error->all(FLERR, "Create_atoms radthresh can only be used with mesh style"); - if (mesh_style != TRICENTER) - error->all(FLERR, "Create_atoms radthresh can only be used with tricenter mesh style"); - radthresh = utils::numeric(FLERR, arg[iarg + 1], false, lmp); - iarg += 2; - } else if (strcmp(arg[iarg], "quasirandom") == 0) { - if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_atoms quasirandom", error); - if (style != MESH) - error->all(FLERR, "Create_atoms quasirandom can only be used with mesh style"); - mesh_style = QUASIRANDOM; - mesh_density = utils::numeric(FLERR, arg[iarg + 1], false, lmp); - iarg += 2; } else error->all(FLERR, "Illegal create_atoms command option {}", arg[iarg]); } @@ -864,7 +860,7 @@ void CreateAtoms::add_random() or split into two halves along the longest side and recurse ------------------------------------------------------------------------- */ -int CreateAtoms::add_tricenter(const double vert[3][3], tagint molid) +int CreateAtoms::add_bisection(const double vert[3][3], tagint molid) { double center[3], temp[3]; @@ -917,8 +913,8 @@ int CreateAtoms::add_tricenter(const double vert[3][3], tagint molid) } } - ilocal = add_tricenter(vert1, molid); - ilocal += add_tricenter(vert2, molid); + ilocal = add_bisection(vert1, molid); + ilocal += add_bisection(vert2, molid); } else { /* @@ -983,7 +979,7 @@ int CreateAtoms::add_quasirandom(const double vert[3][3], tagint molid) for (int i = 0; i < nparticles; i++) { // Define point in unit square xi = (i + 1) * INV_P_CONST; - yi = (i + 1) * INV_SQ_P_CONST; // Add seed function of vertices + yi = (i + 1) * INV_SQ_P_CONST; // Add seed function of vertices xi += seed; yi += seed; @@ -1014,7 +1010,6 @@ int CreateAtoms::add_quasirandom(const double vert[3][3], tagint molid) int idx = atom->nlocal - 1; if (atom->molecule_flag) atom->molecule[idx] = molid; } - } return nparticles; @@ -1044,11 +1039,11 @@ void CreateAtoms::add_mesh(const char *filename) FILE *fp = fopen(filename, "r"); if (fp == nullptr) error->one(FLERR, "Cannot open file {}: {}", filename, utils::getsyserror()); - TextFileReader reader(fp, "triangles"); + TextFileReader reader(fp, "STL mesh"); try { char *line = reader.next_line(); if (!line || !utils::strmatch(line, "^solid")) - throw TokenizerException("Invalid triangles file format", ""); + throw TokenizerException("Invalid STL mesh file format", ""); line += 6; if (comm->me == 0) @@ -1085,12 +1080,14 @@ void CreateAtoms::add_mesh(const char *filename) if (!line || !utils::strmatch(line, "^ *endfacet")) throw TokenizerException("Error reading endfacet", ""); + // now we have the three vertices ... proceed with adding atoms ++ntriangle; - if (mesh_style == TRICENTER) { - // now we have three vertices ... proceed with adding atom in center of triangle - // or splitting recursively into halves as needed to get the desired density - atomlocal += add_tricenter(vert, molid); + if (mesh_style == BISECTION) { + // add in center of triangle or bisecting recursively along longest edge + // as needed to get the desired atom density/radii + atomlocal += add_bisection(vert, molid); } else if (mesh_style == QUASIRANDOM) { + // add quasi-random distribution of atoms atomlocal += add_quasirandom(vert, molid); } } @@ -1102,7 +1099,8 @@ void CreateAtoms::add_mesh(const char *filename) MPI_Allreduce(&atomlocal, &atomall, 1, MPI_LMP_BIGINT, MPI_SUM, world); double ratio = (double) atomall / (double) ntriangle; if (comm->me == 0) - utils::logmesg(lmp, " read {} triangles with {:.2f} atoms per triangle\n", ntriangle, ratio); + utils::logmesg(lmp, " read {} triangles with {:.2f} atoms per triangle added in {} mode\n", + ntriangle, ratio, mesh_name[mesh_style]); } } diff --git a/src/create_atoms.h b/src/create_atoms.h index dcd0a87d94..dfd24ec1ba 100644 --- a/src/create_atoms.h +++ b/src/create_atoms.h @@ -67,7 +67,7 @@ class CreateAtoms : public Command { void add_single(); void add_random(); void add_mesh(const char *); - int add_tricenter(const double [3][3], tagint); + int add_bisection(const double [3][3], tagint); int add_quasirandom(const double [3][3], tagint); void add_lattice(); void loop_lattice(int);