Forum Navigation
You need to log in to create posts and topics.

problem about output file formats

Hello, I find that ovito will write the Masses message by choosing output file in lammps/data format. I just want to prohibit it. How i modify the format  of ovito?

Hi,

In the current program version there is no way to influence the standard behaviour of the LAMMPS data file writer. The latest OVITO version will write the "Masses" file section if (and only if) at least one of the atom types has a non-zero mass. Do you know if this is the case? Typically it will be the case if the atom types were read from an input LAMMPS data file containing mass information.

One possible solution to suppress the output of the masses section during export is to set all masses to zero in OVITO. This can be accomplished using a Python modifier function. We can show you how if you like.

-Alex

Thanks for your suggestions, and I will upgrade my ovito's verdion soon. Just standing from my poins, Lammps will automaticly evaluate the atom masses according to particles type or guys can specify them by using Lammps commands in input file. And most of the times, the "Masses" file are net necessary written in Lammpa data file, if the potentials contains the elememt messages.

For convenient, I hope the next version will provid a choice of whether writtering "Masses" .
Anyway, Python modifier function or Python code is not the best choice, I think.

Thanks

I have added an option to the LAMMPS data file exporter in the latest program build 3.0.0-dev794, which allows you to control whether the "Masses" section is included in the output file or not.

Hello, I still have a question.

 I tried to modify the 'mass' of atom by using python script in Ovito software. but the error message is as following. please show me how should i do.

I write the modify function as following:

##########################################

def modify(frame, data):
  if data.particles != None:
       types = data.particles_.particle_types
       with types:
               types.type_by_id(1).mass = 0

##########################################

I meet the error message is : Please explicitly request a mutable version of the property by using the '_' notation

I am confused that OVITO set the atoms' mass as 0 in default, but the latest program build 3.0.0-dev794 still write 'mass' lines in Lammps/dat format.

Maybe I am just so lazy to modify the data by installing ovito module in my Python interpreter.

thanks

 

Setting the particle type masses to zero in a user-defined modifier function should be done as follows:

def modify(frame, data):
    type_property = data.particles_.particle_types_
    for type in type_property.types:
        type = type_property.make_mutable(type)
        type.mass = 0 

In line 2 the underscore notation is used to request a modifiable copy of the "Particle Type" particle property. The for-loop then visits all ParticleType instances attached to this particle property. Calling the make_mutable() method is necessary to create a modifiable copy of each ParticleType instance before actually changing it.

Setting all mass values to zero should suffice to avoid the "Masses" section in the output LAMMPS data file written by OVITO. Note that the particle type masses will have non-zero values in the first place if the dataset is imported from a LAMMPS data file containing the "Masses" section. In contrast, if the dataset is loaded from a different file format, or if the ParticleType instances are created programatically within OVITO, then their mass fields will be initialized to the default value 0.0.

Since OVITO build 3.0.0-dev794, the export_file() Python function supports the omit_masses=True keyword parameter (see docs), which will leave out the "Masses" section in the output data file even if the particle types have non-zero masses set. Thus, resetting the masses to zero using the user-defined modifier function above should no longer be necessary.