'Python script for time averaging RDF in OVITO
I have generated RDF in "OVITO" software for Si. The "noise" in the RDF is thermally-induced. Ideally, what I want to do is average the RDF over several time steps to average out the noise. I want to use the built-in Python interpreter in OVITO that can be used to write python scripts to do repetitive calculations like this. I tried this code.
from ovito.io import import_file, export_file
from ovito.modifiers import CoordinationAnalysisModifier,
TimeAveragingModifier
import numpy
# Load a simulation trajectory consisting of several frames:
pipeline = import_file("D:\Empirical molecular dynamics\Lammps Works\Research_work\asi_Qrate_sensiv\1\1_1A_Amorphous_NPT.eqil") print("Number of MD frames:", pipeline.source.num_frames)
# Insert the RDF calculation modifier into the
pipeline:
pipeline.modifiers.append(CoordinationAnalysisModifier(cutoff = 5.0, number_of_bins = 200))
# Insert the time-averaging modifier into the pipeline, which accumulates
# the instantaneous DataTable produced by the previous modifier and computes a mean histogram: pipeline.modifiers.append(TimeAveragingModifier(operate_on='table:coordination-rdf'))
# Data export method 1:
Convert to NumPy array and write data to a text file: total_rdf = pipeline.compute().tables['coordination-rdf[average]'].xy() numpy.savetxt("D:\Empirical molecular dynamics\Lammps Works\Research_work\asi_Qrate_sensiv\1/rdf.txt", total_rdf)
Then I got this error
The Python script has exited with an error.
Traceback (most recent call last):
File "<string>", line 6, in <module>
File "D:\SOFTWARE DRIVE\OVITO Pro\plugins\python\ovito\io\import_file.py", line 160, in import_file
importer = FileImporter.autodetect_format(ovito.scene, first_location)
RuntimeError: File does not exist:
D:/Empirical molecular dynamics/Lammps Works/Research_worksi_Qrate_sensiv_1A_Amorphous_NPT.eqil
What should I do to get rid of the error?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
