### Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

### Messages - Constanze Kalcher

Pages: 1 ... 6 7 [8] 9 10
211
##### Support Forum / Re: How to save data as a txt file?
« on: October 18, 2018, 11:03:01 AM »
Dear SC,

indentation matters in python, see e.g. here
https://docs.python.org/3/reference/lexical_analysis.html?highlight=indentation.
The problem is the leading whitespace, which you need to remove.

-Constanze

212
##### Support Forum / Re: Not Able to Print a Variable While Looping Over Frames
« on: October 16, 2018, 02:03:59 PM »
Dear jatink,

we are looking forward to you contacting us directly. But in the meantime here's an idea of how you could track the x-coordinate of the particle with the highest z-coordinate as a function of simulation time. As you already noted, the Displacement vectors modifier is not the right tool to achieve this.
However, here's how you could adapt your python script: Use numpy.argmax() to find the index of the particle with the highest z-coordinate and use that index to look up its x-coordinate.
Code: [Select]
`import numpynode = import_file(...)def compute_max_z(frame, input, output):    #Find the index of the particle with the highest z-coordinate and look up its x-coordinate                                                                                                                                                                         positions = input.particles["Position"]    output.attributes["x_coord"] = positions[ np.argmax(positions[:,2]) ][0]export_file(node, "max_z.txt", "txt", columns=["Frame", "x_coord"], multiple_frames = True)`
This gives you the x-coordinate of the maximum of your "wrinkle" as a function of simulation time. You could then use that data to fit the velocity. Let me know if that was what you had in mind.

-Constanze

213
##### Support Forum / Re: make movie with multiple active frames
« on: October 16, 2018, 11:48:36 AM »
Hello Reza,

there is no direct way to do this with OVITO. You can, however, render a series of *png files for the individual viewports and subsequently combine them to an animation using an external video encoding program. Could you tell me what operating system you are using, so I can give you a more specific answer.

-Constanze

214
##### Support Forum / Re: Dislocation in Tensile Test
« on: October 10, 2018, 12:03:12 PM »
Hi bity,

I don't have much experience with carbon nanotubes, so can you explain how dislocations in a carbon nanotube are defined? That might increase your chances that I or others can help you.

-Constanze

215
##### Support Forum / Re: Problem in executing OVITOS
« on: October 09, 2018, 05:26:45 PM »
Could you please upload your script for me, so I can try and reproduce what the problem is.
-Constanze

216
##### Support Forum / Re: Problem in executing OVITOS
« on: October 09, 2018, 04:02:08 PM »

I don't really understand whats going on with the path you gave us. Do you really have another set of subfolders Ovito.app/Contents/MacOS/ in your folder  /usr/home/ad/ovito/Ovito.app/Contents/MacOS/ ?
Shouldn't it rather be:
Code: [Select]
` /usr/home/ad/ovito/Ovito.app/Contents/MacOS/ovitos <name-of-your-script.py> `
-Constanze

217
##### Support Forum / Re: Problem in executing OVITOS
« on: October 04, 2018, 07:26:43 PM »
Hi,
just to confirm, you followed these instructions?
Could you tell me how you ran the example script?

-Constanze

218
##### Support Forum / Re: Loading the dump file error in python script
« on: October 04, 2018, 05:14:17 PM »
My guess is that "ovito.py" is a script you wrote and it's in the same folder as "velocity.py"? If that's the case, note that this file might be mistaken for the actual ovito module when you call
Code: [Select]
`import ovito`and that's what causes the error. (Read more on python modules here).
You should better rename it to something else.

219
##### Support Forum / Re: Average Quaternions for Each Grain
« on: October 04, 2018, 05:00:57 PM »
Thank you Peter!

220
##### Support Forum / Re: Loading the dump file error in python script
« on: October 04, 2018, 02:03:44 PM »
Hello jatink,

as for your previous reply, yes in principle you're right, except for the part about not being able to load input data when invoking "Run python script" from the GUI, but you would need to call add_to_scene() to make it appear in your viewports. More on this in the first highlighted box in this Manual entry about importing files:
http://ovito.org/manual_testing/python/introduction/file_io.html.

I can't really make sense of your error message though. Did you maybe accidentally install several instances of OVITO? Also can you tell me what this file is?
Quote

-Constanze

221
##### Support Forum / Re: Trying to find Certain types of structure in the cell
« on: October 04, 2018, 01:27:34 PM »
Hi Nirmal,

what you're asking for is actually available as an example script in the manual, so you should give a try:
http://ovito.org/manual/python/introduction/examples.html.

-Constanze

222
##### Support Forum / Re: Loading the dump file error in python script
« on: October 03, 2018, 08:24:54 PM »
Hello jatink,

you don't have to build it from source. The python scripting interface comes with the OVITO package.
From your error message I can see you're using MacOS. If you right click on the OVITO-icon in your applications folder and choose "Show package Content", you can see that "ovitos" is in the subfolder "MacOS".

