Author Topic: Issue with time series in External file for Wigner-Seitz Defect Analysis  (Read 225 times)

liammo29

  • Newbie
  • *
  • Posts: 5
Hi,

I am trying to track vacancies during a tensile test for a material with and without preexisting vacancies. To do this I first ran a simulation to get my reference file with no vacancies and made a dump file with 100 frames. I then reran the exact simulation with 5% initial vacancies and a dump file with 100 frames.

When I do the WS defect analysis I load in the reference external file (no vacancies) and select file contains time series. This identifies the 100 frames, and allows me to select the current frame. However, if I select a different frame, it still says "showing frame 1 of 101" and in the viewport it is comparing it to reference file at the initial timestep.

When doing the defect analysis I need to be comparing the current file to the reference  file at the same stage in the tension test, however it is comparing to the reference file at the beginning.

I have attached a picture of the task bar. Is there a way for me to have it so that when I select a different frame for my reference file it updates in the viewport?

Thanks!

Constanze Kalcher

  • Administrator
  • Full Member
  • *****
  • Posts: 233
Re: Issue with time series in External file for Wigner-Seitz Defect Analysis
« Reply #1 on: January 24, 2019, 07:38:31 PM »
Hi,

I tried to reproduce your problem and you're right. I'm afraid that at the moment you'll have to do the analysis programmatically  rather than in the GUI to solve this issue.
The following script is an example of how to  loop over each frame and also update the reference configuration with the current frame. It's meant to be executed from the terminal
like this: ovitos script.py (see also Manual of scripting usage).


Code: [Select]
from ovito.io import *
from ovito.data import *
from ovito.modifiers import *
from ovito.pipeline import *
import numpy as np

# Create a new pipeline with a FileSource:                                                                                                                                                                                             
pipeline = import_file('input-file.dump')
# Load the reference config from a separate input file.                                                                                                                                                                               
pipeline2 = import_file('reference-file.dump')

# Perform Wigner-Seitz analysis:                                                                                                                                                                                                       
ws = WignerSeitzAnalysisModifier(
        per_type_occupancies = True,
        affine_mapping = ReferenceConfigurationModifier.AffineMapping.ToReference)
pipeline.modifiers.append(ws)

#Loop over all frames                                                                                                                                                                                                                 
for frame_index in range(pipeline.source.num_frames):
    ws.reference = StaticSource(data = pipeline2.compute(frame_index))
    data = pipeline.compute(frame_index)

Hope this helps,

-Constanze
« Last Edit: January 24, 2019, 07:40:56 PM by Constanze Kalcher »

liammo29

  • Newbie
  • *
  • Posts: 5
Re: Issue with time series in External file for Wigner-Seitz Defect Analysis
« Reply #2 on: January 25, 2019, 03:01:31 PM »
Ok at least it is not just me seeing this. Hopefully it will be fixed in a later update.

I am going to take a look at using the script. Just to be sure, when running the script from import script in ovito:

- where is this searching for the file? It is saying cannot find file. Do I need to move the input and ref files to a specific place?

- I tried running on command prompt but am having some issues with the path. Should I move ovitos.exe to where my files are and run from that path (this is what I do with lammps) or should I move the files somewhere else. When I type "ovitos script.py" after moving ovitos to where the files are it says "the application failed to start because it could not find or load the Qt platform plugin "windows"

- finally, will this script then count the number of vacancies at each step or output it for me? Or should I add that into the script?

Thanks very much for your help.

liammo29

  • Newbie
  • *
  • Posts: 5
Re: Issue with time series in External file for Wigner-Seitz Defect Analysis
« Reply #3 on: January 25, 2019, 03:40:30 PM »
As a follow up, when executing from the GUI it is finding the input and ref files, but coming up with an error saying: no module named pipeline. When I comment out the import pipeline line I get a error: Name Error: 'ReferenceConfigurationModifier' is not defined.

I have uninstalled and reinstalled ovito to make sure it is not an error with my build.

Constanze Kalcher

  • Administrator
  • Full Member
  • *****
  • Posts: 233
