type label support for dump xyz
This commit is contained in:
@ -470,8 +470,9 @@ followed by one line per atom with the atom type and the :math:`x`-,
|
|||||||
:math:`y`-, and :math:`z`-coordinate of that atom. You can use the
|
:math:`y`-, and :math:`z`-coordinate of that atom. You can use the
|
||||||
:doc:`dump_modify element <dump_modify>` option to change the output
|
:doc:`dump_modify element <dump_modify>` option to change the output
|
||||||
from using the (numerical) atom type to an element name (or some other
|
from using the (numerical) atom type to an element name (or some other
|
||||||
label). This will help many visualization programs to guess bonds and
|
label). This option will help many visualization programs to guess bonds
|
||||||
colors.
|
and colors. You can use the :doc:`dump_modify types labels <dump_modify>`
|
||||||
|
option to replace numeric atom types with :doc:`type labels <Howto_type_labels>`.
|
||||||
|
|
||||||
.. versionadded:: 22Dec2022
|
.. versionadded:: 22Dec2022
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ Syntax
|
|||||||
* one or more keyword/value pairs may be appended
|
* one or more keyword/value pairs may be appended
|
||||||
|
|
||||||
* these keywords apply to various dump styles
|
* these keywords apply to various dump styles
|
||||||
* keyword = *append* or *at* or *balance* or *buffer* or *colname* or *delay* or *element* or *every* or *every/time* or *fileper* or *first* or *flush* or *format* or *header* or *image* or *label* or *maxfiles* or *nfile* or *pad* or *pbc* or *precision* or *region* or *refresh* or *scale* or *sfactor* or *skip* or *sort* or *tfactor* or *thermo* or *thresh* or *time* or *triclinic/general* or *units* or *unwrap*
|
* keyword = *append* or *at* or *balance* or *buffer* or *colname* or *delay* or *element* or *every* or *every/time* or *fileper* or *first* or *flush* or *format* or *header* or *image* or *label* or *maxfiles* or *nfile* or *pad* or *pbc* or *precision* or *region* or *refresh* or *scale* or *sfactor* or *skip* or *sort* or *tfactor* or *thermo* or *thresh* or *time* or *triclinic/general* or *types* or *units* or *unwrap*
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
@ -81,6 +81,7 @@ Syntax
|
|||||||
these 3 args can be replaced by the word "none" to turn off thresholding
|
these 3 args can be replaced by the word "none" to turn off thresholding
|
||||||
*time* arg = *yes* or *no*
|
*time* arg = *yes* or *no*
|
||||||
*triclinic/general* arg = *yes* or *no*
|
*triclinic/general* arg = *yes* or *no*
|
||||||
|
*types* value = *numeric* or *labels*
|
||||||
*units* arg = *yes* or *no*
|
*units* arg = *yes* or *no*
|
||||||
*unwrap* arg = *yes* or *no*
|
*unwrap* arg = *yes* or *no*
|
||||||
|
|
||||||
@ -849,6 +850,13 @@ The default setting is *no*\ .
|
|||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
The *types* keyword applies only to the dump xyz style. If this keyword is
|
||||||
|
used with a value of *numeric*, then numeric atom types are printed in the
|
||||||
|
xyz file (default). If the value *labels* is specified, then
|
||||||
|
:doc:`type labels <Howto_type_labels>` are printed for atom types.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
The *triclinic/general* keyword only applies to the dump *atom* and
|
The *triclinic/general* keyword only applies to the dump *atom* and
|
||||||
*custom* styles. It can only be used with a value of *yes* if the
|
*custom* styles. It can only be used with a value of *yes* if the
|
||||||
simulation box was created as a general triclinic box. See the
|
simulation box was created as a general triclinic box. See the
|
||||||
@ -960,11 +968,11 @@ The option defaults are
|
|||||||
* sort = id for dump styles *dcd*, *xtc*, and *xyz*
|
* sort = id for dump styles *dcd*, *xtc*, and *xyz*
|
||||||
* thresh = none
|
* thresh = none
|
||||||
* time = no
|
* time = no
|
||||||
* triclinic/general no
|
* triclinic/general = no
|
||||||
|
* types = numeric
|
||||||
* units = no
|
* units = no
|
||||||
* unwrap = no
|
* unwrap = no
|
||||||
|
|
||||||
* compression_level = 9 (gz variants)
|
* compression_level = 9 (gz variants)
|
||||||
* compression_level = 0 (zstd variants)
|
* compression_level = 0 (zstd variants)
|
||||||
* checksum = yes (zstd variants)
|
* checksum = yes (zstd variants)
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "label_map.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
@ -122,6 +123,32 @@ int DumpXYZ::modify_param(int narg, char **arg)
|
|||||||
return ntypes+1;
|
return ntypes+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(arg[0],"types") == 0) {
|
||||||
|
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
||||||
|
if (strcmp(arg[1],"numeric") == 0) {
|
||||||
|
return 2;
|
||||||
|
} else if (strcmp(arg[1],"labels") == 0) {
|
||||||
|
if (!atom->labelmapflag)
|
||||||
|
error->all(FLERR, "Label map must be defined when using 'types labels'");
|
||||||
|
} else error->all(FLERR, "Illegal option for dump_modify 'types' keyword");
|
||||||
|
|
||||||
|
|
||||||
|
if (typenames) {
|
||||||
|
for (int i = 1; i <= ntypes; i++)
|
||||||
|
delete [] typenames[i];
|
||||||
|
|
||||||
|
delete [] typenames;
|
||||||
|
typenames = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
typenames = new char*[ntypes+1];
|
||||||
|
for (int itype = 1; itype <= ntypes; itype++) {
|
||||||
|
typenames[itype] = utils::strdup(atom->lmap->typelabel[itype-1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ namespace LAMMPS_NS {
|
|||||||
|
|
||||||
class LabelMap : protected Pointers {
|
class LabelMap : protected Pointers {
|
||||||
friend class AtomVec;
|
friend class AtomVec;
|
||||||
|
friend class DumpXYZ;
|
||||||
friend class ReadData;
|
friend class ReadData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user