Znn3bq.jpeg
ÉÇÍ·´óѧº£Ñó¿ÆÑ§½ÓÊܵ÷¼Á
²é¿´: 5213  |  »Ø¸´: 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µÄ»ØÌû
»ØÌûÖ§³Ö ( ÏÔʾ֧³Ö¶È×î¸ßµÄǰ 50 Ãû )

969354217

гæ (³õÈëÎÄ̳)

ÒýÓûØÌû:
5Â¥: Originally posted by cuso4852cuoh at 2019-04-17 19:57:33
ÇëÎÊÂ¥Ö÷Ôõô۵ģ¬ÎÒÒ²ÔÚ¸ãÕâ¸ö£¬Ò»Ö±³ö´í
Traceback (most recent call last):
  File &quot;F:\py\vo.py&quot;, line 62, in &lt;module&gt;
    print(&quot;%s\t%i\t(%.1f %%)&quo ...

ÄãÕÒµ½½â¾ö·½·¨ÁËÂð£¿
6Â¥2019-05-10 10:13:19
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
ÆÕͨ»ØÌû

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µÄ»ØÌû

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µÄ»ØÌû

Áõ×Ó²»Ôγµ

½û³æ (³õÈëÎÄ̳)

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

7Â¥2019-12-30 00:23:50
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

pl947

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

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

8Â¥2019-12-31 11:15:26
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

pl996

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

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

9Â¥2020-01-02 14:17:08
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

pl927

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

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

10Â¥2020-01-03 15:54:03
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ gtssongchi µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] ²ÄÁϹ¤³Ì281»¹Óе÷¼Á»ú»áÂð +34 xaw. 2026-04-11 35/1750 2026-04-13 22:22 by zhq0425
[¿¼ÑÐ] µ÷¼Á +27 ²»·ê´º 2026-04-07 28/1400 2026-04-13 20:19 by xxy88888
[¿¼ÑÐ] һ־Ը³¶«´óѧ071000ÉúÎïѧѧ˶³õÊÔ·ÖÊý276Çóµ÷¼Á +8 Ľ¾øcc 2026-04-09 8/400 2026-04-13 14:08 by ÕÅzhihao
[¿¼ÑÐ] ¿¼ÑжþÂÖµ÷¼Á +10 ¹ÊÈË?? 2026-04-09 10/500 2026-04-13 09:55 by szhize
[¿¼ÑÐ] 22408 352·ÖÇóµ÷¼Á +5 ŬÁ¦µÄÏÄÄ© 2026-04-09 5/250 2026-04-12 19:17 by wj165256
[¿¼ÑÐ] 280Çóµ÷¼Á +13 wzzzÍõ 2026-04-09 13/650 2026-04-12 00:31 by ÓÂÅʸ߷å0126
[¿¼ÑÐ] 22408µ÷¼Á315·Ö +3 zhuangyan123 2026-04-09 3/150 2026-04-12 00:25 by À¶ÔÆË¼Óê
[¿¼ÑÐ] 352 Çóµ÷¼Á +6 yzion 2026-04-11 8/400 2026-04-11 16:24 by Ã÷Ô´ËʱÓÐ
[¿¼ÑÐ] »¯Ñ§308·ÖÇóµ÷¼Á +22 ÄãºÃÃ÷ÌìÄãºÃ 2026-04-07 24/1200 2026-04-11 11:14 by ChemPharm
[¿¼ÑÐ] 288Çóµ÷¼Á +15 ´úfish 2026-04-09 16/800 2026-04-11 10:26 by wwj2530616
[¿¼ÑÐ] 346£¬¹¤¿ÆÇóµ÷¼Á +3 moser233 2026-04-09 3/150 2026-04-11 10:04 by zhq0425
[¿¼ÑÐ] ²ÄÁÏÀà284µ÷¼Á +40 Ïë»»ÊÖ»ú²»Ïë½âÊ 2026-04-08 48/2400 2026-04-10 23:28 by 314126402
[¿¼ÑÐ] µ÷¼Á +12 ¾í¾í¾íÐIJË_ 2026-04-09 13/650 2026-04-10 22:36 by Ftglcn90
[¿¼ÑÐ] µ÷¼Á +19 СÕÅZA 2026-04-10 20/1000 2026-04-10 22:08 by Öí»á·É
[¿¼ÑÐ] Ò»Ö¾Ô¸»ª¶«Ê¦·¶ÉúÎïѧ326·Ö£¬Çóµ÷¼Á +8 Áõīī 2026-04-09 8/400 2026-04-10 12:00 by pengliang8036
[¿¼ÑÐ] һ־Ը³¶«´óѧ071000ÉúÎïѧѧ˶³õÊÔ·ÖÊý276Çóµ÷¼Á +20 Ľ¾øcc 2026-04-09 24/1200 2026-04-10 10:22 by xujun0624
[¿¼ÑÐ] 085601³õÊÔ330·ÖÕÒµ÷¼Á +10 Á÷ÐÄÄ̻ưül 2026-04-09 10/500 2026-04-10 08:14 by Sammy2
[¿¼ÑÐ] ÕÐÊÕÓлú»¯Ñ§¡¢»¯¹¤£¬Ò©Ñ§£¬Ê³Æ·µÆ×¨ÒµÑ§Éú +3 yrfhjgdj 2026-04-08 3/150 2026-04-09 10:15 by QYQX_123
[¿¼ÑÐ] 286Çóµ÷¼Á +19 Faune 2026-04-08 20/1000 2026-04-09 08:36 by ŶŶ123
[¿¼ÑÐ] ר˶085403£¬291·Ö£¬ÓÐÁ½Æª×¨Àû£¬Ò»¹úÒ»½± +3 ¹þ¼ªßä¹þ¼ªßä 2026-04-07 3/150 2026-04-07 18:21 by À¶ÔÆË¼Óê
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û