Znn3bq.jpeg
²é¿´: 5240  |  »Ø¸´: 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µÄ»ØÌû

pl954

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

±¾ÌûÄÚÈݱ»ÆÁ±Î

13Â¥2020-01-09 16:11: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µÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] 300Çóµ÷¼Á +12 ³Èa777 2026-04-15 12/600 2026-04-18 23:51 by ·²¡Çé
[¿¼ÑÐ] Ò»Ö¾Ô¸»¦9£¬326ÇóÉúÎïѧµ÷¼Á +12 Áõīī 2026-04-13 12/600 2026-04-18 23:31 by ·²¡Çé
[¿¼ÑÐ] ÉúÎïѧµ÷¼Á +10 Ö½ÉÈzhishan 2026-04-13 10/500 2026-04-18 21:19 by zqndavala
[¿¼ÑÐ] 22408 312Çóµ÷¼Á +24 ÃÅ·ÃþÃþ 2026-04-14 26/1300 2026-04-18 13:04 by wunaiy88
[¿¼²©] É격/¿¼²© +3 ¿ÐÃæ°üµÄСÊ鳿 2026-04-17 4/200 2026-04-17 23:54 by ÑôÑôÑô^_^
[¿¼ÑÐ] 295·ÖÇóµ÷¼Á +5 ?ÒªÉϰ¶? 2026-04-17 5/250 2026-04-17 16:51 by fenglj492
[¿¼ÑÐ] 294Çóµ÷¼Á +7 µ­È»654321 2026-04-17 8/400 2026-04-17 16:36 by wutongshun
[ÂÛÎÄͶ¸å] ÓÐûÓнÓÊձȽϿìµÄsciÆÚ¿¯Ñ½£¬×îºÃÔÚÒ»¸öÔÂÖ®Äڵģ¬ÑÐÈýº¢×ÓÇó±ÏÒµ 20+4 Ö®»¤×Å 2026-04-16 5/250 2026-04-17 10:02 by bobvan
[¿¼ÑÐ] 322Çóµ÷¼Á +8 123°²¿µ 2026-04-12 15/750 2026-04-16 11:07 by Espannnnnol
[¿¼ÑÐ] Çóµ÷¼ÁѧУ +14 ²»»á³ÔÈâ 2026-04-13 16/800 2026-04-15 21:59 by noqvsozv
[¿¼ÑÐ] ͨÐŹ¤³ÌÇóµ÷¼Á£¡£¡£¡ +6 zlb770521 2026-04-14 6/300 2026-04-15 20:00 by ѧԱJpLReM
[¿¼ÑÐ] ҩѧÇóµ÷¼Á +11 RussHu 2026-04-12 13/650 2026-04-15 19:07 by zhuwenxu
[¿¼ÑÐ] 297¹¤¿Æµ÷¼Á? +14 ºÓÄÏũҵ´óѧ-ÄÜ 2026-04-13 15/750 2026-04-15 13:25 by ºÚ¿Æ¼¼¿óÒµ
[¿¼ÑÐ] ʳƷÓëÓªÑø£¨0955£©271Çóµ÷¼Á +15 Éý¸ñ°¢´ï 2026-04-12 16/800 2026-04-14 13:18 by ¸¡Èô_°²Éú
[¿¼ÑÐ] 245Çóµ÷¼Á +6 ±ùÌÇéÙ?ÆûË® 2026-04-13 10/500 2026-04-14 10:49 by jyl0317
[¿¼ÑÐ] 293Çóµ÷¼Á +16 ÎÒ°®¸ßÊý¸ßÊý°®Î 2026-04-12 18/900 2026-04-13 21:47 by ѧԱJpLReM
[¿¼ÑÐ] 302Çóµ÷¼Á +10 Ò×£¡? 2026-04-13 10/500 2026-04-13 19:04 by lbsjt
[¿¼ÑÐ] 297¹¤¿Æ£¬Çóµ÷¼Á? +13 ºÓÄÏũҵ´óѧ-ÄÜ 2026-04-12 13/650 2026-04-13 14:12 by dingyanbo1
[¿¼ÑÐ] 339Çóµ÷¼Á +4 hanwudada 2026-04-12 4/200 2026-04-13 12:03 by À¶ÔÆË¼Óê
[¿¼ÑÐ] µ÷¼Á½áÊø +6 floriea 2026-04-12 8/400 2026-04-12 18:13 by zhouxiaoyu
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û