So from the terminal, you can call it like this:

Code: [Select]
`/Applications/Ovito.app/Contents/MacOS/ovitos `
Code: [Select]
` export PATH=/Applications/Ovito.app/Contents/MacOS/:\$PATH `so you won't have to type the whole path every time.

Edit: If you're not really familiar with the Terminal app, I think this might be helpful:
https://developer.apple.com/library/archive/documentation/OpenSource/Conceptual/ShellScripting/CommandLInePrimer/CommandLine.html

-Constanze

223
##### Support Forum / Re: Python Script Loop
« on: September 29, 2018, 09:55:38 AM »
Hi jhart,
Quote
it is based on displacement distance
yes you're right, my mistake.

Quote
I want to calculate the number of atoms displaced by more than 0.8 Angstroms.
Then you could count them and save them as global attribute -  basically what you already did in your previous script.

Code: [Select]
`for file in sorted(glob.glob('../*.dump')):    node = import_file(file, multiple_frames=True)    node.modifiers.append(SelectExpressionModifier(expression = 'c_disp_4_>0.8'))    data = node.compute()    node.output.attributes['n_atoms'] = np.count_nonzero(data.particle_properties["Selection"].array)    export_file( node, "natoms_{}.txt".format(file[-10:-7]), "txt", columns=['Timestep', 'n_atoms'], multiple_frames=True    )`
The Select expression modifier, however, already creates a global attribute 'SelectExpression.num_selected',
(see scripting manual of the Select expression modifier). So you could also just reference that:
Code: [Select]
`for file in sorted(glob.glob('../*.dump')):    node = import_file(file, multiple_frames=True)    node.modifiers.append(SelectExpressionModifier(expression = 'c_disp_4_>0.8'))    node.compute()    export_file( node, "natoms_{}.txt".format(file[-10:-7]), "txt", columns=['Timestep', 'SelectExpression.num_selected'], multiple_frames=True    )`
Does that work for you?
-Constanze

224
##### Support Forum / Re: Loading the dump file error in python script
« on: September 28, 2018, 10:19:25 AM »
Quote
Additionally, is there a documentation explaining how to compile the ovitos in university cluster

There is no documentation for any specific cluster, however, this section in the manual describes how to compile ovito from source if necessary.
http://www.ovito.org/manual_testing/development.html
Quote
...or to access the dump files from cluster while running ovito python script in local machine?
Yes, when running on a local machine, the path to the file in the import_file() function can be a remote sftp:// URL. Have a look at the section about importing files from remote computers.

-Constanze

225
##### Support Forum / Re: Loading the dump file error in python script
« on: September 28, 2018, 09:44:39 AM »
Hi,

