Znn3bq.jpeg
²é¿´: 5241  |  »Ø¸´: 12
µ±Ç°Ö»ÏÔʾÂú×ãÖ¸¶¨Ìõ¼þµÄ»ØÌû£¬µã»÷ÕâÀï²é¿´±¾»°ÌâµÄËùÓлØÌû

gtssongchi

ľ³æ (СÓÐÃûÆø)

[ÇóÖú] ovitoÖдò¿ªpython½Å±¾´íÎó ÒÑÓÐ3È˲ÎÓë

´ó¼ÒºÃ£¬ÓÃovito¼ÆËãvoronoi¶àÃæÌåʱ£¬°´ÕÕÊÖ²á²ÉÓõÄpython½Å±¾¼ÆËã¡£ÊÖ²áÉϽű¾ÈçÏÂ
# Import OVITO modules.
from ovito.io import *
from ovito.modifiers import *

# Import NumPy module.
import numpy

# Load a simulation snapshot of a Cu-Zr metallic glass.
node = import_file("../data/CuZr_metallic_glass.dump.gz"

# Set atomic radii (required for polydisperse Voronoi tessellation).
atypes = node.source.particle_properties.particle_type.type_list
atypes[0].radius = 1.35        # Cu atomic radius (atom type 1 in input file)
atypes[1].radius = 1.55        # Zr atomic radius (atom type 2 in input file)

# Set up the Voronoi analysis modifier.
voro = VoronoiAnalysisModifier(
    compute_indices = True,
    use_radii = True,
    edge_count = 6, # Length after which Voronoi index vectors are truncated
    edge_threshold = 0.1
)
node.modifiers.append(voro)
                     
# Let OVITO compute the results.
node.compute()

# Make sure we did not lose information due to truncated Voronoi index vectors.
if voro.max_face_order > voro.edge_count:
    print("Warning: Maximum face order in Voronoi tessellation is {0}, "
          "but computed Voronoi indices are truncated after {1} entries. "
          "You should consider increasing the 'edge_count' parameter to {0}."
          .format(voro.max_face_order, voro.edge_count))
    # Note that it would be possible to automatically increase the 'edge_count'
    # parameter to 'max_face_order' here and recompute the Voronoi tessellation:
    #   voro.edge_count = voro.max_face_order
    #   node.compute()

# Access computed Voronoi indices as NumPy array.
# This is an (N)x(edge_count) array.
voro_indices = node.output.particle_properties['Voronoi Index'].array

# This helper function takes a two-dimensional array and computes a frequency
# histogram of the data rows using some NumPy magic.
# It returns two arrays (of equal length):
#    1. The list of unique data rows from the input array
#    2. The number of occurences of each unique row
# Both arrays are sorted in descending order such that the most frequent rows
# are listed first.
def row_histogram(a):
    ca = numpy.ascontiguousarray(a).view([('', a.dtype)] * a.shape[1])
    unique, indices, inverse = numpy.unique(ca, return_index=True, return_inverse=True)
    counts = numpy.bincount(inverse)
    sort_indices = numpy.argsort(counts)[::-1]
    return (a[indices[sort_indices]], counts[sort_indices])

# Compute frequency histogram.
unique_indices, counts = row_histogram(voro_indices)

# Print the ten most frequent histogram entries.
for i in range(10):
    print("%s\t%i\t(%.1f %%)" % (tuple(unique_indices),
                                 counts,
                                 100.0*float(counts)/len(voro_indices)))

ÎÒÖ»Êǽ«ÆäÖеÄÎļþ·¾¶¸Ä±äÁË¡£ÔÚÔËÐÐʱȴÌáʾÈçÏ´íÎó£º
Traceback (most recent call last):
  File "/home/csong/ovito.py", line 2, in <module>
    from ovito.io import *
ImportError: No module named 'ovito.io'; 'ovito' is not a package
ERROR: Failed to initialize Python interpreter.

ÇëÎÊÕâÊÇʲôԭÒòÄØ£¿
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

cuso4852cuoh

гæ (СÓÐÃûÆø)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

ÇëÎÊÂ¥Ö÷Ôõô۵ģ¬ÎÒÒ²ÔÚ¸ãÕâ¸ö£¬Ò»Ö±³ö´í
Traceback (most recent call last):
  File "F:\py\vo.py", line 62, in <module>
    print("%s\t%i\t(%.1f %%)" % (tuple(unique_indices),
IndexError: index 1 is out of bounds for axis 0 with size 1
£¬ÎÒŪµ½ovitoÀһֱ±¨Õâ¸ö´í
5Â¥2019-04-17 19:57:33
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
²é¿´È«²¿ 13 ¸ö»Ø´ð

abinitio

°æÖ÷ (ÖøÃûдÊÖ)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
ovito ÊÇÄǸö°æ±¾£¿ÎҸоõ3.0.0 -devµÄpythonscriptºÃÏóÓÐÎÊÌâ
2Â¥2017-11-15 15:58:03
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

gtssongchi

ľ³æ (СÓÐÃûÆø)

ÒýÓûØÌû:
2Â¥: Originally posted by abinitio at 2017-11-15 15:58:03
ovito ÊÇÄǸö°æ±¾£¿ÎҸоõ3.0.0 -devµÄpythonscriptºÃÏóÓÐÎÊÌâ

ÀÏʦÄúºÃ£¬ovitoÊÇ2.9.0µÄ°æ±¾
3Â¥2017-11-15 19:16:03
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

ÒÁÓÐÑÄ

гæ (СÓÐÃûÆø)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

ovitoÔõôÓÃpython½øÐмÆËã°¡£¿Ôõô۵İ¡£¿
ϲ»¶Ìì¿Õ£¬°Ù¿´²»Ñá¡£µ±È»²»¿´Ò²¿ÉÒÔ¡£
4Â¥2018-07-05 19:37:49
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] 307ÖÐÒ½¿¼Ñе÷¼Á +9 ÓÚÒÔ²ÉÞÀ 2026-04-14 9/450 2026-04-19 08:41 by ÑÌÓêÁ÷ÑÄ
[¿¼ÑÐ] ²ÄÁÏÏà¹Ø×¨Òµ344Çóµ÷¼ÁË«·Ç¹¤¿ÆÑ§Ð£»ò¿ÎÌâ×é +25 hualkop 2026-04-12 27/1350 2026-04-19 01:58 by ÑÌÓêÁ÷ÑÄ
[¿¼ÑÐ] Ò»Ö¾Ô¸»¦9£¬326ÇóÉúÎïѧµ÷¼Á +12 Áõīī 2026-04-13 12/600 2026-04-18 23:31 by ·²¡Çé
[¿¼ÑÐ] ½ÓÊÜÈκε÷¼Á +6 Ò²¾ÍÊÇÀõ×Ó 2026-04-17 7/350 2026-04-18 17:20 by º­ÖñÁõ
[¿¼ÑÐ] Ò»Ö¾Ô¸»ªÖÐũҵ071010£¬320Çóµ÷¼Á +17 À§À§À§À§À¤À¤ 2026-04-14 19/950 2026-04-17 20:08 by ¹ØÒ»ÕµµÆcd
[¿¼ÑÐ] Ò»Ö¾Ô¸Öпƴó²ÄÁÏÓ뻯¹¤£¬353·Ö»¹Óе÷¼ÁѧУÂð +10 ·ñ¼«Ì©À´2026 2026-04-15 12/600 2026-04-17 17:54 by mapenggao
[¿¼ÑÐ] 295·ÖÇóµ÷¼Á +5 ?ÒªÉϰ¶? 2026-04-17 5/250 2026-04-17 16:51 by fenglj492
[¿¼ÑÐ] 291Çóµ÷¼Á +11 ¹ØÒä±±. 2026-04-14 11/550 2026-04-16 15:18 by jiahl2024
[»ù½ðÉêÇë] RY£ºÖйú²ú³öµÄ¿ÆÑ§À¬»øÂÛÎÄ£¬¾ø¶ÔÊýÁ¿ºÍ±ÈÀý¶¼ÊÀ½çµÚÒ» +7 zju2000 2026-04-14 18/900 2026-04-16 11:36 by »¶ÀÖËÌÒ¶Ýè
[¿¼ÑÐ] 322Çóµ÷¼Á +8 123°²¿µ 2026-04-12 15/750 2026-04-16 11:07 by Espannnnnol
[¿¼ÑÐ] ҩѧÇóµ÷¼Á +14 à¶¹þ¼ÓÓÍ 2026-04-14 16/800 2026-04-16 10:15 by beilsong20
[¿¼ÑÐ] 289 ·Ö105500ҩѧר˶Çóµ÷¼Á(ÕÒBÇøÑ§Ð£) +4 °×ÔÆ123456789 2026-04-13 4/200 2026-04-16 00:18 by ·ÛÇßÈô³¾
[¿¼ÑÐ] Ò»Ö¾Ô¸AÇø211£¬22408 321Çóµ÷¼Á +6 ËæÐÄËùÓû¡î 2026-04-15 7/350 2026-04-15 21:45 by lbsjt
[¿¼ÑÐ] ҩѧÇóµ÷¼Á +11 RussHu 2026-04-12 13/650 2026-04-15 19:07 by zhuwenxu
[¿¼ÑÐ] ¸÷λÀÏʦºÃ£¬Çóµ÷¼Á£¬±¾¿Æ211£¬Ò»Ö¾Ô¸Ìì½ò´óѧÉúÎïÓëҽҩѧ˶£¬²îÁ½Ãû¼ȡ¡£ +11 ·ÁùÁùjjj 2026-04-13 11/550 2026-04-14 16:01 by zs92450
[¿¼ÑÐ] 105500ҩѧÇóµ÷¼Á +4 x_skys 2026-04-12 4/200 2026-04-14 13:37 by rndfc
[¿¼ÑÐ] ¿¼ÑÐÇóµ÷¼Á +12 ×ÓľÄÅ 2026-04-12 13/650 2026-04-14 01:19 by Íõ¬Bè±
[¿¼ÑÐ] Çóµ÷¼Á +3 ÎÒ°®¸ßÊý¸ßÊý°®Î 2026-04-12 3/150 2026-04-14 01:00 by Íõ¬Bè±
[¿¼ÑÐ] 297¹¤¿Æ£¬Çóµ÷¼Á? +13 ºÓÄÏũҵ´óѧ-ÄÜ 2026-04-12 13/650 2026-04-13 14:12 by dingyanbo1
[¿¼ÑÐ] µ÷¼Á½áÊø +6 floriea 2026-04-12 8/400 2026-04-12 18:13 by zhouxiaoyu
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û