from ovito.io import import_file from ovito.modifiers import ConstructSurfaceModifier from ovito.modifiers import DeleteSelectedParticlesModifier from ovito.modifiers import SelectParticleTypeModifier import sys # Load a particle structure and construct its geometric surface: fname = sys.argv[1] node = import_file(fname, columns=["Particle Type", "Position.X", "Position.Y", "Position.Z"]) mod = ConstructSurfaceModifier(radius = 2.9) node.modifiers.append(mod) node.compute() # Query computed surface properties: print("Surface area: %f" % node.output.attributes['ConstructSurfaceMesh.surface_area']) print("Solid volume: %f" % node.output.attributes['ConstructSurfaceMesh.solid_volume']) fraction = node.output.attributes['ConstructSurfaceMesh.solid_volume'] / node.output.cell.volume print("Solid volume fraction: %f" % fraction) # Export the surface triangle mesh to a VTK file. mesh = node.output.surface mesh.export_vtk('surface.vtk', node.output.cell)
help="The concentration of surafce TMS in C3H9Si/nm^2") args = parser.parse_args() node = import_file(args.filename) print("... loading %s"%(args.filename) ) print("... %d files"%(node.source.num_frames)) print("... cutoff for core region %d A"%(args.coreCutoff)) #### Create a bonds modifier (mod) and apply it to the system ################################################################################### rcut = args.bondLength modbonds = CreateBondsModifier(mode = CreateBondsModifier.Mode.Pairwise) modbonds.set_pairwise_cutoff("Type 1", "Type 2", rcut) modmesh = ConstructSurfaceModifier(radius=5.0) modbondcount = PythonScriptModifier(function = create_bond_count_particle) modbondnghbr = PythonScriptModifier(function = create_bond_neighbors_particle) print("") print("... adding modifiers") print(" creating Si-O bonds using cutoff = %1.4f"%(rcut)) print(" calculating bond count") print(" calculating nearest-neighbor bonded atoms") node.modifiers.append(modmesh) node.modifiers.append(modbonds) node.modifiers.append(modbondcount) node.modifiers.append(modbondnghbr) node.compute()
import sys if "ovito.modifiers.crystalanalysis" not in sys.modules: sys.exit() from ovito.io import import_file from ovito.data import SurfaceMesh, SimulationCell from ovito.modifiers import ConstructSurfaceModifier # Load a particle structure and reconstruct its geometric surface: pipeline = import_file("simulation.dump") pipeline.modifiers.append(ConstructSurfaceModifier(radius=2.9)) data = pipeline.compute() mesh = data.expect(SurfaceMesh) cell = data.expect(SimulationCell) # Query computed surface properties: print("Surface area: %f" % data.attributes['ConstructSurfaceMesh.surface_area']) print("Solid volume: %f" % data.attributes['ConstructSurfaceMesh.solid_volume']) fraction = data.attributes['ConstructSurfaceMesh.solid_volume'] / cell.volume print("Solid volume fraction: %f" % fraction) # Export the surface triangle mesh to a VTK file. mesh.export_vtk('surface.vtk', cell)
from ovito.io import import_file from ovito.modifiers import ConstructSurfaceModifier # Load a particle structure and construct its surface mesh: node = import_file("simulation.dump") node.modifiers.append(ConstructSurfaceModifier(radius=2.8)) node.compute() # Access the computed surface mesh and export it to VTK files for # visualization with ParaView. mesh = node.output.surface mesh.export_vtk('surface.vtk', node.output.cell) mesh.export_cap_vtk('surface_cap.vtk', node.output.cell)
try: print(kuttX) except: kuttX = 15 #Load dump file node = import_file(mappenavn + "/" + filnavn_dump, multiple_frames=True) #makes folder called "data" #alternative would be to use if/else and shutil.rmtree() to remove folder. I don't wanna do that though os.chdir(mappenavn) os.makedirs("area_mesh") os.chdir("area_mesh") #makes Surface mesh r = 3.5 mod = ConstructSurfaceModifier(radius=r) node.modifiers.append(mod) totframe = int(node.source.num_frames) #number of frames k = 0 areas = [] #write surface mesh to surface_nr files for i in range(totframe): dataset.anim.current_frame = i works = False reset = False while not works and k < 15: k += 1 try: actual = node.compute()