it looks like you copied that code snippet you posted here in a Python script modifier in the gui? This wouldn't work, since it's only meant to contain a single modifier function.
Note that what you wrote is a stand-alone batch script which you need to run from the command line, (see this section in the manual about running scripts http://ovito.org/manual/python/introduction/running.htm .

Code: [Select]
`ovitos name_of_your_script.py`
-Constanze

226
##### Support Forum / Re: Python Script Loop
« on: September 28, 2018, 09:29:50 AM »
Hi,
well you never calculated a global attribute "Displacement" that you're trying to export. You only created a selection based on the potential energy of the atoms. (This means that they now have a particle property "Selection" which is either 0 or 1. Again, what would you like to do with this selection?

-Constanze

227
##### Support Forum / Re: Python Script Loop
« on: September 26, 2018, 11:32:27 AM »
Hi,

I haven't gone through your whole script but the current error is definitely due to the naming of the variables in the expression select modifier. I tried with an expression select on an example file in the GUI version of ovito, where you can see the available particle properties in the "Variables" panel.
You should try the following:

Code: [Select]
` node.modifiers.append(SelectExpressionModifier(expression = 'c_disp_4_>0.8'))`
This will select all atoms with displacement magnitudes larger than 0.8. What would you like to do with these atoms? Let me know if you need further help.

-Constanze

228
##### Support Forum / Re: Loading the dump file error in python script
« on: September 26, 2018, 11:17:52 AM »
Dear jatin1990,

the error message is telling you that there is no file called "dump.mix" in the folder where you're executing ovitos. Are you sure that's the correct name and location etc.?

-Constanze

229
##### Support Forum / Re: Not able to visualize .CFG file in "OVITO" but the same file works with "Atomeye
« on: September 26, 2018, 10:57:00 AM »
Hi sairajdream,

I also tried and could open your file without any problem. Could you please upload your file here instead of just copying the text, because the latter one seems to be perfectly fine.

-Constanze

230
##### Support Forum / Re: Von Mises Stress
« on: September 20, 2018, 12:29:25 PM »
This doesn't answer my question. How do you want to save the information you calculated?

Besides, if your lammps command worked (I guess it's because the correct variable style should be atom not equal), the quantity VMS would also be a part of your dump file since it's a per-atom quantity. So now that you've calculated that with OVITO, why don't you append that new information as additional column to your .dump files?

However, the sum of all the per-atom values you compute for every snapshot and save as global attribute is something you could export as *.txt file, like you tried above.

231
##### Support Forum / Re: Von Mises Stress
« on: September 20, 2018, 11:50:22 AM »
That's what I meant with line 7 in your python script doesn't make much sense. Global attributes are not meant to save arrays.

Why don't you export the atomic von Mises stresses via the file-export formats *.dump"  or ".xyz"? Then you don't need that python script modifier at all.

Maybe you can explain how you want your output file to look like, because I'm having trouble understanding the issue.

232
##### Support Forum / Re: Von Mises Stress
« on: September 20, 2018, 10:51:50 AM »
If you want to sum up only the z-component of your stress tensor you can do:
Code: [Select]
`numpy.sum( input.particles["Stress Tensor"][:,2] )`

233
##### Support Forum / Re: Von Mises Stress
« on: September 20, 2018, 10:44:14 AM »
Code: [Select]
`numpy.sum(Von_Mises)` sums up all the atomic von Mises stresses.
See https://docs.scipy.org/doc/numpy/reference/generated/numpy.sum.html

234
##### Support Forum / Re: Von Mises Stress
« on: September 20, 2018, 10:06:40 AM »
Amir,

it's not an error, you trying to print a particle property object and that's what it does.
Try e.g.
Code: [Select]
`print(Von_Mises[...])`to print all the values in the von_Mises array,
or
Code: [Select]
`print(Von_Mises[0])`to print the first one.

Just so you know you didn't have to change the name of your particle property "Von Mises Stress",
Code: [Select]
`input.particles["Von Mises Stress"]`Blank spaces in strings (enclosed by " ")  are fine. But since you apparently also changed it in the Compute property modifier that of course also works.

In line 7 you're saving the whole particle property object as a global attribute, which works but is probably not what you wanted to do.

-Constanze

235
##### Support Forum / Re: Von Mises Stress
« on: September 20, 2018, 08:10:09 AM »
Also in line 6 you‘re calling the particle property „Selection“, which I can see from your screenshot doesn’t exist. You can remove that line.
Also what are you trying to achieve with line 7?

236
##### Support Forum / Re: Von Mises Stress
« on: September 20, 2018, 08:04:49 AM »
Hi Amir,

the error is due to the way you’re trying to define variables.
You can’t use blank spaces, rather use „-„ or „_“.

Code: [Select]
`von_Mises = ...von_Mises_Stress = ...`
-Constanze

237
##### Support Forum / Re: Exporting data
« on: September 19, 2018, 05:57:44 PM »
But if you simply want to compute the strain from the length-change of your simulation cell, e.g. in z-direction, you could use a python script modifier function like this one:
Code: [Select]
`from ovito.data import *import ovitol0 = ovito.scene.selected_pipeline.source.compute(0).cell[2][2]def modify(frame, input, output):    cell = input.expect(SimulationCell)    print(cell)    output.attributes["Strain"] = (cell[2][2] - l0)/l0    `

238
##### Support Forum / Re: Exporting data
« on: September 19, 2018, 05:42:07 PM »
In case you are just getting familiar with python, here's how you could reference the z component of the per-atom stress and strain tensors.
Code: [Select]
`strain_zz = input.particles["Strain Tensor"][:,2]stress_zz = input.particles["Stress Tensor"][:,2]`
To calculate the strain tensor activate the option "Output strain tensors" in the Atomic strain modifier.

239
##### Support Forum / Re: Particles
« on: September 19, 2018, 01:36:58 PM »
OVITO currently has the following file export functions:

1) Either you can export a selection of particles along with their properties, like e.g. the atomic stresses. If you choose the *.dump or *.xyz format as export file format you can select which particle-properties you want to export, e.g. only the Stress Tensor (see screenshot 1).

2) Global attributes like the total strain and stress (which you probably first need to calculate using a Python script modifier as explained above) can be exported as well. Simply choose "Table of values" as export file format (see screenshot 2).

-Constanze

240
##### Support Forum / Re: Particles
« on: September 19, 2018, 12:06:26 PM »
Amir,
it's not clear what you mean by "tension in different strains" and "copy" the data. What you where trying to reference in your first screenshot as StressTensor.ZZ is a per-atom information, not the total stress.
If you're trying to calculate the total stress and strain you can do so, e.g. with a python script modifier. This has been explained here:

http://forum.ovito.org/index.php?topic=376.0

Still, the file-export is the way to go to export the time-evolution these quantities.

-Constanze

Pages: 1 ... 6 7 [8] 9 10