Re: Issue with time series in External file for Wigner-Seitz Defect Analysis
« Reply #4 on: January 25, 2019, 05:00:22 PM »
Hi,

it will look for the files in the current folder, but you can of course specify the path to that file when you call import_file().
Moreover, this script is written in OVITO 3 syntax.
Also note, that you can call ovitos.exe by its absolute path, e.g., if you have installed it in C:\Program Files:

Code: [Select]
"C:\Program Files\Ovito\ovitos.exe"
or you add that folder to your path variable

Code: [Select]
set PATH=%PATH%;"C:\Program Files\Ovito\"
so you don't need to type the whole path every time.

Concerning your last question. No, so far the code-snippet will not output anything, you'll need to add that. The good news is that you can basically copy the
Wigner Seitz analysis example script from the scripting reference:
http://ovito.org/manual_testing/python/modules/ovito_modifiers.html#ovito.modifiers.WignerSeitzAnalysisModifier

-Constanze

« Last Edit: January 25, 2019, 05:18:12 PM by Constanze Kalcher »

Alexander Stukowski

  • Administrator
  • Hero Member
  • *****
  • Posts: 588
Re: Issue with time series in External file for Wigner-Seitz Defect Analysis
« Reply #5 on: January 26, 2019, 08:47:17 AM »
Hi liammo29,

Here is some additional info regarding the original problem from my side, the Ovito developer:

The Wigner-Seitz function is currently limited to static reference configurations. This is unlike the Displacement Vectors and Atomic Strain functions, which already support dynamically changing reference configurations. This option is needed to perform the frame-by-frame analysis of the defective trajectory with respect to the corresponding frames of the reference trajectory.

Unfortunately, there currently is a drop-down box in the WS-modifier user interface listing all frames of the selected reference trajectory. It may lead you to think that it allows you to select a reference frame from the trajectory. However, that is not the case. This drop-down list is only there, because Ovito re-uses the same UI panel as for the main trajectory, where it allows you to quickly jump in time to a specific frame. In case of the reference trajectory, it doesn't work like that though. The only way to select a different reference frame other than the first one from the trajectory dump file is to split the reference trajectory into a series of individual dump files. (Use Ovito's export function for that). Then you can load in a specific frame as reference configuration.

However, even with this approach the reference frame will still be static. So it doesn't solve the original problem, which is to update the reference in sync with the main trajectory. I agree with Constanze that the only solution to this problem currently is the usage of a Python script.

Note that her script is for the current 3.0.0 development release. Your screenshot suggests that you were still using the old 2.9.0 program release.

Alexander Stukowski

  • Administrator
  • Hero Member
  • *****
  • Posts: 588
Re: Issue with time series in External file for Wigner-Seitz Defect Analysis
« Reply #6 on: January 26, 2019, 03:51:39 PM »
Hi again,

please ignore my previous statements regarding the WS modifier's inability to use frames from the reference trajectory other than the first frame. In the current development version of Ovito 3.0.0 the WS modifier already provides the "Reference frame number" field, which lets you select the desired frame from the trajectory. It's just that you cannot use the mentioned drop-down box to select it.

That being said, I have worked on the Ovito code in the meantime and added the missing capability of using a dynamically changing reference configuration. The newly available build Ovito 3.0.0-dev334 provides the "relative to current frame" option, which lets you use a reference configuration that is in sync with your defective configuration (see screenshot).

Just perform the following steps in the WS modifier panel:

  • Set "Reference configuration source" to "External file" and pick your dump file containing the reference trajectory,
  • select the "Relative to current frame" option, and
  • set "Frame offset" to 0.

You will also notice that the non-functioning drop-down frames list, which contributed to your confusion, is hidden now.
With the new extension you shouldn't need a Python script anymore to do what you wanted to.

-Alex

liammo29

  • Newbie
  • *
  • Posts: 5
Re: Issue with time series in External file for Wigner-Seitz Defect Analysis
« Reply #7 on: January 28, 2019, 05:00:00 PM »
Thank you both very much.

I just downloaded this and it works perfectly. I am amazed how helpful you have been. Ovito really is a joy to use.

Have a great day.

Liam