Merge branch 'lammps:develop' into local-composition
This commit is contained in:
@ -67,7 +67,7 @@ Syntax
|
||||
bound(group,dir,region), gyration(group,region), ke(group,reigon),
|
||||
angmom(group,dim,region), torque(group,dim,region),
|
||||
inertia(group,dimdim,region), omega(group,dim,region)
|
||||
special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name), extract_setting(name), label2type(kind,label)
|
||||
special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name), extract_setting(name), label2type(kind,label), is_typelabel(kind,label)
|
||||
feature functions = is_available(category,feature), is_active(category,feature), is_defined(category,id)
|
||||
atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i]
|
||||
atom vector = id, mass, type, mol, radius, q, x, y, z, vx, vy, vz, fx, fy, fz
|
||||
@ -532,7 +532,7 @@ variables.
|
||||
+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Region functions | count(ID,IDR), mass(ID,IDR), charge(ID,IDR), xcm(ID,dim,IDR), vcm(ID,dim,IDR), fcm(ID,dim,IDR), bound(ID,dir,IDR), gyration(ID,IDR), ke(ID,IDR), angmom(ID,dim,IDR), torque(ID,dim,IDR), inertia(ID,dimdim,IDR), omega(ID,dim,IDR) |
|
||||
+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Special functions | sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name), extract_setting(name), label2type(kind,label) |
|
||||
| Special functions | sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name), extract_setting(name), label2type(kind,label), is_typelabel(kind,label) |
|
||||
+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Feature functions | is_available(category,feature), is_active(category,feature), is_defined(category,id) |
|
||||
+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
@ -996,10 +996,17 @@ via the link in this paragraph.
|
||||
|
||||
The label2type(kind,label) function converts type labels into numeric
|
||||
types, using label maps created by the :doc:`labelmap <labelmap>` or
|
||||
:doc:`read_data <read_data>` commands. The first argument is the
|
||||
label map kind (atom, bond, angle, dihedral, or improper) and the
|
||||
second argument is the label. The function returns the corresponding
|
||||
numeric type.
|
||||
:doc:`read_data <read_data>` commands. The first argument is the label
|
||||
map kind (atom, bond, angle, dihedral, or improper) and the second
|
||||
argument is the label. The function returns the corresponding numeric
|
||||
type or triggers an error if the queried label does not exist.
|
||||
|
||||
.. versionadded:: TBD
|
||||
|
||||
The is_typelabel(kind,label) function has the same arguments as
|
||||
label2type(), but returns 1 if the type label has been assigned,
|
||||
otherwise it returns 0. This function can be used to check if a
|
||||
particular type label already exists in the simulation.
|
||||
|
||||
----------
|
||||
|
||||
|
||||
1
examples/snap/C_SNAP_2021.10.15.quadratic.snapcoeff
Symbolic link
1
examples/snap/C_SNAP_2021.10.15.quadratic.snapcoeff
Symbolic link
@ -0,0 +1 @@
|
||||
../../potentials/C_SNAP_2021.10.15.quadratic.snapcoeff
|
||||
1
examples/snap/C_SNAP_2021.10.15.quadratic.snapparam
Symbolic link
1
examples/snap/C_SNAP_2021.10.15.quadratic.snapparam
Symbolic link
@ -0,0 +1 @@
|
||||
../../potentials/C_SNAP_2021.10.15.quadratic.snapparam
|
||||
31
examples/snap/in.C_SNAP
Normal file
31
examples/snap/in.C_SNAP
Normal file
@ -0,0 +1,31 @@
|
||||
#Carbon SNAP example: 216 atom diamond unit cell simulated NVT at ~1,000GPa and 5,000K
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
boundary p p p
|
||||
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Crystal orientation and MD box creation #
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
lattice diamond 2.845
|
||||
region Bbox block 0 3 0 3 0 3
|
||||
create_box 1 Bbox
|
||||
create_atoms 1 region Bbox basis 1 1
|
||||
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Interatomic potential parameters #
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Specify hybrid with SNAP, ZBL, and long-range C_SNAP_2021.10.15.quadratic.ulomb
|
||||
|
||||
pair_style hybrid/overlay zbl 0.1 0.2 snap
|
||||
pair_coeff 1 1 zbl 10 10
|
||||
pair_coeff * * snap C_SNAP_2021.10.15.quadratic.snapcoeff C_SNAP_2021.10.15.quadratic.snapparam C
|
||||
|
||||
mass * 12.01
|
||||
velocity all create 8000.0 3412461 loop geom
|
||||
|
||||
fix NVE all nve
|
||||
fix NVT all langevin 5000.0 5000.0 0.1 3216548
|
||||
thermo 50
|
||||
thermo_style custom step temp ke pe etotal press pxx pyy pzz
|
||||
run 500
|
||||
105
examples/snap/log.30May23.C_SNAP.g++.1
Normal file
105
examples/snap/log.30May23.C_SNAP.g++.1
Normal file
@ -0,0 +1,105 @@
|
||||
LAMMPS (28 Mar 2023 - Development)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
#Carbon SNAP example: 216 atom diamond unit cell simulated NVT at ~1,000GPa and 5,000K
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
boundary p p p
|
||||
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Crystal orientation and MD box creation #
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
lattice diamond 2.845
|
||||
Lattice spacing in x,y,z = 2.845 2.845 2.845
|
||||
region Bbox block 0 3 0 3 0 3
|
||||
create_box 1 Bbox
|
||||
Created orthogonal box = (0 0 0) to (8.535 8.535 8.535)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
create_atoms 1 region Bbox basis 1 1
|
||||
Created 216 atoms
|
||||
using lattice units in orthogonal box = (0 0 0) to (8.535 8.535 8.535)
|
||||
create_atoms CPU = 0.000 seconds
|
||||
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Interatomic potential parameters #
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Specify hybrid with SNAP, ZBL, and long-range C_SNAP_2021.10.15.quadratic.ulomb
|
||||
|
||||
pair_style hybrid/overlay zbl 0.1 0.2 snap
|
||||
pair_coeff 1 1 zbl 10 10
|
||||
pair_coeff * * snap C_SNAP_2021.10.15.quadratic.snapcoeff C_SNAP_2021.10.15.quadratic.snapparam C
|
||||
SNAP Element = C, Radius 0.5, Weight 1
|
||||
SNAP keyword rcutfac 2.7
|
||||
SNAP keyword twojmax 8
|
||||
SNAP keyword rfac0 0.99363
|
||||
SNAP keyword rmin0 0.0
|
||||
SNAP keyword bzeroflag 0
|
||||
SNAP keyword quadraticflag 1
|
||||
|
||||
mass * 12.01
|
||||
velocity all create 8000.0 3412461 loop geom
|
||||
|
||||
fix NVE all nve
|
||||
fix NVT all langevin 5000.0 5000.0 0.1 3216548
|
||||
thermo 50
|
||||
thermo_style custom step temp ke pe etotal press pxx pyy pzz
|
||||
run 500
|
||||
Neighbor list info ...
|
||||
update: every = 1 steps, delay = 0 steps, check = yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 4.7
|
||||
ghost atom cutoff = 4.7
|
||||
binsize = 2.35, bins = 4 4 4
|
||||
2 neighbor lists, perpetual/occasional/extra = 2 0 0
|
||||
(1) pair zbl, perpetual, half/full trim from (2)
|
||||
attributes: half, newton on, cut 2.2
|
||||
pair build: halffull/newton/trim
|
||||
stencil: none
|
||||
bin: none
|
||||
(2) pair snap, perpetual
|
||||
attributes: full, newton on
|
||||
pair build: full/bin/atomonly
|
||||
stencil: full/bin/3d
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 4.835 | 4.835 | 4.835 Mbytes
|
||||
Step Temp KinEng PotEng TotEng Press Pxx Pyy Pzz
|
||||
0 8000 222.32745 -846.66062 -624.33318 10234249 10210805 10267435 10224506
|
||||
50 4199.4229 116.70587 -723.2423 -606.53643 10256033 10157803 10280166 10330129
|
||||
100 3820.2509 106.16833 -710.43537 -604.26704 10232872 10216484 10241309 10240825
|
||||
150 4413.2948 122.64957 -710.09702 -587.44745 10254093 10323013 10265454 10173810
|
||||
200 4688.024 130.28455 -702.26198 -571.97742 10306186 10281632 10342390 10294536
|
||||
250 4997.165 138.87587 -720.58476 -581.70889 10284438 10220856 10360231 10272226
|
||||
300 4640.4911 128.96357 -710.75063 -581.78706 10263301 10264007 10290526 10235369
|
||||
350 4929.5117 136.99572 -707.2526 -570.25688 10290742 10359920 10284236 10228071
|
||||
400 4700.9354 130.64337 -697.90277 -567.2594 10250682 10277287 10246032 10228729
|
||||
450 5108.4971 141.96989 -700.57144 -558.60155 10289765 10323648 10306588 10239058
|
||||
500 5146.7039 143.03169 -700.33221 -557.30052 10334303 10349736 10358785 10294387
|
||||
Loop time of 36.7771 on 1 procs for 500 steps with 216 atoms
|
||||
|
||||
Performance: 1.175 ns/day, 20.432 hours/ns, 13.595 timesteps/s, 2.937 katom-step/s
|
||||
99.8% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 36.766 | 36.766 | 36.766 | 0.0 | 99.97
|
||||
Neigh | 0.0010226 | 0.0010226 | 0.0010226 | 0.0 | 0.00
|
||||
Comm | 0.0033205 | 0.0033205 | 0.0033205 | 0.0 | 0.01
|
||||
Output | 0.00020657 | 0.00020657 | 0.00020657 | 0.0 | 0.00
|
||||
Modify | 0.0047621 | 0.0047621 | 0.0047621 | 0.0 | 0.01
|
||||
Other | | 0.001464 | | | 0.00
|
||||
|
||||
Nlocal: 216 ave 216 max 216 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 1746 ave 1746 max 1746 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 1767 ave 1767 max 1767 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
FullNghs: 32846 ave 32846 max 32846 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 32846
|
||||
Ave neighs/atom = 152.06481
|
||||
Neighbor list builds = 1
|
||||
Dangerous builds = 0
|
||||
Total wall time: 0:00:36
|
||||
105
examples/snap/log.30May23.C_SNAP.g++.4
Normal file
105
examples/snap/log.30May23.C_SNAP.g++.4
Normal file
@ -0,0 +1,105 @@
|
||||
LAMMPS (28 Mar 2023 - Development)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
#Carbon SNAP example: 216 atom diamond unit cell simulated NVT at ~1,000GPa and 5,000K
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
boundary p p p
|
||||
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Crystal orientation and MD box creation #
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
lattice diamond 2.845
|
||||
Lattice spacing in x,y,z = 2.845 2.845 2.845
|
||||
region Bbox block 0 3 0 3 0 3
|
||||
create_box 1 Bbox
|
||||
Created orthogonal box = (0 0 0) to (8.535 8.535 8.535)
|
||||
1 by 2 by 2 MPI processor grid
|
||||
create_atoms 1 region Bbox basis 1 1
|
||||
Created 216 atoms
|
||||
using lattice units in orthogonal box = (0 0 0) to (8.535 8.535 8.535)
|
||||
create_atoms CPU = 0.000 seconds
|
||||
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Interatomic potential parameters #
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Specify hybrid with SNAP, ZBL, and long-range C_SNAP_2021.10.15.quadratic.ulomb
|
||||
|
||||
pair_style hybrid/overlay zbl 0.1 0.2 snap
|
||||
pair_coeff 1 1 zbl 10 10
|
||||
pair_coeff * * snap C_SNAP_2021.10.15.quadratic.snapcoeff C_SNAP_2021.10.15.quadratic.snapparam C
|
||||
SNAP Element = C, Radius 0.5, Weight 1
|
||||
SNAP keyword rcutfac 2.7
|
||||
SNAP keyword twojmax 8
|
||||
SNAP keyword rfac0 0.99363
|
||||
SNAP keyword rmin0 0.0
|
||||
SNAP keyword bzeroflag 0
|
||||
SNAP keyword quadraticflag 1
|
||||
|
||||
mass * 12.01
|
||||
velocity all create 8000.0 3412461 loop geom
|
||||
|
||||
fix NVE all nve
|
||||
fix NVT all langevin 5000.0 5000.0 0.1 3216548
|
||||
thermo 50
|
||||
thermo_style custom step temp ke pe etotal press pxx pyy pzz
|
||||
run 500
|
||||
Neighbor list info ...
|
||||
update: every = 1 steps, delay = 0 steps, check = yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 4.7
|
||||
ghost atom cutoff = 4.7
|
||||
binsize = 2.35, bins = 4 4 4
|
||||
2 neighbor lists, perpetual/occasional/extra = 2 0 0
|
||||
(1) pair zbl, perpetual, half/full trim from (2)
|
||||
attributes: half, newton on, cut 2.2
|
||||
pair build: halffull/newton/trim
|
||||
stencil: none
|
||||
bin: none
|
||||
(2) pair snap, perpetual
|
||||
attributes: full, newton on
|
||||
pair build: full/bin/atomonly
|
||||
stencil: full/bin/3d
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 4.681 | 4.681 | 4.681 Mbytes
|
||||
Step Temp KinEng PotEng TotEng Press Pxx Pyy Pzz
|
||||
0 8000 222.32745 -846.66062 -624.33318 10234249 10210805 10267435 10224506
|
||||
50 4382.3571 121.78978 -715.70492 -593.91513 10262157 10278549 10181545 10326376
|
||||
100 4546.1549 126.34188 -713.11818 -586.77631 10261694 10257647 10333666 10193770
|
||||
150 5109.4576 141.99658 -708.87952 -566.88294 10268132 10248182 10248240 10307974
|
||||
200 4764.2181 132.40206 -712.16881 -579.76675 10329903 10238991 10379394 10371323
|
||||
250 4989.5099 138.66313 -710.39748 -571.73435 10282678 10321057 10274124 10252854
|
||||
300 4853.3102 134.87801 -699.98167 -565.10366 10343314 10204138 10430172 10395634
|
||||
350 4788.1153 133.06618 -705.14381 -572.07763 10325571 10312657 10267999 10396058
|
||||
400 5055.7813 140.50487 -707.38537 -566.8805 10323176 10357258 10310733 10301536
|
||||
450 5182.3198 144.02149 -695.11614 -551.09465 10345564 10358486 10346325 10331881
|
||||
500 5311.077 147.59977 -691.32767 -543.7279 10308823 10242668 10214102 10469700
|
||||
Loop time of 11.5932 on 4 procs for 500 steps with 216 atoms
|
||||
|
||||
Performance: 3.726 ns/day, 6.441 hours/ns, 43.129 timesteps/s, 9.316 katom-step/s
|
||||
94.9% CPU use with 4 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 10.241 | 10.446 | 10.695 | 5.0 | 90.11
|
||||
Neigh | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Comm | 0.87613 | 1.1187 | 1.3179 | 14.9 | 9.65
|
||||
Output | 0.0002656 | 0.0010016 | 0.0015521 | 1.5 | 0.01
|
||||
Modify | 0.0019493 | 0.0020668 | 0.0021577 | 0.2 | 0.02
|
||||
Other | | 0.02508 | | | 0.22
|
||||
|
||||
Nlocal: 54 ave 54 max 54 min
|
||||
Histogram: 4 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 1082 ave 1082 max 1082 min
|
||||
Histogram: 4 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 432 ave 432 max 432 min
|
||||
Histogram: 4 0 0 0 0 0 0 0 0 0
|
||||
FullNghs: 8532 ave 8532 max 8532 min
|
||||
Histogram: 4 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 34128
|
||||
Ave neighs/atom = 158
|
||||
Neighbor list builds = 0
|
||||
Dangerous builds = 0
|
||||
Total wall time: 0:00:11
|
||||
1602
potentials/C_SNAP_2021.10.15.quadratic.snapcoeff
Normal file
1602
potentials/C_SNAP_2021.10.15.quadratic.snapcoeff
Normal file
File diff suppressed because it is too large
Load Diff
10
potentials/C_SNAP_2021.10.15.quadratic.snapparam
Normal file
10
potentials/C_SNAP_2021.10.15.quadratic.snapparam
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
# required
|
||||
rcutfac 2.7
|
||||
twojmax 8
|
||||
|
||||
# optional
|
||||
rfac0 0.99363
|
||||
rmin0 0.0
|
||||
bzeroflag 0
|
||||
quadraticflag 1
|
||||
@ -4040,8 +4040,8 @@ Region *Variable::region_function(char *id, int ivar)
|
||||
return 0 if not a match, 1 if successfully processed
|
||||
customize by adding a special function:
|
||||
sum(x),min(x),max(x),ave(x),trap(x),slope(x),
|
||||
gmask(x),rmask(x),grmask(x,y),next(x),
|
||||
is_file(x),is_ox(x),extract_setting(x),label2type(x,y)
|
||||
gmask(x),rmask(x),grmask(x,y),next(x),is_file(x),is_ox(x),
|
||||
extract_setting(x),label2type(x,y),is_typelabel(x,y)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int Variable::special_function(char *word, char *contents, Tree **tree, Tree **treestack,
|
||||
@ -4056,20 +4056,28 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t
|
||||
strcmp(word,"ave") != 0 && strcmp(word,"trap") != 0 && strcmp(word,"slope") != 0 &&
|
||||
strcmp(word,"gmask") != 0 && strcmp(word,"rmask") != 0 && strcmp(word,"grmask") != 0 &&
|
||||
strcmp(word,"next") != 0 && strcmp(word,"is_file") != 0 && strcmp(word,"is_os") != 0 &&
|
||||
strcmp(word,"extract_setting") != 0 && strcmp(word,"label2type") != 0)
|
||||
strcmp(word,"extract_setting") != 0 && strcmp(word,"label2type") != 0 &&
|
||||
strcmp(word,"is_typelabel") != 0)
|
||||
return 0;
|
||||
|
||||
// process label2type() separately b/c its label arg can have commas in it
|
||||
|
||||
if (strcmp(word,"label2type") == 0) {
|
||||
if (strcmp(word,"label2type") == 0 || strcmp(word,"is_typelabel") == 0) {
|
||||
if (!atom->labelmapflag)
|
||||
print_var_error(FLERR,"Cannot use label2type() function without a labelmap",ivar);
|
||||
print_var_error(FLERR,fmt::format("Cannot use {}() function without a labelmap",word),ivar);
|
||||
|
||||
std::string contents_copy(contents);
|
||||
auto pos = contents_copy.find_first_of(',');
|
||||
if (pos == std::string::npos)
|
||||
print_var_error(FLERR, fmt::format("Invalid label2type({}) function in variable formula",
|
||||
contents_copy), ivar);
|
||||
if (pos == std::string::npos) {
|
||||
if (strcmp(word,"label2type") == 0) {
|
||||
print_var_error(FLERR, fmt::format("Invalid label2type({}) function in variable formula",
|
||||
contents_copy), ivar);
|
||||
} else {
|
||||
print_var_error(FLERR, fmt::format("Invalid is_typelabel({}) function in variable formula",
|
||||
contents_copy), ivar);
|
||||
}
|
||||
}
|
||||
|
||||
std::string typestr = contents_copy.substr(pos+1);
|
||||
std::string kind = contents_copy.substr(0, pos);
|
||||
|
||||
@ -4085,12 +4093,14 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t
|
||||
} else if (kind == "improper") {
|
||||
value = atom->lmap->find(typestr,Atom::IMPROPER);
|
||||
} else {
|
||||
print_var_error(FLERR, fmt::format("Invalid kind {} in label2type() in variable",kind),ivar);
|
||||
print_var_error(FLERR, fmt::format("Invalid kind {} in {}() in variable", kind, word),ivar);
|
||||
}
|
||||
|
||||
if (value == -1)
|
||||
print_var_error(FLERR, fmt::format("Invalid {} type label {} in label2type() in variable",
|
||||
kind, typestr), ivar);
|
||||
if (strcmp(word,"label2type") == 0) {
|
||||
if (value == -1)
|
||||
print_var_error(FLERR, fmt::format("Invalid {} type label {} in label2type() in variable",
|
||||
kind, typestr), ivar);
|
||||
} else value = (value == -1) ? 0.0 : 1.0;
|
||||
|
||||
// save value in tree or on argstack
|
||||
|
||||
|
||||
@ -590,7 +590,7 @@ TEST_F(VariableTest, NextCommand)
|
||||
command("next five four"););
|
||||
}
|
||||
|
||||
TEST_F(VariableTest, Label2TypeAtomic)
|
||||
TEST_F(VariableTest, LabelMapAtomic)
|
||||
{
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("region box block 0 2 0 2 0 2");
|
||||
@ -608,14 +608,20 @@ TEST_F(VariableTest, Label2TypeAtomic)
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("label2type(atom,N1)"), 2.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("label2type(atom,O1)"), 3.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("label2type(atom,H1)"), 4.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,N1)"), 1.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,N2)"), 0.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,O)"), 0.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,H1)"), 1.0);
|
||||
|
||||
TEST_FAILURE(".*ERROR: Variable t1: Invalid atom type label C1 in label2type.. in variable.*",
|
||||
command("print \"${t1}\""););
|
||||
TEST_FAILURE(".*ERROR: Invalid bond type label H1 in label2type.. in variable.*",
|
||||
variable->compute_equal("label2type(bond,H1)"););
|
||||
TEST_FAILURE(".*ERROR: Invalid kind xxx in label2type.. in variable.*",
|
||||
variable->compute_equal("label2type(xxx,H1)"););
|
||||
TEST_FAILURE(".*ERROR: Invalid kind xxx in is_typelabel.. in variable.*",
|
||||
variable->compute_equal("is_typelabel(xxx,H1)"););
|
||||
}
|
||||
|
||||
TEST_F(VariableTest, Label2TypeMolecular)
|
||||
TEST_F(VariableTest, LabelMapMolecular)
|
||||
{
|
||||
if (!info->has_style("atom", "full")) GTEST_SKIP();
|
||||
|
||||
@ -637,6 +643,14 @@ TEST_F(VariableTest, Label2TypeMolecular)
|
||||
command("variable a2 equal \"\"\"label2type(angle,N2'-C1\"-N2')\"\"\"");
|
||||
command("variable d1 equal label2type(dihedral,C1-N2-C1-N2)");
|
||||
command("variable i1 equal label2type(improper,C1-N2-C1-N2)");
|
||||
|
||||
command("variable l1 equal is_typelabel(atom,C2)+is_typelabel(bond,C2-N1)"
|
||||
"+is_typelabel(bond,[X1][Y1])+is_typelabel(angle,C1-C2-N1)"
|
||||
"+is_typelabel(dihedral,N2-C1-C1-N2)+is_typelabel(improper,N2-C1-C1-N2)");
|
||||
command("variable l2 equal is_typelabel(atom,C1)+is_typelabel(bond,C1-N2)"
|
||||
"+is_typelabel(bond,[C1][C1])+is_typelabel(angle,C1-N2-C1)"
|
||||
"+is_typelabel(dihedral,C1-N2-C1-N2)+is_typelabel(improper,C1-N2-C1-N2)");
|
||||
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
ASSERT_THAT(variable->retrieve("t1"), StrEq("1"));
|
||||
@ -647,6 +661,30 @@ TEST_F(VariableTest, Label2TypeMolecular)
|
||||
ASSERT_THAT(variable->retrieve("a2"), StrEq("2"));
|
||||
ASSERT_THAT(variable->retrieve("d1"), StrEq("1"));
|
||||
ASSERT_THAT(variable->retrieve("i1"), StrEq("1"));
|
||||
ASSERT_THAT(variable->retrieve("l1"), StrEq("0"));
|
||||
ASSERT_THAT(variable->retrieve("l2"), StrEq("6"));
|
||||
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,N2')"), 1.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,\"N2'\")"), 0.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(bond,C1-N2)"), 1.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(bond,C2-N1)"), 0.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(bond,[C1][C1])"), 1.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(bond,[X1][Y1])"), 0.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(angle,C1-C2-N1)"), 0.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(angle,C1-N2-C1)"), 1.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(dihedral,C1-N2-C1-N2)"), 1.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(dihedral,N2-C1-C1-N2)"), 0.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(improper,C1-N2-C1-N2)"), 1.0);
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(improper,N2-C1-C1-N2)"), 0.0);
|
||||
|
||||
TEST_FAILURE(".*ERROR: Invalid bond type label H1 in label2type.. in variable.*",
|
||||
variable->compute_equal("label2type(bond,H1)"););
|
||||
TEST_FAILURE(".*ERROR: Invalid angle type label H1 in label2type.. in variable.*",
|
||||
variable->compute_equal("label2type(angle,H1)"););
|
||||
TEST_FAILURE(".*ERROR: Invalid dihedral type label H1 in label2type.. in variable.*",
|
||||
variable->compute_equal("label2type(dihedral,H1)"););
|
||||
TEST_FAILURE(".*ERROR: Invalid improper type label H1 in label2type.. in variable.*",
|
||||
variable->compute_equal("label2type(improper,H1)"););
|
||||
}
|
||||
|
||||
TEST_F(VariableTest, Format)
|
||||
|
||||
Reference in New Issue
Block a user