whitespace fixes
This commit is contained in:
@ -20,7 +20,7 @@ Syntax
|
|||||||
*model* values = style Nelems Nparams
|
*model* values = style Nelems Nparams
|
||||||
style = *linear* or *quadratic*
|
style = *linear* or *quadratic*
|
||||||
Nelems = number of elements
|
Nelems = number of elements
|
||||||
Nparams = number of parameters per element
|
Nparams = number of parameters per element
|
||||||
*descriptor* values = style filename
|
*descriptor* values = style filename
|
||||||
style = *sna*
|
style = *sna*
|
||||||
filename = name of file containing descriptor definitions
|
filename = name of file containing descriptor definitions
|
||||||
@ -36,25 +36,25 @@ Description
|
|||||||
"""""""""""
|
"""""""""""
|
||||||
|
|
||||||
Compute style *mliap* provides a general interface to the gradient
|
Compute style *mliap* provides a general interface to the gradient
|
||||||
of machine-learning interatomic potentials w.r.t. model parameters.
|
of machine-learning interatomic potentials w.r.t. model parameters.
|
||||||
It is used primarily for calculating the gradient of energy, force, and
|
It is used primarily for calculating the gradient of energy, force, and
|
||||||
stress components w.r.t. model parameters, which is useful when training
|
stress components w.r.t. model parameters, which is useful when training
|
||||||
:doc:`mliap pair_style <pair_mliap>` models to match target data.
|
:doc:`mliap pair_style <pair_mliap>` models to match target data.
|
||||||
It provides separate
|
It provides separate
|
||||||
definitions of the interatomic potential functional form (*model*)
|
definitions of the interatomic potential functional form (*model*)
|
||||||
and the geometric quantities that characterize the atomic positions
|
and the geometric quantities that characterize the atomic positions
|
||||||
(*descriptor*). By defining *model* and *descriptor* separately,
|
(*descriptor*). By defining *model* and *descriptor* separately,
|
||||||
it is possible to use many different models with a given descriptor,
|
it is possible to use many different models with a given descriptor,
|
||||||
or many different descriptors with a given model. Currently, the
|
or many different descriptors with a given model. Currently, the
|
||||||
compute supports just two models, *linear* and *quadratic*,
|
compute supports just two models, *linear* and *quadratic*,
|
||||||
and one descriptor, *sna*, the SNAP descriptor used by
|
and one descriptor, *sna*, the SNAP descriptor used by
|
||||||
:doc:`pair_style snap <pair_snap>`, including the linear, quadratic,
|
:doc:`pair_style snap <pair_snap>`, including the linear, quadratic,
|
||||||
and chem variants. Work is currently underway to extend
|
and chem variants. Work is currently underway to extend
|
||||||
the interface to handle neural network energy models,
|
the interface to handle neural network energy models,
|
||||||
and it is also straightforward to add new descriptor styles.
|
and it is also straightforward to add new descriptor styles.
|
||||||
|
|
||||||
The compute *mliap* command must be followed by two keywords
|
The compute *mliap* command must be followed by two keywords
|
||||||
*model* and *descriptor* in either order.
|
*model* and *descriptor* in either order.
|
||||||
|
|
||||||
The *model* keyword is followed by a model style, currently limited to
|
The *model* keyword is followed by a model style, currently limited to
|
||||||
either *linear* or *quadratic*. In both cases,
|
either *linear* or *quadratic*. In both cases,
|
||||||
@ -62,25 +62,25 @@ this is followed by two arguments. *nelems* is the number of elements.
|
|||||||
It must be equal to the number of LAMMPS atom types. *nparams*
|
It must be equal to the number of LAMMPS atom types. *nparams*
|
||||||
is the number of parameters per element for this model i.e.
|
is the number of parameters per element for this model i.e.
|
||||||
the number of parameter gradients for each element. Note these definitions
|
the number of parameter gradients for each element. Note these definitions
|
||||||
are identical to those of *nelems* and *nparams* in the
|
are identical to those of *nelems* and *nparams* in the
|
||||||
:doc:`pair_style mliap <pair_mliap>` model file.
|
:doc:`pair_style mliap <pair_mliap>` model file.
|
||||||
|
|
||||||
The *descriptor* keyword is followed by a descriptor style, and additional arguments.
|
The *descriptor* keyword is followed by a descriptor style, and additional arguments.
|
||||||
Currently the only descriptor style is *sna*, indicating the bispectrum component
|
Currently the only descriptor style is *sna*, indicating the bispectrum component
|
||||||
descriptors used by the Spectral Neighbor Analysis Potential (SNAP) potentials of
|
descriptors used by the Spectral Neighbor Analysis Potential (SNAP) potentials of
|
||||||
:doc:`pair_style snap <pair_snap>`.
|
:doc:`pair_style snap <pair_snap>`.
|
||||||
The \'p\' in SNAP is dropped, because keywords that match pair_styles are silently stripped
|
The \'p\' in SNAP is dropped, because keywords that match pair_styles are silently stripped
|
||||||
out by the LAMMPS command parser. A single additional argument specifies the descriptor filename
|
out by the LAMMPS command parser. A single additional argument specifies the descriptor filename
|
||||||
containing the parameters and setting used by the SNAP descriptor.
|
containing the parameters and setting used by the SNAP descriptor.
|
||||||
The descriptor filename usually ends in the *.mliap.descriptor* extension.
|
The descriptor filename usually ends in the *.mliap.descriptor* extension.
|
||||||
The format of this file is identical to the descriptor file in the
|
The format of this file is identical to the descriptor file in the
|
||||||
:doc:`pair_style mliap <pair_mliap>`, and is described in detail
|
:doc:`pair_style mliap <pair_mliap>`, and is described in detail
|
||||||
there.
|
there.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
The number of LAMMPS atom types (and the value of *nelems* in the model)
|
The number of LAMMPS atom types (and the value of *nelems* in the model)
|
||||||
must match the value of *nelems* in the descriptor file.
|
must match the value of *nelems* in the descriptor file.
|
||||||
|
|
||||||
Compute *mliap* calculates a global array containing gradient information.
|
Compute *mliap* calculates a global array containing gradient information.
|
||||||
The number of columns in the array is :math:`nelems \times nparams + 1`.
|
The number of columns in the array is :math:`nelems \times nparams + 1`.
|
||||||
@ -89,9 +89,9 @@ each parameter and each element. The last six rows
|
|||||||
of the array contain the corresponding derivatives of the
|
of the array contain the corresponding derivatives of the
|
||||||
virial stress tensor, listed in Voigt notation: *pxx*, *pyy*, *pzz*,
|
virial stress tensor, listed in Voigt notation: *pxx*, *pyy*, *pzz*,
|
||||||
*pyz*, *pxz*, *pxy*. In between the energy and stress rows are
|
*pyz*, *pxz*, *pxy*. In between the energy and stress rows are
|
||||||
the 3\*\ *N* rows containing the derivatives of the force components.
|
the 3\*\ *N* rows containing the derivatives of the force components.
|
||||||
See section below on output for a detailed description of how
|
See section below on output for a detailed description of how
|
||||||
rows and columns are ordered.
|
rows and columns are ordered.
|
||||||
|
|
||||||
The element in the last column of each row contains
|
The element in the last column of each row contains
|
||||||
the potential energy, force, or stress, according to the row.
|
the potential energy, force, or stress, according to the row.
|
||||||
@ -109,7 +109,7 @@ command:
|
|||||||
See section below on output for a detailed explanation of the data
|
See section below on output for a detailed explanation of the data
|
||||||
layout in the global array.
|
layout in the global array.
|
||||||
|
|
||||||
Atoms not in the group do not contribute to this compute.
|
Atoms not in the group do not contribute to this compute.
|
||||||
Neighbor atoms not in the group do not contribute to this compute.
|
Neighbor atoms not in the group do not contribute to this compute.
|
||||||
The neighbor list needed to compute this quantity is constructed each
|
The neighbor list needed to compute this quantity is constructed each
|
||||||
time the calculation is performed (i.e. each time a snapshot of atoms
|
time the calculation is performed (i.e. each time a snapshot of atoms
|
||||||
@ -120,7 +120,7 @@ too frequently.
|
|||||||
|
|
||||||
If the user-specified reference potentials includes bonded and
|
If the user-specified reference potentials includes bonded and
|
||||||
non-bonded pairwise interactions, then the settings of
|
non-bonded pairwise interactions, then the settings of
|
||||||
:doc:`special_bonds <special_bonds>` command can remove pairwise
|
:doc:`special_bonds <special_bonds>` command can remove pairwise
|
||||||
interactions between atoms in the same bond, angle, or dihedral. This
|
interactions between atoms in the same bond, angle, or dihedral. This
|
||||||
is the default setting for the :doc:`special_bonds <special_bonds>`
|
is the default setting for the :doc:`special_bonds <special_bonds>`
|
||||||
command, and means those pairwise interactions do not appear in the
|
command, and means those pairwise interactions do not appear in the
|
||||||
@ -128,7 +128,7 @@ too frequently.
|
|||||||
those pairs will not be included in the calculation. The :doc:`rerun <rerun>`
|
those pairs will not be included in the calculation. The :doc:`rerun <rerun>`
|
||||||
command is not an option here, since the reference potential is required
|
command is not an option here, since the reference potential is required
|
||||||
for the last column of the global array. A work-around is to prevent
|
for the last column of the global array. A work-around is to prevent
|
||||||
pairwise interactions from being removed by explicitly adding a
|
pairwise interactions from being removed by explicitly adding a
|
||||||
*tiny* positive value for every pairwise interaction that would otherwise be
|
*tiny* positive value for every pairwise interaction that would otherwise be
|
||||||
set to zero in the :doc:`special_bonds <special_bonds>` command.
|
set to zero in the :doc:`special_bonds <special_bonds>` command.
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ too frequently.
|
|||||||
Compute *mliap* evaluates a global array.
|
Compute *mliap* evaluates a global array.
|
||||||
The columns are arranged into
|
The columns are arranged into
|
||||||
*nelems* blocks, listed in order of element *I*\ . Each block
|
*nelems* blocks, listed in order of element *I*\ . Each block
|
||||||
contains one column for each of the *nparams* model parameters.
|
contains one column for each of the *nparams* model parameters.
|
||||||
A final column contains the corresponding energy, force component
|
A final column contains the corresponding energy, force component
|
||||||
on an atom, or virial stress component. The rows of the array appear
|
on an atom, or virial stress component. The rows of the array appear
|
||||||
in the following order:
|
in the following order:
|
||||||
|
|||||||
@ -392,7 +392,7 @@ of :math:`K N_{elem}^3` columns.
|
|||||||
These values can be accessed by any command that uses per-atom values
|
These values can be accessed by any command that uses per-atom values
|
||||||
from a compute as input. See the :doc:`Howto output <Howto_output>` doc
|
from a compute as input. See the :doc:`Howto output <Howto_output>` doc
|
||||||
page for an overview of LAMMPS output options. To see how this command
|
page for an overview of LAMMPS output options. To see how this command
|
||||||
can be used within a Python workflow to train SNAP potentials,
|
can be used within a Python workflow to train SNAP potentials,
|
||||||
see the examples in `FitSNAP <https://github.com/FitSNAP/FitSNAP>`_.
|
see the examples in `FitSNAP <https://github.com/FitSNAP/FitSNAP>`_.
|
||||||
|
|
||||||
Restrictions
|
Restrictions
|
||||||
|
|||||||
@ -7,20 +7,20 @@
|
|||||||
.. index:: pair_style lj/cut/coul/debye/kk
|
.. index:: pair_style lj/cut/coul/debye/kk
|
||||||
.. index:: pair_style lj/cut/coul/debye/omp
|
.. index:: pair_style lj/cut/coul/debye/omp
|
||||||
.. index:: pair_style lj/cut/coul/dsf
|
.. index:: pair_style lj/cut/coul/dsf
|
||||||
.. index:: pair_style lj/cut/coul/dsf/gpu
|
.. index:: pair_style lj/cut/coul/dsf/gpu
|
||||||
.. index:: pair_style lj/cut/coul/dsf/kk
|
.. index:: pair_style lj/cut/coul/dsf/kk
|
||||||
.. index:: pair_style lj/cut/coul/dsf/omp
|
.. index:: pair_style lj/cut/coul/dsf/omp
|
||||||
.. index:: pair_style lj/cut/coul/long
|
.. index:: pair_style lj/cut/coul/long
|
||||||
.. index:: pair_style lj/cut/coul/long/gpu
|
.. index:: pair_style lj/cut/coul/long/gpu
|
||||||
.. index:: pair_style lj/cut/coul/long/kk
|
.. index:: pair_style lj/cut/coul/long/kk
|
||||||
.. index:: pair_style lj/cut/coul/long/intel
|
.. index:: pair_style lj/cut/coul/long/intel
|
||||||
.. index:: pair_style lj/cut/coul/long/opt
|
.. index:: pair_style lj/cut/coul/long/opt
|
||||||
.. index:: pair_style lj/cut/coul/long/omp
|
.. index:: pair_style lj/cut/coul/long/omp
|
||||||
.. index:: pair_style lj/cut/coul/msm
|
.. index:: pair_style lj/cut/coul/msm
|
||||||
.. index:: pair_style lj/cut/coul/msm/gpu
|
.. index:: pair_style lj/cut/coul/msm/gpu
|
||||||
.. index:: pair_style lj/cut/coul/msm/omp
|
.. index:: pair_style lj/cut/coul/msm/omp
|
||||||
.. index:: pair_style lj/cut/coul/wolf
|
.. index:: pair_style lj/cut/coul/wolf
|
||||||
.. index:: pair_style lj/cut/coul/wolf/omp
|
.. index:: pair_style lj/cut/coul/wolf/omp
|
||||||
|
|
||||||
pair_style lj/cut/coul/cut command
|
pair_style lj/cut/coul/cut command
|
||||||
==================================
|
==================================
|
||||||
@ -234,7 +234,7 @@ LJ and Coulombic cutoffs specified in the pair_style command are used.
|
|||||||
If only one cutoff is specified, it is used as the cutoff for both LJ
|
If only one cutoff is specified, it is used as the cutoff for both LJ
|
||||||
and Coulombic interactions for this type pair. If both coefficients
|
and Coulombic interactions for this type pair. If both coefficients
|
||||||
are specified, they are used as the LJ and Coulombic cutoffs for this
|
are specified, they are used as the LJ and Coulombic cutoffs for this
|
||||||
type pair.
|
type pair.
|
||||||
|
|
||||||
For *lj/cut/coul/long* and *lj/cut/coul/msm* only the LJ cutoff can be
|
For *lj/cut/coul/long* and *lj/cut/coul/msm* only the LJ cutoff can be
|
||||||
specified since a Coulombic cutoff cannot be specified for an individual I,J
|
specified since a Coulombic cutoff cannot be specified for an individual I,J
|
||||||
|
|||||||
@ -34,8 +34,8 @@ Examples
|
|||||||
Description
|
Description
|
||||||
"""""""""""
|
"""""""""""
|
||||||
|
|
||||||
Pair style *mliap* provides a general interface to families of
|
Pair style *mliap* provides a general interface to families of
|
||||||
machine-learning interatomic potentials. It allows separate
|
machine-learning interatomic potentials. It allows separate
|
||||||
definitions of the interatomic potential functional form (*model*)
|
definitions of the interatomic potential functional form (*model*)
|
||||||
and the geometric quantities that characterize the atomic positions
|
and the geometric quantities that characterize the atomic positions
|
||||||
(*descriptor*). By defining *model* and *descriptor* separately,
|
(*descriptor*). By defining *model* and *descriptor* separately,
|
||||||
@ -61,8 +61,8 @@ where N is the number of LAMMPS atom types.
|
|||||||
|
|
||||||
The *model* keyword is followed by a model style, currently limited to
|
The *model* keyword is followed by a model style, currently limited to
|
||||||
either *linear* or *quadratic*. In both cases,
|
either *linear* or *quadratic*. In both cases,
|
||||||
this is followed by a single argument specifying the model filename containing the
|
this is followed by a single argument specifying the model filename containing the
|
||||||
parameters for a set of elements.
|
parameters for a set of elements.
|
||||||
The model filename usually ends in the *.mliap.model* extension.
|
The model filename usually ends in the *.mliap.model* extension.
|
||||||
It may contain parameters for many elements. The only requirement is that it
|
It may contain parameters for many elements. The only requirement is that it
|
||||||
contain at least those element names appearing in the
|
contain at least those element names appearing in the
|
||||||
|
|||||||
@ -213,7 +213,7 @@ int BodyNparticle::pack_data_body(tagint atomID, int ibonus, double *buf)
|
|||||||
int nsub = ivalue[0];
|
int nsub = ivalue[0];
|
||||||
|
|
||||||
if (buf) {
|
if (buf) {
|
||||||
|
|
||||||
// ID ninteger ndouble
|
// ID ninteger ndouble
|
||||||
|
|
||||||
m = 0;
|
m = 0;
|
||||||
@ -222,7 +222,7 @@ int BodyNparticle::pack_data_body(tagint atomID, int ibonus, double *buf)
|
|||||||
buf[m++] = ubuf(6 + 3*nsub).d;
|
buf[m++] = ubuf(6 + 3*nsub).d;
|
||||||
|
|
||||||
// single integer Nsub
|
// single integer Nsub
|
||||||
|
|
||||||
buf[m++] = ubuf(nsub).d;
|
buf[m++] = ubuf(nsub).d;
|
||||||
|
|
||||||
// 6 moments of inertia
|
// 6 moments of inertia
|
||||||
@ -239,7 +239,7 @@ int BodyNparticle::pack_data_body(tagint atomID, int ibonus, double *buf)
|
|||||||
buf[m++] = ispace[1][2];
|
buf[m++] = ispace[1][2];
|
||||||
|
|
||||||
// 3*Nsub particle coords = displacement from COM in box frame
|
// 3*Nsub particle coords = displacement from COM in box frame
|
||||||
|
|
||||||
for (int i = 0; i < nsub; i++) {
|
for (int i = 0; i < nsub; i++) {
|
||||||
MathExtra::matvec(p,&dvalue[3*i],values);
|
MathExtra::matvec(p,&dvalue[3*i],values);
|
||||||
buf[m++] = values[0];
|
buf[m++] = values[0];
|
||||||
@ -248,7 +248,7 @@ int BodyNparticle::pack_data_body(tagint atomID, int ibonus, double *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else m = 3 + 1 + 6 + 3*nsub;
|
} else m = 3 + 1 + 6 + 3*nsub;
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,10 +272,10 @@ int BodyNparticle::write_data_body(FILE *fp, double *buf)
|
|||||||
fmt::print(fp,"{} {} {} {} {} {}\n",
|
fmt::print(fp,"{} {} {} {} {} {}\n",
|
||||||
inertia[0],inertia[1],inertia[2],inertia[3],inertia[4],inertia[5]);
|
inertia[0],inertia[1],inertia[2],inertia[3],inertia[4],inertia[5]);
|
||||||
m += 6;
|
m += 6;
|
||||||
|
|
||||||
for (int i = 0; i < nsub; i++)
|
for (int i = 0; i < nsub; i++)
|
||||||
fmt::print(fp,"{} {} {}\n",buf[m++],buf[m++],buf[m++]);
|
fmt::print(fp,"{} {} {}\n",buf[m++],buf[m++],buf[m++]);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
This package provides a general interface to families of
|
This package provides a general interface to families of
|
||||||
machine-learning interatomic potentials (MLIAPs). This interface consists
|
machine-learning interatomic potentials (MLIAPs). This interface consists
|
||||||
of a mliap pair style and a mliap compute.
|
of a mliap pair style and a mliap compute.
|
||||||
|
|
||||||
The mliap pair style is used when running simulations with energies and
|
The mliap pair style is used when running simulations with energies and
|
||||||
forces calculated by an MLIAP. The interface allows separate
|
forces calculated by an MLIAP. The interface allows separate
|
||||||
definitions of the interatomic potential functional form (*model*)
|
definitions of the interatomic potential functional form (*model*)
|
||||||
and the geometric quantities that characterize the atomic positions
|
and the geometric quantities that characterize the atomic positions
|
||||||
(*descriptor*). By defining *model* and *descriptor* separately,
|
(*descriptor*). By defining *model* and *descriptor* separately,
|
||||||
it is possible to use many different models with a given descriptor,
|
it is possible to use many different models with a given descriptor,
|
||||||
or many different descriptors with a given model. Currently, the pair_style
|
or many different descriptors with a given model. Currently, the pair_style
|
||||||
supports just two models, *linear* and *quadratic*,
|
supports just two models, *linear* and *quadratic*,
|
||||||
and one descriptor, *sna*, the SNAP descriptor, including the
|
and one descriptor, *sna*, the SNAP descriptor, including the
|
||||||
linear, quadratic, and chem variants. Work is currently underway to extend
|
linear, quadratic, and chem variants. Work is currently underway to extend
|
||||||
the interface to handle neural network energy models,
|
the interface to handle neural network energy models,
|
||||||
and it is also straightforward to add new descriptor styles.
|
and it is also straightforward to add new descriptor styles.
|
||||||
@ -22,8 +22,8 @@ Any *model or *descriptor* that has been implemented for the
|
|||||||
*mliap* pair style can also be accessed by the *mliap* compute.
|
*mliap* pair style can also be accessed by the *mliap* compute.
|
||||||
In addition to the energy, force, and stress gradients, w.r.t.
|
In addition to the energy, force, and stress gradients, w.r.t.
|
||||||
each *model* parameter, the compute also calculates the energy,
|
each *model* parameter, the compute also calculates the energy,
|
||||||
force, and stress contributions from a user-specified
|
force, and stress contributions from a user-specified
|
||||||
reference potential.
|
reference potential.
|
||||||
|
|
||||||
To see how this command
|
To see how this command
|
||||||
can be used within a Python workflow to train machine-learning interatomic
|
can be used within a Python workflow to train machine-learning interatomic
|
||||||
|
|||||||
@ -35,7 +35,7 @@ enum{SCALAR,VECTOR,ARRAY};
|
|||||||
|
|
||||||
ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
|
ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Compute(lmp, narg, arg), list(NULL), mliap(NULL),
|
Compute(lmp, narg, arg), list(NULL), mliap(NULL),
|
||||||
gradforce(NULL), mliapall(NULL), map(NULL),
|
gradforce(NULL), mliapall(NULL), map(NULL),
|
||||||
descriptors(NULL), gamma_row_index(NULL), gamma_col_index(NULL),
|
descriptors(NULL), gamma_row_index(NULL), gamma_col_index(NULL),
|
||||||
gamma(NULL), egradient(NULL), model(NULL), descriptor(NULL)
|
gamma(NULL), egradient(NULL), model(NULL), descriptor(NULL)
|
||||||
{
|
{
|
||||||
@ -263,15 +263,15 @@ void ComputeMLIAP::compute_array()
|
|||||||
// i.e. gamma = d2E/dsigma_l.dB_k
|
// i.e. gamma = d2E/dsigma_l.dB_k
|
||||||
// sigma_l is a parameter and B_k is a descriptor of atom i
|
// sigma_l is a parameter and B_k is a descriptor of atom i
|
||||||
// for SNAP, this is a sparse natoms*nparams*ndescriptors matrix,
|
// for SNAP, this is a sparse natoms*nparams*ndescriptors matrix,
|
||||||
// but in general it could be fully dense.
|
// but in general it could be fully dense.
|
||||||
|
|
||||||
model->param_gradient(map, list, descriptors, gamma_row_index,
|
model->param_gradient(map, list, descriptors, gamma_row_index,
|
||||||
gamma_col_index, gamma, egradient);
|
gamma_col_index, gamma, egradient);
|
||||||
|
|
||||||
|
|
||||||
// calculate descriptor gradient contributions to parameter gradients
|
// calculate descriptor gradient contributions to parameter gradients
|
||||||
|
|
||||||
descriptor->compute_gradients(map, list, gamma_nnz, gamma_row_index,
|
descriptor->compute_gradients(map, list, gamma_nnz, gamma_row_index,
|
||||||
gamma_col_index, gamma, gradforce,
|
gamma_col_index, gamma, gradforce,
|
||||||
yoffset, zoffset);
|
yoffset, zoffset);
|
||||||
|
|
||||||
|
|||||||
@ -44,13 +44,13 @@ class ComputeMLIAP : public Compute {
|
|||||||
int nelements;
|
int nelements;
|
||||||
|
|
||||||
double** descriptors; // descriptors for all atoms in list
|
double** descriptors; // descriptors for all atoms in list
|
||||||
int ndescriptors; // number of descriptors
|
int ndescriptors; // number of descriptors
|
||||||
int gamma_max; // number of atoms allocated for beta, descriptors
|
int gamma_max; // number of atoms allocated for beta, descriptors
|
||||||
int nparams; // number of model paramters per element
|
int nparams; // number of model paramters per element
|
||||||
int gamma_nnz; // number of non-zero entries in gamma
|
int gamma_nnz; // number of non-zero entries in gamma
|
||||||
double** gamma; // gamma element
|
double** gamma; // gamma element
|
||||||
int** gamma_row_index; // row (parameter) index
|
int** gamma_row_index; // row (parameter) index
|
||||||
int** gamma_col_index; // column (descriptor) index
|
int** gamma_col_index; // column (descriptor) index
|
||||||
double* egradient; // energy gradient w.r.t. parameters
|
double* egradient; // energy gradient w.r.t. parameters
|
||||||
|
|
||||||
class MLIAPModel* model;
|
class MLIAPModel* model;
|
||||||
|
|||||||
@ -24,9 +24,9 @@ public:
|
|||||||
~MLIAPDescriptor();
|
~MLIAPDescriptor();
|
||||||
virtual void compute_descriptors(int*, class NeighList*, double**)=0;
|
virtual void compute_descriptors(int*, class NeighList*, double**)=0;
|
||||||
virtual void compute_forces(class PairMLIAP*, class NeighList*, double**, int)=0;
|
virtual void compute_forces(class PairMLIAP*, class NeighList*, double**, int)=0;
|
||||||
virtual void compute_gradients(int*, class NeighList*, int, int**, int**, double**,
|
virtual void compute_gradients(int*, class NeighList*, int, int**, int**, double**,
|
||||||
double**, int, int)=0;
|
double**, int, int)=0;
|
||||||
virtual void compute_descriptor_gradients(int*, class NeighList*, int, int**, int**, double**,
|
virtual void compute_descriptor_gradients(int*, class NeighList*, int, int**, int**, double**,
|
||||||
double**, int, int)=0;
|
double**, int, int)=0;
|
||||||
virtual void init()=0;
|
virtual void init()=0;
|
||||||
virtual double memory_usage()=0;
|
virtual double memory_usage()=0;
|
||||||
@ -34,7 +34,7 @@ public:
|
|||||||
int ndescriptors; // number of descriptors
|
int ndescriptors; // number of descriptors
|
||||||
int nelements; // # of unique elements
|
int nelements; // # of unique elements
|
||||||
char **elements; // names of unique elements
|
char **elements; // names of unique elements
|
||||||
double **cutsq; // nelem x nelem rcutsq values
|
double **cutsq; // nelem x nelem rcutsq values
|
||||||
double cutmax; // maximum cutoff needed
|
double cutmax; // maximum cutoff needed
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@ -259,8 +259,8 @@ void MLIAPDescriptorSNAP::compute_forces(PairMLIAP* pairmliap, NeighList* list,
|
|||||||
compute force gradient for each atom
|
compute force gradient for each atom
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void MLIAPDescriptorSNAP::compute_gradients(int *map, NeighList* list,
|
void MLIAPDescriptorSNAP::compute_gradients(int *map, NeighList* list,
|
||||||
int gamma_nnz, int **gamma_row_index,
|
int gamma_nnz, int **gamma_row_index,
|
||||||
int **gamma_col_index, double **gamma, double **gradforce,
|
int **gamma_col_index, double **gamma, double **gradforce,
|
||||||
int yoffset, int zoffset)
|
int yoffset, int zoffset)
|
||||||
{
|
{
|
||||||
@ -345,9 +345,9 @@ void MLIAPDescriptorSNAP::compute_gradients(int *map, NeighList* list,
|
|||||||
snaptr->rcutij[jj],jj, 0);
|
snaptr->rcutij[jj],jj, 0);
|
||||||
|
|
||||||
snaptr->compute_dbidrj();
|
snaptr->compute_dbidrj();
|
||||||
|
|
||||||
// Accumulate gamma_lk*dB_k/dRi, -gamma_lk**dB_k/dRj
|
// Accumulate gamma_lk*dB_k/dRi, -gamma_lk**dB_k/dRj
|
||||||
|
|
||||||
for (int inz = 0; inz < gamma_nnz; inz++) {
|
for (int inz = 0; inz < gamma_nnz; inz++) {
|
||||||
const int l = gamma_row_index[ii][inz];
|
const int l = gamma_row_index[ii][inz];
|
||||||
const int k = gamma_col_index[ii][inz];
|
const int k = gamma_col_index[ii][inz];
|
||||||
@ -358,7 +358,7 @@ void MLIAPDescriptorSNAP::compute_gradients(int *map, NeighList* list,
|
|||||||
gradforce[j][l+yoffset] -= gamma[ii][inz]*snaptr->dblist[k][1];
|
gradforce[j][l+yoffset] -= gamma[ii][inz]*snaptr->dblist[k][1];
|
||||||
gradforce[j][l+zoffset] -= gamma[ii][inz]*snaptr->dblist[k][2];
|
gradforce[j][l+zoffset] -= gamma[ii][inz]*snaptr->dblist[k][2];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,8 +368,8 @@ void MLIAPDescriptorSNAP::compute_gradients(int *map, NeighList* list,
|
|||||||
compute descriptor gradients for each neighbor atom
|
compute descriptor gradients for each neighbor atom
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void MLIAPDescriptorSNAP::compute_descriptor_gradients(int *map, NeighList* list,
|
void MLIAPDescriptorSNAP::compute_descriptor_gradients(int *map, NeighList* list,
|
||||||
int gamma_nnz, int **gamma_row_index,
|
int gamma_nnz, int **gamma_row_index,
|
||||||
int **gamma_col_index, double **gamma, double **graddesc,
|
int **gamma_col_index, double **gamma, double **graddesc,
|
||||||
int yoffset, int zoffset)
|
int yoffset, int zoffset)
|
||||||
{
|
{
|
||||||
@ -464,7 +464,7 @@ void MLIAPDescriptorSNAP::compute_descriptor_gradients(int *map, NeighList* list
|
|||||||
graddesc[j][k] = -snaptr->dblist[k][0];
|
graddesc[j][k] = -snaptr->dblist[k][0];
|
||||||
graddesc[j][k] = -snaptr->dblist[k][1];
|
graddesc[j][k] = -snaptr->dblist[k][1];
|
||||||
graddesc[j][k] = -snaptr->dblist[k][2];
|
graddesc[j][k] = -snaptr->dblist[k][2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,9 +24,9 @@ public:
|
|||||||
~MLIAPDescriptorSNAP();
|
~MLIAPDescriptorSNAP();
|
||||||
virtual void compute_descriptors(int*, class NeighList*, double**);
|
virtual void compute_descriptors(int*, class NeighList*, double**);
|
||||||
virtual void compute_forces(class PairMLIAP*, class NeighList*, double**, int);
|
virtual void compute_forces(class PairMLIAP*, class NeighList*, double**, int);
|
||||||
virtual void compute_gradients(int*, class NeighList*, int, int**, int**, double**,
|
virtual void compute_gradients(int*, class NeighList*, int, int**, int**, double**,
|
||||||
double**, int, int);
|
double**, int, int);
|
||||||
virtual void compute_descriptor_gradients(int*, class NeighList*, int, int**, int**, double**,
|
virtual void compute_descriptor_gradients(int*, class NeighList*, int, int**, int**, double**,
|
||||||
double**, int, int);
|
double**, int, int);
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual double memory_usage();
|
virtual double memory_usage();
|
||||||
|
|||||||
@ -36,7 +36,7 @@ MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, char* coefffilename) :
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, int nelements_in, int nparams_in) :
|
MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, int nelements_in, int nparams_in) :
|
||||||
MLIAPModel(lmp, nelements_in, nparams_in)
|
MLIAPModel(lmp, nelements_in, nparams_in)
|
||||||
{
|
{
|
||||||
ndescriptors = nparams - 1;
|
ndescriptors = nparams - 1;
|
||||||
@ -47,7 +47,7 @@ MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, int nelements_in, int nparams_in
|
|||||||
MLIAPModelLinear::~MLIAPModelLinear(){}
|
MLIAPModelLinear::~MLIAPModelLinear(){}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
Calculate model gradients w.r.t descriptors
|
Calculate model gradients w.r.t descriptors
|
||||||
for each atom beta_i = dE(B_i)/dB_i
|
for each atom beta_i = dE(B_i)/dB_i
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -87,22 +87,22 @@ void MLIAPModelLinear::gradient(PairMLIAP* pairmliap, NeighList* list, double **
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
Calculate model double gradients w.r.t descriptors and parameters
|
Calculate model double gradients w.r.t descriptors and parameters
|
||||||
for each atom energy gamma_lk = d2E(B)/dB_k/dsigma_l,
|
for each atom energy gamma_lk = d2E(B)/dB_k/dsigma_l,
|
||||||
where sigma_l is a parameter, B_k a descriptor,
|
where sigma_l is a parameter, B_k a descriptor,
|
||||||
and atom subscript i is omitted
|
and atom subscript i is omitted
|
||||||
|
|
||||||
gamma is in CSR format:
|
gamma is in CSR format:
|
||||||
nnz = number of non-zero values
|
nnz = number of non-zero values
|
||||||
gamma_row_index[inz] = l indices, 0 <= l < nparams
|
gamma_row_index[inz] = l indices, 0 <= l < nparams
|
||||||
gamma_col_indexiinz] = k indices, 0 <= k < ndescriptors
|
gamma_col_indexiinz] = k indices, 0 <= k < ndescriptors
|
||||||
gamma[i][inz] = non-zero values, 0 <= inz < nnz
|
gamma[i][inz] = non-zero values, 0 <= inz < nnz
|
||||||
|
|
||||||
egradient is derivative of energy w.r.t. parameters
|
egradient is derivative of energy w.r.t. parameters
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void MLIAPModelLinear::param_gradient(int *map, NeighList* list,
|
void MLIAPModelLinear::param_gradient(int *map, NeighList* list,
|
||||||
double **descriptors,
|
double **descriptors,
|
||||||
int **gamma_row_index, int **gamma_col_index,
|
int **gamma_row_index, int **gamma_col_index,
|
||||||
double **gamma, double *egradient)
|
double **gamma, double *egradient)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -112,7 +112,7 @@ void MLIAPModelLinear::param_gradient(int *map, NeighList* list,
|
|||||||
|
|
||||||
for (int l = 0; l < nelements*nparams; l++)
|
for (int l = 0; l < nelements*nparams; l++)
|
||||||
egradient[l] = 0.0;
|
egradient[l] = 0.0;
|
||||||
|
|
||||||
for (int ii = 0; ii < list->inum; ii++) {
|
for (int ii = 0; ii < list->inum; ii++) {
|
||||||
|
|
||||||
i = list->ilist[ii];
|
i = list->ilist[ii];
|
||||||
@ -128,12 +128,12 @@ void MLIAPModelLinear::param_gradient(int *map, NeighList* list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// gradient of energy of atom I w.r.t. parameters
|
// gradient of energy of atom I w.r.t. parameters
|
||||||
|
|
||||||
l = elemoffset;
|
l = elemoffset;
|
||||||
egradient[l++] += 1.0;
|
egradient[l++] += 1.0;
|
||||||
for (int icoeff = 0; icoeff < ndescriptors; icoeff++)
|
for (int icoeff = 0; icoeff < ndescriptors; icoeff++)
|
||||||
egradient[l++] += descriptors[ii][icoeff];
|
egradient[l++] += descriptors[ii][icoeff];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,7 @@ MLIAPModelQuadratic::MLIAPModelQuadratic(LAMMPS* lmp, char* coefffilename) :
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
MLIAPModelQuadratic::MLIAPModelQuadratic(LAMMPS* lmp, int nelements_in, int nparams_in) :
|
MLIAPModelQuadratic::MLIAPModelQuadratic(LAMMPS* lmp, int nelements_in, int nparams_in) :
|
||||||
MLIAPModel(lmp, nelements_in, nparams_in)
|
MLIAPModel(lmp, nelements_in, nparams_in)
|
||||||
{
|
{
|
||||||
nonlinearflag = 1;
|
nonlinearflag = 1;
|
||||||
@ -113,22 +113,22 @@ void MLIAPModelQuadratic::gradient(PairMLIAP* pairmliap, NeighList* list, double
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
Calculate model double gradients w.r.t descriptors and parameters
|
Calculate model double gradients w.r.t descriptors and parameters
|
||||||
for each atom energy gamma_lk = d2E(B)/dB_k/dsigma_l,
|
for each atom energy gamma_lk = d2E(B)/dB_k/dsigma_l,
|
||||||
where sigma_l is a parameter, B_k a descriptor,
|
where sigma_l is a parameter, B_k a descriptor,
|
||||||
and atom subscript i is omitted
|
and atom subscript i is omitted
|
||||||
|
|
||||||
gamma is in CSR format:
|
gamma is in CSR format:
|
||||||
nnz = number of non-zero values
|
nnz = number of non-zero values
|
||||||
gamma_row_index[inz] = l indices, 0 <= l < nparams
|
gamma_row_index[inz] = l indices, 0 <= l < nparams
|
||||||
gamma_col_indexiinz] = k indices, 0 <= k < ndescriptors
|
gamma_col_indexiinz] = k indices, 0 <= k < ndescriptors
|
||||||
gamma[i][inz] = non-zero values, 0 <= inz < nnz
|
gamma[i][inz] = non-zero values, 0 <= inz < nnz
|
||||||
|
|
||||||
egradient is derivative of energy w.r.t. parameters
|
egradient is derivative of energy w.r.t. parameters
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void MLIAPModelQuadratic::param_gradient(int *map, NeighList* list,
|
void MLIAPModelQuadratic::param_gradient(int *map, NeighList* list,
|
||||||
double **descriptors,
|
double **descriptors,
|
||||||
int **gamma_row_index, int **gamma_col_index,
|
int **gamma_row_index, int **gamma_col_index,
|
||||||
double **gamma, double *egradient)
|
double **gamma, double *egradient)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -138,7 +138,7 @@ void MLIAPModelQuadratic::param_gradient(int *map, NeighList* list,
|
|||||||
|
|
||||||
for (int l = 0; l < nelements*nparams; l++)
|
for (int l = 0; l < nelements*nparams; l++)
|
||||||
egradient[l] = 0.0;
|
egradient[l] = 0.0;
|
||||||
|
|
||||||
for (int ii = 0; ii < list->inum; ii++) {
|
for (int ii = 0; ii < list->inum; ii++) {
|
||||||
|
|
||||||
i = list->ilist[ii];
|
i = list->ilist[ii];
|
||||||
@ -179,14 +179,14 @@ void MLIAPModelQuadratic::param_gradient(int *map, NeighList* list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// gradient of energy of atom I w.r.t. parameters
|
// gradient of energy of atom I w.r.t. parameters
|
||||||
|
|
||||||
l = elemoffset;
|
l = elemoffset;
|
||||||
egradient[l++] += 1.0;
|
egradient[l++] += 1.0;
|
||||||
for (int icoeff = 0; icoeff < ndescriptors; icoeff++)
|
for (int icoeff = 0; icoeff < ndescriptors; icoeff++)
|
||||||
egradient[l++] += descriptors[ii][icoeff];
|
egradient[l++] += descriptors[ii][icoeff];
|
||||||
|
|
||||||
// quadratic contributions
|
// quadratic contributions
|
||||||
|
|
||||||
for (int icoeff = 0; icoeff < ndescriptors; icoeff++) {
|
for (int icoeff = 0; icoeff < ndescriptors; icoeff++) {
|
||||||
double bveci = descriptors[ii][icoeff];
|
double bveci = descriptors[ii][icoeff];
|
||||||
egradient[l++] += 0.5*bveci*bveci;
|
egradient[l++] += 0.5*bveci*bveci;
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class PairMesoCNT : public Pair {
|
|||||||
double r_ang,rsq_ang,d_ang,rc_ang,rcsq_ang,cutoff_ang,cutoffsq_ang;
|
double r_ang,rsq_ang,d_ang,rc_ang,rcsq_ang,cutoff_ang,cutoffsq_ang;
|
||||||
double sig,sig_ang,comega,ctheta;
|
double sig,sig_ang,comega,ctheta;
|
||||||
double hstart_uinf,hstart_gamma,
|
double hstart_uinf,hstart_gamma,
|
||||||
hstart_phi,psistart_phi,hstart_usemi,xistart_usemi;
|
hstart_phi,psistart_phi,hstart_usemi,xistart_usemi;
|
||||||
double delh_uinf,delh_gamma,delh_phi,delpsi_phi,delh_usemi,delxi_usemi;
|
double delh_uinf,delh_gamma,delh_phi,delpsi_phi,delh_usemi,delxi_usemi;
|
||||||
|
|
||||||
double p1[3],p2[3],p[3],m[3];
|
double p1[3],p2[3],p[3],m[3];
|
||||||
@ -55,7 +55,7 @@ class PairMesoCNT : public Pair {
|
|||||||
void read_file();
|
void read_file();
|
||||||
void read_data(FILE *, double *, double &, double &, int);
|
void read_data(FILE *, double *, double &, double &, int);
|
||||||
void read_data(FILE *, double **, double &, double &,
|
void read_data(FILE *, double **, double &, double &,
|
||||||
double &, double &, int);
|
double &, double &, int);
|
||||||
|
|
||||||
void spline_coeff(double *, double **, double, int);
|
void spline_coeff(double *, double **, double, int);
|
||||||
void spline_coeff(double **, double ****, double, double, int);
|
void spline_coeff(double **, double ****, double, double, int);
|
||||||
@ -63,17 +63,17 @@ class PairMesoCNT : public Pair {
|
|||||||
double spline(double, double, double, double **, int);
|
double spline(double, double, double, double **, int);
|
||||||
double dspline(double, double, double, double **, int);
|
double dspline(double, double, double, double **, int);
|
||||||
double spline(double, double, double, double, double, double,
|
double spline(double, double, double, double, double, double,
|
||||||
double ****, int);
|
double ****, int);
|
||||||
double dxspline(double, double, double, double, double, double,
|
double dxspline(double, double, double, double, double, double,
|
||||||
double ****, int);
|
double ****, int);
|
||||||
double dyspline(double, double, double, double, double, double,
|
double dyspline(double, double, double, double, double, double,
|
||||||
double ****, int);
|
double ****, int);
|
||||||
|
|
||||||
void geometry(const double *, const double *, const double *,
|
void geometry(const double *, const double *, const double *,
|
||||||
const double *, const double *,
|
const double *, const double *,
|
||||||
double *, double *, double *, double **);
|
double *, double *, double *, double **);
|
||||||
void weight(const double *, const double *, const double *,
|
void weight(const double *, const double *, const double *,
|
||||||
const double *, double &, double *, double *,
|
const double *, double &, double *, double *,
|
||||||
double *, double *);
|
double *, double *);
|
||||||
|
|
||||||
void finf(const double *, double &, double **);
|
void finf(const double *, double &, double **);
|
||||||
@ -97,7 +97,7 @@ class PairMesoCNT : public Pair {
|
|||||||
inline double s5(double x) {
|
inline double s5(double x) {
|
||||||
double x2 = x * x;
|
double x2 = x * x;
|
||||||
return heaviside(-x)
|
return heaviside(-x)
|
||||||
+ heaviside(x)*heaviside(1-x)*(1 - x2*x*(6*x2 - 15*x + 10));
|
+ heaviside(x)*heaviside(1-x)*(1 - x2*x*(6*x2 - 15*x + 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double ds5(double x) {
|
inline double ds5(double x) {
|
||||||
|
|||||||
@ -587,7 +587,7 @@ void AtomVecBody::pack_data_pre(int ilocal)
|
|||||||
int AtomVecBody::pack_data_bonus(double *buf, int /*flag*/)
|
int AtomVecBody::pack_data_bonus(double *buf, int /*flag*/)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
tagint *tag = atom->tag;
|
tagint *tag = atom->tag;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
@ -596,7 +596,7 @@ int AtomVecBody::pack_data_bonus(double *buf, int /*flag*/)
|
|||||||
if (body[i] < 0) continue;
|
if (body[i] < 0) continue;
|
||||||
m += bptr->pack_data_body(tag[i],body[i],buf);
|
m += bptr->pack_data_body(tag[i],body[i],buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -490,7 +490,7 @@ void AtomVecEllipsoid::pack_data_post(int ilocal)
|
|||||||
int AtomVecEllipsoid::pack_data_bonus(double *buf, int /*flag*/)
|
int AtomVecEllipsoid::pack_data_bonus(double *buf, int /*flag*/)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
tagint *tag = atom->tag;
|
tagint *tag = atom->tag;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class AtomVecEllipsoid : public AtomVec {
|
|||||||
|
|
||||||
int pack_data_bonus(double *, int);
|
int pack_data_bonus(double *, int);
|
||||||
void write_data_bonus(FILE *, int, double *, int);
|
void write_data_bonus(FILE *, int, double *, int);
|
||||||
|
|
||||||
// unique to AtomVecEllipsoid
|
// unique to AtomVecEllipsoid
|
||||||
|
|
||||||
void set_shape(int, double, double, double);
|
void set_shape(int, double, double, double);
|
||||||
|
|||||||
@ -469,7 +469,7 @@ int AtomVecHybrid::pack_data_bonus(double *buf, int flag)
|
|||||||
if (flag == LINE && strcmp(keywords[k],"line") != 0) continue;
|
if (flag == LINE && strcmp(keywords[k],"line") != 0) continue;
|
||||||
if (flag == TRIANGLE && strcmp(keywords[k],"tri") != 0) continue;
|
if (flag == TRIANGLE && strcmp(keywords[k],"tri") != 0) continue;
|
||||||
if (flag == BODY && strcmp(keywords[k],"body") != 0) continue;
|
if (flag == BODY && strcmp(keywords[k],"body") != 0) continue;
|
||||||
|
|
||||||
return styles[k]->pack_data_bonus(buf,flag);
|
return styles[k]->pack_data_bonus(buf,flag);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -465,7 +465,7 @@ int AtomVecLine::pack_data_bonus(double *buf, int /*flag*/)
|
|||||||
int i,j;
|
int i,j;
|
||||||
double length,theta;
|
double length,theta;
|
||||||
double xc,yc,x1,x2,y1,y2;
|
double xc,yc,x1,x2,y1,y2;
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
tagint *tag = atom->tag;
|
tagint *tag = atom->tag;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class Body : protected Pointers {
|
|||||||
virtual void data_body(int, int, int, int*, double *) = 0;
|
virtual void data_body(int, int, int, int*, double *) = 0;
|
||||||
virtual int pack_data_body(tagint, int, double *) = 0;
|
virtual int pack_data_body(tagint, int, double *) = 0;
|
||||||
virtual int write_data_body(FILE *, double *) = 0;
|
virtual int write_data_body(FILE *, double *) = 0;
|
||||||
|
|
||||||
virtual int noutrow(int) = 0;
|
virtual int noutrow(int) = 0;
|
||||||
virtual int noutcol() = 0;
|
virtual int noutcol() = 0;
|
||||||
virtual void output(int, int, double *) = 0;
|
virtual void output(int, int, double *) = 0;
|
||||||
|
|||||||
@ -198,14 +198,14 @@ void WriteData::write(const std::string &file)
|
|||||||
|
|
||||||
// molecular topology info if defined
|
// molecular topology info if defined
|
||||||
// do not write molecular topology for atom_style template
|
// do not write molecular topology for atom_style template
|
||||||
|
|
||||||
if (atom->molecular == 1) {
|
if (atom->molecular == 1) {
|
||||||
if (atom->nbonds && nbonds) bonds();
|
if (atom->nbonds && nbonds) bonds();
|
||||||
if (atom->nangles && nangles) angles();
|
if (atom->nangles && nangles) angles();
|
||||||
if (atom->ndihedrals) dihedrals();
|
if (atom->ndihedrals) dihedrals();
|
||||||
if (atom->nimpropers) impropers();
|
if (atom->nimpropers) impropers();
|
||||||
}
|
}
|
||||||
|
|
||||||
// bonus info if defined
|
// bonus info if defined
|
||||||
|
|
||||||
if (natoms && atom->ellipsoid_flag) bonus(ELLIPSOID);
|
if (natoms && atom->ellipsoid_flag) bonus(ELLIPSOID);
|
||||||
@ -214,7 +214,7 @@ void WriteData::write(const std::string &file)
|
|||||||
if (natoms && atom->body_flag) bonus(BODY);
|
if (natoms && atom->body_flag) bonus(BODY);
|
||||||
|
|
||||||
// extra sections managed by fixes
|
// extra sections managed by fixes
|
||||||
|
|
||||||
if (fixflag)
|
if (fixflag)
|
||||||
for (int i = 0; i < modify->nfix; i++)
|
for (int i = 0; i < modify->nfix; i++)
|
||||||
if (modify->fix[i]->wd_section)
|
if (modify->fix[i]->wd_section)
|
||||||
@ -261,7 +261,7 @@ void WriteData::header()
|
|||||||
if (atom->body_flag) fmt::print(fp,"{} bodies\n",atom->nbodies);
|
if (atom->body_flag) fmt::print(fp,"{} bodies\n",atom->nbodies);
|
||||||
|
|
||||||
// fix info
|
// fix info
|
||||||
|
|
||||||
if (fixflag)
|
if (fixflag)
|
||||||
for (int i = 0; i < modify->nfix; i++)
|
for (int i = 0; i < modify->nfix; i++)
|
||||||
if (modify->fix[i]->wd_header)
|
if (modify->fix[i]->wd_header)
|
||||||
@ -671,7 +671,7 @@ void WriteData::bonus(int flag)
|
|||||||
// pack my bonus data into buf
|
// pack my bonus data into buf
|
||||||
|
|
||||||
atom->avec->pack_data_bonus(buf,flag);
|
atom->avec->pack_data_bonus(buf,flag);
|
||||||
|
|
||||||
// write one chunk of info per proc to file
|
// write one chunk of info per proc to file
|
||||||
// proc 0 pings each proc, receives its chunk, writes to file
|
// proc 0 pings each proc, receives its chunk, writes to file
|
||||||
// all other procs wait for ping, send their chunk to proc 0
|
// all other procs wait for ping, send their chunk to proc 0
|
||||||
@ -686,7 +686,7 @@ void WriteData::bonus(int flag)
|
|||||||
if (flag == LINE) fprintf(fp,"\nLines\n\n");
|
if (flag == LINE) fprintf(fp,"\nLines\n\n");
|
||||||
if (flag == TRIANGLE) fprintf(fp,"\nTriangles\n\n");
|
if (flag == TRIANGLE) fprintf(fp,"\nTriangles\n\n");
|
||||||
if (flag == BODY) fprintf(fp,"\nBodies\n\n");
|
if (flag == BODY) fprintf(fp,"\nBodies\n\n");
|
||||||
|
|
||||||
for (int iproc = 0; iproc < nprocs; iproc++) {
|
for (int iproc = 0; iproc < nprocs; iproc++) {
|
||||||
if (iproc) {
|
if (iproc) {
|
||||||
MPI_Irecv(buf,maxvalues,MPI_DOUBLE,iproc,0,world,&request);
|
MPI_Irecv(buf,maxvalues,MPI_DOUBLE,iproc,0,world,&request);
|
||||||
|
|||||||
Reference in New Issue
Block a user