diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index a9ea3a059fb9d14bab34adb1f2b0bbefa30dda37..478785b3cb7169fa4610f1c28e4cd6e049273c8b 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -198,14 +198,13 @@ if(ENABLE_PYTHON) add_definitions(-DLMP_PYTHON) include_directories(${PYTHON_INCLUDE_DIR}) list(APPEND LAMMPS_LINK_LIBS ${PYTHON_LIBRARY}) - if(NOT PYTHON_INSTDIR) - execute_process(COMMAND ${PYTHON_EXECUTABLE} - -c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))" - OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR}) - if(NOT BUILD_SHARED_LIBS) - message(FATAL_ERROR "Python package need lammps to be build shared, use -DBUILD_SHARED_LIBS=ON") + if(BUILD_SHARED_LIBS) + if(NOT PYTHON_INSTDIR) + execute_process(COMMAND ${PYTHON_EXECUTABLE} + -c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))" + OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR}) endif() endif() @@ -401,6 +400,10 @@ foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD target_include_directories(awpmd PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include) elseif(PKG_LIB STREQUAL h5md) target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include) + elseif(PKG_LIB STREQUAL colvars) + target_compile_options(colvars PRIVATE -DLEPTON) + target_include_directories(colvars PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/include) + target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars) else() target_include_directories(${PKG_LIB} PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}) endif() diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt index ccb94ff5ca4e2bd23ad1f7067520b2ff77a97352..131432b9d04c94472b07338103be9d4e165fdacb 100644 --- a/doc/src/Section_commands.txt +++ b/doc/src/Section_commands.txt @@ -619,7 +619,7 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "pour"_fix_pour.html, "press/berendsen"_fix_press_berendsen.html, "print"_fix_print.html, -"property/atom"_fix_property_atom.html, +"property/atom (k)"_fix_property_atom.html, "python/invoke"_fix_python_invoke.html, "python/move"_fix_python_move.html, "qeq/comb (o)"_fix_qeq_comb.html, @@ -669,7 +669,7 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "wall/harmonic"_fix_wall.html, "wall/lj1043"_fix_wall.html, "wall/lj126"_fix_wall.html, -"wall/lj93"_fix_wall.html, +"wall/lj93 (k)"_fix_wall.html, "wall/piston"_fix_wall_piston.html, "wall/reflect (k)"_fix_wall_reflect.html, "wall/region"_fix_wall_region.html, @@ -684,14 +684,14 @@ package"_Section_start.html#start_3. "atc"_fix_atc.html, "ave/correlate/long"_fix_ave_correlate_long.html, "colvars"_fix_colvars.html, -"dpd/energy"_fix_dpd_energy.html, +"dpd/energy (k)"_fix_dpd_energy.html, "drude"_fix_drude.html, "drude/transform/direct"_fix_drude_transform.html, "drude/transform/reverse"_fix_drude_transform.html, "edpd/source"_fix_dpd_source.html, "eos/cv"_fix_eos_cv.html, "eos/table"_fix_eos_table.html, -"eos/table/rx"_fix_eos_table_rx.html, +"eos/table/rx (k)"_fix_eos_table_rx.html, "filter/corotate"_fix_filter_corotate.html, "flow/gauss"_fix_flow_gauss.html, "gle"_fix_gle.html, @@ -729,12 +729,12 @@ package"_Section_start.html#start_3. "qeq/reax (ko)"_fix_qeq_reax.html, "qmmm"_fix_qmmm.html, "qtb"_fix_qtb.html, -"reax/c/bonds"_fix_reax_bonds.html, -"reax/c/species"_fix_reaxc_species.html, +"reax/c/bonds (k)"_fix_reax_bonds.html, +"reax/c/species (k)"_fix_reaxc_species.html, "rhok"_fix_rhok.html, -"rx"_fix_rx.html, +"rx (k)"_fix_rx.html, "saed/vtk"_fix_saed_vtk.html, -"shardlow"_fix_shardlow.html, +"shardlow (k)"_fix_shardlow.html, "smd"_fix_smd.html, "smd/adjust/dt"_fix_smd_adjust_dt.html, "smd/integrate/tlsph"_fix_smd_integrate_tlsph.html, @@ -907,7 +907,7 @@ KOKKOS, o = USER-OMP, t = OPT. "none"_pair_none.html, "zero"_pair_zero.html, "hybrid"_pair_hybrid.html, -"hybrid/overlay"_pair_hybrid.html, +"hybrid/overlay (k)"_pair_hybrid.html, "adp (o)"_pair_adp.html, "airebo (oi)"_pair_airebo.html, "airebo/morse (oi)"_pair_airebo.html, @@ -1026,7 +1026,7 @@ KOKKOS, o = USER-OMP, t = OPT. "vashishta/table (o)"_pair_vashishta.html, "yukawa (gok)"_pair_yukawa.html, "yukawa/colloid (go)"_pair_yukawa_colloid.html, -"zbl (go)"_pair_zbl.html :tb(c=4,ea=c) +"zbl (gok)"_pair_zbl.html :tb(c=4,ea=c) These are additional pair styles in USER packages, which can be used if "LAMMPS is built with the appropriate @@ -1039,13 +1039,13 @@ package"_Section_start.html#start_3. "coul/diel (o)"_pair_coul_diel.html, "coul/long/soft (o)"_pair_lj_soft.html, "dpd/fdt"_pair_dpd_fdt.html, -"dpd/fdt/energy"_pair_dpd_fdt.html, +"dpd/fdt/energy (k)"_pair_dpd_fdt.html, "eam/cd (o)"_pair_eam.html, "edip (o)"_pair_edip.html, "edip/multi"_pair_edip.html, "edpd"_pair_meso.html, "eff/cut"_pair_eff.html, -"exp6/rx"_pair_exp6_rx.html, +"exp6/rx (k)"_pair_exp6_rx.html, "extep"_pair_extep.html, "gauss/cut"_pair_gauss.html, "kolmogorov/crespi/z"_pair_kolmogorov_crespi_z.html, @@ -1072,7 +1072,7 @@ package"_Section_start.html#start_3. "morse/smooth/linear"_pair_morse.html, "morse/soft"_pair_morse.html, "multi/lucy"_pair_multi_lucy.html, -"multi/lucy/rx"_pair_multi_lucy_rx.html, +"multi/lucy/rx (k)"_pair_multi_lucy_rx.html, "oxdna/coaxstk"_pair_oxdna.html, "oxdna/excv"_pair_oxdna.html, "oxdna/hbond"_pair_oxdna.html, @@ -1089,6 +1089,7 @@ package"_Section_start.html#start_3. "smd/triangulated/surface"_pair_smd_triangulated_surface.html, "smd/ulsph"_pair_smd_ulsph.html, "smtbq"_pair_smtbq.html, +"snap (k)"_pair_sap.html, "sph/heatconduction"_pair_sph_heatconduction.html, "sph/idealgas"_pair_sph_idealgas.html, "sph/lj"_pair_sph_lj.html, @@ -1096,7 +1097,7 @@ package"_Section_start.html#start_3. "sph/taitwater"_pair_sph_taitwater.html, "sph/taitwater/morris"_pair_sph_taitwater_morris.html, "srp"_pair_srp.html, -"table/rx"_pair_table_rx.html, +"table/rx (k)"_pair_table_rx.html, "tdpd"_pair_meso.html, "tersoff/table (o)"_pair_tersoff.html, "thole"_pair_thole.html, @@ -1251,7 +1252,7 @@ USER-OMP, t = OPT. "ewald/disp"_kspace_style.html, "msm (o)"_kspace_style.html, "msm/cg (o)"_kspace_style.html, -"pppm (go)"_kspace_style.html, +"pppm (gok)"_kspace_style.html, "pppm/cg (o)"_kspace_style.html, "pppm/disp (i)"_kspace_style.html, "pppm/disp/tip4p"_kspace_style.html, diff --git a/doc/src/accelerate_kokkos.txt b/doc/src/accelerate_kokkos.txt index b2279c5c719b46562c0ecf5593a9600e453f3b74..0c9178d6e4f42863003b0a2848f29cd42189620f 100644 --- a/doc/src/accelerate_kokkos.txt +++ b/doc/src/accelerate_kokkos.txt @@ -326,9 +326,9 @@ include both "Cuda" and "OpenMP", as is the case for /src/MAKE/OPTIONS/Makefile. KOKKOS_DEVICES=Cuda,OpenMP :pre -The suffix “/kk” is equivalent to “/kk/device”, and for Kokkos CUDA, -using the “-sf kk” in the command line gives the default CUDA version everywhere. -However, if the “/kk/host” suffix is added to a specific style in the input +The suffix "/kk" is equivalent to "/kk/device", and for Kokkos CUDA, +using the "-sf kk" in the command line gives the default CUDA version everywhere. +However, if the "/kk/host" suffix is added to a specific style in the input script, the Kokkos OpenMP (CPU) version of that specific style will be used instead. Set the number of OpenMP threads as "t Nt" and the number of GPUs as "g Ng" @@ -338,16 +338,16 @@ For example, the command to run with 1 GPU and 8 OpenMP threads is then: mpiexec -np 1 lmp_kokkos_cuda_openmpi -in in.lj -k on g 1 t 8 -sf kk :pre -Conversely, if the “-sf kk/host” is used in the command line and then the -“/kk” or “/kk/device” suffix is added to a specific style in your input script, +Conversely, if the "-sf kk/host" is used in the command line and then the +"/kk" or "/kk/device" suffix is added to a specific style in your input script, then only that specific style will run on the GPU while everything else will run on the CPU in OpenMP mode. Note that the execution of the CPU and GPU styles will NOT overlap, except for a special case: A kspace style and/or molecular topology (bonds, angles, etc.) running on the host CPU can overlap with a pair style running on the GPU. First compile -with “--default-stream per-thread” added to CCFLAGS in the Kokkos CUDA Makefile. -Then explicitly use the “/kk/host” suffix for kspace and bonds, angles, etc. +with "--default-stream per-thread" added to CCFLAGS in the Kokkos CUDA Makefile. +Then explicitly use the "/kk/host" suffix for kspace and bonds, angles, etc. in the input file and the "kk" suffix (equal to "kk/device") on the command line. Also make sure the environment variable CUDA_LAUNCH_BLOCKING is not set to "1" so CPU/GPU overlap can occur. diff --git a/doc/src/body.txt b/doc/src/body.txt index d44f82d4cc6703ed41c23dd08b2f1d294d45ceca..54ec157c744b4a18b89e318651b25d385c53c45e 100644 --- a/doc/src/body.txt +++ b/doc/src/body.txt @@ -261,7 +261,7 @@ For images created by the "dump image"_dump_image.html command, if the polygon consisting of N line segments. Note that the line segments are drawn between the N vertices, which does not correspond exactly to the physical extent of the body (because the "pair_style -rounded/polygon"_pair_body_rounded_polygon.cpp defines finite-size +rounded/polygon"_pair_body_rounded_polygon.html defines finite-size spheres at those point and the line segments between the spheres are tangent to the spheres). The drawn diameter of each line segment is determined by the {bflag1} parameter for the {body} keyword. The diff --git a/doc/src/compute_orientorder_atom.txt b/doc/src/compute_orientorder_atom.txt index 70c7ef68f71cfe7bf675730caa5819890510bfe2..adf11dcfcfa9822f4c736f1cb7203ca0e02c446c 100644 --- a/doc/src/compute_orientorder_atom.txt +++ b/doc/src/compute_orientorder_atom.txt @@ -67,7 +67,7 @@ parameters. This is followed by that number of integers giving the degree of each order parameter. Because {Q}2 and all odd-degree order parameters are zero for atoms in cubic crystals (see "Steinhardt"_#Steinhardt), the default order parameters are {Q}4, -{Q}6, {Q}8, {Q}10, and {Q}12. For the FCC crystal with {nnn}=12, {Q}4 +{Q}6, {Q}8, {Q}10, and {Q}12. For the FCC crystal with {nnn} =12, {Q}4 = sqrt(7/3)/8 = 0.19094.... The numerical values of all order parameters up to {Q}12 for a range of commonly encountered high-symmetry structures are given in Table I of "Mickel et diff --git a/doc/src/compute_sna_atom.txt b/doc/src/compute_sna_atom.txt index defd98d520d06489d8e93e93369cb33bdfb4b2d5..1c3787e696638191373d0b563f461c37d42dddad 100644 --- a/doc/src/compute_sna_atom.txt +++ b/doc/src/compute_sna_atom.txt @@ -224,7 +224,7 @@ block contains six sub-blocks corresponding to the {xx}, {yy}, {zz}, notation. Each of these sub-blocks contains one column for each bispectrum component, the same as for compute {sna/atom} -For example, if {K}=30 and ntypes=1, the number of columns in the per-atom +For example, if {K} =30 and ntypes=1, the number of columns in the per-atom arrays generated by {sna/atom}, {snad/atom}, and {snav/atom} are 30, 90, and 180, respectively. With {quadratic} value=1, the numbers of columns are 930, 2790, and 5580, respectively. diff --git a/doc/src/fix_controller.txt b/doc/src/fix_controller.txt index cd4d6adfdf03dc2e8332ffb3eec9e338de1b2240..cfb26138fdaa468c3074b1ef6fa1f1dfe6c6eb8c 100644 --- a/doc/src/fix_controller.txt +++ b/doc/src/fix_controller.txt @@ -83,7 +83,7 @@ the following dynamic equation: :c,image(Eqs/fix_controller1.jpg) where {c} is the continuous time analog of the control variable, -{e}={pvar}-{setpoint} is the error in the process variable, and +{e} ={pvar}-{setpoint} is the error in the process variable, and {alpha}, {Kp}, {Ki}, and {Kd} are constants set by the corresponding keywords described above. The discretized version of this equation is: @@ -106,10 +106,10 @@ the value of {alpha} to reflect this, while leaving {Kp}, {Ki}, and When choosing the values of the four constants, it is best to first pick a value and sign for {alpha} that is consistent with the magnitudes and signs of {pvar} and {cvar}. The magnitude of {Kp} -should then be tested over a large positive range keeping {Ki}={Kd}=0. +should then be tested over a large positive range keeping {Ki} = {Kd} =0. A good value for {Kp} will produce a fast response in {pvar}, without overshooting the {setpoint}. For many applications, proportional -feedback is sufficient, and so {Ki}={Kd}=0 can be used. In cases where +feedback is sufficient, and so {Ki} = {Kd} =0 can be used. In cases where there is a substantial lag time in the response of {pvar} to a change in {cvar}, this can be counteracted by increasing {Kd}. In situations where {pvar} plateaus without reaching {setpoint}, this can be diff --git a/doc/src/fix_shake.txt b/doc/src/fix_shake.txt index 9f82fc0fb66f5755f08c22c07c8418b148ec5141..46452a1f7e932eaf2531525f7ee6d557fceffb37 100644 --- a/doc/src/fix_shake.txt +++ b/doc/src/fix_shake.txt @@ -58,7 +58,7 @@ required in order to eliminate velocity components along the bonds In order to formulate individual constraints for SHAKE and RATTLE, focus on a single molecule whose bonds are constrained. Let Ri and Vi be the position and velocity of atom {i} at time {n}, for -{i}=1,...,{N}, where {N} is the number of sites of our reference +{i} =1,...,{N}, where {N} is the number of sites of our reference molecule. The distance vector between sites {i} and {j} is given by :c,image(Eqs/fix_rattle_rij.jpg) diff --git a/doc/src/fix_smd_integrate_tlsph.txt b/doc/src/fix_smd_integrate_tlsph.txt index 24d319bdb9a3db4a33467cbbb785492a5a25b72e..17c9c0f400f4cdf5dfc67966d5b1f51d4d0f4672 100644 --- a/doc/src/fix_smd_integrate_tlsph.txt +++ b/doc/src/fix_smd_integrate_tlsph.txt @@ -14,15 +14,12 @@ fix ID group-ID smd/integrate_tlsph keyword values :pre ID, group-ID are documented in "fix"_fix.html command smd/integrate_tlsph = style name of this fix command -zero or more keyword/value pairs may be appended :ul - -keyword = {limit_velocity} :l +zero or more keyword/value pairs may be appended +keyword = {limit_velocity} :ul {limit_velocity} value = max_vel max_vel = maximum allowed velocity :pre -:ule - [Examples:] fix 1 all smd/integrate_tlsph diff --git a/doc/src/fix_smd_integrate_ulsph.txt b/doc/src/fix_smd_integrate_ulsph.txt index 0dfb9451de3efb4a72cc7f6af5ce59bccef5b91e..28e38c7f970a9d99a07294bd77f4fb66a54ced00 100644 --- a/doc/src/fix_smd_integrate_ulsph.txt +++ b/doc/src/fix_smd_integrate_ulsph.txt @@ -14,9 +14,8 @@ fix ID group-ID smd/integrate_ulsph keyword :pre ID, group-ID are documented in "fix"_fix.html command smd/integrate_ulsph = style name of this fix command -zero or more keyword/value pairs may be appended :ul - -keyword = adjust_radius or limit_velocity +zero or more keyword/value pairs may be appended +keyword = adjust_radius or limit_velocity :ul adjust_radius values = adjust_radius_factor min_nn max_nn adjust_radius_factor = factor which scale the smooth/kernel radius @@ -28,7 +27,7 @@ limit_velocity values = max_velocity [Examples:] -fix 1 all smd/integrate_ulsph adjust_radius 1.02 25 50 :pre +fix 1 all smd/integrate_ulsph adjust_radius 1.02 25 50 fix 1 all smd/integrate_ulsph limit_velocity 1000 :pre [Description:] @@ -38,7 +37,7 @@ See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth Mach Dynamics The {adjust_radius} keyword activates dynamic adjustment of the per-particle SPH smoothing kernel radius such that the number of neighbors per particles remains within the interval {min_nn} to {max_nn}. The parameter {adjust_radius_factor} determines the amount of adjustment per timestep. Typical values are -{adjust_radius_factor}=1.02, {min_nn}=15, and {max_nn}=20. +{adjust_radius_factor} =1.02, {min_nn} =15, and {max_nn} =20. The {limit_velocity} keyword will control the velocity, scaling the norm of the velocity vector to max_vel in case it exceeds this velocity limit. diff --git a/doc/src/fix_surface_global.txt b/doc/src/fix_surface_global.txt new file mode 100644 index 0000000000000000000000000000000000000000..b470babab72a14f2761805d4719d8bfc92165546 --- /dev/null +++ b/doc/src/fix_surface_global.txt @@ -0,0 +1,19 @@ +"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c + +:link(lws,http://lammps.sandia.gov) +:link(ld,Manual.html) +:link(lc,Section_commands.html#comm) + +:line + +fix wall/surface/globale command :h3 + +[Description:] + +This feature is not yet implemented. + +[Related commands:] + +"dump image"_dump_image.html + + diff --git a/doc/src/fixes.txt b/doc/src/fixes.txt index 4bb3feed0a6e4ecadd1ce1c5af47557719e859ed..c3fcc06bf1c53e780b9b7bc3ce9885671fc9f690 100644 --- a/doc/src/fixes.txt +++ b/doc/src/fixes.txt @@ -148,6 +148,7 @@ Fixes :h1 fix_srd fix_store_force fix_store_state + fix_surface_global fix_temp_berendsen fix_temp_csvr fix_temp_rescale diff --git a/doc/src/info.txt b/doc/src/info.txt index 43b430f746451f05f5a2308520eefdd7f0062c42..d5b5bd97b942842c03a26011d66ce7049b1c3a27 100644 --- a/doc/src/info.txt +++ b/doc/src/info.txt @@ -12,7 +12,7 @@ info command :h3 info args :pre -args = one or more of the following keywords: {out}, {all}, {system}, {memory}, {communication}, {computes}, {dumps}, {fixes}, {groups}, {regions}, {variables}, {styles}, {time}, or {configuration} +args = one or more of the following keywords: {out}, {all}, {system}, {memory}, {communication}, {computes}, {dumps}, {fixes}, {groups}, {regions}, {variables}, {coeffs}, {styles}, {time}, or {configuration} {out} values = {screen}, {log}, {append} filename, {overwrite} filename {styles} values = {all}, {angle}, {atom}, {bond}, {compute}, {command}, {dump}, {dihedral}, {fix}, {improper}, {integrate}, {kspace}, {minimize}, {pair}, {region} :ul @@ -81,6 +81,11 @@ The {variables} category prints a list of all currently defined variables, their names, styles, definition and last computed value, if available. +The {coeffs} category prints a list for each defined force style +(pair, bond, angle, dihedral, improper) indicating which of the +corresponding coefficients have been set. This can be very helpful +to debug error messages like "All pair coeffs are not set". + The {styles} category prints the list of styles available in the current LAMMPS binary. It supports one of the following options to control which category of styles is printed out: diff --git a/doc/src/lammps.book b/doc/src/lammps.book index 8c2daa5835575c3cfd9ab56d75427562b1363c7c..54762a885e6743df62ca8979cd92b842ca91783a 100644 --- a/doc/src/lammps.book +++ b/doc/src/lammps.book @@ -1,6 +1,5 @@ -#HTMLDOC 1.8.27 --t pdf14 -f "../Manual.pdf" --book --toclevels 4 --no-numbered --toctitle "Table of Contents" --title --textcolor #000000 --linkcolor #0000ff --linkstyle plain --bodycolor #ffffff --size Universal --left 1.00in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --header1 ... --footer ..1 --nup 1 --tocheader .t. --tocfooter ..i --portrait --color --no-pscommands --no-xrxcomments --compression=1 --jpeg=0 --fontsize 11.0 --fontspacing 1.2 --headingfont helvetica --bodyfont times --headfootsize 11.0 --headfootfont helvetica --charset iso-8859-1 --links --embedfonts --pagemode document --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680 --no-strict --no-overflow - +#HTMLDOC 1.8.28 +-t pdf14 -f "../Manual.pdf" --book --toclevels 4 --no-numbered --toctitle "Table of Contents" --title --textcolor #000000 --linkcolor #0000ff --linkstyle plain --bodycolor #ffffff --size Universal --left 1.00in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --header1 ... --footer ..1 --nup 1 --tocheader .t. --tocfooter ..i --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=0 --fontsize 11.0 --fontspacing 1.2 --headingfont Sans --bodyfont Serif --headfootsize 11.0 --headfootfont Sans-Bold --charset iso-8859-15 --links --embedfonts --pagemode document --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680 --no-strict --no-overflow Manual.html Section_intro.html Section_start.html diff --git a/doc/src/pair_body_rounded_polygon.txt b/doc/src/pair_body_rounded_polygon.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6dc2e37b5a80fce04b7b753ffb7e007c4703ae6 --- /dev/null +++ b/doc/src/pair_body_rounded_polygon.txt @@ -0,0 +1,19 @@ +"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c + +:link(lws,http://lammps.sandia.gov) +:link(ld,Manual.html) +:link(lc,Section_commands.html#comm) + +:line + +pair_style body/rounded/polygon command :h3 + +[Description:] + +Note: This feature is not yet implemented. + +[Related commands:] + +"pair_style body"_pair_body.html + +[Default:] none diff --git a/doc/src/pair_smd_hertz.txt b/doc/src/pair_smd_hertz.txt index 2a70c598cef7a0a5d41ab82aac6d706562e53a1e..eeaa3387a44a834cfe4361a75e40d2610d29bdb6 100644 --- a/doc/src/pair_smd_hertz.txt +++ b/doc/src/pair_smd_hertz.txt @@ -28,7 +28,7 @@ The parameter <contact_stiffness> has units of pressure and should equal roughly of the Young's modulus (or bulk modulus in the case of fluids) of the material model associated with the SPH particles. The parameter {scale_factor} can be used to scale the particles' contact radii. This can be useful to control how close -particles can approach each other. Usually, {scale_factor}=1.0. +particles can approach each other. Usually, {scale_factor} =1.0. :line diff --git a/doc/src/pair_smd_triangulated_surface.txt b/doc/src/pair_smd_triangulated_surface.txt index 76d3891a3c995d2778920b0ad55406e90eb63f1d..c32bf3a22ea89c35efd3231b0ffbfdd72590a810 100644 --- a/doc/src/pair_smd_triangulated_surface.txt +++ b/doc/src/pair_smd_triangulated_surface.txt @@ -29,7 +29,7 @@ The parameter <contact_stiffness> has units of pressure and should equal roughly of the Young's modulus (or bulk modulus in the case of fluids) of the material model associated with the SPH particle The parameter {scale_factor} can be used to scale the particles' contact radii. This can be useful to control how close -particles can approach the triangulated surface. Usually, {scale_factor}=1.0. +particles can approach the triangulated surface. Usually, {scale_factor} =1.0. :line diff --git a/doc/src/pair_smd_ulsph.txt b/doc/src/pair_smd_ulsph.txt index 393bbc066525c90db749a8d80acdfedca93ad4a9..268fe78d02294eca17134ff7fcffb276512db2be 100644 --- a/doc/src/pair_smd_ulsph.txt +++ b/doc/src/pair_smd_ulsph.txt @@ -12,8 +12,8 @@ pair_style smd/ulsph command :h3 pair_style smd/ulsph args :pre -these keywords must be given :l -keyword = {*DENSITY_SUMMATION} or {*DENSITY_CONTINUITY} and {*VELOCITY_GRADIENT} or {*NO_VELOCITY_GRADIENT} and {*GRADIENT_CORRECTION} or {*NO_GRADIENT_CORRECTION} +these keywords must be given :ul +keyword = {*DENSITY_SUMMATION} or {*DENSITY_CONTINUITY} and {*VELOCITY_GRADIENT} or {*NO_VELOCITY_GRADIENT} and {*GRADIENT_CORRECTION} or {*NO_GRADIENT_CORRECTION} :pre [Examples:] diff --git a/doc/src/pair_snap.txt b/doc/src/pair_snap.txt index 593765aa633b3f117a9e2b67d0966144472a6f3d..27dcf6082b892b5a5df64442f2045215c8d5dbd8 100644 --- a/doc/src/pair_snap.txt +++ b/doc/src/pair_snap.txt @@ -7,6 +7,7 @@ :line pair_style snap command :h3 +pair_style snap/kk command :h3 [Syntax:] @@ -171,6 +172,29 @@ This pair style can only be used via the {pair} keyword of the :line +Styles with a {gpu}, {intel}, {kk}, {omp}, or {opt} suffix are +functionally the same as the corresponding style without the suffix. +They have been optimized to run faster, depending on your available +hardware, as discussed in "Section 5"_Section_accelerate.html +of the manual. The accelerated styles take the same arguments and +should produce the same results, except for round-off and precision +issues. + +These accelerated styles are part of the GPU, USER-INTEL, KOKKOS, +USER-OMP and OPT packages, respectively. They are only enabled if +LAMMPS was built with those packages. See the "Making +LAMMPS"_Section_start.html#start_3 section for more info. + +You can specify the accelerated styles explicitly in your input script +by including their suffix, or you can use the "-suffix command-line +switch"_Section_start.html#start_6 when you invoke LAMMPS, or you can +use the "suffix"_suffix.html command in your input script. + +See "Section 5"_Section_accelerate.html of the manual for +more instructions on how to use the accelerated styles effectively. + +:line + [Restrictions:] This style is part of the SNAP package. It is only enabled if diff --git a/doc/src/pair_zbl.txt b/doc/src/pair_zbl.txt index 5ab672171b7bd041330965199ebc862119088692..1984cd831f6bf2fef81c9f2ef39c16b04284e309 100644 --- a/doc/src/pair_zbl.txt +++ b/doc/src/pair_zbl.txt @@ -8,6 +8,7 @@ pair_style zbl command :h3 pair_style zbl/gpu command :h3 +pair_style zbl/kk command :h3 pair_style zbl/omp command :h3 [Syntax:] diff --git a/doc/src/pairs.txt b/doc/src/pairs.txt index ccd540bf44a6e1f37e374cf4118f7a53655bbbd6..f1c4e77041a720d917efc38bfa0858ce5f50bc92 100644 --- a/doc/src/pairs.txt +++ b/doc/src/pairs.txt @@ -11,6 +11,7 @@ Pair Styles :h1 pair_awpmd pair_beck pair_body + pair_body_rounded_polygon pair_bop pair_born pair_brownian diff --git a/doc/utils/converters/lammpsdoc/txt2rst.py b/doc/utils/converters/lammpsdoc/txt2rst.py index e9a25e18930a9b98d80934b8e10f7044360b0867..17d0916157a4f2d9b07ec655522ac6999b6978cb 100755 --- a/doc/utils/converters/lammpsdoc/txt2rst.py +++ b/doc/utils/converters/lammpsdoc/txt2rst.py @@ -67,7 +67,8 @@ class RSTMarkup(Markup): text = text.replace('*', '\\*') text = text.replace('^', '\\^') text = text.replace('|', '\\|') - text = re.sub(r'([^"])_', r'\1\\_', text) + text = re.sub(r'([^"])_([ \t\n\r\f])', r'\1\\\\_\2', text) + text = re.sub(r'([^"])_([^ \t\n\r\f])', r'\1\\_\2', text) return text def unescape_rst_chars(self, text): diff --git a/examples/reax/HNS/README.txt b/examples/reax/HNS/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..465d64d17115e29b46e19de817523a7e17f74d55 --- /dev/null +++ b/examples/reax/HNS/README.txt @@ -0,0 +1,49 @@ +# Pure HNS crystal, ReaxFF tests for benchmarking LAMMPS + +Authors: Mitchell Wood, Stan Moore, and Aidan Thompson, Sandia National Labs +Date: 2017-10-17 +Questions: Mitchell Wood, mitwood@sandia.gov + +---------ReaxFF Benchmark Files--------- +1) in.reaxc.hns +2) data.hns-equil +3) ffield.reax.hns + +---------File Description--------- + +1) LAMMPS input file for this test. + The file is read line by line looking for keywords to set up this run. + It will read in the configuration given by the argument of the read_data command, which is supplied in this distribution. + The type of simulation is set by the 'fix' commands, dynamic charges are controlled with 'fix qeq' and the integration style is given as 'fix nve' here. + More information about each of the individual commands can be found online at lammps.sandia.gov in the user manual section. + + *There are four free varaibles in this file, three of which control the size of the simulation and the last will dictate how many MD time steps are taken. + *The size of the system is controlled by the 'replicate' command given the values of $x, $y and $z. + *The number of timesteps taken is controlled by the 'run' command given the value of $t + + It is worth noting that these four free variables can be set at the command line when the simulation is invoked rather than editing the file by hand prior to each run. + + Example syntax: + lmp_serial -in in.reaxc.hns -v x 2 -v y 2 -v z 2 -v t 100 + +2) LAMMPS Data file for crystalline HNS + This file matches the LAMMPS data format, more information about this data structure can be found at lammps.sandia.gov + + This particular data file is of the energetic material Hexanitrostilbene (HNS) with atom_style charge (id type q x y z). + The file contains eight molecules (2 unit cells). + + Chemical Name: Hexanitrostilbene + Molecule Composition: C14H6N6O12 + IUPAC Name: 1,3,5-Trinitro-2-[2-(2,4,6-trinitrophenyl)ethenyl]benzene + + Phyical Properties (Gerard F., Hardy A. Acta Cryst. (1988) 1283-1287) + Density: 1.741 g/cc + Crystal Structure: Monoclinic P2(1)/c + Molecules per Unit Cell: 4 + Lattice Constants: a=22.326 + b=5.5706 + c=14.667 + beta=110.04 deg + +3) ReaxFF force field file. + Details about this particular parameterization can be found in T.-R. Shan, R. R. Wixom, A. P. Thompson, "Atomistic Simulation of Nanoscale Void-Enhanced Initiation in Hexanitrostilbene", Proc. 15th International Detonation Symposium, pp. 962-969, SAND Number: SAND2014-15518J diff --git a/examples/reax/HNS/data.hns-equil b/examples/reax/HNS/data.hns-equil new file mode 100644 index 0000000000000000000000000000000000000000..5adda8822aa35803b9718f31f4ba749ccdc1553e --- /dev/null +++ b/examples/reax/HNS/data.hns-equil @@ -0,0 +1,631 @@ +# Pure HNS crystal, ReaxFF tests for benchmarking LAMMPS +# See README for more info + +304 atoms +4 atom types + +0.0000000000000000e+00 2.2326000000000001e+01 xlo xhi +0.0000000000000000e+00 1.1141200000000000e+01 ylo yhi +0.0000000000000000e+00 1.3778966000000000e+01 zlo zhi +0.0000000000000000e+00 -5.0260300000000004e+00 0.0000000000000000e+00 xy xz yz + +Masses + +1 12 +2 1.008 +3 15.999 +4 14 + +Atoms + +30 1 -1.5978703752096285e-03 1.2032863869865822e+00 2.8256400602546141e+00 1.6550970119417108e+00 0 0 0 +34 1 1.4609342964817035e-01 1.9907567656339498e+00 4.0380967812225812e+00 1.6037009557414807e+00 0 0 0 +38 1 -1.1313442904350110e-01 2.3735208752501014e+00 4.6358508212064597e+00 2.8207166456035706e+00 0 0 0 +42 1 1.6137623866269668e-01 2.2068159183466545e+00 3.9155626912486312e+00 4.0393199600260017e+00 0 0 0 +46 1 -1.3231732350799086e-01 1.6723546283637456e+00 2.6490843099361769e+00 4.0718695650174555e+00 0 0 0 +50 1 1.3924326618460361e-01 1.0432796609680879e+00 2.1377763017045028e+00 2.8779760001142254e+00 0 0 0 +2 1 1.0355454307915037e-02 9.2365304282304432e+00 3.0315922757175588e+00 5.8645178945136656e-01 0 0 0 +83 3 -1.1387168269097275e-01 -2.8903688091767799e-01 4.4353520665316273e+00 5.8542082062284990e+00 0 0 0 +151 2 2.4137857976817839e-01 -1.2098303319415862e+00 6.2642360580370904e-01 6.3751534971040620e+00 0 0 0 +90 3 -1.4867175259103951e-01 2.7301832997028690e+00 4.2208910046400874e+00 6.4748944299312052e+00 0 0 0 +62 3 -1.4102407432432201e-01 9.4127387076516271e+00 5.0642928548941315e+00 3.6732353442096048e+00 0 0 0 +98 3 -1.4663622654196759e-01 -3.6147625406370998e-01 6.2032706772140034e-01 4.2927916563248019e+00 0 0 0 +54 1 -4.5611437629532792e-02 4.5789128567777315e-01 2.3037414864278984e+00 4.4853180490390432e-01 0 0 0 +87 3 -1.8118678506945068e-01 3.4239328769587729e-01 2.4978291763591067e+00 6.8433313861644862e+00 0 0 0 +122 4 -1.3816556601478763e-03 2.7347000852858909e+00 4.7780564701856187e+00 5.2860122928435764e+00 0 0 0 +126 4 3.6742909094152829e-03 2.4236147574090339e-01 8.2881803614262350e-01 3.1300069722778523e+00 0 0 0 +106 4 5.0380311643663904e-03 9.5333959154754595e+00 4.9409481826854691e+00 2.4063719536640074e+00 0 0 0 +146 2 2.5678858551879979e-01 1.6690771913639459e+00 2.1486485750781656e+00 4.9718402573987817e+00 0 0 0 +110 4 1.6289496724444380e-03 5.3102382664427816e+00 1.9205393567101749e+00 2.1572449075775788e+00 0 0 0 +150 2 2.1173170721002404e-01 7.5386951474057873e-01 1.3549807632892001e+00 9.3638420990104679e-02 0 0 1 +6 1 1.1953236006118220e-01 8.7624714685569316e+00 3.7188181320106537e+00 1.7053122151642655e+00 0 0 0 +10 1 -1.2241319991927709e-01 7.5639831402718549e+00 3.2619209383245216e+00 2.2783314043500087e+00 0 0 0 +14 1 1.6332523038636718e-01 6.7064629894786840e+00 2.3225374933384266e+00 1.5993053103840011e+00 0 0 0 +18 1 -1.2740222789777322e-01 7.1960583589051836e+00 1.7158122662355066e+00 4.4569871516692844e-01 0 0 0 +27 1 -5.3470339611564929e-02 8.2035551240691014e+00 5.2145834528427404e+00 6.7535330772512978e+00 0 0 0 +130 2 2.6175533983311156e-01 7.2291088343383372e+00 3.7463444170136344e+00 3.1894666598585886e+00 0 0 0 +115 4 -1.0266178820511205e-02 6.5003245602926247e+00 1.9837100341352589e+00 5.4205438257015626e+00 0 0 0 +70 3 -1.9659495203039720e-01 4.8736785299263445e+00 6.8433015433575883e-01 2.0399570769464188e+00 0 0 0 +66 3 -1.4139946566263059e-01 4.6669037558628865e+00 2.7410416721294739e+00 2.9336061027665226e+00 0 0 0 +79 3 -1.4677703049809945e-01 7.3812392124196062e+00 1.4179852894043470e+00 4.6640710482179113e+00 0 0 0 +75 3 -1.6908670824429517e-01 6.1211322589023460e+00 3.2420945874253642e+00 5.3132771020098115e+00 0 0 0 +139 2 2.5448108175084960e-01 8.4566882159339229e+00 4.3172025545808355e+00 6.2369390618225014e+00 0 0 0 +23 1 1.3477422750843063e-01 6.0540050656644713e+00 1.1700924054581945e+00 6.6706585187016119e+00 0 0 0 +118 4 -1.5835790692106114e-02 2.4504894190711446e+00 4.5478624528845764e+00 2.3408689744414402e-01 0 0 0 +26 1 -5.8799784794887205e-02 1.0677497585216404e+01 3.3270395487987150e+00 2.1937163062090195e-01 0 0 1 +135 2 2.2667543991902223e-01 4.2303516292691130e+00 2.3680991399220881e+00 6.7600909900965371e+00 0 0 0 +134 2 2.6603700384712170e-01 1.5553791693879147e+00 9.2759126357203769e-01 1.3751336880718977e+01 0 0 -1 +35 1 1.3619576950915824e-01 -6.1123259368930594e-01 4.2744050950379879e+00 8.2689176641591953e+00 0 0 0 +39 1 -1.3619776752057167e-01 2.1174961291658523e-02 3.7911192964937714e+00 9.4031145771372433e+00 0 0 0 +43 1 1.7616533882120664e-01 -2.4082821430091039e-01 4.3921540571785220e+00 1.0667961368752986e+01 0 0 0 +55 1 -4.7675633308455131e-02 -1.8255087561703223e+00 2.3531147144749784e-02 7.0185294659074930e+00 0 0 0 +51 1 1.4229302277810482e-01 -1.4696286889225143e+00 2.4331344403165978e-01 9.4912358273027095e+00 0 0 0 +67 3 -1.3320855668594128e-01 2.2563624634551185e+00 6.4796712999277428e-01 9.7945933875844204e+00 0 0 0 +82 3 -1.2277895342641043e-01 -2.4283488967409923e+00 3.7198642287090697e+00 1.2995930949473768e+01 0 0 0 +111 4 -1.5140995980939403e-03 3.0250993995224067e+00 1.4943316767321402e+00 9.1744364446145408e+00 0 0 0 +91 3 -1.4025506634127735e-01 1.7753588712423607e-01 4.4153781344920002e+00 1.3115706743542738e+01 0 0 0 +95 3 -1.3868856763412177e-01 1.2309740323323872e+00 2.8163901938840534e+00 1.1864853104907548e+01 0 0 0 +99 3 -1.3250332187377967e-01 -2.4235387111074864e+00 2.2927169952708413e+00 1.0531038226936827e+01 0 0 0 +103 3 -1.5214067005316109e-01 -2.5943266041046478e+00 2.0130134130925272e+00 8.2928000156291564e+00 0 0 0 +11 1 -1.2064832278125080e-01 4.9238352739840066e+00 5.1583157878512989e+00 8.7390613510373552e+00 0 0 0 +123 4 -1.8374834914142782e-03 4.6335581596415221e-01 3.8350456476487684e+00 1.1969089243285413e+01 0 0 0 +127 4 -4.5958705273757214e-03 -2.3340640092443685e+00 1.5285367626179718e+00 9.4882316286490980e+00 0 0 0 +143 2 2.8164020999934403e-01 8.1801006001560150e-01 3.0833734683476477e+00 9.2359390877007783e+00 0 0 0 +226 3 -1.3797612921025582e-01 3.0686575977270270e+00 5.3454897967899155e+00 1.2182598966837521e+01 0 0 0 +74 3 -1.4848161091470552e-01 3.6465792627245133e+00 4.2615086181930439e-02 1.2180659758160441e+01 0 0 0 +107 4 -1.4162558249806764e-02 6.9041986670066819e+00 3.4945477378354388e+00 8.8118463563242155e+00 0 0 0 +7 1 1.3874647498773149e-01 6.1777705393650866e+00 4.7275638247590814e+00 8.2546633769247251e+00 0 0 0 +59 3 -1.4867036170029541e-01 7.9924230788486739e+00 3.0224192820538822e+00 8.2251400208652061e+00 0 0 0 +15 1 1.5783636416316224e-01 4.3575954701770536e+00 9.7856621771074259e-01 8.4167269066637989e+00 0 0 0 +19 1 -1.2015824785960097e-01 4.8284895573299593e+00 1.5629079717902468e+00 7.2532253050378577e+00 0 0 0 +147 2 2.8239828117589366e-01 -9.3165419330122523e-01 4.2118942787062214e-01 1.1512337330019069e+01 0 0 0 +114 4 -1.4785079641223244e-02 3.8503739478102448e+00 1.3491416192259467e+00 1.2373804865591053e+01 0 0 0 +3 1 1.3350861714137560e-02 6.8114774504878302e+00 5.5447953386683206e+00 7.2580722690515636e+00 0 0 0 +63 3 -1.2277076639947315e-01 6.4897117194665608e+00 2.8986172068480283e+00 9.9060820538034609e+00 0 0 0 +78 3 -1.1723116541459006e-01 4.4127311301931043e+00 2.1084084419897180e+00 1.1535065556985785e+01 0 0 0 +71 3 -1.7152044820786300e-01 2.8873531342706946e+00 2.7797489684906393e+00 9.3163860457066789e+00 0 0 0 +131 2 2.7834313014819689e-01 4.3817210322557489e+00 4.5528948096328836e+00 9.5379421136925018e+00 0 0 0 +31 1 9.4935956929876678e-03 -1.4954352092350376e+00 5.3645298943245292e+00 8.3142675828162034e+00 0 0 0 +86 3 -1.6350292182104242e-01 -1.8311649351050598e+00 2.0802600512349903e-01 1.3629050043036029e+01 0 0 -1 +60 3 -1.7749808073059342e-01 6.6696465438141646e+00 1.5936122406953454e-01 1.1815497920409818e+01 0 0 0 +155 1 7.9312977244249613e-03 6.8120544939431360e+00 1.0199834144196412e-01 7.2127972853813258e+00 0 1 0 +22 1 1.4407031044516649e-01 3.4096950234688004e+00 2.0679954049404619e+00 1.3690619069119307e+01 0 0 -1 +140 2 2.5769600911651236e-01 6.0687404141669434e+00 1.3241144290919518e+00 1.3462978005934200e+01 0 0 -1 +199 1 -1.3944547646247771e-01 -1.1362038789337188e+00 5.4530148366485571e+00 1.0742524104946057e+01 0 0 0 +119 4 -1.2299043862974497e-02 -2.3446859456688562e-01 3.6495764565964248e+00 6.8964694682143248e+00 0 0 0 +182 1 6.7658225708544725e-03 1.4169424463071361e+00 8.3763330460636727e+00 1.4012109232974952e+00 0 0 0 +186 1 1.2980507892816731e-01 2.2797704925844604e+00 9.5291291369621636e+00 1.3666006980904655e+00 0 0 0 +190 1 -1.5071175365705503e-01 2.7699144439458436e+00 1.0081261276817276e+01 2.5544135724485146e+00 0 0 0 +194 1 1.7547903565045994e-01 2.3921031079123969e+00 9.5103250107764765e+00 3.8009524053675627e+00 0 0 0 +198 1 -1.3144018623170101e-01 1.4977753357515831e+00 8.3987685531196199e+00 3.8549410858411388e+00 0 0 0 +202 1 1.3849820878754834e-01 1.0150476921735834e+00 7.8483962991977574e+00 2.6673948664405547e+00 0 0 0 +206 1 -6.3927688649410647e-02 6.6270841666167679e-01 7.9494021125481424e+00 1.4197887405827284e-01 0 0 0 +235 3 -1.3761341595728172e-01 -2.8837295421316522e-01 9.2189872838153608e+00 5.8372696110592788e+00 0 0 0 +142 2 2.6479443554012794e-01 2.9320229108693479e+00 5.5858386406215974e+00 2.8822394959582591e+00 0 0 0 +242 3 -1.4112562564538583e-01 2.5388308202795757e+00 9.7663385818562389e+00 6.3230546934248055e+00 0 0 0 +291 2 2.3831756420052311e-01 8.3394602256848422e+00 1.0597218595134976e+01 5.6327293542472532e+00 0 0 0 +250 3 -1.0987475178029475e-01 -5.0622879855012592e-01 6.2591257947415606e+00 3.8940086364947737e+00 0 0 0 +258 4 6.9512359773382104e-03 9.4664816115561496e+00 1.0405510702076073e+01 1.9702849156142326e+00 0 0 0 +262 4 -8.0100924398892291e-03 5.3017951547661228e+00 7.1947421307917523e+00 2.2008872174147442e+00 0 0 0 +274 4 -2.8801715867946998e-02 2.8217805545648877e+00 1.0198911718869871e+01 5.0989203211129208e+00 0 0 0 +278 4 -8.3382269572114982e-03 1.9022473073729729e-01 6.5306916972236531e+00 2.7977581783283543e+00 0 0 0 +222 3 -1.5735096896248177e-01 5.0460780570651043e+00 5.9652600638197084e+00 1.9688452086847921e+00 0 0 0 +298 2 2.8845912568524801e-01 1.2259584803396069e+00 7.9975091793540463e+00 4.8377168239797355e+00 0 0 0 +267 4 -8.1543222370399418e-04 6.7515502316853571e+00 7.3530236371224733e+00 5.3783512877798509e+00 0 0 0 +154 1 7.1908069858682630e-03 9.1240531784682535e+00 8.3732699807014779e+00 4.1677219242496333e-01 0 0 0 +158 1 1.3448308907124562e-01 8.6487938120238645e+00 9.1661211028768115e+00 1.5116534817235705e+00 0 0 0 +162 1 -1.1355360785260224e-01 7.3973813587135364e+00 8.8118392837386903e+00 2.0442619468259688e+00 0 0 0 +166 1 1.5711265427818599e-01 6.6193754339762592e+00 7.7216957118390352e+00 1.5125332287756803e+00 0 0 0 +170 1 -1.2245433545215903e-01 7.2334953478137844e+00 6.9135079041535876e+00 5.1425051872838257e-01 0 0 0 +175 1 1.3581278243177822e-01 6.1399576319422247e+00 6.6351336822606477e+00 6.6388959270812675e+00 0 0 0 +282 2 2.3480529560852545e-01 6.8780657238569551e+00 9.4266263098711551e+00 2.8083989170176249e+00 0 0 0 +179 1 -3.9098442124970913e-02 8.1921382670269995e+00 1.1015911501599872e+01 6.6154483416940151e+00 0 0 0 +231 3 -1.2568742237480407e-01 7.4708728388631442e+00 6.7304833314035504e+00 4.5334798740490836e+00 0 0 0 +218 3 -1.4344893238707335e-01 4.7091494226840656e+00 7.8204929202859752e+00 3.1719768839537057e+00 0 0 0 +294 2 2.9175211722940220e-01 3.4302436656544328e+00 1.0911761593148093e+01 2.4580124801797307e+00 0 0 0 +227 3 -1.5716251537215054e-01 6.3710113945660511e+00 8.6140075062272228e+00 5.1189294887372707e+00 0 0 0 +254 3 -1.6304878692327615e-01 1.1369152465923738e-02 5.8040125934093432e+00 1.7344736606349882e+00 0 0 0 +94 3 -1.6001482691396210e-01 3.4226797144178276e+00 5.8324891118411557e+00 5.0673816802761040e+00 0 0 0 +214 3 -1.3095404512866216e-01 9.2822478837309497e+00 1.0944567563926054e+01 3.1520938926115289e+00 0 0 0 +210 3 -1.6656061802004779e-01 1.0125927049661630e+01 1.0968553134904163e+01 1.0306564425404838e+00 0 0 0 +58 3 -1.8302344471552118e-01 1.0213161644629823e+01 5.8090021306247959e+00 1.7225024677054026e+00 0 0 0 +246 3 -1.6180800736237624e-01 3.7271744208235593e+00 1.1136471158690993e+01 4.9690967792530811e+00 0 0 0 +102 3 -1.6531840940386305e-01 3.3511101143416933e-01 1.1054539855366549e+01 2.2157686745942939e+00 0 -1 0 +238 3 -1.6856155817812890e-01 2.9083086152708901e+00 5.7681194020610480e+00 1.7191101722965371e-01 0 0 0 +287 2 2.4377790046642306e-01 4.4026866149631791e+00 7.9897646117591492e+00 6.8189677819979027e+00 0 0 0 +286 2 2.6154505839152942e-01 6.7181127902312507e+00 5.9804318863208010e+00 2.1530836987465235e-01 0 0 0 +171 1 -1.1187852832153318e-01 4.9158733746689869e+00 7.0613244573777925e+00 7.1285394473597972e+00 0 0 0 +187 1 1.3804049779409072e-01 -4.7081814568988589e-01 9.4447023070407337e+00 8.2867903808074814e+00 0 0 0 +191 1 -1.2971955344725286e-01 1.0532858911262055e-01 9.0301089070007023e+00 9.5194948333957843e+00 0 0 0 +195 1 1.7237826722593086e-01 -3.2979026063385319e-02 9.7887682538998035e+00 1.0706940452275044e+01 0 0 0 +270 4 -1.3464043531568919e-02 -2.2543639852501798e+00 1.0142966260197174e+01 1.3730567035196929e+01 0 0 -1 +203 1 1.3427963268281090e-01 -1.8024111493992248e+00 5.9588781753908151e+00 9.5912321727716829e+00 0 0 0 +302 2 2.4793795803104607e-01 -4.0813465149326733e+00 7.0098028171254363e+00 1.3582140525668459e+01 0 0 0 +234 3 -1.2298530438399083e-01 -2.0999175503602907e+00 9.3334349911585850e+00 1.2713070387329807e+01 0 0 0 +183 1 -1.3480580351704630e-03 -1.2524425039534379e+00 1.0603399634220155e+01 8.3052270038890796e+00 0 0 0 +243 3 -1.6074098714307544e-01 1.0092944188786444e+00 1.0218279224693790e+01 1.2861379846486365e+01 0 0 0 +247 3 -1.5387578069009830e-01 8.5439915136228706e-01 8.0170106581812881e+00 1.2211169111299865e+01 0 0 0 +251 3 -1.3983948146137931e-01 -2.9738796938163725e+00 7.5122263482065499e+00 1.1030823813483353e+01 0 0 0 +255 3 -1.6423936253041480e-01 -3.0284913258585524e+00 7.9088522479385679e+00 8.7407850365314399e+00 0 0 0 +259 4 8.0410558983729646e-04 6.7961292001636444e+00 9.1867860735672711e+00 8.8636424740217947e+00 0 0 0 +275 4 -4.3259974176743099e-05 6.9707283465202874e-01 9.3227186018980994e+00 1.1981108937286187e+01 0 0 0 +279 4 -5.4226204814747658e-03 -2.7183814077004502e+00 7.1633679386102083e+00 9.7555594565405492e+00 0 0 0 +295 2 2.6218133810847499e-01 6.0410847381122412e-01 8.0421997981783182e+00 9.5648500938018834e+00 0 0 0 +230 3 -1.2018011636818954e-01 4.6317864784420824e+00 6.8176590020738042e+00 1.1516620570461674e+01 0 0 0 +271 4 -2.8439562879540532e-02 -2.3352025232358109e-01 8.6009765210205842e+00 7.0174876202960812e+00 0 0 0 +219 3 -1.4441576113611607e-01 2.1139860757598838e+00 5.9566809343395395e+00 9.2739736659519139e+00 0 0 0 +159 1 1.3413754194495167e-01 6.2381774846970295e+00 1.0512869843000209e+01 8.2998411286674898e+00 0 0 0 +207 1 -4.5275085907843307e-02 -2.2313374155847714e+00 5.9531808015124978e+00 7.1401084416064693e+00 0 0 0 +167 1 1.7086332099009921e-01 4.3308992321162805e+00 6.2978761471859119e+00 8.1848912823747266e+00 0 0 0 +299 2 2.8374116457714360e-01 -1.3476728927796344e+00 5.8584256959679699e+00 1.1723539811442672e+01 0 0 0 +163 1 -1.2189457501468513e-01 5.0935078513079350e+00 1.1062258678023431e+01 9.0012683062525820e+00 0 0 0 +263 4 -7.2701194644572698e-04 2.9434843653848728e+00 6.8044753722388700e+00 8.7310546416994494e+00 0 0 0 +283 2 2.7264339681755889e-01 4.8359812206870174e+00 1.0640435156903745e+01 9.9608335270238513e+00 0 0 0 +215 3 -1.4288902954841964e-01 6.2383981494412399e+00 8.7703889714141425e+00 9.9908196032513992e+00 0 0 0 +266 4 -8.3036691590210043e-03 3.8552898694615410e+00 6.3532834866457213e+00 1.2405163389905894e+01 0 0 0 +223 3 -1.5495221688355837e-01 2.7688702181241505e+00 8.0788864563930165e+00 8.7961622886575483e+00 0 0 0 +47 1 -1.4240292392311604e-01 -8.0585282619207854e-01 1.1001203580909479e+01 1.0640184120123211e+01 0 -1 0 +239 3 -1.5918937290882762e-01 1.2364626954722713e-01 7.3735979096052837e+00 7.1236548585242829e+00 0 0 0 +211 3 -1.5314927771899267e-01 7.7651972221628771e+00 8.5829452424035306e+00 8.2735478967570266e+00 0 0 0 +174 1 1.3567196175621835e-01 3.3561575756156685e+00 7.2839028683362592e+00 1.3611594287463081e+01 0 0 -1 +178 1 -4.2521883951091258e-02 5.4615345784574156e+00 8.6476231458927373e+00 1.3600443195015076e+01 0 0 0 +290 2 2.1442656366253354e-01 5.5274039219990954e+00 9.2255865950855895e+00 1.2687705291121766e+01 0 0 0 +303 2 2.5353570250225943e-01 -2.2348717930687036e+00 7.0298204354936624e+00 6.9132532076613566e+00 0 0 0 +24 1 1.2162850983145865e-01 1.3570458894241060e+01 3.7277652770944414e+00 9.8918074854908070e-02 0 0 1 +5 1 1.3914102385590588e-01 1.1213395000571410e+01 8.0472724282855101e-01 5.7408880705229404e+00 0 0 0 +197 1 -1.3041827238141993e-01 1.8473286069241315e+01 1.0985097812596707e-01 3.0075353107267451e+00 0 1 0 +13 1 1.7283275995574809e-01 1.2875160453890059e+01 4.7996107330851263e+00 5.2087316096641079e+00 0 0 0 +17 1 -1.1881087407702678e-01 1.2355470079281316e+01 4.1155201213165631e+00 6.3297886650294171e+00 0 0 0 +125 4 3.7413972756181225e-03 1.9792607892607982e+01 3.8314384983826288e+00 3.7758070374204347e+00 0 0 0 +65 3 -1.5036712947298864e-01 1.5121389160787066e+01 4.9829628898301168e+00 4.1493419461259045e+00 0 0 0 +117 4 -2.8172670419954578e-02 1.7196064275775313e+01 2.0768392879531876e+00 6.6413862436815210e+00 0 0 0 +61 3 -1.2308569749478299e-01 1.0809273741496686e+01 2.5226209794106560e+00 4.0850632510091458e+00 0 0 0 +85 3 -1.6137869003688254e-01 1.6596173548046423e+01 3.2483998401081635e+00 6.6279770720028131e+00 0 0 0 +69 3 -1.6211349992745419e-01 1.4316483787038429e+01 2.8679518868321781e+00 4.4855442842711772e+00 0 0 0 +9 1 -1.3074969844225212e-01 1.2401631549383206e+01 3.6248247848246284e-01 5.0973483639088109e+00 0 0 0 +80 3 -1.2136120739760561e-01 1.2414408244527392e+01 3.7798480870141100e+00 2.3049497332865676e+00 0 0 0 +105 4 -8.7639699558985304e-03 1.0400914317139788e+01 1.9934211504476644e+00 5.2185528134499632e+00 0 0 0 +109 4 3.6355423208319151e-03 1.4153445124920722e+01 4.1606747163691100e+00 4.5151554719853308e+00 0 0 0 +116 4 -2.0040355754916923e-02 1.3085160543744017e+01 4.4594714321443236e+00 1.4538603237969565e+00 0 0 0 +129 2 2.8405512757711698e-01 1.2820832866494431e+01 8.9357547891832556e-01 4.2332198666407352e+00 0 0 0 +152 2 2.4669130813086726e-01 2.1677578157490025e+01 4.0323646146544609e+00 3.5638857460123857e-01 0 0 0 +29 1 5.8620817499049974e-03 1.8561052170019028e+01 2.8191467769292960e-01 5.3975919601693825e+00 0 0 0 +141 2 2.6074912497584113e-01 1.6683115099591326e+01 2.8811346832734976e+00 4.1932142387762292e+00 0 0 0 +33 1 1.3809754803072044e-01 1.7700292673901394e+01 1.4462902229581946e+00 5.3613784374191082e+00 0 0 0 +37 1 -1.2506428679034834e-01 1.7292724764729162e+01 1.9577791424971711e+00 4.1365222417858645e+00 0 0 0 +41 1 1.5574606725144832e-01 1.7684017799240962e+01 1.2568437218671011e+00 2.9834398674586708e+00 0 0 0 +121 4 3.1035256692961075e-03 1.7254091420272236e+01 1.9749573648856620e+00 1.5939503050368518e+00 0 0 0 +49 1 1.3615547301261535e-01 1.8863927091248083e+01 5.0961048964131059e+00 3.9285863191137240e+00 0 0 0 +149 2 2.2703718115742552e-01 1.9254758140895767e+01 4.0931544733063738e+00 6.6148594449325175e+00 0 0 0 +84 3 -1.3924471002607569e-01 2.0413070700633931e+01 1.2047548927515181e+00 1.0936978108224675e+00 0 0 0 +53 1 -4.8376182763242251e-02 1.9296848129360342e+01 5.1351935135474474e+00 6.3529637885031054e+00 0 0 0 +89 3 -1.4492596391523513e-01 1.7151071776065425e+01 1.2918686591231159e+00 5.0291711308277665e-01 0 0 0 +93 3 -1.7423814775149760e-01 1.6893419100350471e+01 3.2111750510659807e+00 1.6437292442546174e+00 0 0 0 +97 3 -1.3408621635364737e-01 2.0252553978161927e+01 3.6033112624663475e+00 2.6319164884537698e+00 0 0 0 +101 3 -1.5647560242362671e-01 1.9966818329962706e+01 2.9803252235704702e+00 4.7704681555938286e+00 0 0 0 +145 2 2.9710717883828969e-01 1.8342396226420870e+01 5.0375210273389071e+00 1.8399466526232027e+00 0 0 0 +228 3 -1.4751575154425844e-01 1.3620322518195461e+01 4.8592688087461144e-01 1.7071338271502052e+00 0 1 0 +57 3 -1.6234942986621856e-01 9.5573034514145281e+00 2.5713316687631611e+00 6.0309294315367872e+00 0 0 0 +133 2 2.5213413889296182e-01 1.2870471176495373e+01 3.1816472789094496e+00 6.6131200188746284e+00 0 0 0 +136 2 2.5352888813788832e-01 1.5309707786810065e+01 4.9333975554866214e+00 8.8529787370636895e-02 0 0 1 +138 2 2.4757969448062320e-01 1.1088418315051889e+01 4.2920333787949172e+00 3.0106028235732774e-01 0 0 1 +1 1 1.4746669082761749e-02 1.0642281893540970e+01 6.8544269556010395e-02 6.8142401227780320e+00 0 0 0 +88 3 -1.6483993868322799e-01 1.9581081903169775e+01 5.2703115059623826e+00 2.1488086883709036e-02 0 0 1 +64 3 -1.5561028561723289e-01 8.1514538556249523e+00 3.6877081373514281e-01 1.0190861669963537e+01 0 0 0 +8 1 1.2742104870686943e-01 8.4817612503248814e+00 1.9386649635257653e+00 1.2088673448348180e+01 0 0 0 +12 1 -1.3287822675261260e-01 9.7374245849040690e+00 2.3614292305863063e+00 1.1668887530828931e+01 0 0 0 +16 1 1.7038148918615603e-01 1.0385610834546672e+01 3.4830285077629948e+00 1.2258282947730743e+01 0 0 0 +20 1 -1.2612831428267482e-01 9.7652115043624903e+00 4.1264217871858486e+00 1.3381826333553166e+01 0 0 0 +25 1 -4.9580879905770883e-02 9.2720365942599763e+00 3.2092695107275732e-01 7.3585562419532167e+00 0 0 0 +148 2 2.8255405335750933e-01 1.6024837696238595e+01 3.2479443163306607e+00 8.9410550895656549e+00 0 0 0 +137 2 2.4211278788929905e-01 9.1875734209445099e+00 7.8297873360776893e-01 8.2956507179333450e+00 0 0 0 +104 3 -1.6303797587445271e-01 1.7571928078007303e+01 5.3161697109543047e+00 1.2072204347282128e+01 0 0 0 +68 3 -1.3950884940126265e-01 1.2726252049625897e+01 3.2949351425978031e+00 1.1414834763137264e+01 0 0 0 +128 4 -1.1637074791112794e-02 1.7184554793649326e+01 4.6282393562250501e+00 1.1015460865140042e+01 0 0 0 +73 3 -1.5872839596893912e-01 1.1181520064577594e+01 2.5784441672869147e+00 8.5109267793241798e+00 0 0 0 +77 3 -1.2443355673803388e-01 1.0091806544554002e+01 4.3646337275773526e+00 9.2688186113011550e+00 0 0 0 +108 4 -3.6175483988508603e-03 7.8242079841413910e+00 6.6722303677879913e-01 1.1399732511932291e+01 0 0 0 +112 4 -1.1575150065119208e-03 1.1761455742350400e+01 4.0719181606614256e+00 1.1776879794815027e+01 0 0 0 +113 4 2.4550599269124868e-04 1.0795250821397342e+01 3.7987066995239132e+00 8.3505753502250588e+00 0 0 0 +132 2 2.4842899099174726e-01 1.0210124897784075e+01 1.8788605874908142e+00 1.0866322237260500e+01 0 0 0 +56 1 -5.7548729418621672e-02 1.6817150692583052e+01 3.1182828489110217e+00 1.3647345422902928e+01 0 0 0 +21 1 1.3924700036304882e-01 1.1320578571569595e+01 4.6135876874421253e+00 7.0983485573687055e+00 0 0 0 +32 1 1.0844185182340992e-02 1.6170921360774656e+01 2.7042197293152741e+00 1.2379322306625614e+01 0 0 0 +36 1 1.3503387619781887e-01 1.5341369407103103e+01 1.5518718147435990e+00 1.2428854940060008e+01 0 0 0 +40 1 -1.3597771280707957e-01 1.4740075360614529e+01 1.0465774988630860e+00 1.1294731238516940e+01 0 0 0 +44 1 1.6880045598426557e-01 1.5001353192585187e+01 1.6411551197426020e+00 1.0010620303523039e+01 0 0 0 +48 1 -1.2558996845974929e-01 1.5808101597792366e+01 2.7755379813359049e+00 9.9372975636831917e+00 0 0 0 +52 1 1.3281216321759565e-01 1.6322309187162340e+01 3.3644510045114564e+00 1.1112513564301416e+01 0 0 0 +28 1 -6.5294980841562170e-02 6.4211323147196655e+00 2.3017586164015249e+00 1.3490316072051021e+01 0 0 -1 +81 3 -1.2843492532541184e-01 1.7151825848192740e+01 1.3120341070283221e+00 7.7174295144219229e+00 0 0 0 +124 4 -1.4764597579941991e-02 1.4185236897374100e+01 1.0228517938755142e+00 8.8729039133495515e+00 0 0 0 +92 3 -1.4190415481562765e-01 1.4204698596670227e+01 1.5016257934556176e+00 7.6321699049346643e+00 0 0 0 +248 3 -1.5638430087805932e-01 1.4020886714186110e+01 5.0947360067557721e+00 8.6627100663371710e+00 0 0 0 +100 3 -1.3133130869891860e-01 1.7310522047850426e+01 5.1918304994019406e+00 9.8392866690657019e+00 0 0 0 +4 1 1.5734719075794559e-02 7.8639113856106908e+00 2.6785305061792619e+00 1.3189765412864087e+01 0 0 0 +72 3 -1.5426752144049144e-01 1.1969567014622319e+01 5.3270782247615420e+00 1.2064966387155430e+01 0 0 0 +120 4 -2.0660475242344017e-02 1.5113088125709915e+01 6.8136976964891294e-01 1.3734925518848485e+01 0 0 0 +144 2 2.8606673499984137e-01 1.4148562456194458e+01 1.2935293435874679e-01 1.1341925553730979e+01 0 0 0 +169 1 -1.2507437749398062e-01 1.2589350193664469e+01 9.6660641865322336e+00 6.6820816309750768e+00 0 0 0 +157 1 1.3101766309728599e-01 1.1145831453245778e+01 6.5322364284476038e+00 5.4897532104231015e+00 0 0 0 +237 3 -1.8127406245080599e-01 1.6806111047670463e+01 8.6400093722835205e+00 6.6759262988075010e+00 0 0 0 +165 1 1.6995487109137958e-01 1.3103500332034736e+01 1.0384335954455226e+01 5.5271785715298618e+00 0 0 0 +176 1 1.2882442652127868e-01 1.3671797000328342e+01 9.6038663738548795e+00 2.6168928776903760e-01 0 0 1 +205 1 -4.8207815225547582e-02 1.9224825955952788e+01 1.0874213403116096e+01 6.6574893131046124e+00 0 0 0 +277 4 1.4930286360253821e-03 1.9651416561184572e+01 9.2489608770003588e+00 4.1784091141788453e+00 0 0 0 +209 3 -1.6275120538245183e-01 9.5554489015501503e+00 8.3795120288952756e+00 5.8743003066822324e+00 0 0 0 +213 3 -1.3485169792328811e-01 1.0943788927101483e+01 8.6431449393778390e+00 4.0928003727842803e+00 0 0 0 +161 1 -1.3273743374911376e-01 1.2280736566108812e+01 6.0290419636079431e+00 4.8556228573471660e+00 0 0 0 +221 3 -1.7679581574343128e-01 1.4393585749017504e+01 8.4899193891902520e+00 4.5825079042836760e+00 0 0 0 +253 3 -1.6035745761620385e-01 1.9781445944064224e+01 8.6485767448586675e+00 5.3040041753399327e+00 0 0 0 +232 3 -1.2799358810754613e-01 1.2364918612601592e+01 9.7758010551044840e+00 2.2401917199098085e+00 0 0 0 +257 4 -1.9913799867289986e-04 1.0451479233722360e+01 7.9379519522033899e+00 5.0504514859089920e+00 0 0 0 +261 4 -3.4555361126691019e-03 1.4320242842210837e+01 9.7749018361670981e+00 4.7062260598906827e+00 0 0 0 +268 4 -1.5055288888581174e-02 1.3124484360209099e+01 1.0442001174009329e+01 1.4325865653416883e+00 0 0 0 +281 2 2.5703834979854812e-01 1.2682557129077104e+01 6.5903281288690403e+00 4.0666020770935871e+00 0 0 0 +76 3 -1.6586999266455632e-01 1.3327490136711706e+01 5.7131554828911719e+00 1.6697801246823667e+00 0 0 0 +269 4 -2.1171000778044357e-02 1.7283160130632815e+01 7.4411692063792323e+00 6.6447469455156956e+00 0 0 0 +293 2 2.7290480959393421e-01 1.6390117340052175e+01 8.1427871754464327e+00 4.1453778817030393e+00 0 0 0 +185 1 1.4251888962968337e-01 1.7646301360095702e+01 6.8060051363141278e+00 5.2762360485359965e+00 0 0 0 +189 1 -1.3737458776787198e-01 1.7106287939262291e+01 7.3151885688533937e+00 4.0829606247112133e+00 0 0 0 +193 1 1.6541485059377861e-01 1.7474745511598268e+01 6.7395321126450396e+00 2.8386528663930264e+00 0 0 0 +249 3 -1.1843584216878646e-01 2.0295681305936338e+01 8.9442689135060611e+00 3.0850044490980602e+00 0 0 0 +201 1 1.3485899621277553e-01 1.8900452250802715e+01 1.0643913043619367e+01 4.2326691162612606e+00 0 0 0 +273 4 -1.6714023259828865e-02 1.6938996933016462e+01 7.3387870122823786e+00 1.5363988784299578e+00 0 0 0 +236 3 -1.2355410366085848e-01 2.0177433851291724e+01 7.3270773757376118e+00 8.0727851108673909e-01 0 0 0 +297 2 2.7365008989235995e-01 1.8678094529668360e+01 1.0829042176024551e+01 2.0264646843938703e+00 0 0 0 +241 3 -1.3242507487597038e-01 1.7150677421619047e+01 6.6859112973428427e+00 4.3318022894633185e-01 0 0 0 +245 3 -1.5323252835912843e-01 1.6103166872797594e+01 8.3462901340103492e+00 1.5133752076252216e+00 0 0 0 +217 3 -1.4629220392561476e-01 1.5067188206352801e+01 1.0618680859452411e+01 4.0492352246916967e+00 0 0 0 +181 1 5.0965121162264149e-03 1.8587182516354687e+01 5.7170737089830137e+00 5.1565413815669334e+00 0 0 0 +292 2 2.2874358541976608e-01 1.1552525108380831e+01 7.6259286510297697e+00 1.3384679985379644e+00 0 0 0 +180 1 -5.1746461189359383e-02 1.1625165190185328e+01 8.1444186576450406e+00 4.0762536869394300e-01 0 0 0 +153 1 8.8208209649980433e-03 1.0600258034032093e+01 5.7454307198841628e+00 6.5451775261429477e+00 0 0 0 +288 2 2.4927582339981319e-01 1.5463637315305929e+01 1.0699099426447392e+01 1.0486275946296693e-01 0 0 1 +45 1 -1.3517946310057191e-01 1.8301477956473473e+01 5.5717679472161583e+00 2.7664633054482839e+00 0 0 0 +304 2 2.2486586845500126e-01 2.1617085806614373e+01 9.5310367098813202e+00 5.5239430577664519e-02 0 0 0 +301 2 2.3470421113143294e-01 1.8703111761640312e+01 1.0141321746893691e+01 7.2037351056071399e+00 0 0 0 +160 1 1.3364542254657649e-01 8.4346293600260474e+00 7.6851716017603682e+00 1.2467023336907147e+01 0 0 0 +164 1 -1.2487089796822108e-01 9.6666468779246557e+00 8.0468240032658169e+00 1.1943669747243241e+01 0 0 0 +168 1 1.6701349494391496e-01 1.0439803295885056e+01 9.1127840899256274e+00 1.2381177087258184e+01 0 0 0 +172 1 -1.3020759405372742e-01 9.8932371684989029e+00 9.8913871779883049e+00 1.3447195727693076e+01 0 0 0 +212 3 -1.5125403187103914e-01 6.9624281408518947e+00 5.6571610609985141e+00 1.2453261174476992e+01 0 0 0 +300 2 2.7611769610997067e-01 1.6017471570020845e+01 8.6259558338967963e+00 8.7191276546742404e+00 0 0 0 +173 1 1.3743470947361397e-01 1.1427208127509154e+01 1.0070249006720299e+01 7.3012666328220623e+00 0 0 0 +252 3 -1.3985099857863706e-01 1.7703283623898365e+01 1.0471689159899555e+01 9.4960946630226921e+00 0 0 0 +220 3 -1.3314684995454354e-01 1.2640391702818302e+01 8.7278098710881640e+00 1.1171691575716721e+01 0 0 0 +224 3 -1.6236151179485753e-01 1.2195126308387401e+01 1.0782788030472828e+01 1.1930418819765878e+01 0 0 0 +225 3 -1.6039635575996958e-01 1.1353998720161787e+01 8.0440397714963083e+00 8.6550334837763891e+00 0 0 0 +229 3 -1.3323753060864349e-01 9.9301103297282758e+00 9.5821150336327268e+00 9.3285752178239303e+00 0 0 0 +260 4 -7.2882218470804692e-03 7.7661613649657051e+00 6.4638379478392016e+00 1.1828846332357456e+01 0 0 0 +264 4 -4.4812040282032721e-03 1.1811851783049329e+01 9.5492369552617848e+00 1.1798537690204709e+01 0 0 0 +265 4 -1.1490593454960719e-02 1.0900624858965966e+01 9.2549569808961660e+00 8.5265278740098260e+00 0 0 0 +284 2 2.6169361381127387e-01 1.0136530252720341e+01 7.4934987247178269e+00 1.1092226812526848e+01 0 0 0 +156 1 3.7379196017244612e-03 7.9392347778451446e+00 8.4560411860777513e+00 1.3578276661002105e+01 0 0 0 +296 2 2.6498019774798365e-01 1.4043644232829966e+01 5.7233288173678014e+00 1.1072881863137523e+01 0 0 0 +184 1 6.4957634629475743e-03 1.6305180909519947e+01 8.0991512260634924e+00 1.2086442524820042e+01 0 0 0 +188 1 1.4843357901885965e-01 1.5406855890108130e+01 7.0068766343707436e+00 1.2240334144353453e+01 0 0 0 +192 1 -1.2516789083526150e-01 1.4818668347533144e+01 6.5268485695570471e+00 1.1067589711981087e+01 0 0 0 +196 1 1.6508881872184145e-01 1.5069466191418311e+01 7.0262259913129794e+00 9.7805102402414406e+00 0 0 0 +200 1 -1.3083913251494941e-01 1.5877770724233319e+01 8.1909563622810566e+00 9.6849283497158432e+00 0 0 0 +204 1 1.4328415910864176e-01 1.6517454767413131e+01 8.7153370164695936e+00 1.0835341568135473e+01 0 0 0 +208 1 -3.8003030991159703e-02 1.6991575004843000e+01 8.6944401555232247e+00 1.3313277441939094e+01 0 0 0 +233 3 -1.2326769386570821e-01 1.7156065036742135e+01 6.6639053499866350e+00 7.7079787843959817e+00 0 0 0 +276 4 -5.2986617880064930e-03 1.4413639513006760e+01 6.3307747767611460e+00 8.5405715830585791e+00 0 0 0 +244 3 -1.5332334147379001e-01 1.4369625482518934e+01 6.9679841418869541e+00 7.4021901341817147e+00 0 0 0 +280 4 -1.0402553151618275e-03 1.7407378472673361e+01 9.9643766158767004e+00 1.0667658376032438e+01 0 0 0 +256 3 -1.5333876696855078e-01 1.7730538655474327e+01 1.0586091087689283e+01 1.1752671734713664e+01 0 0 0 +216 3 -1.2878785467194953e-01 8.1639102845009042e+00 6.0881555837219636e+00 1.0601035151948000e+01 0 0 0 +272 4 -1.1454730376138519e-02 1.5121809213972451e+01 6.4239863410326965e+00 1.3638484698105245e+01 0 0 0 +240 3 -1.7440955102646941e-01 1.4541899399377094e+01 1.0692525508455294e+01 1.3580894402760997e+01 0 0 0 +289 2 2.5518604784481402e-01 9.0866514971259225e+00 6.9566208908866489e+00 7.6825247899372453e+00 0 0 0 +177 1 -5.5916134966486265e-02 9.2532862740598993e+00 6.0521578915699488e+00 7.1173031955497548e+00 0 0 0 +96 3 -1.5202035991426149e-01 1.3493699232041106e+01 1.1085823288281921e+01 9.0487676573379119e+00 0 -1 0 +285 2 2.4589286761119938e-01 1.3000363019268956e+01 8.7257850399635615e+00 7.0132894052156329e+00 0 0 0 + +Velocities + +30 -2.4174866102998649e-05 -5.8400589693352791e-03 3.6955846688862632e-03 +34 -1.3368307218153295e-03 7.0584278791678914e-04 -3.0271317908999555e-03 +38 8.6171069789500506e-03 -1.0386254798008827e-02 -2.3314367537503582e-03 +42 4.8899848626993876e-03 3.9658933682618922e-03 -1.3834629869053450e-03 +46 -5.1759547107459820e-03 -1.6591730900438351e-03 1.3562788235339125e-03 +50 3.2654372821856043e-04 -2.6116773352929845e-03 3.0838446698027021e-03 +2 5.1894432194761312e-04 -3.6417701641676351e-03 -6.0338161946400983e-03 +83 6.4151200155796147e-03 1.1229419196344197e-03 5.8686926636185061e-04 +151 -2.8796970286988421e-02 -1.9548040511881571e-02 -6.7147938124706083e-03 +90 6.2870412345627461e-04 -3.1855217036112515e-03 -2.4627865498249857e-03 +62 -4.4936223386147171e-03 2.5073159143134635e-03 5.0810575404568363e-03 +98 -2.6875273259438230e-03 -2.4115478804683705e-03 -4.4288138402231482e-03 +54 -5.1467385322100587e-03 2.3510009029855091e-03 -5.7599904123623999e-03 +87 -2.6684214311491952e-03 -2.8674576614179329e-03 -2.4648328610147843e-03 +122 -1.1105639887986528e-04 3.7635425105536613e-03 6.5468310425097244e-03 +126 1.7828516731701188e-03 2.8588181283881898e-03 -2.1514694876793162e-03 +106 -7.7358290604802099e-03 -4.3326415268508372e-03 2.1962581331009981e-03 +146 -1.9223843131665190e-02 -1.5532877349572517e-02 -1.1613923723158268e-02 +110 -8.2566212285788074e-03 4.2234253378360346e-03 3.6785470951886073e-03 +150 -1.2647024341794211e-02 1.8221509465505117e-02 -5.0128424122487351e-03 +6 -6.8768919890731146e-03 9.6678308905083585e-03 -1.3917811305885867e-03 +10 3.3168337478153122e-03 3.3619712471675725e-03 1.0650876474592522e-03 +14 -1.6475678689132532e-03 -6.7698081292684271e-03 -7.9364870861734881e-04 +18 1.0422096740317807e-04 -4.8696249119766313e-04 -4.3921928339088817e-03 +27 -6.9682265925353234e-04 5.5558986359258728e-03 -2.7945120615473170e-03 +130 7.3436853366040510e-03 -1.5615310112063635e-02 -9.7973567669173128e-03 +115 -4.9493176729646319e-03 2.2805811912743512e-03 -4.9676425031934309e-03 +70 4.0695789639428725e-03 2.2086802832277375e-03 3.2576668769327293e-03 +66 -8.5702414719068636e-04 1.8464043867736203e-03 -9.9555929207937981e-04 +79 1.1070783496162258e-03 6.1862400561743238e-03 -4.4051680685139050e-04 +75 1.9178089415144753e-03 3.1463732884630131e-04 -1.7217916675468907e-03 +139 2.8517079207620144e-02 -1.9905991206418231e-02 3.0264652754780935e-02 +23 4.3797306852474890e-03 7.4086737657933421e-03 -2.8926828277232282e-03 +118 -4.2147982046991687e-03 -8.2984567965974573e-03 -1.7977706716132648e-03 +26 3.4699369555654721e-03 -5.3268668174097636e-03 1.8533436395768656e-03 +135 5.0870099813551360e-03 2.0031409187880080e-02 2.2279936704878493e-02 +134 -3.4718997783717287e-02 -2.9046322574695655e-02 -6.7290107414706181e-03 +35 -1.2742938214048215e-03 -5.4677769759628484e-03 4.7166914319580477e-03 +39 -3.5171031039312260e-05 -1.1036949335105606e-03 -1.7799449964092009e-03 +43 4.8250906268874363e-04 -3.8354099752335269e-03 -5.0163266920790258e-03 +55 3.9772466070045580e-03 -3.5583777510197752e-03 -2.7896235341660572e-04 +51 1.5321458062959898e-03 -2.5209486954065438e-03 -2.9415253251844297e-03 +67 5.2768727282876873e-03 3.3637779239677082e-04 -5.3077524292974064e-03 +82 -4.6010418478961692e-03 2.1304975260813871e-03 1.1013307930023183e-03 +111 -4.0141402813814028e-03 1.2793755351396241e-02 -1.1323015089853242e-03 +91 -9.6347063458754171e-04 -3.5925228782824701e-03 3.7468788450416997e-03 +95 5.2641923860850424e-03 -1.1996066942874387e-03 -3.8583046662080682e-03 +99 2.3310479302716311e-03 2.2048601264337848e-03 1.9775025948164386e-03 +103 6.3269083153676174e-03 6.1569760098524693e-03 -1.3850043247383714e-03 +11 -8.2028729433133388e-04 8.2443337191164673e-03 6.9902706057217599e-03 +123 2.8650904196624318e-03 -6.0257734224878484e-03 -1.2614564384462788e-02 +127 -1.3550684527947047e-04 -2.6284774608511655e-03 2.8069949466735810e-04 +143 -1.8419932991845429e-03 -2.6883069832929719e-03 -8.1392982989522298e-04 +226 3.4261189824281555e-03 -3.2522996094829560e-03 2.8225670673923528e-03 +74 -1.5628901433170131e-03 2.5608703622864438e-04 -1.3280001953940086e-04 +107 1.5589530299060254e-03 -2.4852894833352420e-03 8.3108677637003976e-03 +7 4.2438551230323320e-04 -5.7307909930981258e-03 -2.7893810245450206e-03 +59 2.2690384886148115e-03 -9.0468087925548706e-03 -5.1781998228276976e-04 +15 -3.9577231821540616e-03 -2.1847885018534147e-03 -8.4371976597557574e-03 +19 7.1229587205270907e-03 -2.1206916186471624e-04 -5.8627889621317396e-03 +147 1.6390240343441092e-02 -8.7176501390591708e-03 -2.8178922194092536e-03 +114 4.7515421240825620e-03 6.7642492576560622e-03 1.7473395470475074e-03 +3 4.2551631139686498e-03 1.9437904991404275e-03 1.7935525179072753e-03 +63 3.8697842475399176e-03 -8.4765436511819187e-03 -2.0491881784184133e-03 +78 -5.3846747219525202e-03 -6.8961963835257167e-03 -3.7349089410657235e-03 +71 2.9873740104239097e-03 8.1549198198451985e-04 -1.2934279359320738e-03 +131 -5.0390794739495932e-03 -4.6131525347064785e-03 -4.9175135351588175e-03 +31 -5.2605889050595231e-03 5.7430101599048719e-04 -7.0682843661158861e-03 +86 3.1844979209605865e-03 4.0950803059798075e-03 -3.0587604667680749e-03 +60 8.1133523195327998e-04 -7.6704816714192525e-03 -2.2818047599636416e-03 +155 -8.0144518574578917e-03 -5.1005256982490348e-03 6.2037281719425292e-03 +22 4.1797836257974454e-03 1.6568806164942351e-03 8.7670139729851895e-05 +140 -2.3324839515429668e-02 -1.2437810613019238e-02 3.6287188915814311e-02 +199 -1.0790097311952464e-03 -2.9869062426129372e-03 -4.0112108465879112e-03 +119 -1.1755627465417481e-03 -8.2100780073601515e-03 2.6479374681998786e-03 +182 1.8734201874040408e-03 -2.6689908635035755e-03 1.0860930707006422e-02 +186 -2.5675279605953606e-03 -2.4756375850000737e-03 1.0395482737196491e-03 +190 2.2910971675434619e-03 -1.3145289380748972e-03 -5.2985364488092098e-03 +194 6.8186760409634419e-03 8.3840465649670081e-04 5.3074104269872037e-03 +198 -5.0859955599489521e-03 4.2087962673814959e-04 4.6023185972026296e-03 +202 2.1012410907117738e-03 -6.7507745063792000e-03 -1.1128219310673163e-03 +206 -6.5209450456218789e-03 -1.0339535444774403e-03 -1.4501279837400901e-03 +235 3.3388911239315496e-03 2.1065220517720367e-03 7.9991895755700954e-03 +142 9.8475835271551841e-03 -9.5028518218655076e-03 -1.8276565508549877e-03 +242 1.0217457780939720e-03 -1.5197673217320828e-03 4.7406923875269085e-03 +291 -3.0930387698493111e-02 7.8445304030849618e-03 1.6310030568432197e-02 +250 -6.8489632875769993e-04 4.6565160745170404e-03 3.3886136702525487e-03 +258 -1.4004182588445049e-03 2.2806177132263595e-03 -1.0347843260651223e-03 +262 -1.2881324206774447e-03 6.9434393825884946e-04 -5.8956964621466827e-03 +274 -1.8944352259530324e-03 3.2192357927930009e-04 -1.7082790058223906e-03 +278 1.5288401707297728e-03 3.6217814543088645e-03 -2.0316883110052923e-04 +222 7.7331045584829068e-03 1.2362023936040929e-03 8.2907874575483369e-03 +298 2.5328078728893279e-03 -6.2165377525673126e-03 1.5784008908580539e-02 +267 7.0018357704332811e-03 -4.5522884959513024e-03 7.6649882914402567e-03 +154 -3.6287490712629171e-03 -1.2740874221828388e-02 3.8314063886802823e-03 +158 -7.6208895283387092e-03 1.1878194435768373e-02 -3.5971056387286322e-03 +162 -6.4746300934775817e-04 5.5506749212761494e-04 6.0756597279294430e-03 +166 1.1989320501678076e-03 -5.0577544194060501e-03 6.3998146927604317e-03 +170 -3.8035317060563859e-03 7.5841699707098983e-04 6.5780084783308920e-03 +175 -3.8974609142492406e-04 6.1926230615375706e-04 -2.3335031290293434e-04 +282 9.3600641903433621e-03 3.6118288335866035e-02 -6.6071709116293925e-03 +179 3.4096307972593799e-03 -3.4658785452165147e-03 -3.1253185076433169e-03 +231 -2.9608872194030354e-03 1.7079627030041283e-04 3.4641088880785907e-03 +218 5.3586543913679188e-04 2.9233881729537371e-03 3.5123582767227724e-03 +294 5.5955227959160669e-03 -1.0367898439140481e-02 2.0848408079255427e-02 +227 5.9077764223686036e-03 -2.1490305761074865e-03 -1.1498913753977054e-03 +254 1.0207662040460023e-03 -2.8373729468057305e-03 -4.2228149347897145e-03 +94 7.0053050017033342e-04 -3.4205728973730012e-03 5.5901075709640308e-03 +214 -2.1438652636591813e-03 -7.5896096294795689e-03 -8.6309429242904783e-03 +210 -1.0137192662770177e-03 1.7866741192566335e-03 -2.8780339165619612e-03 +58 3.6776824844257320e-03 5.0588406301632300e-03 -7.3087049943876834e-03 +246 -4.7447451326206687e-03 2.9334768545539193e-03 -3.7175562945460888e-03 +102 -7.7688822748834601e-03 -3.3809459073935026e-03 -1.9803049579750244e-03 +238 -2.2703027353564169e-03 2.3821770671317356e-03 -2.3098026900021324e-03 +287 6.1455392512188714e-03 -6.1103362577766343e-03 2.6693189746480363e-03 +286 -1.3231867204732992e-02 9.6718744859041784e-03 5.2001428560543668e-03 +171 -3.2795522829800667e-03 2.3198896576538167e-03 -8.7584561749707406e-03 +187 -7.1723088512307930e-03 -1.4024816229882265e-03 2.4036881855671209e-03 +191 -1.1265816553933752e-03 -1.6943105339333627e-03 2.1934152683983758e-03 +195 -3.0355768625237203e-03 -1.4270597862987302e-03 -4.4764275782047036e-03 +270 4.9452386193567094e-03 3.4248768308214380e-03 -2.7114518030588778e-03 +203 -3.6586732242194263e-03 -6.3045607688845878e-03 1.2589365192845096e-02 +302 -3.0967008143875647e-03 -1.4504530673619854e-02 -2.5558490469790678e-02 +234 5.8312510510702895e-03 -2.7109492663016086e-03 2.7864231473259892e-03 +183 1.9611113402573451e-03 -4.6399229602014196e-03 -4.5484397980495861e-03 +243 -1.7989222282919558e-03 -8.3773945133634839e-04 -8.9721100811624658e-03 +247 5.3124635291446163e-04 -6.0116601385645152e-03 5.1900240478296765e-03 +251 -6.8565419117596312e-03 -1.1124755685907217e-03 5.6599142152711874e-03 +255 -1.4205420643149062e-03 4.8031833242560776e-03 -3.4229862352147741e-03 +259 -1.1678626131811894e-03 -7.6285944329823087e-03 4.4278412712106946e-03 +275 4.1647945349179862e-04 -6.5900329798053903e-04 -5.8751124096330177e-03 +279 1.3825195837119980e-03 -1.3491169538852154e-03 2.8955034735846019e-03 +295 -2.7825193434958737e-02 3.7188963726747116e-03 1.4241395330423495e-02 +230 3.9381149513646446e-03 -8.3657637033183324e-04 2.4205795188033744e-03 +271 -5.5957344548436894e-03 4.3979467178565422e-03 2.6593393575132305e-03 +219 1.8686514417658123e-03 -3.5626313146927386e-03 5.5554970146296989e-03 +159 1.0526790106853650e-02 3.0132509030908776e-03 -5.9349539991849767e-03 +207 7.6888508831103432e-03 1.9814068662144511e-03 5.8024603926956310e-03 +167 7.3873940493462574e-03 5.0561160614476441e-03 -9.5138068359663409e-03 +299 1.1389090343270231e-02 1.2335222052153004e-02 5.1854247830508448e-03 +163 3.7514806422877323e-03 6.0021848224389458e-04 7.3984182635305855e-04 +263 -1.3311416384275030e-03 -8.3947102292534256e-04 -1.6587363346947726e-03 +283 -1.0620025504881845e-02 2.7452983956948855e-03 -8.6416056884697917e-03 +215 -1.3673571899212099e-03 -4.9165406371302806e-06 -5.4353669866533106e-04 +266 -1.5207241133139229e-03 -3.0455538066024301e-03 -4.9898142041270308e-03 +223 7.5910823419502059e-03 2.1726507130216993e-03 2.7886767580300427e-03 +47 1.7101589232864246e-03 6.5504844423619577e-04 -3.8918976101025146e-03 +239 5.3972599702514796e-03 -3.2074197692656811e-03 -2.8617030304009731e-03 +211 3.8857543898680621e-04 2.1756300867946709e-03 3.0390581737593124e-03 +174 3.0622057715666486e-04 -3.5442317884825654e-03 6.8549731131780913e-03 +178 1.0100086235516800e-02 -2.1135991151899139e-03 -3.9716759635449574e-03 +290 4.6165685682473881e-03 1.1431875282555784e-02 -9.5929415658242510e-03 +303 3.4375944882452270e-02 1.2663150202869896e-02 5.0191122447531662e-02 +24 2.7722040270529322e-04 9.3045183484613270e-03 -5.4696809618402084e-03 +5 1.4530732421377847e-03 8.4407096360853799e-03 6.9996566944709208e-03 +197 1.2180196447747885e-04 1.9057884749376704e-03 2.5203716257742922e-03 +13 2.9580325020781683e-03 -7.2598114036915157e-03 2.4953271033417565e-03 +17 -2.5691329217609050e-03 9.4706315563068708e-06 1.9944514378249611e-03 +125 6.0633500715407871e-04 6.0911401225465130e-03 2.0083752286464618e-03 +65 -3.6413892234086150e-03 8.4183871082086866e-04 -9.5673812168976177e-03 +117 -2.4135897728023823e-03 5.8854918825421406e-03 -9.7691183765619746e-04 +61 4.6973997015394816e-03 1.1808478803322716e-02 -1.6550999664335026e-03 +85 -8.2406395830183915e-03 -1.5500026972734928e-03 -3.1459961335715596e-04 +69 -2.8622735200865383e-03 2.0014502794053028e-03 -5.7101986761900507e-03 +9 -1.0407713436376988e-03 -5.4188685232808183e-03 9.7397563007423766e-04 +80 4.1821094389522294e-03 -1.4661786050517277e-03 -6.6021963934954691e-03 +105 -2.2592350958062024e-03 2.9575142392665385e-03 -3.4456168045163224e-03 +109 -4.4630310484392944e-03 8.3843196556275083e-03 -1.7785718826200719e-03 +116 -3.7261596410293608e-03 3.3180847030642203e-03 -3.6946196242010175e-04 +129 9.0700019604887097e-04 -3.6265074779059637e-03 -4.4372949358870211e-03 +152 1.1700981066970786e-02 -1.5474385127547048e-02 4.5469649055726834e-03 +29 -7.6273392485150498e-04 -5.2638028956206217e-03 1.5055014077169275e-03 +141 -3.7118829597102436e-02 6.5148473098852189e-03 4.3511847061281370e-03 +33 -3.9470728901237319e-03 4.5498742407082057e-03 -5.5393392769089384e-03 +37 8.8145907550448016e-03 -5.6012684363408336e-03 2.7301067646077464e-03 +41 4.1486225497212514e-03 -1.8362733044464384e-03 -1.7013548165352639e-03 +121 2.1700813079443522e-03 5.4557303436680955e-03 -4.4782699909277088e-03 +49 4.6413606571955217e-03 -1.9124228477447340e-03 -2.3388241246549385e-03 +149 -1.9995983634128758e-02 -5.0606377461450049e-03 2.0255946982863860e-02 +84 3.3713805726191702e-03 -2.9297704191600440e-04 9.1670737511324657e-04 +53 7.6804037541409907e-03 5.3546368402172320e-03 -3.2086851687728036e-03 +89 -3.5239071966877531e-03 -1.0591472119567920e-03 -3.0112741584284752e-03 +93 3.0220138249750666e-03 -1.7671027489704343e-03 3.3436379217387634e-03 +97 2.9633387608442546e-03 2.1027128795329643e-03 -1.4424462438033939e-03 +101 -1.7277449363560275e-03 -3.7883930305986006e-03 -1.2778141319349334e-03 +145 1.3754301880493217e-02 -2.9464527569243112e-02 -1.8827157517875556e-02 +228 2.4060656531958990e-03 -3.0156919087798470e-03 2.7324065007439283e-03 +57 7.0375169402002663e-04 -2.8537039994158140e-03 -1.5277803933876235e-03 +133 -7.1051720384830604e-03 -1.3677602407398261e-03 3.6026752123927572e-02 +136 -2.5544385010401623e-02 -1.4078454458823419e-03 4.0579684781210344e-03 +138 -4.0187647722179178e-02 -2.1571801243316192e-02 -7.1604231565876022e-03 +1 -3.4095272641180428e-03 6.1537481095595712e-03 7.9045267349075663e-04 +88 4.4116705299466841e-03 2.7993870615652876e-03 5.1164335644218956e-03 +64 -1.8742297825381788e-03 2.6827591735599583e-03 -5.1722459872697744e-03 +8 3.1885844258643008e-03 4.2903678434358713e-03 5.1786330955596359e-03 +12 -5.2210336672334420e-03 3.9495414273393922e-03 2.2335713352698550e-03 +16 9.9422742059577423e-04 1.7521404301466441e-03 8.7590953970051986e-04 +20 6.0854312947614614e-03 5.4983631623741992e-03 5.4593745160439952e-03 +25 -5.4309141612719491e-03 -1.7666866720226777e-03 4.7703338575602657e-03 +148 1.1086815383338491e-02 2.6022863618603707e-02 2.0087587552315819e-02 +137 1.5690832964233584e-02 -2.5293009109084732e-03 -1.1883375678028274e-02 +104 -5.0640494124431987e-03 2.3370245336442447e-03 -2.2986534425586274e-04 +68 -1.0867367865646591e-03 2.3623004024366013e-03 2.4942168922851425e-03 +128 -8.2438351816644800e-03 1.0571196268724028e-03 -8.4815808051728534e-04 +73 -5.7362573079004020e-03 -3.0043343214873099e-03 1.5237919791527093e-03 +77 -3.4255948914421685e-03 5.4760208931593666e-03 6.6618412238336061e-04 +108 5.2795029127425666e-03 6.5415836813069569e-04 6.1298969724376466e-04 +112 -1.6078046478582991e-03 4.0606635002996610e-03 9.1026530262352373e-04 +113 6.4915058150423399e-03 5.1629533163456854e-03 -6.3755775127421538e-03 +132 -4.0774627249993917e-03 -1.5399070432691127e-02 -7.4691887109230096e-03 +56 -5.2003817997179165e-03 -9.7620641513053094e-03 -4.3950880281533765e-03 +21 -7.0691445197789441e-03 7.6955670100957842e-04 -5.4105853611055871e-03 +32 -2.9169110825653880e-03 -1.1073349638571425e-03 -5.4851932971711724e-03 +36 -2.4396685252407470e-03 1.4819068238334156e-03 -3.0805515593447705e-03 +40 -7.0666779614816802e-03 -1.3430215710235145e-03 -4.4139313396336999e-03 +44 -5.1539163988777083e-03 -1.9320778456829594e-03 2.9052648833327553e-03 +48 -8.0370531818583901e-03 -4.9164082712983724e-03 1.0053385697820794e-02 +52 4.6673277069024383e-03 2.4732486926647718e-03 -3.0437092822526947e-03 +28 9.5059021626105167e-04 6.6703881368338760e-03 1.2183723942516731e-03 +81 -1.7766957322548395e-03 -8.0571519569416382e-04 -4.2657655144627132e-03 +124 -2.5737399426471086e-03 4.8932142374913043e-03 -3.0826221822277021e-04 +92 -2.7210332800526667e-03 -4.3522625573974967e-06 5.0313762934084396e-03 +248 -2.1428984033524610e-04 3.5920620300439283e-03 -1.2394812885684373e-03 +100 6.9480047945285808e-03 -2.0720536878365910e-03 6.0976223682410527e-04 +4 3.0533858921656435e-03 1.3749371297301436e-03 2.6879157400351203e-03 +72 6.9563359253365785e-04 -3.3839307816438810e-03 -5.2966447925867051e-04 +120 4.3628381698379657e-04 3.3989272988654736e-04 -4.7418586471331681e-03 +144 -1.9399828512073235e-02 2.8784276306305957e-03 -4.9015707840947172e-03 +169 3.6286101890929310e-04 1.3804030749833694e-03 3.8772039152943243e-03 +157 -9.7104751271310137e-03 -2.5432779712195779e-03 4.9920473407863593e-04 +237 -5.6836990991889925e-03 4.3828035612363779e-03 -4.9564216578871206e-03 +165 6.9095280546444867e-03 1.0729454663071183e-04 -2.8377808824037773e-04 +176 -3.5726796462146955e-03 -6.9803617017510314e-04 6.5737720026882414e-03 +205 -4.7897558884080942e-03 -9.7012031638177235e-03 1.6149422322463858e-03 +277 2.3932341723865618e-03 -1.2799481485681208e-03 -9.5088871626072000e-04 +209 1.5940196133829015e-03 3.4125147840405141e-03 -1.9185849366575963e-04 +213 5.0359888288056447e-03 -3.2459317567451623e-03 -6.0422204701546540e-03 +161 3.1496494652942433e-03 -5.4032811877358826e-03 -1.8404083591310836e-03 +221 -7.0837711227610673e-05 3.5642763354140797e-03 7.1267387665626429e-03 +253 -1.1552964427254658e-03 8.1061938945047457e-03 6.8560275135920814e-04 +232 7.1516069443152200e-04 6.9884991537049641e-03 1.9456377945585132e-03 +257 9.7287812908641580e-03 5.6802362058564610e-04 -1.9896602364413026e-03 +261 3.5641606450239399e-03 1.1263657016134332e-03 -4.9800485874682988e-03 +268 -2.4182201566053767e-03 5.6517425572549286e-04 -4.7968007270599378e-03 +281 1.8023451989382603e-02 -2.0011466408538753e-02 2.6788628047223523e-03 +76 3.6833438514848591e-03 -7.5314593270302587e-03 2.3036184377253134e-03 +269 5.4766103896972693e-04 1.0714454448212749e-04 -2.9150182080626727e-03 +293 -1.5803838932239959e-02 4.4565921908284638e-03 6.0777345016507587e-03 +185 -4.2480671256378598e-03 -7.4956530350122502e-04 8.8480321154379964e-03 +189 -2.1548899566118220e-03 1.5465752986606573e-03 -1.2754684317658836e-03 +193 -3.2970116016428075e-03 -5.5091314245397441e-03 4.6300273271534225e-03 +249 2.0185063121804770e-03 -3.3503108367265821e-03 6.4889425299302387e-03 +201 4.9894242342005612e-04 2.0554328851371461e-03 -2.2943565378546371e-03 +273 7.2763997976980747e-04 -1.0896643067098042e-03 7.1256273183209901e-03 +236 2.0690907685087471e-03 6.8363977716210979e-03 4.1459649884454768e-03 +297 1.3621128083419113e-02 1.6046581101408330e-02 4.8457931367957398e-03 +241 -2.5291016298909096e-03 1.4215869718728002e-03 -1.9884597198944918e-03 +245 -5.2221318448004168e-03 -1.7800664058218062e-04 4.4010035123521704e-04 +217 -1.7843053411821738e-03 -1.6528038759970564e-03 -2.3128643778518122e-04 +181 1.2770006041816402e-03 9.0821236224940469e-03 -6.7109253232624253e-04 +292 4.6641003179734592e-03 -1.5497869295909884e-02 9.9209229002761717e-03 +180 -2.3945351490970031e-03 2.1740953931129073e-04 6.0240486612073230e-03 +153 9.1376359130041884e-04 1.2619379366518707e-03 -1.1019889044123631e-03 +288 9.1870458102437658e-03 1.2778922312094822e-02 -2.1072238127411075e-02 +45 -7.7724575331532535e-04 -1.7141020628976028e-03 5.6759226356627775e-03 +304 -2.5582451057078827e-02 -2.2645536121991501e-02 -1.4290517463409140e-02 +301 -5.9841500766453981e-03 -1.5684175634367186e-03 -2.4956264538292219e-02 +160 3.9339801689694557e-03 -3.6126921625193411e-03 -2.4443523541620845e-03 +164 8.1230468881143946e-03 -9.3521431341237662e-03 -3.5308117479258393e-04 +168 4.9446040375734903e-03 -8.2154773760103651e-04 -1.0492769229361480e-02 +172 2.6148305794376089e-03 2.6504247099737371e-03 -2.7694367959707113e-03 +212 4.4593645697807213e-03 -1.4573503711062438e-05 -1.3782207140241650e-03 +300 -1.8679506789017677e-03 -2.0469993534843488e-02 -3.8301874388749933e-03 +173 -1.6137581443588121e-03 2.0965695130792921e-03 -4.0201255392549005e-03 +252 1.9637421273734318e-03 -4.1845350440895444e-04 9.1914352340609893e-04 +220 4.8425364408329402e-03 4.1558131563977632e-03 -4.5732135892261249e-03 +224 -5.0106731049793761e-03 6.3056084400456101e-03 -2.5402324427869867e-03 +225 2.3074874398853491e-03 -8.2581204918229945e-03 5.7223482227764808e-03 +229 -3.1949429657485212e-03 1.2470862731982931e-03 1.6206842413737377e-03 +260 -1.7356077348708357e-03 -6.6380421726333931e-04 4.9344441008672127e-03 +264 -1.4170245024577935e-03 2.5892297874871607e-03 6.1212726394288964e-04 +265 -2.0491154530031591e-03 -4.6743453933109679e-03 2.6620072482574646e-03 +284 1.0822583460626851e-02 1.1993987876701846e-02 3.7723405443682773e-02 +156 3.2121442419044783e-03 7.5002892289370033e-03 1.9824119709575898e-03 +296 -2.5491930009982500e-02 -2.3854508590914567e-02 -7.4606589514458746e-03 +184 -1.9223239057771181e-03 -4.9053534641709537e-04 1.2211379250644705e-03 +188 1.2636857357410621e-03 -4.9864683204641908e-03 -1.3531293825327969e-03 +192 -7.7727559158047056e-03 3.7612632558858211e-03 4.7003948322159681e-03 +196 -2.8825133856888118e-03 3.9250757025840674e-03 5.0909854172008495e-04 +200 -7.4421531526066200e-03 -1.5108146428348063e-03 4.2441546002170358e-03 +204 -4.5541880771186351e-03 2.2282891439829376e-03 9.6246255590907315e-03 +208 5.5460189242739375e-04 -8.5643343980268936e-04 4.6961691086096109e-03 +233 -9.7408104129497115e-04 2.0917875306183170e-03 1.6045486422407123e-03 +276 -1.0986838142969923e-03 5.4315792533420901e-03 5.0077081054951244e-03 +244 -1.2183665223623778e-03 -4.2193410981771198e-03 -2.7354288515525696e-03 +280 1.3552010403368481e-03 6.3132429381080192e-04 1.7031901341229926e-04 +256 -2.2077829342060304e-03 1.6772588023449473e-03 2.2350654447874461e-04 +216 1.2254364422878230e-03 2.0994512158283556e-03 -2.0172376558553222e-03 +272 2.1464441432257797e-03 -1.8486660410473694e-04 1.9014747511050384e-03 +240 3.1573950446869229e-04 -3.7605367960744638e-04 2.3191303881599541e-04 +289 -1.2039974662100633e-02 2.6395586163545951e-03 -2.8478645629107940e-02 +177 6.1157082891864691e-03 6.9161818478923455e-04 -3.0081137643864736e-03 +96 -3.1669072586457290e-03 -6.3737086224948253e-03 1.5172924185041878e-03 +285 -1.2188701008670824e-02 -1.7123376677445068e-02 2.0830072814090890e-02 diff --git a/examples/reax/HNS/ffield.reax.hns b/examples/reax/HNS/ffield.reax.hns new file mode 100644 index 0000000000000000000000000000000000000000..ccf7ab71a0869c2c0916f81f63abe1604f363db2 --- /dev/null +++ b/examples/reax/HNS/ffield.reax.hns @@ -0,0 +1,168 @@ +Reactive MD-force field: c/h/o/s/f/cl Jan30_2012 + 39 ! Number of general parameters + 50.0000 !p(boc1) + 9.5469 !p(boc2) + 26.5405 !p(coa2) + 1.5105 !p(trip4) + 6.6630 !p(trip3) + 70.0000 !kc2 + 1.0588 !p(ovun6) + 4.6000 !p(trip2) + 12.1176 !p(ovun7) + 13.3056 !p(ovun8) + -60.1292 !p(trip1) + 0.0000 !Lower Taper-radius (swa) + 10.0000 !Upper Taper-radius (swb) + 0.0000 !not used + 33.8667 !p(val7) + 6.0891 !p(lp1) + 1.0563 !p(val9) + 2.0384 !p(val10) + 6.1431 !not used + 6.9290 !p(pen2) + 0.3989 !p(pen3) + 3.9954 !p(pen4) + 0.0000 !not used + 5.7796 !p(tor2) + 10.0000 !p(tor3) + 1.9487 !p(tor4) + 0.0000 !not used + 2.1645 !p(cot2) + 1.5591 !p(vdW1) + 0.1000 !Cutoff for bond order*100 (cutoff) + 2.1365 !p(coa4) + 0.6991 !p(ovun4) + 50.0000 !p(ovun3) + 1.8512 !p(val8) + 0.0000 !not used + 0.0000 !not used + 0.0000 !not used + 0.0000 !not used + 2.6962 !p(coa3) + 4 ! Nr of atoms; atomID;ro(sigma); Val;atom mass;Rvdw;Dij;gamma + alfa;gamma(w);Val(angle);p(ovun5);n.u.;chiEEM;etaEEM;n.u. + ro(pipi);p(lp2);Heat increment;p(boc4);p(boc3);p(boc5),n.u.;n.u. + p(ovun2);p(val3);n.u.;Val(boc);p(val5);n.u.;n.u.;n.u. + C 1.3825 4.0000 12.0000 1.9133 0.1853 0.9000 1.1359 4.0000 + 9.7602 2.1346 4.0000 33.2433 79.5548 5.8678 7.0000 0.0000 + 1.2104 0.0000 199.0303 8.6991 34.7289 13.3894 0.8563 0.0000 + -2.8983 2.5000 1.0564 4.0000 2.9663 0.0000 0.0000 0.0000 + H 0.7853 1.0000 1.0080 1.5904 0.0419 1.0206 -0.1000 1.0000 + 9.3557 5.0518 1.0000 0.0000 121.1250 5.3200 7.4366 1.0000 + -0.1000 0.0000 55.0000 1.9771 3.3517 0.7571 1.0698 0.0000 + -15.7683 2.1488 1.0338 1.0000 2.8793 0.0000 0.0000 0.0000 + O 1.2477 2.0000 15.9990 1.9236 0.0904 1.0503 1.0863 6.0000 + 10.2127 7.7719 4.0000 36.9573 116.0768 8.5000 8.9989 2.0000 + 0.9088 1.0003 60.8726 20.4140 3.3754 0.2702 0.9745 0.0000 + -3.6141 2.7025 1.0493 4.0000 2.9225 0.0000 0.0000 0.0000 + N 1.6157 3.0000 14.0000 1.9376 0.1203 1.0000 1.2558 5.0000 + 9.4267 26.8500 4.0000 8.6294 100.0000 7.6099 7.7500 2.0000 + 1.0439 0.1000 119.9837 1.7640 2.7409 2.3814 0.9745 0.0000 + -6.5798 4.4843 1.0183 4.0000 2.8793 0.0000 0.0000 0.0000 + 10 ! Nr of bonds; at1;at2;De(sigma);De(pi);De(pipi);p(be1);p(b + p(be2);p(bo3);p(bo4);n.u.;p(bo1);p(bo2) + 1 1 156.5953 100.0397 80.0000 -0.8157 -0.4591 1.0000 37.7369 0.4235 + 0.4527 -0.1000 9.2605 1.0000 -0.0750 6.8316 1.0000 0.0000 + 1 2 170.2316 0.0000 0.0000 -0.5931 0.0000 1.0000 6.0000 0.7140 + 5.2267 1.0000 0.0000 1.0000 -0.0500 6.8315 0.0000 0.0000 + 2 2 156.0973 0.0000 0.0000 -0.1377 0.0000 1.0000 6.0000 0.8240 + 2.9907 1.0000 0.0000 1.0000 -0.0593 4.8358 0.0000 0.0000 + 1 3 160.4802 105.1693 23.3059 -0.3873 -0.1613 1.0000 10.8851 1.0000 + 0.5341 -0.3174 7.0303 1.0000 -0.1463 5.2913 0.0000 0.0000 + 3 3 60.1463 176.6202 51.1430 -0.2802 -0.1244 1.0000 29.6439 0.9114 + 0.2441 -0.1239 7.6487 1.0000 -0.1302 6.2919 1.0000 0.0000 + 2 3 180.4373 0.0000 0.0000 -0.8074 0.0000 1.0000 6.0000 0.5514 + 1.2490 1.0000 0.0000 1.0000 -0.0657 5.0451 0.0000 0.0000 + 1 4 175.7446 131.3190 132.3859 -0.5827 -0.2709 1.0000 29.9009 0.8400 + 1.9511 -0.2103 7.4487 1.0000 -0.1150 5.8717 1.0000 0.0000 + 2 4 161.1063 0.0000 0.0000 -0.1387 0.0000 1.0000 6.0000 0.7276 + 0.6127 1.0000 0.0000 1.0000 -0.0395 7.2218 0.0000 0.0000 + 3 4 86.0536 180.5864 40.0000 1.0000 -0.4462 1.0000 34.9336 0.2000 + 0.8154 -0.2175 7.0255 1.0000 -0.1937 5.2140 1.0000 0.0000 + 4 4 134.6492 66.2329 149.2707 -0.7228 -0.1000 1.0000 19.0850 1.0000 + 0.6060 -0.2050 9.7308 1.0000 -0.1791 5.8008 1.0000 0.0000 + 6 ! Nr of off-diagonal terms. at1;at2;Dij;RvdW;alfa;ro(sigma);r + 1 2 0.1219 1.4000 9.8442 1.1203 -1.0000 -1.0000 + 2 3 0.0344 1.6800 10.3247 0.9013 -1.0000 -1.0000 + 1 3 0.1131 1.8523 9.8442 1.2775 1.1342 1.0621 + 1 4 0.1398 1.9263 10.1847 1.4778 1.1446 1.1216 + 2 4 0.0480 2.3000 9.0050 1.0156 -1.0000 -1.0000 + 3 4 0.0942 1.9531 10.3265 1.3018 1.0984 1.0125 + 40 ! Nr of angles. at1;at2;at3;Thetao,o;p(val1);p(val2);p(coa1); + 1 1 1 67.2326 22.0695 1.6286 0.0000 1.7959 15.4141 1.8089 + 1 1 2 65.2527 14.3185 6.2977 0.0000 0.5645 0.0000 1.1530 + 2 1 2 70.0840 25.3540 3.4508 0.0000 0.0050 0.0000 3.0000 + 1 2 2 0.0000 0.0000 6.0000 0.0000 0.0000 0.0000 1.0400 + 1 2 1 0.0000 3.4110 7.7350 0.0000 0.0000 0.0000 1.0400 + 2 2 2 0.0000 27.9213 5.8635 0.0000 0.0000 0.0000 1.0400 + 1 1 3 49.5561 7.3771 4.9568 0.0000 0.7533 15.9906 1.0010 + 3 1 3 77.1171 39.8746 2.5403 -24.3902 1.7740 -42.9758 2.1240 + 2 1 3 65.0000 14.2057 4.8649 0.0000 0.3504 0.0000 1.7185 + 1 3 1 74.3994 44.7500 0.7982 0.0000 3.0000 0.0000 1.0528 + 1 3 3 77.9854 36.6201 2.0201 0.0000 0.7434 67.0264 3.0000 + 3 3 3 80.7324 30.4554 0.9953 0.0000 1.6310 50.0000 1.0783 + 1 3 2 71.5018 21.7062 0.4735 0.0000 0.5186 0.0000 1.1793 + 2 3 3 84.9468 23.3540 1.5057 0.0000 2.6374 0.0000 1.3023 + 2 3 2 77.0645 10.4737 1.2895 0.0000 0.9924 0.0000 1.1043 + 1 2 3 0.0000 25.0000 3.0000 0.0000 1.0000 0.0000 1.0400 + 3 2 3 0.0000 0.0148 6.0000 0.0000 0.0000 0.0000 1.0400 + 2 2 3 0.0000 9.7025 6.0000 0.0000 0.0000 0.0000 1.0400 + 1 1 4 61.6894 9.9742 3.5920 0.0000 5.0000 50.0000 2.2098 + 3 1 4 67.5853 29.6915 1.8611 0.0000 3.0000 0.0000 1.5926 + 4 1 4 53.0437 35.9280 1.7824 0.0000 5.0000 0.0000 4.0000 + 2 1 4 66.9313 25.8025 3.5718 0.0000 0.0600 0.0000 1.0946 + 1 3 4 71.7246 38.5022 1.1738 0.0000 1.6310 0.0000 1.2782 + 3 3 4 83.0764 35.5413 1.4072 0.0000 1.6310 0.0000 1.1439 + 4 3 4 79.3317 40.0000 2.3424 0.0000 1.6310 0.0000 1.0061 + 2 3 4 81.0695 40.0000 2.0285 0.0000 0.1218 0.0000 1.4477 + 1 4 1 68.9764 14.3404 1.9702 0.0000 1.3606 0.0000 1.0000 + 1 4 3 76.1086 35.0355 1.0724 0.0000 1.6777 0.0000 1.6071 + 1 4 4 81.8917 25.7475 0.7287 0.0000 2.0100 0.0000 1.9350 + 3 4 3 80.1274 24.7547 1.7946 -10.0963 1.6777 0.0000 3.2815 + 3 4 4 83.6527 36.3627 1.0967 -0.9193 1.6777 0.0000 1.0000 + 4 4 4 90.0000 44.3028 1.6659 0.0000 0.7529 0.0000 1.2398 + 1 4 2 76.9847 29.2262 0.9407 0.0000 0.0300 0.0000 2.6196 + 2 4 3 85.4080 40.0000 1.7549 0.0000 0.0222 0.0000 1.0774 + 2 4 4 83.5658 40.0000 1.3540 0.0000 0.0222 0.0000 2.6397 + 2 4 2 58.0387 1.1862 3.9770 0.0000 0.0222 0.0000 1.0000 + 1 2 4 0.0000 0.0019 6.3000 0.0000 0.0000 0.0000 1.0400 + 2 2 4 0.0000 0.0019 6.0000 0.0000 0.0000 0.0000 1.0400 + 3 2 4 0.0000 0.0019 6.0000 0.0000 0.0000 0.0000 1.0400 + 4 2 4 0.0000 0.0019 6.0000 0.0000 0.0000 0.0000 1.0400 + 31 ! Nr of torsions. at1;at2;at3;at4;;V1;V2;V3;p(tor1);p(cot1);n + 1 1 1 1 -0.2500 11.5822 0.1879 -4.7057 -2.2047 0.0000 0.0000 + 1 1 1 2 -0.2500 31.2596 0.1709 -4.6391 -1.9002 0.0000 0.0000 + 2 1 1 2 -0.1770 30.0252 0.4340 -5.0019 -2.0697 0.0000 0.0000 + 1 1 1 3 -0.7098 22.2951 0.0060 -2.5000 -2.1688 0.0000 0.0000 + 2 1 1 3 -0.3568 22.6472 0.6045 -4.0088 -1.0000 0.0000 0.0000 + 3 1 1 3 -0.0528 6.8150 0.7498 -5.0913 -1.0000 0.0000 0.0000 + 1 1 3 1 2.0007 25.5641 -0.0608 -2.6456 -1.1766 0.0000 0.0000 + 1 1 3 2 -1.1953 42.1545 -1.0000 -8.0821 -1.0000 0.0000 0.0000 + 2 1 3 1 -0.9284 34.3952 0.7285 -2.5440 -2.4641 0.0000 0.0000 + 2 1 3 2 -2.5000 79.6980 1.0000 -3.5697 -2.7501 0.0000 0.0000 + 1 1 3 3 -0.0179 5.0603 -0.1894 -2.5000 -2.0399 0.0000 0.0000 + 2 1 3 3 -0.5583 80.0000 1.0000 -4.4000 -3.0000 0.0000 0.0000 + 3 1 3 1 -2.5000 76.0427 -0.0141 -3.7586 -2.9000 0.0000 0.0000 + 3 1 3 2 0.0345 78.9586 -0.6810 -4.1777 -3.0000 0.0000 0.0000 + 3 1 3 3 -2.5000 66.3525 0.3986 -3.0293 -3.0000 0.0000 0.0000 + 1 3 3 1 2.5000 -0.5332 1.0000 -3.5096 -2.9000 0.0000 0.0000 + 1 3 3 2 -2.5000 3.3219 0.7180 -5.2021 -2.9330 0.0000 0.0000 + 2 3 3 2 2.2500 -6.2288 1.0000 -2.6189 -1.0000 0.0000 0.0000 + 1 3 3 3 0.0531 -17.3983 1.0000 -2.5000 -2.1584 0.0000 0.0000 + 2 3 3 3 0.4723 -12.4144 -1.0000 -2.5000 -1.0000 0.0000 0.0000 + 3 3 3 3 -2.5000 -25.0000 1.0000 -2.5000 -1.0000 0.0000 0.0000 + 0 1 2 0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0 2 2 0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0 2 3 0 0.0000 0.1000 0.0200 -2.5415 0.0000 0.0000 0.0000 + 0 1 1 0 0.0000 50.0000 0.3000 -4.0000 -2.0000 0.0000 0.0000 + 0 3 3 0 0.5511 25.4150 1.1330 -5.1903 -1.0000 0.0000 0.0000 + 0 1 4 0 -0.5473 25.3808 0.9931 -4.3407 -3.0000 0.0000 0.0000 + 0 2 4 0 0.0000 0.1000 0.0200 -2.5415 0.0000 0.0000 0.0000 + 0 3 4 0 2.0000 71.9948 -0.8805 -6.1274 -2.7831 0.0000 0.0000 + 0 4 4 0 2.0000 90.0000 -0.7837 -9.0000 -2.0000 0.0000 0.0000 + 4 1 4 4 -2.0000 90.0000 -0.0279 -7.5866 -0.1000 0.0000 0.0000 + 4 ! Nr of hydrogen bonds. at1;at2;at3;r(hb);p(hb1);p(hb2);p(hb3 + 3 2 3 2.0000 -2.0000 1.5000 19.5000 + 3 2 4 1.9000 -2.0000 1.7976 19.0000 + 4 2 3 1.9000 -2.0000 1.7976 19.0000 + 4 2 4 1.9000 -2.0000 1.7976 19.0000 diff --git a/examples/reax/HNS/in.reaxc.hns b/examples/reax/HNS/in.reaxc.hns new file mode 100644 index 0000000000000000000000000000000000000000..51cec6afd22a57cec9d2671bc6f4cd9afa972d1f --- /dev/null +++ b/examples/reax/HNS/in.reaxc.hns @@ -0,0 +1,34 @@ +# Pure HNS crystal, ReaxFF tests for benchmarking LAMMPS +# See README for more info + +units real +atom_style charge +atom_modify sort 100 0.0 # optional +dimension 3 +boundary p p p +box tilt large + +read_data data.hns-equil +replicate $x $y $z bbox + + +pair_style reax/c NULL +pair_coeff * * ffield.reax.hns C H O N + +compute reax all pair reax/c + +neighbor 1.0 bin +neigh_modify every 20 delay 0 check no + +timestep 0.1 + +thermo_style custom step temp pe press evdwl ecoul vol +thermo_modify norm yes +thermo 100 + +velocity all create 300.0 41279 loop geom + +fix 1 all nve +fix 2 all qeq/reax 1 0.0 10.0 1e-6 reax/c + +run 100 diff --git a/src/.gitignore b/src/.gitignore index 04dabdcc7afa6deef18ce433b571ce2f5f01c526..6ffc34cfe7aa20e3d803e789281ea0ea9360fc03 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -11,6 +11,7 @@ /*_intel.h /*_intel.cpp /*_kokkos.h +/*_kokkos_impl.h /*_kokkos.cpp /*_omp.h /*_omp.cpp diff --git a/src/Depend.sh b/src/Depend.sh index e1c812ebc26f740d98cc3060ec2636ea31ab103b..a83a99ffb5da5bf320b8a28a151b33af4eb189f6 100644 --- a/src/Depend.sh +++ b/src/Depend.sh @@ -109,6 +109,10 @@ if (test $1 = "RIGID") then depend USER-OMP fi +if (test $1 = "SNAP") then + depend KOKKOS +fi + if (test $1 = "USER-CGSDK") then depend GPU depend KOKKOS diff --git a/src/KOKKOS/Install.sh b/src/KOKKOS/Install.sh index 295e46bcaec54282a9511adb4ff5af91a9b75fff..c6fab2a1b10f5d9f45c6bac72de82dd1ab5d8bf1 100644 --- a/src/KOKKOS/Install.sh +++ b/src/KOKKOS/Install.sh @@ -151,6 +151,10 @@ action neighbor_kokkos.cpp action neighbor_kokkos.h action npair_copy_kokkos.cpp action npair_copy_kokkos.h +action npair_halffull_kokkos.cpp +action npair_halffull_kokkos.h +action npair_skip_kokkos.cpp +action npair_skip_kokkos.h action npair_kokkos.cpp action npair_kokkos.h action npair_ssa_kokkos.cpp npair_half_bin_newton_ssa.cpp @@ -228,6 +232,9 @@ action pair_multi_lucy_rx_kokkos.cpp pair_multi_lucy_rx.cpp action pair_multi_lucy_rx_kokkos.h pair_multi_lucy_rx.h action pair_reaxc_kokkos.cpp pair_reaxc.cpp action pair_reaxc_kokkos.h pair_reaxc.h +action pair_snap_kokkos.cpp pair_snap.cpp +action pair_snap_kokkos.h pair_snap.h +action pair_snap_kokkos_impl.h pair_snap.cpp action pair_sw_kokkos.cpp pair_sw.cpp action pair_sw_kokkos.h pair_sw.h action pair_vashishta_kokkos.cpp pair_vashishta.cpp @@ -244,12 +251,16 @@ action pair_tersoff_zbl_kokkos.cpp pair_tersoff_zbl.cpp action pair_tersoff_zbl_kokkos.h pair_tersoff_zbl.h action pair_yukawa_kokkos.cpp action pair_yukawa_kokkos.h +action pair_zbl_kokkos.cpp +action pair_zbl_kokkos.h action pppm_kokkos.cpp pppm.cpp action pppm_kokkos.h pppm.h action rand_pool_wrap_kokkos.cpp action rand_pool_wrap_kokkos.h action region_block_kokkos.cpp action region_block_kokkos.h +action sna_kokkos.h sna.h +action sna_kokkos_impl.h sna.cpp action verlet_kokkos.cpp action verlet_kokkos.h diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index 5b53b8ed05d5fb6fbe8a6b1a1001a70f83bfe726..6b6fc8610abfcec8fcdcd4f40677de1f8458657f 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -106,6 +106,71 @@ typedef double FFT_SCALAR; } }; +template<class Scalar> +struct t_scalar3 { + Scalar x,y,z; + + KOKKOS_FORCEINLINE_FUNCTION + t_scalar3() { + x = 0; y = 0; z = 0; + } + + KOKKOS_FORCEINLINE_FUNCTION + t_scalar3(const t_scalar3& rhs) { + x = rhs.x; y = rhs.y; z = rhs.z; + } + + KOKKOS_FORCEINLINE_FUNCTION + t_scalar3(const Scalar& x_, const Scalar& y_, const Scalar& z_ ) { + x = x_; y = y_; z = z_; + } + + KOKKOS_FORCEINLINE_FUNCTION + t_scalar3 operator= (const t_scalar3& rhs) { + x = rhs.x; y = rhs.y; z = rhs.z; + return *this; + } + + KOKKOS_FORCEINLINE_FUNCTION + t_scalar3 operator= (const volatile t_scalar3& rhs) { + x = rhs.x; y = rhs.y; z = rhs.z; + return *this; + } + + KOKKOS_FORCEINLINE_FUNCTION + t_scalar3 operator+= (const t_scalar3& rhs) { + x += rhs.x; y += rhs.y; z += rhs.z; + return *this; + } + + KOKKOS_FORCEINLINE_FUNCTION + t_scalar3 operator+= (const volatile t_scalar3& rhs) volatile { + x += rhs.x; y += rhs.y; z += rhs.z; + return *this; + } +}; + +template<class Scalar> +KOKKOS_FORCEINLINE_FUNCTION +t_scalar3<Scalar> operator + + (const t_scalar3<Scalar>& a, const t_scalar3<Scalar>& b) { + return t_scalar3<Scalar>(a.x+b.x,a.y+b.y,a.z+b.z); +} + +template<class Scalar> +KOKKOS_FORCEINLINE_FUNCTION +t_scalar3<Scalar> operator * + (const t_scalar3<Scalar>& a, const Scalar& b) { + return t_scalar3<Scalar>(a.x*b,a.y*b,a.z*b); +} + +template<class Scalar> +KOKKOS_FORCEINLINE_FUNCTION +t_scalar3<Scalar> operator * + (const Scalar& b, const t_scalar3<Scalar>& a) { + return t_scalar3<Scalar>(a.x*b,a.y*b,a.z*b); +} + #if !defined(__CUDACC__) && !defined(__VECTOR_TYPES_H__) struct double2 { double x, y; @@ -324,6 +389,8 @@ typedef double2 K_FLOAT2; typedef double4 K_FLOAT4; #endif +typedef int T_INT; + // ------------------------------------------------------------------------ // LAMMPS types diff --git a/src/KOKKOS/npair_halffull_kokkos.cpp b/src/KOKKOS/npair_halffull_kokkos.cpp new file mode 100644 index 0000000000000000000000000000000000000000..67481985da1e578c390ebbe4b6728dc7215d4656 --- /dev/null +++ b/src/KOKKOS/npair_halffull_kokkos.cpp @@ -0,0 +1,128 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "npair_halffull_kokkos.h" +#include "neighbor.h" +#include "neigh_list_kokkos.h" +#include "atom_kokkos.h" +#include "atom_vec.h" +#include "molecule.h" +#include "domain.h" +#include "my_page.h" +#include "error.h" +#include "atom_masks.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType, int NEWTON> +NPairHalffullKokkos<DeviceType,NEWTON>::NPairHalffullKokkos(LAMMPS *lmp) : NPair(lmp) { + atomKK = (AtomKokkos *) atom; + execution_space = ExecutionSpaceFromDevice<DeviceType>::space; +} + +/* ---------------------------------------------------------------------- + build half list from full list + pair stored once if i,j are both owned and i < j + pair stored by me if j is ghost (also stored by proc owning j) + works if full list is a skip list + works for owned (non-ghost) list, also for ghost list + if ghost, also store neighbors of ghost atoms & set inum,gnum correctly +------------------------------------------------------------------------- */ + +template<class DeviceType, int NEWTON> +void NPairHalffullKokkos<DeviceType,NEWTON>::build(NeighList *list) +{ + if (NEWTON) { + x = atomKK->k_x.view<DeviceType>(); + atomKK->sync(execution_space,X_MASK); + } + nlocal = atom->nlocal; + + NeighListKokkos<DeviceType>* k_list_full = static_cast<NeighListKokkos<DeviceType>*>(list->listfull); + d_ilist_full = k_list_full->d_ilist; + d_numneigh_full = k_list_full->d_numneigh; + d_neighbors_full = k_list_full->d_neighbors; + int inum_full = list->listfull->inum; + if (list->ghost) inum_full += list->listfull->gnum; + + NeighListKokkos<DeviceType>* k_list = static_cast<NeighListKokkos<DeviceType>*>(list); + k_list->maxneighs = k_list_full->maxneighs; // simple, but could be made more memory efficient + k_list->grow(atom->nmax); + d_ilist = k_list->d_ilist; + d_numneigh = k_list->d_numneigh; + d_neighbors = k_list->d_neighbors; + + // loop over parent full list + + copymode = 1; + Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagNPairHalffullCompute>(0,inum_full),*this); + + list->inum = k_list_full->inum; + list->gnum = k_list_full->gnum; + k_list->k_ilist.template modify<DeviceType>(); + + copymode = 0; +} + +template<class DeviceType, int NEWTON> +KOKKOS_INLINE_FUNCTION +void NPairHalffullKokkos<DeviceType,NEWTON>::operator()(TagNPairHalffullCompute, const int &ii) const { + int n = 0; + + const int i = d_ilist_full(ii); + F_FLOAT xtmp,ytmp,ztmp; + if (NEWTON) { + xtmp = x(i,0); + ytmp = x(i,1); + ztmp = x(i,2); + } + + // loop over full neighbor list + + const int jnum = d_numneigh_full(i); + const AtomNeighbors neighbors_i = AtomNeighbors(&d_neighbors(i,0),d_numneigh(i), + &d_neighbors(i,1)-&d_neighbors(i,0)); + + for (int jj = 0; jj < jnum; jj++) { + const int joriginal = d_neighbors_full(i,jj); + const int j = joriginal & NEIGHMASK; + if (NEWTON) { + if (j < nlocal) { + if (i > j) continue; + } else { + if (x(j,2) < ztmp) continue; + if (x(j,2) == ztmp) { + if (x(j,1) < ytmp) continue; + if (x(j,1) == ytmp && x(j,0) < xtmp) continue; + } + } + neighbors_i(n++) = joriginal; + } else { + if (j > i) neighbors_i(n++) = joriginal; + } + } + + d_numneigh(i) = n; + d_ilist(ii) = i; +} + +namespace LAMMPS_NS { +template class NPairHalffullKokkos<LMPDeviceType,0>; +template class NPairHalffullKokkos<LMPDeviceType,1>; +#ifdef KOKKOS_HAVE_CUDA +template class NPairHalffullKokkos<LMPHostType,0>; +template class NPairHalffullKokkos<LMPHostType,1>; +#endif +} diff --git a/src/KOKKOS/npair_halffull_kokkos.h b/src/KOKKOS/npair_halffull_kokkos.h new file mode 100644 index 0000000000000000000000000000000000000000..15505a376c6f8810055acbfe5e63fad1971a5cb6 --- /dev/null +++ b/src/KOKKOS/npair_halffull_kokkos.h @@ -0,0 +1,168 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef NPAIR_CLASS + +// Newton + +typedef NPairHalffullKokkos<LMPDeviceType,1> NPairKokkosHalffullNewtonDevice; +NPairStyle(halffull/newton/kk/device, + NPairKokkosHalffullNewtonDevice, + NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_KOKKOS_DEVICE) + +typedef NPairHalffullKokkos<LMPHostType,1> NPairKokkosHalffullNewtonHost; +NPairStyle(halffull/newton/kk/host, + NPairKokkosHalffullNewtonHost, + NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_KOKKOS_HOST) + +typedef NPairHalffullKokkos<LMPDeviceType,1> NPairKokkosHalffullNewtonDevice; +NPairStyle(halffull/newton/skip/kk/device, + NPairKokkosHalffullNewtonDevice, + NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_SKIP | NP_KOKKOS_DEVICE) + +typedef NPairHalffullKokkos<LMPHostType,1> NPairKokkosHalffullNewtonHost; +NPairStyle(halffull/newton/skip/kk/host, + NPairKokkosHalffullNewtonHost, + NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_SKIP | NP_KOKKOS_HOST) + +// Newtoff + +typedef NPairHalffullKokkos<LMPDeviceType,0> NPairKokkosHalffullNewtoffDevice; +NPairStyle(halffull/newtoff/kk/device, + NPairKokkosHalffullNewtoffDevice, + NP_HALF_FULL | NP_NEWTOFF | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_KOKKOS_DEVICE) + +typedef NPairHalffullKokkos<LMPHostType,0> NPairKokkosHalffullNewtoffHost; +NPairStyle(halffull/newtoff/kk/host, + NPairKokkosHalffullNewtoffHost, + NP_HALF_FULL | NP_NEWTOFF | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_KOKKOS_HOST) + +typedef NPairHalffullKokkos<LMPDeviceType,0> NPairKokkosHalffullNewtoffDevice; +NPairStyle(halffull/newtoff/skip/kk/device, + NPairKokkosHalffullNewtoffDevice, + NP_HALF_FULL | NP_NEWTOFF | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_SKIP | NP_KOKKOS_DEVICE) + +typedef NPairHalffullKokkos<LMPHostType,0> NPairKokkosHalffullNewtoffHost; +NPairStyle(halffull/newtoff/skip/kk/host, + NPairKokkosHalffullNewtoffHost, + NP_HALF_FULL | NP_NEWTOFF | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_SKIP | NP_KOKKOS_HOST) + +//************ Ghost ************** + +// Newton + +typedef NPairHalffullKokkos<LMPDeviceType,1> NPairKokkosHalffullNewtonGhostDevice; +NPairStyle(halffull/newton/ghost/kk/device, + NPairKokkosHalffullNewtonGhostDevice, + NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_GHOST | NP_KOKKOS_DEVICE) + +typedef NPairHalffullKokkos<LMPHostType,1> NPairKokkosHalffullNewtonHost; +NPairStyle(halffull/newton/ghost/kk/host, + NPairKokkosHalffullNewtonHost, + NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_GHOST | NP_KOKKOS_HOST) + +typedef NPairHalffullKokkos<LMPDeviceType,1> NPairKokkosHalffullNewtonGhostDevice; +NPairStyle(halffull/newton/skip/ghost/kk/device, + NPairKokkosHalffullNewtonGhostDevice, + NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_GHOST | NP_SKIP | NP_KOKKOS_DEVICE) + +typedef NPairHalffullKokkos<LMPHostType,1> NPairKokkosHalffullNewtonHost; +NPairStyle(halffull/newton/skip/ghost/kk/host, + NPairKokkosHalffullNewtonHost, + NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_GHOST | NP_SKIP | NP_KOKKOS_HOST) + +// Newtoff + +typedef NPairHalffullKokkos<LMPDeviceType,0> NPairKokkosHalffullNewtoffGhostDevice; +NPairStyle(halffull/newtoff/ghost/kk/device, + NPairKokkosHalffullNewtoffGhostDevice, + NP_HALF_FULL | NP_NEWTOFF | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_GHOST | NP_KOKKOS_DEVICE) + +typedef NPairHalffullKokkos<LMPHostType,0> NPairKokkosHalffullNewtoffHost; +NPairStyle(halffull/newtoff/ghost/kk/host, + NPairKokkosHalffullNewtoffHost, + NP_HALF_FULL | NP_NEWTOFF | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_GHOST | NP_KOKKOS_HOST) + +typedef NPairHalffullKokkos<LMPDeviceType,0> NPairKokkosHalffullNewtoffGhostDevice; +NPairStyle(halffull/newtoff/skip/ghost/kk/device, + NPairKokkosHalffullNewtoffGhostDevice, + NP_HALF_FULL | NP_NEWTOFF | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_GHOST | NP_SKIP | NP_KOKKOS_DEVICE) + +typedef NPairHalffullKokkos<LMPHostType,0> NPairKokkosHalffullNewtoffHost; +NPairStyle(halffull/newtoff/skip/ghost/kk/host, + NPairKokkosHalffullNewtoffHost, + NP_HALF_FULL | NP_NEWTOFF | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | + NP_ORTHO | NP_TRI | NP_GHOST | NP_SKIP | NP_KOKKOS_HOST) + +#else + +#ifndef LMP_NPAIR_HALFFULL_KOKKOS_H +#define LMP_NPAIR_HALFFULL_KOKKOS_H + +#include "npair.h" +#include "kokkos_type.h" + +namespace LAMMPS_NS { + +struct TagNPairHalffullCompute{}; + +template<class DeviceType, int NEWTON> +class NPairHalffullKokkos : public NPair { + public: + typedef DeviceType device_type; + typedef ArrayTypes<DeviceType> AT; + + NPairHalffullKokkos(class LAMMPS *); + ~NPairHalffullKokkos() {} + void build(class NeighList *); + + KOKKOS_INLINE_FUNCTION + void operator()(TagNPairHalffullCompute, const int&) const; + + private: + int nlocal; + + typename AT::t_x_array_randomread x; + + typename AT::t_neighbors_2d_const d_neighbors_full; + typename AT::t_int_1d_const d_ilist_full; + typename AT::t_int_1d_const d_numneigh_full; + + typename AT::t_neighbors_2d d_neighbors; + typename AT::t_int_1d d_ilist; + typename AT::t_int_1d d_numneigh; +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +*/ diff --git a/src/KOKKOS/npair_skip_kokkos.cpp b/src/KOKKOS/npair_skip_kokkos.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c537afaa6b8344d110e9f6d6f52430f92ba47e91 --- /dev/null +++ b/src/KOKKOS/npair_skip_kokkos.cpp @@ -0,0 +1,157 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "npair_skip_kokkos.h" +#include "neighbor.h" +#include "neigh_list_kokkos.h" +#include "atom_kokkos.h" +#include "atom_vec.h" +#include "molecule.h" +#include "domain.h" +#include "my_page.h" +#include "error.h" +#include "atom_masks.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +NPairSkipKokkos<DeviceType>::NPairSkipKokkos(LAMMPS *lmp) : NPair(lmp) { + atomKK = (AtomKokkos *) atom; + execution_space = ExecutionSpaceFromDevice<DeviceType>::space; + d_inum = typename AT::t_int_scalar("npair_skip:inum"); +} + +/* ---------------------------------------------------------------------- + build skip list for subset of types from parent list + works for half and full lists + works for owned (non-ghost) list, also for ghost list + iskip and ijskip flag which atom types and type pairs to skip + if ghost, also store neighbors of ghost atoms & set inum,gnum correctly +------------------------------------------------------------------------- */ + +template<class DeviceType> +void NPairSkipKokkos<DeviceType>::build(NeighList *list) +{ + atomKK->sync(execution_space,TYPE_MASK); + type = atomKK->k_type.view<DeviceType>(); + nlocal = atom->nlocal; + + + NeighListKokkos<DeviceType>* k_list_skip = static_cast<NeighListKokkos<DeviceType>*>(list->listskip); + d_ilist_skip = k_list_skip->d_ilist; + d_numneigh_skip = k_list_skip->d_numneigh; + d_neighbors_skip = k_list_skip->d_neighbors; + + num_skip = list->listskip->inum; + if (list->ghost) num_skip += list->listskip->gnum; + + NeighListKokkos<DeviceType>* k_list = static_cast<NeighListKokkos<DeviceType>*>(list); + k_list->maxneighs = k_list_skip->maxneighs; // simple, but could be made more memory efficient + k_list->grow(atom->nmax); + d_ilist = k_list->d_ilist; + d_numneigh = k_list->d_numneigh; + d_neighbors = k_list->d_neighbors; + + int ntypes = atom->ntypes; + + k_iskip = DAT::tdual_int_1d("npair_skip:iskip",ntypes+1); + k_ijskip = DAT::tdual_int_2d("npair_skip:ijskip",ntypes+1,ntypes+1); + d_iskip = k_iskip.view<DeviceType>(); + d_ijskip = k_ijskip.view<DeviceType>(); + + for (int itype = 1; itype <= ntypes; itype++) { + k_iskip.h_view(itype) = list->iskip[itype]; + for (int jtype = 1; jtype <= ntypes; jtype++) { + k_ijskip.h_view(itype,jtype) = list->ijskip[itype][jtype]; + } + } + k_iskip.modify<LMPHostType>(); + k_ijskip.modify<LMPHostType>(); + + k_iskip.sync<DeviceType>(); + k_ijskip.sync<DeviceType>(); + + // loop over atoms in other list + // skip I atom entirely if iskip is set for type[I] + // skip I,J pair if ijskip is set for type[I],type[J] + + copymode = 1; + Kokkos::parallel_scan(Kokkos::RangePolicy<DeviceType, TagNPairSkipCompute>(0,num_skip),*this); + + auto h_inum = Kokkos::create_mirror_view(d_inum); + Kokkos::deep_copy(h_inum,d_inum); + const int inum = h_inum(); + list->inum = inum; + if (list->ghost) { + int num = 0; + Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagNPairSkipCountLocal>(0,inum),*this,num); + list->inum = num; + list->gnum = inum - num; + } + copymode = 0; +} + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void NPairSkipKokkos<DeviceType>::operator()(TagNPairSkipCompute, const int &ii, int &inum, const bool &final) const { + + const int i = d_ilist_skip(ii); + const int itype = type(i); + + if (!d_iskip(itype)) { + + if (final) { + + int n = 0; + + // loop over parent non-skip list + + const int jnum = d_numneigh_skip(i); + const AtomNeighbors neighbors_i = AtomNeighbors(&d_neighbors(i,0),d_numneigh(i), + &d_neighbors(i,1)-&d_neighbors(i,0)); + + for (int jj = 0; jj < jnum; jj++) { + const int joriginal = d_neighbors_skip(i,jj); + int j = joriginal & NEIGHMASK; + if (d_ijskip(itype,type(j))) continue; + neighbors_i(n++) = joriginal; + } + + d_numneigh(i) = n; + d_ilist(inum) = i; + } + + inum++; + } + + if (final) { + if (ii == num_skip-1) + d_inum() = inum; + } +} + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void NPairSkipKokkos<DeviceType>::operator()(TagNPairSkipCountLocal, const int &i, int &num) const { + if (d_ilist[i] < nlocal) num++; +} + + +namespace LAMMPS_NS { +template class NPairSkipKokkos<LMPDeviceType>; +#ifdef KOKKOS_HAVE_CUDA +template class NPairSkipKokkos<LMPHostType>; +#endif +} diff --git a/src/KOKKOS/npair_skip_kokkos.h b/src/KOKKOS/npair_skip_kokkos.h new file mode 100644 index 0000000000000000000000000000000000000000..a274c1738c7cb17b0a57b9b0722f971dd61bded5 --- /dev/null +++ b/src/KOKKOS/npair_skip_kokkos.h @@ -0,0 +1,102 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef NPAIR_CLASS + +typedef NPairSkipKokkos<LMPDeviceType> NPairKokkosSkipDevice; +NPairStyle(skip/kk/device, + NPairKokkosSkipDevice, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_KOKKOS_DEVICE) + +typedef NPairSkipKokkos<LMPDeviceType> NPairKokkosSkipGhostDevice; +NPairStyle(skip/ghost/kk/device, + NPairKokkosSkipGhostDevice, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_GHOST | NP_KOKKOS_DEVICE) + +typedef NPairSkipKokkos<LMPHostType> NPairKokkosSkipHost; +NPairStyle(skip/kk/host, + NPairKokkosSkipHost, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_KOKKOS_HOST) + +typedef NPairSkipKokkos<LMPHostType> NPairKokkosSkipGhostHost; +NPairStyle(skip/ghost/kk/host, + NPairKokkosSkipGhostHost, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_GHOST | NP_KOKKOS_HOST) + +#else + +#ifndef LMP_NPAIR_SKIP_KOKKOS_H +#define LMP_NPAIR_SKIP_KOKKOS_H + +#include "npair.h" +#include "kokkos_type.h" + +namespace LAMMPS_NS { + +struct TagNPairSkipCompute{}; +struct TagNPairSkipCountLocal{}; + +template<class DeviceType> +class NPairSkipKokkos : public NPair { + public: + typedef DeviceType device_type; + typedef int value_type; + typedef ArrayTypes<DeviceType> AT; + + NPairSkipKokkos(class LAMMPS *); + ~NPairSkipKokkos() {} + void build(class NeighList *); + + KOKKOS_INLINE_FUNCTION + void operator()(TagNPairSkipCompute, const int&, int&, const bool&) const; + + KOKKOS_INLINE_FUNCTION + void operator()(TagNPairSkipCountLocal, const int&, int&) const; + + private: + int nlocal,num_skip; + + typename AT::t_int_1d_randomread type; + + typename AT::t_int_scalar d_inum; + + typename AT::t_neighbors_2d_const d_neighbors_skip; + typename AT::t_int_1d_const d_ilist_skip; + typename AT::t_int_1d_const d_numneigh_skip; + + typename AT::t_neighbors_2d d_neighbors; + typename AT::t_int_1d d_ilist; + typename AT::t_int_1d d_numneigh; + + DAT::tdual_int_1d k_iskip; + DAT::tdual_int_2d k_ijskip; + typename AT::t_int_1d d_iskip; + typename AT::t_int_2d d_ijskip; +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +*/ diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index 4c215ed16287d54ed3237aa678612c74c5faabf0..6257566ba761bfc1314c6b403cb25545f9ebba12 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -247,8 +247,8 @@ struct PairComputeFunctor { if (EFLAG) { if (c.eflag_atom) { const E_FLOAT epairhalf = 0.5 * epair; - if (NEWTON_PAIR || i < c.nlocal) c.d_eatom[i] += epairhalf; - if ((NEWTON_PAIR || j < c.nlocal) && NEIGHFLAG != FULL) c.d_eatom[j] += epairhalf; + if (NEWTON_PAIR || i < c.nlocal) eatom[i] += epairhalf; + if ((NEWTON_PAIR || j < c.nlocal) && NEIGHFLAG != FULL) eatom[j] += epairhalf; } } @@ -299,20 +299,20 @@ struct PairComputeFunctor { if (c.vflag_atom) { if (NEWTON_PAIR || i < c.nlocal) { - c.d_vatom(i,0) += 0.5*v0; - c.d_vatom(i,1) += 0.5*v1; - c.d_vatom(i,2) += 0.5*v2; - c.d_vatom(i,3) += 0.5*v3; - c.d_vatom(i,4) += 0.5*v4; - c.d_vatom(i,5) += 0.5*v5; + vatom(i,0) += 0.5*v0; + vatom(i,1) += 0.5*v1; + vatom(i,2) += 0.5*v2; + vatom(i,3) += 0.5*v3; + vatom(i,4) += 0.5*v4; + vatom(i,5) += 0.5*v5; } if ((NEWTON_PAIR || j < c.nlocal) && NEIGHFLAG != FULL) { - c.d_vatom(j,0) += 0.5*v0; - c.d_vatom(j,1) += 0.5*v1; - c.d_vatom(j,2) += 0.5*v2; - c.d_vatom(j,3) += 0.5*v3; - c.d_vatom(j,4) += 0.5*v4; - c.d_vatom(j,5) += 0.5*v5; + vatom(j,0) += 0.5*v0; + vatom(j,1) += 0.5*v1; + vatom(j,2) += 0.5*v2; + vatom(j,3) += 0.5*v3; + vatom(j,4) += 0.5*v4; + vatom(j,5) += 0.5*v5; } } } diff --git a/src/KOKKOS/pair_snap_kokkos.cpp b/src/KOKKOS/pair_snap_kokkos.cpp new file mode 100644 index 0000000000000000000000000000000000000000..32510721d3dbceaff6928d2cbd40899c92a9ca58 --- /dev/null +++ b/src/KOKKOS/pair_snap_kokkos.cpp @@ -0,0 +1,23 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "pair_snap_kokkos.h" +#include "pair_snap_kokkos_impl.h" + +namespace LAMMPS_NS { +template class PairSNAPKokkos<LMPDeviceType>; +#ifdef KOKKOS_HAVE_CUDA +template class PairSNAPKokkos<LMPHostType>; +#endif +} + diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h new file mode 100644 index 0000000000000000000000000000000000000000..7bfac0039156364b0b8fdbfd40f3028c3ffd2fe2 --- /dev/null +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -0,0 +1,139 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(snap/kk,PairSNAPKokkos<LMPDeviceType>) +PairStyle(snap/kk/device,PairSNAPKokkos<LMPDeviceType>) +PairStyle(snap/kk/host,PairSNAPKokkos<LMPHostType>) + +#else + +#ifndef LMP_PAIR_SNAP_KOKKOS_H +#define LMP_PAIR_SNAP_KOKKOS_H + +#include "pair_snap.h" +#include "kokkos_type.h" +#include "neigh_list_kokkos.h" +#include "sna_kokkos.h" +#include "pair_kokkos.h" + +namespace LAMMPS_NS { + +template<int NEIGHFLAG, int EVFLAG> +struct TagPairSNAP{}; + +template<class DeviceType> +class PairSNAPKokkos : public PairSNAP { +public: + enum {EnabledNeighFlags=FULL|HALF|HALFTHREAD}; + enum {COUL_FLAG=0}; + typedef DeviceType device_type; + typedef ArrayTypes<DeviceType> AT; + typedef EV_FLOAT value_type; + + PairSNAPKokkos(class LAMMPS *); + ~PairSNAPKokkos(); + + void coeff(int, char**); + void init_style(); + double init_one(int, int); + void compute(int, int); + double memory_usage(); + + template<int NEIGHFLAG, int EVFLAG> + KOKKOS_INLINE_FUNCTION + void operator() (TagPairSNAP<NEIGHFLAG,EVFLAG>,const typename Kokkos::TeamPolicy<DeviceType, TagPairSNAP<NEIGHFLAG,EVFLAG> >::member_type& team) const; + + template<int NEIGHFLAG, int EVFLAG> + KOKKOS_INLINE_FUNCTION + void operator() (TagPairSNAP<NEIGHFLAG,EVFLAG>,const typename Kokkos::TeamPolicy<DeviceType, TagPairSNAP<NEIGHFLAG,EVFLAG> >::member_type& team, EV_FLOAT&) const; + + template<int NEIGHFLAG> + KOKKOS_INLINE_FUNCTION + void v_tally_xyz(EV_FLOAT &ev, const int &i, const int &j, + const F_FLOAT &fx, const F_FLOAT &fy, const F_FLOAT &fz, + const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const; + +protected: + typename AT::t_neighbors_2d d_neighbors; + typename AT::t_int_1d_randomread d_ilist; + typename AT::t_int_1d_randomread d_numneigh; + + DAT::tdual_efloat_1d k_eatom; + DAT::tdual_virial_array k_vatom; + typename AT::t_efloat_1d d_eatom; + typename AT::t_virial_array d_vatom; + + typedef Kokkos::View<F_FLOAT**> t_bvec; + t_bvec bvec; + typedef Kokkos::View<F_FLOAT***> t_dbvec; + t_dbvec dbvec; + SNAKokkos<DeviceType> snaKK; + + // How much parallelism to use within an interaction + int vector_length; + + int eflag,vflag; + + void allocate(); + //void read_files(char *, char *); + /*template<class DeviceType> +inline int equal(double* x,double* y); + template<class DeviceType> +inline double dist2(double* x,double* y); + double extra_cutoff(); + void load_balance(); + void set_sna_to_shared(int snaid,int i); + void build_per_atom_arrays();*/ + + int neighflag; + + Kokkos::View<T_INT*, DeviceType> ilistmast; + Kokkos::View<T_INT*, DeviceType> ghostilist; + Kokkos::View<T_INT*, DeviceType> ghostnumneigh; + Kokkos::View<T_INT*, DeviceType> ghostneighs; + Kokkos::View<T_INT*, DeviceType> ghostfirstneigh; + + Kokkos::View<T_INT**, Kokkos::LayoutRight, DeviceType> i_pairs; + Kokkos::View<T_INT***, Kokkos::LayoutRight, DeviceType> i_rij; + Kokkos::View<T_INT**, Kokkos::LayoutRight, DeviceType> i_inside; + Kokkos::View<F_FLOAT**, Kokkos::LayoutRight, DeviceType> i_wj; + Kokkos::View<F_FLOAT***, Kokkos::LayoutRight, DeviceType>i_rcutij; + Kokkos::View<T_INT*, DeviceType> i_ninside; + Kokkos::View<F_FLOAT****, Kokkos::LayoutRight, DeviceType> i_uarraytot_r, i_uarraytot_i; + Kokkos::View<F_FLOAT******, Kokkos::LayoutRight, DeviceType> i_zarray_r, i_zarray_i; + + Kokkos::View<F_FLOAT*, DeviceType> d_radelem; // element radii + Kokkos::View<F_FLOAT*, DeviceType> d_wjelem; // elements weights + Kokkos::View<F_FLOAT**, Kokkos::LayoutRight, DeviceType> d_coeffelem; // element bispectrum coefficients + Kokkos::View<T_INT*, DeviceType> d_map; // mapping from atom types to elements + + typedef Kokkos::DualView<F_FLOAT**, DeviceType> tdual_fparams; + tdual_fparams k_cutsq; + typedef Kokkos::View<const F_FLOAT**, DeviceType, + Kokkos::MemoryTraits<Kokkos::RandomAccess> > t_fparams_rnd; + t_fparams_rnd rnd_cutsq; + + typename AT::t_x_array_randomread x; + typename AT::t_f_array f; + typename AT::t_int_1d_randomread type; + + friend void pair_virial_fdotr_compute<PairSNAPKokkos>(PairSNAPKokkos*); + +}; + +} + +#endif +#endif diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..b2c8bbcd993eeef13c2f80ae673e4173ef288dbb --- /dev/null +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -0,0 +1,646 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: Christian Trott (SNL), Stan Moore (SNL) +------------------------------------------------------------------------- */ + +#include <math.h> +#include <stdlib.h> +#include <string.h> +#include "pair_snap_kokkos.h" +#include "atom_kokkos.h" +#include "error.h" +#include "force.h" +#include "atom_masks.h" +#include "memory_kokkos.h" +#include "neigh_request.h" +#include "neighbor_kokkos.h" +#include "kokkos.h" +#include "sna.h" + +#define MAXLINE 1024 +#define MAXWORD 3 + +using namespace LAMMPS_NS; + +// Outstanding issues with quadratic term +// 1. there seems to a problem with compute_optimized energy calc +// it does not match compute_regular, even when quadratic coeffs = 0 + +//static double t1 = 0.0; +//static double t2 = 0.0; +//static double t3 = 0.0; +//static double t4 = 0.0; +//static double t5 = 0.0; +//static double t6 = 0.0; +//static double t7 = 0.0; +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +PairSNAPKokkos<DeviceType>::PairSNAPKokkos(LAMMPS *lmp) : PairSNAP(lmp) +{ + respa_enable = 0; + + atomKK = (AtomKokkos *) atom; + execution_space = ExecutionSpaceFromDevice<DeviceType>::space; + datamask_read = EMPTY_MASK; + datamask_modify = EMPTY_MASK; + + vector_length = 8; + k_cutsq = tdual_fparams("PairSNAPKokkos::cutsq",atom->ntypes+1,atom->ntypes+1); + auto d_cutsq = k_cutsq.template view<DeviceType>(); + rnd_cutsq = d_cutsq; +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +PairSNAPKokkos<DeviceType>::~PairSNAPKokkos() +{ + if (copymode) return; + + memoryKK->destroy_kokkos(k_eatom,eatom); + memoryKK->destroy_kokkos(k_vatom,vatom); +} + + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +template<class DeviceType> +void PairSNAPKokkos<DeviceType>::init_style() +{ + if (force->newton_pair == 0) + error->all(FLERR,"Pair style SNAP requires newton pair on"); + + if (diagonalstyle != 3) + error->all(FLERR,"Must use diagonal style = 3 with pair snap/kk"); + + // irequest = neigh request made by parent class + + neighflag = lmp->kokkos->neighflag; + int irequest = neighbor->request(this,instance_me); + + neighbor->requests[irequest]-> + kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && + !Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; + neighbor->requests[irequest]-> + kokkos_device = Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; + + if (neighflag == HALF || neighflag == HALFTHREAD) { // still need atomics, even though using a full neigh list + neighbor->requests[irequest]->full = 1; + neighbor->requests[irequest]->half = 0; + } else { + error->all(FLERR,"Must use half neighbor list style with pair snap/kk"); + } +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +struct FindMaxNumNeighs { + typedef DeviceType device_type; + NeighListKokkos<DeviceType> k_list; + + FindMaxNumNeighs(NeighListKokkos<DeviceType>* nl): k_list(*nl) {} + ~FindMaxNumNeighs() {k_list.copymode = 1;} + + KOKKOS_INLINE_FUNCTION + void operator() (const int& ii, int& max_neighs) const { + const int i = k_list.d_ilist[ii]; + const int num_neighs = k_list.d_numneigh[i]; + if (max_neighs<num_neighs) max_neighs = num_neighs; + } +}; + +/* ---------------------------------------------------------------------- + This version is a straightforward implementation + ---------------------------------------------------------------------- */ + +template<class DeviceType> +void PairSNAPKokkos<DeviceType>::compute(int eflag_in, int vflag_in) +{ + eflag = eflag_in; + vflag = vflag_in; + + if (neighflag == FULL) no_virial_fdotr_compute = 1; + + if (eflag || vflag) ev_setup(eflag,vflag,0); + else evflag = vflag_fdotr = 0; + + // reallocate per-atom arrays if necessary + + if (eflag_atom) { + memoryKK->destroy_kokkos(k_eatom,eatom); + memoryKK->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom"); + d_eatom = k_eatom.view<DeviceType>(); + } + if (vflag_atom) { + memoryKK->destroy_kokkos(k_vatom,vatom); + memoryKK->create_kokkos(k_vatom,vatom,maxvatom,6,"pair:vatom"); + d_vatom = k_vatom.view<DeviceType>(); + } + + copymode = 1; + int newton_pair = force->newton_pair; + if (newton_pair == false) + error->all(FLERR,"PairSNAPKokkos requires 'newton on'"); + + atomKK->sync(execution_space,X_MASK|F_MASK|TYPE_MASK); + x = atomKK->k_x.view<DeviceType>(); + f = atomKK->k_f.view<DeviceType>(); + type = atomKK->k_type.view<DeviceType>(); + k_cutsq.template sync<DeviceType>(); + + NeighListKokkos<DeviceType>* k_list = static_cast<NeighListKokkos<DeviceType>*>(list); + d_numneigh = k_list->d_numneigh; + d_neighbors = k_list->d_neighbors; + d_ilist = k_list->d_ilist; + int inum = list->inum; + + /* + for (int i = 0; i < nlocal; i++) { + typename t_neigh_list::t_neighs neighs_i = neigh_list.get_neighs(i); + const int num_neighs = neighs_i.get_num_neighs(); + if (max_neighs<num_neighs) max_neighs = num_neighs; + }*/ + int max_neighs = 0; + Kokkos::parallel_reduce("PairSNAPKokkos::find_max_neighs",inum, FindMaxNumNeighs<DeviceType>(k_list), Kokkos::Experimental::Max<int>(max_neighs)); + + snaKK.nmax = max_neighs; + + T_INT team_scratch_size = snaKK.size_team_scratch_arrays(); + T_INT thread_scratch_size = snaKK.size_thread_scratch_arrays(); + + //printf("Sizes: %i %i\n",team_scratch_size/1024,thread_scratch_size/1024); + int team_size_max = Kokkos::TeamPolicy<DeviceType>::team_size_max(*this); + int vector_length = 8; +#ifdef KOKKOS_ENABLE_CUDA + int team_size = 20;//max_neighs; + if (team_size*vector_length > team_size_max) + team_size = team_size_max/vector_length; +#else + int team_size = 1; +#endif + + EV_FLOAT ev; + + if (eflag) { + if (neighflag == HALF) { + typename Kokkos::TeamPolicy<DeviceType, TagPairSNAP<HALF,1> > policy(inum,team_size,vector_length); + Kokkos::parallel_reduce(policy + .set_scratch_size(1,Kokkos::PerThread(thread_scratch_size)) + .set_scratch_size(1,Kokkos::PerTeam(team_scratch_size)) + ,*this,ev); + } else if (neighflag == HALFTHREAD) { + typename Kokkos::TeamPolicy<DeviceType, TagPairSNAP<HALFTHREAD,1> > policy(inum,team_size,vector_length); + Kokkos::parallel_reduce(policy + .set_scratch_size(1,Kokkos::PerThread(thread_scratch_size)) + .set_scratch_size(1,Kokkos::PerTeam(team_scratch_size)) + ,*this,ev); + } + } else { + if (neighflag == HALF) { + typename Kokkos::TeamPolicy<DeviceType, TagPairSNAP<HALF,0> > policy(inum,team_size,vector_length); + Kokkos::parallel_for(policy + .set_scratch_size(1,Kokkos::PerThread(thread_scratch_size)) + .set_scratch_size(1,Kokkos::PerTeam(team_scratch_size)) + ,*this); + } else if (neighflag == HALFTHREAD) { + typename Kokkos::TeamPolicy<DeviceType, TagPairSNAP<HALFTHREAD,0> > policy(inum,team_size,vector_length); + Kokkos::parallel_for(policy + .set_scratch_size(1,Kokkos::PerThread(thread_scratch_size)) + .set_scratch_size(1,Kokkos::PerTeam(team_scratch_size)) + ,*this); + } + } + +//static int step =0; +//step++; +//if (step%10==0) +// printf(" %e %e %e %e %e (%e %e): %e\n",t1,t2,t3,t4,t5,t6,t7,t1+t2+t3+t4+t5); + + if (eflag_global) eng_vdwl += ev.evdwl; + if (vflag_global) { + virial[0] += ev.v[0]; + virial[1] += ev.v[1]; + virial[2] += ev.v[2]; + virial[3] += ev.v[3]; + virial[4] += ev.v[4]; + virial[5] += ev.v[5]; + } + + if (vflag_fdotr) pair_virial_fdotr_compute(this); + + if (eflag_atom) { + k_eatom.template modify<DeviceType>(); + k_eatom.template sync<LMPHostType>(); + } + + if (vflag_atom) { + k_vatom.template modify<DeviceType>(); + k_vatom.template sync<LMPHostType>(); + } + + atomKK->modified(execution_space,F_MASK); + copymode = 0; +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +template<class DeviceType> +void PairSNAPKokkos<DeviceType>::allocate() +{ + PairSNAP::allocate(); + + int n = atom->ntypes; + d_map = Kokkos::View<T_INT*, DeviceType>("PairSNAPKokkos::map",n+1); +} + + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +template<class DeviceType> +double PairSNAPKokkos<DeviceType>::init_one(int i, int j) +{ + double cutone = PairSNAP::init_one(i,j); + k_cutsq.h_view(i,j) = k_cutsq.h_view(j,i) = cutone*cutone; + k_cutsq.template modify<LMPHostType>(); + + return cutone; +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +template<class DeviceType> +void PairSNAPKokkos<DeviceType>::coeff(int narg, char **arg) +{ + PairSNAP::coeff(narg,arg); + + // Set up element lists + + d_radelem = Kokkos::View<F_FLOAT*, DeviceType>("pair:radelem",nelements); + d_wjelem = Kokkos::View<F_FLOAT*, DeviceType>("pair:wjelem",nelements); + d_coeffelem = Kokkos::View<F_FLOAT**, Kokkos::LayoutRight, DeviceType>("pair:coeffelem",nelements,ncoeffall); + + auto h_radelem = Kokkos::create_mirror_view(d_radelem); + auto h_wjelem = Kokkos::create_mirror_view(d_wjelem); + auto h_coeffelem = Kokkos::create_mirror_view(d_coeffelem); + auto h_map = Kokkos::create_mirror_view(d_map); + + for (int ielem = 0; ielem < nelements; ielem++) { + h_radelem(ielem) = radelem[ielem]; + h_wjelem(ielem) = wjelem[ielem]; + for (int jcoeff = 0; jcoeff < ncoeffall; jcoeff++) { + h_coeffelem(ielem,jcoeff) = coeffelem[ielem][jcoeff]; + } + } + + for (int i = 1; i <= atom->ntypes; i++) { + h_map(i) = map[i]; + } + + Kokkos::deep_copy(d_radelem,h_radelem); + Kokkos::deep_copy(d_wjelem,h_wjelem); + Kokkos::deep_copy(d_coeffelem,h_coeffelem); + Kokkos::deep_copy(d_map,h_map); + + // deallocate non-kokkos sna + + if (sna) { + for (int tid = 0; tid<nthreads; tid++) + delete sna[tid]; + delete [] sna; + sna = NULL; + } + + // allocate memory for per OpenMP thread data which + // is wrapped into the sna class + + snaKK = SNAKokkos<DeviceType>(rfac0,twojmax, + diagonalstyle,use_shared_arrays, + rmin0,switchflag,bzeroflag); + //if (!use_shared_arrays) + snaKK.grow_rij(nmax); + snaKK.init(); +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +template<int NEIGHFLAG, int EVFLAG> +KOKKOS_INLINE_FUNCTION +void PairSNAPKokkos<DeviceType>::operator() (TagPairSNAP<NEIGHFLAG,EVFLAG>,const typename Kokkos::TeamPolicy<DeviceType, TagPairSNAP<NEIGHFLAG,EVFLAG> >::member_type& team, EV_FLOAT& ev) const { + // The f array is atomic for Half/Thread neighbor style + Kokkos::View<F_FLOAT*[3], typename DAT::t_f_array::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > a_f = f; + + const int ii = team.league_rank(); + const int i = d_ilist[ii]; + SNAKokkos<DeviceType> my_sna(snaKK,team); + const double x_i = x(i,0); + const double y_i = x(i,1); + const double z_i = x(i,2); + const int type_i = type[i]; + const int elem_i = d_map[type_i]; + const double radi = d_radelem[elem_i]; + + const int num_neighs = d_numneigh[i]; + + // rij[][3] = displacements between atom I and those neighbors + // inside = indices of neighbors of I within cutoff + // wj = weights for neighbors of I within cutoff + // rcutij = cutoffs for neighbors of I within cutoff + // note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi + + //Kokkos::Timer timer; + int ninside = 0; + Kokkos::parallel_reduce(Kokkos::TeamThreadRange(team,num_neighs), + [&] (const int jj, int& count) { + Kokkos::single(Kokkos::PerThread(team), [&] (){ + T_INT j = d_neighbors(i,jj); + const F_FLOAT dx = x(j,0) - x_i; + const F_FLOAT dy = x(j,1) - y_i; + const F_FLOAT dz = x(j,2) - z_i; + + const int type_j = type(j); + const F_FLOAT rsq = dx*dx + dy*dy + dz*dz; + const int elem_j = d_map[type_j]; + + if ( rsq < rnd_cutsq(type_i,type_j) ) + count++; + }); + },ninside); + + //t1 += timer.seconds(); timer.reset(); + + if (team.team_rank() == 0) + Kokkos::parallel_scan(Kokkos::ThreadVectorRange(team,num_neighs), + [&] (const int jj, int& offset, bool final){ + //for (int jj = 0; jj < num_neighs; jj++) { + T_INT j = d_neighbors(i,jj); + const F_FLOAT dx = x(j,0) - x_i; + const F_FLOAT dy = x(j,1) - y_i; + const F_FLOAT dz = x(j,2) - z_i; + + const int type_j = type(j); + const F_FLOAT rsq = dx*dx + dy*dy + dz*dz; + const int elem_j = d_map[type_j]; + + if ( rsq < rnd_cutsq(type_i,type_j) ) { + if (final) { + my_sna.rij(offset,0) = dx; + my_sna.rij(offset,1) = dy; + my_sna.rij(offset,2) = dz; + my_sna.inside[offset] = j; + my_sna.wj[offset] = d_wjelem[elem_j]; + my_sna.rcutij[offset] = (radi + d_radelem[elem_j])*rcutfac; + } + offset++; + } + }); + + //t2 += timer.seconds(); timer.reset(); + + team.team_barrier(); + // compute Ui, Zi, and Bi for atom I + my_sna.compute_ui(team,ninside); + //t3 += timer.seconds(); timer.reset(); + team.team_barrier(); + my_sna.compute_zi(team); + //t4 += timer.seconds(); timer.reset(); + team.team_barrier(); + + // for neighbors of I within cutoff: + // compute dUi/drj and dBi/drj + // Fij = dEi/dRj = -dEi/dRi => add to Fi, subtract from Fj + + Kokkos::View<double*,Kokkos::LayoutRight,DeviceType,Kokkos::MemoryTraits<Kokkos::Unmanaged>> + d_coeffi(d_coeffelem,elem_i,Kokkos::ALL); + + Kokkos::parallel_for (Kokkos::TeamThreadRange(team,ninside), + [&] (const int jj) { + //for (int jj = 0; jj < ninside; jj++) { + int j = my_sna.inside[jj]; + + //Kokkos::Timer timer2; + my_sna.compute_duidrj(team,&my_sna.rij(jj,0), + my_sna.wj[jj],my_sna.rcutij[jj]); + //t6 += timer2.seconds(); timer2.reset(); + my_sna.compute_dbidrj(team); + //t7 += timer2.seconds(); timer2.reset(); + my_sna.copy_dbi2dbvec(team); + if (quadraticflag) { + my_sna.compute_bi(team); + my_sna.copy_bi2bvec(team); + } + + Kokkos::single(Kokkos::PerThread(team), [&] (){ + F_FLOAT fij[3]; + + fij[0] = 0.0; + fij[1] = 0.0; + fij[2] = 0.0; + + // linear contributions + + for (int k = 1; k <= ncoeff; k++) { + double bgb = d_coeffi[k]; + fij[0] += bgb*my_sna.dbvec(k-1,0); + fij[1] += bgb*my_sna.dbvec(k-1,1); + fij[2] += bgb*my_sna.dbvec(k-1,2); + } + + if (quadraticflag) { + + int k = ncoeff+1; + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { + double bveci = my_sna.bvec[icoeff]; + double fack = d_coeffi[k]*bveci; + double dbvecix = my_sna.dbvec(icoeff,0); + double dbveciy = my_sna.dbvec(icoeff,1); + double dbveciz = my_sna.dbvec(icoeff,2); + fij[0] += fack*dbvecix; + fij[1] += fack*dbveciy; + fij[2] += fack*dbveciz; + k++; + for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { + double facki = d_coeffi[k]*bveci; + double fackj = d_coeffi[k]*my_sna.bvec[jcoeff]; + fij[0] += facki*my_sna.dbvec(jcoeff,0)+fackj*dbvecix; + fij[1] += facki*my_sna.dbvec(jcoeff,1)+fackj*dbveciy; + fij[2] += facki*my_sna.dbvec(jcoeff,2)+fackj*dbveciz; + k++; + } + } + } + + // Hard-coded ZBL potential + //const double dx = my_sna.rij(jj,0); + //const double dy = my_sna.rij(jj,1); + //const double dz = my_sna.rij(jj,2); + //const double fdivr = -1.5e6/pow(dx*dx + dy*dy + dz*dz,7.0); + //fij[0] += dx*fdivr; + //fij[1] += dy*fdivr; + //fij[2] += dz*fdivr; + + //OK + //printf("%lf %lf %lf %lf %lf %lf %lf %lf %lf SNAP-COMPARE: FIJ\n" + // ,x(i,0),x(i,1),x(i,2),x(j,0),x(j,1),x(j,2),fij[0],fij[1],fij[2] ); + a_f(i,0) += fij[0]; + a_f(i,1) += fij[1]; + a_f(i,2) += fij[2]; + a_f(j,0) -= fij[0]; + a_f(j,1) -= fij[1]; + a_f(j,2) -= fij[2]; + + // tally per-atom virial contribution + + if (EVFLAG) { + if (vflag) { + v_tally_xyz<NEIGHFLAG>(ev,i,j, + fij[0],fij[1],fij[2], + -my_sna.rij(jj,0),-my_sna.rij(jj,1), + -my_sna.rij(jj,2)); + } + } + + }); + }); + //t5 += timer.seconds(); timer.reset(); + + // tally energy contribution + + if (EVFLAG) { + if (eflag) { + + if (!quadraticflag) { + my_sna.compute_bi(team); + my_sna.copy_bi2bvec(team); + } + + // E = beta.B + 0.5*B^t.alpha.B + // coeff[k] = beta[k-1] or + // coeff[k] = alpha_ii or + // coeff[k] = alpha_ij = alpha_ji, j != i + + if (team.team_rank() == 0) + Kokkos::single(Kokkos::PerThread(team), [&] () { + + // evdwl = energy of atom I, sum over coeffs_k * Bi_k + + double evdwl = d_coeffi[0]; + + // linear contributions + for (int k = 1; k <= ncoeff; k++) + evdwl += d_coeffi[k]*my_sna.bvec[k-1]; + + // quadratic contributions + + if (quadraticflag) { + int k = ncoeff+1; + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { + double bveci = my_sna.bvec[icoeff]; + evdwl += 0.5*d_coeffi[k++]*bveci*bveci; + for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { + evdwl += d_coeffi[k++]*bveci*my_sna.bvec[jcoeff]; + } + } + } +// ev_tally_full(i,2.0*evdwl,0.0,0.0,0.0,0.0,0.0); + if (eflag_either) { + if (eflag_global) ev.evdwl += evdwl; + if (eflag_atom) d_eatom[i] += evdwl; + } + }); + } + } +} + +template<class DeviceType> +template<int NEIGHFLAG, int EVFLAG> +KOKKOS_INLINE_FUNCTION +void PairSNAPKokkos<DeviceType>::operator() (TagPairSNAP<NEIGHFLAG,EVFLAG>,const typename Kokkos::TeamPolicy<DeviceType,TagPairSNAP<NEIGHFLAG,EVFLAG> >::member_type& team) const { + EV_FLOAT ev; + this->template operator()<NEIGHFLAG,EVFLAG>(TagPairSNAP<NEIGHFLAG,EVFLAG>(), team, ev); +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +template<int NEIGHFLAG> +KOKKOS_INLINE_FUNCTION +void PairSNAPKokkos<DeviceType>::v_tally_xyz(EV_FLOAT &ev, const int &i, const int &j, + const F_FLOAT &fx, const F_FLOAT &fy, const F_FLOAT &fz, + const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const +{ + // The vatom array is atomic for Half/Thread neighbor style + Kokkos::View<F_FLOAT*[6], typename DAT::t_virial_array::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > v_vatom = k_vatom.view<DeviceType>(); + + const E_FLOAT v0 = delx*fx; + const E_FLOAT v1 = dely*fy; + const E_FLOAT v2 = delz*fz; + const E_FLOAT v3 = delx*fy; + const E_FLOAT v4 = delx*fz; + const E_FLOAT v5 = dely*fz; + + if (vflag_global) { + ev.v[0] += v0; + ev.v[1] += v1; + ev.v[2] += v2; + ev.v[3] += v3; + ev.v[4] += v4; + ev.v[5] += v5; + } + + if (vflag_atom) { + v_vatom(i,0) += 0.5*v0; + v_vatom(i,1) += 0.5*v1; + v_vatom(i,2) += 0.5*v2; + v_vatom(i,3) += 0.5*v3; + v_vatom(i,4) += 0.5*v4; + v_vatom(i,5) += 0.5*v5; + v_vatom(j,0) += 0.5*v0; + v_vatom(j,1) += 0.5*v1; + v_vatom(j,2) += 0.5*v2; + v_vatom(j,3) += 0.5*v3; + v_vatom(j,4) += 0.5*v4; + v_vatom(j,5) += 0.5*v5; + } +} + +/* ---------------------------------------------------------------------- + memory usage +------------------------------------------------------------------------- */ + +template<class DeviceType> +double PairSNAPKokkos<DeviceType>::memory_usage() +{ + double bytes = Pair::memory_usage(); + int n = atom->ntypes+1; + bytes += n*n*sizeof(int); + bytes += n*n*sizeof(double); + bytes += 3*nmax*sizeof(double); + bytes += nmax*sizeof(int); + bytes += (2*ncoeffall)*sizeof(double); + bytes += (ncoeff*3)*sizeof(double); + bytes += snaKK.memory_usage(); + return bytes; +} diff --git a/src/KOKKOS/pair_table_kokkos.cpp b/src/KOKKOS/pair_table_kokkos.cpp index b3e80d1f664e012555a826834df2d6b78ec7bba4..957214915bf403ac790b032d9179bc55e10161c3 100644 --- a/src/KOKKOS/pair_table_kokkos.cpp +++ b/src/KOKKOS/pair_table_kokkos.cpp @@ -141,8 +141,8 @@ void PairTableKokkos<DeviceType>::compute_style(int eflag_in, int vflag_in) } else if (neighflag == N2) { PairComputeFunctor<PairTableKokkos<DeviceType>,N2,false,S_TableCompute<DeviceType,TABSTYLE> > f(this,(NeighListKokkos<DeviceType>*) list); - if (eflag || vflag) Kokkos::parallel_reduce(nlocal,f,ev); - else Kokkos::parallel_for(nlocal,f); + if (eflag || vflag) Kokkos::parallel_reduce(list->inum,f,ev); + else Kokkos::parallel_for(list->inum,f); } } else { if (neighflag == FULL) { @@ -163,8 +163,8 @@ void PairTableKokkos<DeviceType>::compute_style(int eflag_in, int vflag_in) } else if (neighflag == N2) { PairComputeFunctor<PairTableKokkos<DeviceType>,N2,true,S_TableCompute<DeviceType,TABSTYLE> > f(this,(NeighListKokkos<DeviceType>*) list); - if (eflag || vflag) Kokkos::parallel_reduce(nlocal,f,ev); - else Kokkos::parallel_for(nlocal,f); + if (eflag || vflag) Kokkos::parallel_reduce(list->inum,f,ev); + else Kokkos::parallel_for(list->inum,f); } } diff --git a/src/KOKKOS/pair_zbl_kokkos.cpp b/src/KOKKOS/pair_zbl_kokkos.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0ed9e62dfff2d496dde2d9cac65ab31423cb0982 --- /dev/null +++ b/src/KOKKOS/pair_zbl_kokkos.cpp @@ -0,0 +1,439 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: Stan Moore (SNL) +------------------------------------------------------------------------- */ + +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "pair_zbl_kokkos.h" +#include "atom_kokkos.h" +#include "comm.h" +#include "force.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "update.h" +#include "integrate.h" +#include "respa.h" +#include "math_const.h" +#include "memory_kokkos.h" +#include "error.h" +#include "atom_masks.h" +#include "kokkos.h" + +// From J.F. Zeigler, J. P. Biersack and U. Littmark, +// "The Stopping and Range of Ions in Matter" volume 1, Pergamon, 1985. + +using namespace LAMMPS_NS; +using namespace MathConst; +using namespace PairZBLConstants; + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +PairZBLKokkos<DeviceType>::PairZBLKokkos(LAMMPS *lmp) : PairZBL(lmp) +{ + respa_enable = 0; + + atomKK = (AtomKokkos *) atom; + execution_space = ExecutionSpaceFromDevice<DeviceType>::space; + datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; + datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +PairZBLKokkos<DeviceType>::~PairZBLKokkos() +{ + if (copymode) return; + + if (allocated) { + memoryKK->destroy_kokkos(k_eatom,eatom); + memoryKK->destroy_kokkos(k_vatom,vatom); + memory->sfree(cutsq); + eatom = NULL; + vatom = NULL; + cutsq = NULL; + } +} + + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +template<class DeviceType> +void PairZBLKokkos<DeviceType>::init_style() +{ + PairZBL::init_style(); + + // error if rRESPA with inner levels + + if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + int respa = 0; + if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; + if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; + if (respa) + error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); + } + + // irequest = neigh request made by parent class + + neighflag = lmp->kokkos->neighflag; + int irequest = neighbor->nrequest - 1; + + neighbor->requests[irequest]-> + kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && + !Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; + neighbor->requests[irequest]-> + kokkos_device = Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; + + if (neighflag == FULL) { + neighbor->requests[irequest]->full = 1; + neighbor->requests[irequest]->half = 0; + } else if (neighflag == HALF || neighflag == HALFTHREAD) { + neighbor->requests[irequest]->full = 0; + neighbor->requests[irequest]->half = 1; + } else if (neighflag == N2) { + neighbor->requests[irequest]->full = 0; + neighbor->requests[irequest]->half = 0; + } else { + error->all(FLERR,"Cannot use chosen neighbor list style with lj/cut/kk"); + } + + Kokkos::deep_copy(d_cutsq,cut_globalsq); +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +void PairZBLKokkos<DeviceType>::compute(int eflag_in, int vflag_in) +{ + eflag = eflag_in; + vflag = vflag_in; + + if (neighflag == FULL) no_virial_fdotr_compute = 1; + + if (eflag || vflag) ev_setup(eflag,vflag,0); + else evflag = vflag_fdotr = 0; + + // reallocate per-atom arrays if necessary + + if (eflag_atom) { + memoryKK->destroy_kokkos(k_eatom,eatom); + memoryKK->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom"); + d_eatom = k_eatom.view<DeviceType>(); + } + if (vflag_atom) { + memoryKK->destroy_kokkos(k_vatom,vatom); + memoryKK->create_kokkos(k_vatom,vatom,maxvatom,6,"pair:vatom"); + d_vatom = k_vatom.view<DeviceType>(); + } + + atomKK->sync(execution_space,datamask_read); + if (eflag || vflag) atomKK->modified(execution_space,datamask_modify); + else atomKK->modified(execution_space,F_MASK); + + x = atomKK->k_x.view<DeviceType>(); + f = atomKK->k_f.view<DeviceType>(); + type = atomKK->k_type.view<DeviceType>(); + nlocal = atom->nlocal; + nall = atom->nlocal + atom->nghost; + newton_pair = force->newton_pair; + special_lj[0] = force->special_lj[0]; + special_lj[1] = force->special_lj[1]; + special_lj[2] = force->special_lj[2]; + special_lj[3] = force->special_lj[3]; + + k_z.sync<DeviceType>(); + k_d1a.sync<DeviceType>(); + k_d2a.sync<DeviceType>(); + k_d3a.sync<DeviceType>(); + k_d4a.sync<DeviceType>(); + k_zze.sync<DeviceType>(); + k_sw1.sync<DeviceType>(); + k_sw2.sync<DeviceType>(); + k_sw3.sync<DeviceType>(); + k_sw4.sync<DeviceType>(); + k_sw5.sync<DeviceType>(); + + // loop over neighbors of my atoms + + EV_FLOAT ev = pair_compute<PairZBLKokkos<DeviceType>,void >(this,(NeighListKokkos<DeviceType>*)list); + + if (eflag_global) eng_vdwl += ev.evdwl; + if (vflag_global) { + virial[0] += ev.v[0]; + virial[1] += ev.v[1]; + virial[2] += ev.v[2]; + virial[3] += ev.v[3]; + virial[4] += ev.v[4]; + virial[5] += ev.v[5]; + } + + if (eflag_atom) { + k_eatom.template modify<DeviceType>(); + k_eatom.template sync<LMPHostType>(); + } + + if (vflag_atom) { + k_vatom.template modify<DeviceType>(); + k_vatom.template sync<LMPHostType>(); + } + + if (vflag_fdotr) pair_virial_fdotr_compute(this); +} + +template<class DeviceType> +template<bool STACKPARAMS, class Specialisation> +KOKKOS_INLINE_FUNCTION +F_FLOAT PairZBLKokkos<DeviceType>:: +compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const { + (void) i; + (void) j; + const F_FLOAT r = sqrt(rsq); + F_FLOAT fpair = dzbldr(r, itype, jtype); + + if (rsq > cut_innersq) { + const F_FLOAT t = r - cut_inner; + const F_FLOAT fswitch = t*t * + (d_sw1(itype,jtype) + d_sw2(itype,jtype)*t); + fpair += fswitch; + } + + fpair *= -1.0/r; + return fpair; +} + +template<class DeviceType> +template<bool STACKPARAMS, class Specialisation> +KOKKOS_INLINE_FUNCTION +F_FLOAT PairZBLKokkos<DeviceType>:: +compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const { + (void) i; + (void) j; + const F_FLOAT r = sqrt(rsq); + F_FLOAT evdwl = e_zbl(r, itype, jtype); + evdwl += d_sw5(itype,jtype); + if (rsq > cut_innersq) { + const F_FLOAT t = r - cut_inner; + const F_FLOAT eswitch = t*t*t * + (d_sw3(itype,jtype) + d_sw4(itype,jtype)*t); + evdwl += eswitch; + } + return evdwl; +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +template<class DeviceType> +void PairZBLKokkos<DeviceType>::allocate() +{ + PairZBL::allocate(); + + int n = atom->ntypes; + + k_z = DAT::tdual_ffloat_1d("pair_zbl:z ",n+1); + k_d1a = DAT::tdual_ffloat_2d_dl("pair_zbl:d1a",n+1,n+1); + k_d2a = DAT::tdual_ffloat_2d_dl("pair_zbl:d2a",n+1,n+1); + k_d3a = DAT::tdual_ffloat_2d_dl("pair_zbl:d3a",n+1,n+1); + k_d4a = DAT::tdual_ffloat_2d_dl("pair_zbl:d4a",n+1,n+1); + k_zze = DAT::tdual_ffloat_2d_dl("pair_zbl:zze",n+1,n+1); + k_sw1 = DAT::tdual_ffloat_2d_dl("pair_zbl:sw1",n+1,n+1); + k_sw2 = DAT::tdual_ffloat_2d_dl("pair_zbl:sw2",n+1,n+1); + k_sw3 = DAT::tdual_ffloat_2d_dl("pair_zbl:sw3",n+1,n+1); + k_sw4 = DAT::tdual_ffloat_2d_dl("pair_zbl:sw4",n+1,n+1); + k_sw5 = DAT::tdual_ffloat_2d_dl("pair_zbl:sw5",n+1,n+1); + + d_z = k_z.view<DeviceType>(); + d_d1a = k_d1a.view<DeviceType>(); + d_d2a = k_d2a.view<DeviceType>(); + d_d3a = k_d3a.view<DeviceType>(); + d_d4a = k_d4a.view<DeviceType>(); + d_zze = k_zze.view<DeviceType>(); + d_sw1 = k_sw1.view<DeviceType>(); + d_sw2 = k_sw2.view<DeviceType>(); + d_sw3 = k_sw3.view<DeviceType>(); + d_sw4 = k_sw4.view<DeviceType>(); + d_sw5 = k_sw5.view<DeviceType>(); + + d_cutsq = typename AT::t_ffloat_2d_dl("pair_zbl:cutsq",n+1,n+1); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +template<class DeviceType> +double PairZBLKokkos<DeviceType>::init_one(int i, int j) +{ + double cutone = PairZBL::init_one(i,j); + + k_z.h_view(i) = z[i]; + k_z.h_view(j) = z[j]; + k_d1a.h_view(i,j) = k_d1a.h_view(j,i) = d1a[i][j]; + k_d2a.h_view(i,j) = k_d2a.h_view(j,i) = d2a[i][j]; + k_d3a.h_view(i,j) = k_d3a.h_view(j,i) = d3a[i][j]; + k_d4a.h_view(i,j) = k_d4a.h_view(j,i) = d4a[i][j]; + k_zze.h_view(i,j) = k_zze.h_view(j,i) = zze[i][j]; + k_sw1.h_view(i,j) = k_sw1.h_view(j,i) = sw1[i][j]; + k_sw2.h_view(i,j) = k_sw2.h_view(j,i) = sw2[i][j]; + k_sw3.h_view(i,j) = k_sw3.h_view(j,i) = sw3[i][j]; + k_sw4.h_view(i,j) = k_sw4.h_view(j,i) = sw4[i][j]; + k_sw5.h_view(i,j) = k_sw5.h_view(j,i) = sw5[i][j]; + + k_z.modify<LMPHostType>(); + k_d1a.modify<LMPHostType>(); + k_d2a.modify<LMPHostType>(); + k_d3a.modify<LMPHostType>(); + k_d4a.modify<LMPHostType>(); + k_zze.modify<LMPHostType>(); + k_sw1.modify<LMPHostType>(); + k_sw2.modify<LMPHostType>(); + k_sw3.modify<LMPHostType>(); + k_sw4.modify<LMPHostType>(); + k_sw5.modify<LMPHostType>(); + + if(i<MAX_TYPES_STACKPARAMS+1 && j<MAX_TYPES_STACKPARAMS+1) { + m_cutsq[i][j] = m_cutsq[j][i] = cutone*cutone; + } + + return cutone; +} + +/* ---------------------------------------------------------------------- + compute ZBL pair energy +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +F_FLOAT PairZBLKokkos<DeviceType>::e_zbl(F_FLOAT r, int i, int j) const { + + const F_FLOAT d1aij = d_d1a(i,j); + const F_FLOAT d2aij = d_d2a(i,j); + const F_FLOAT d3aij = d_d3a(i,j); + const F_FLOAT d4aij = d_d4a(i,j); + const F_FLOAT zzeij = d_zze(i,j); + const F_FLOAT rinv = 1.0/r; + + F_FLOAT sum = c1*exp(-d1aij*r); + sum += c2*exp(-d2aij*r); + sum += c3*exp(-d3aij*r); + sum += c4*exp(-d4aij*r); + + F_FLOAT result = zzeij*sum*rinv; + + return result; +} + +/* ---------------------------------------------------------------------- + compute ZBL first derivative +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +F_FLOAT PairZBLKokkos<DeviceType>::dzbldr(F_FLOAT r, int i, int j) const { + + const F_FLOAT d1aij = d_d1a(i,j); + const F_FLOAT d2aij = d_d2a(i,j); + const F_FLOAT d3aij = d_d3a(i,j); + const F_FLOAT d4aij = d_d4a(i,j); + const F_FLOAT zzeij = d_zze(i,j); + const F_FLOAT rinv = 1.0/r; + + const F_FLOAT e1 = exp(-d1aij*r); + const F_FLOAT e2 = exp(-d2aij*r); + const F_FLOAT e3 = exp(-d3aij*r); + const F_FLOAT e4 = exp(-d4aij*r); + + F_FLOAT sum = c1*e1; + sum += c2*e2; + sum += c3*e3; + sum += c4*e4; + + F_FLOAT sum_p = -c1*d1aij*e1; + sum_p -= c2*d2aij*e2; + sum_p -= c3*d3aij*e3; + sum_p -= c4*d4aij*e4; + + F_FLOAT result = zzeij*(sum_p - sum*rinv)*rinv; + + return result; +} + +/* ---------------------------------------------------------------------- + compute ZBL second derivative +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +F_FLOAT PairZBLKokkos<DeviceType>::d2zbldr2(F_FLOAT r, int i, int j) const { + + const F_FLOAT d1aij = d_d1a(i,j); + const F_FLOAT d2aij = d_d2a(i,j); + const F_FLOAT d3aij = d_d3a(i,j); + const F_FLOAT d4aij = d_d4a(i,j); + const F_FLOAT zzeij = d_zze(i,j); + const F_FLOAT rinv = 1.0/r; + + const F_FLOAT e1 = exp(-d1aij*r); + const F_FLOAT e2 = exp(-d2aij*r); + const F_FLOAT e3 = exp(-d3aij*r); + const F_FLOAT e4 = exp(-d4aij*r); + + F_FLOAT sum = c1*e1; + sum += c2*e2; + sum += c3*e3; + sum += c4*e4; + + F_FLOAT sum_p = c1*e1*d1aij; + sum_p += c2*e2*d2aij; + sum_p += c3*e3*d3aij; + sum_p += c4*e4*d4aij; + + F_FLOAT sum_pp = c1*e1*d1aij*d1aij; + sum_pp += c2*e2*d2aij*d2aij; + sum_pp += c3*e3*d3aij*d3aij; + sum_pp += c4*e4*d4aij*d4aij; + + F_FLOAT result = zzeij*(sum_pp + 2.0*sum_p*rinv + + 2.0*sum*rinv*rinv)*rinv; + + return result; +} + + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +void PairZBLKokkos<DeviceType>::cleanup_copy() { + // WHY needed: this prevents parent copy from deallocating any arrays + allocated = 0; + cutsq = NULL; + eatom = NULL; + vatom = NULL; +} + +namespace LAMMPS_NS { +template class PairZBLKokkos<LMPDeviceType>; +#ifdef KOKKOS_HAVE_CUDA +template class PairZBLKokkos<LMPHostType>; +#endif +} diff --git a/src/KOKKOS/pair_zbl_kokkos.h b/src/KOKKOS/pair_zbl_kokkos.h new file mode 100644 index 0000000000000000000000000000000000000000..fc54fa7092b18fc140b362312ce19cadbda6605e --- /dev/null +++ b/src/KOKKOS/pair_zbl_kokkos.h @@ -0,0 +1,113 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(zbl/kk,PairZBLKokkos<LMPDeviceType>) +PairStyle(zbl/kk/device,PairZBLKokkos<LMPDeviceType>) +PairStyle(zbl/kk/host,PairZBLKokkos<LMPHostType>) + +#else + +#ifndef LMP_PAIR_ZBL_KOKKOS_H +#define LMP_PAIR_ZBL_KOKKOS_H + +#include "pair_zbl.h" +#include "pair_kokkos.h" +#include "neigh_list_kokkos.h" + +namespace LAMMPS_NS { + +template<class DeviceType> +class PairZBLKokkos : public PairZBL { + public: + enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF}; + enum {COUL_FLAG=0}; + typedef DeviceType device_type; + typedef ArrayTypes<DeviceType> AT; + + PairZBLKokkos(class LAMMPS *); + virtual ~PairZBLKokkos(); + void compute(int, int); + void init_style(); + F_FLOAT init_one(int, int); + + private: + DAT::tdual_ffloat_1d k_z; + DAT::tdual_ffloat_2d_dl k_d1a,k_d2a,k_d3a,k_d4a,k_zze,k_sw1,k_sw2,k_sw3,k_sw4,k_sw5; + + typename AT::t_ffloat_1d d_z; + typename AT::t_ffloat_2d_dl d_d1a,d_d2a,d_d3a,d_d4a,d_zze,d_sw1,d_sw2,d_sw3,d_sw4,d_sw5; + + typename AT::t_x_array_randomread x; + typename AT::t_f_array f; + typename AT::t_int_1d_randomread type; + + DAT::tdual_efloat_1d k_eatom; + DAT::tdual_virial_array k_vatom; + typename AT::t_efloat_1d d_eatom; + typename AT::t_virial_array d_vatom; + + F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; + typename AT::t_ffloat_2d_dl d_cutsq; + + int newton_pair; + int neighflag; + int nlocal,nall,eflag,vflag; + double special_lj[4]; + + KOKKOS_INLINE_FUNCTION + F_FLOAT e_zbl(F_FLOAT, int, int) const; + KOKKOS_INLINE_FUNCTION + F_FLOAT dzbldr(F_FLOAT, int, int) const; + KOKKOS_INLINE_FUNCTION + F_FLOAT d2zbldr2(F_FLOAT, int, int) const; + + template<bool STACKPARAMS, class Specialisation> + KOKKOS_INLINE_FUNCTION + F_FLOAT compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const; + + template<bool STACKPARAMS, class Specialisation> + KOKKOS_INLINE_FUNCTION + F_FLOAT compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const; + + template<bool STACKPARAMS, class Specialisation> + KOKKOS_INLINE_FUNCTION + F_FLOAT compute_ecoul(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const { + return 0; + } + + void cleanup_copy(); + void allocate(); + + friend class PairComputeFunctor<PairZBLKokkos,FULL,true>; + friend class PairComputeFunctor<PairZBLKokkos,HALF,true>; + friend class PairComputeFunctor<PairZBLKokkos,HALFTHREAD,true>; + friend class PairComputeFunctor<PairZBLKokkos,FULL,false>; + friend class PairComputeFunctor<PairZBLKokkos,HALF,false>; + friend class PairComputeFunctor<PairZBLKokkos,HALFTHREAD,false>; + friend EV_FLOAT pair_compute_neighlist<PairZBLKokkos,FULL,void>(PairZBLKokkos*,NeighListKokkos<DeviceType>*); + friend EV_FLOAT pair_compute_neighlist<PairZBLKokkos,HALF,void>(PairZBLKokkos*,NeighListKokkos<DeviceType>*); + friend EV_FLOAT pair_compute_neighlist<PairZBLKokkos,HALFTHREAD,void>(PairZBLKokkos*,NeighListKokkos<DeviceType>*); + friend EV_FLOAT pair_compute<PairZBLKokkos,void>(PairZBLKokkos*,NeighListKokkos<DeviceType>*); + friend void pair_virial_fdotr_compute<PairZBLKokkos>(PairZBLKokkos*); +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +*/ diff --git a/src/KOKKOS/sna_kokkos.h b/src/KOKKOS/sna_kokkos.h new file mode 100644 index 0000000000000000000000000000000000000000..7a80b262b7ceea7d21c58efd355c5adabea35732 --- /dev/null +++ b/src/KOKKOS/sna_kokkos.h @@ -0,0 +1,211 @@ +/* -*- c++ -*- ------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: Christian Trott (SNL), Stan Moore (SNL) +------------------------------------------------------------------------- */ + +#ifndef LMP_SNA_KOKKOS_H +#define LMP_SNA_KOKKOS_H + +#include <complex> +#include <ctime> +#include <Kokkos_Core.hpp> +#include "kokkos_type.h" + +namespace LAMMPS_NS { + +struct SNAKK_LOOPINDICES { + int j1, j2, j; +}; + +template<class DeviceType> +class SNAKokkos { + +public: + typedef Kokkos::View<int*, DeviceType> t_sna_1i; + typedef Kokkos::View<double*, DeviceType> t_sna_1d; + typedef Kokkos::View<double**, Kokkos::LayoutRight, DeviceType> t_sna_2d; + typedef Kokkos::View<double***, Kokkos::LayoutRight, DeviceType> t_sna_3d; + typedef Kokkos::View<double***, Kokkos::LayoutRight, DeviceType, Kokkos::MemoryTraits<Kokkos::Atomic> > t_sna_3d_atomic; + typedef Kokkos::View<double***[3], Kokkos::LayoutRight, DeviceType> t_sna_4d; + typedef Kokkos::View<double**[3], Kokkos::LayoutRight, DeviceType> t_sna_3d3; + typedef Kokkos::View<double*****, Kokkos::LayoutRight, DeviceType> t_sna_5d; + +inline + SNAKokkos() {}; + KOKKOS_INLINE_FUNCTION + SNAKokkos(const SNAKokkos<DeviceType>& sna, const typename Kokkos::TeamPolicy<DeviceType>::member_type& team); + +inline + SNAKokkos(double, int, int, int, double, int, int); + + KOKKOS_INLINE_FUNCTION + ~SNAKokkos(); + +inline + void build_indexlist(); // SNAKokkos() + +inline + void init(); // + +inline + T_INT size_team_scratch_arrays(); + +inline + T_INT size_thread_scratch_arrays(); + + double memory_usage(); + + int ncoeff; + + // functions for bispectrum coefficients + + KOKKOS_INLINE_FUNCTION + void compute_ui(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, int); // ForceSNAP + KOKKOS_INLINE_FUNCTION + void compute_zi(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team); // ForceSNAP + KOKKOS_INLINE_FUNCTION + void compute_bi(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team); // ForceSNAP + KOKKOS_INLINE_FUNCTION + void copy_bi2bvec(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team); //ForceSNAP + + // functions for derivatives + + KOKKOS_INLINE_FUNCTION + void compute_duidrj(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, double*, double, double); //ForceSNAP + KOKKOS_INLINE_FUNCTION + void compute_dbidrj(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team); //ForceSNAP + KOKKOS_INLINE_FUNCTION + void copy_dbi2dbvec(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team); //ForceSNAP + KOKKOS_INLINE_FUNCTION + double compute_sfac(double, double); // add_uarraytot, compute_duarray + KOKKOS_INLINE_FUNCTION + double compute_dsfac(double, double); // compute_duarray + +#ifdef TIMING_INFO + double* timers; + timespec starttime, endtime; + int print; + int counter; +#endif + + //per sna class instance for OMP use + + + // Per InFlight Particle + t_sna_2d rij; + t_sna_1i inside; + t_sna_1d wj; + t_sna_1d rcutij; + int nmax; + + void grow_rij(int); + + int twojmax, diagonalstyle; + // Per InFlight Particle + t_sna_3d barray; + t_sna_3d uarraytot_r, uarraytot_i; + t_sna_3d_atomic uarraytot_r_a, uarraytot_i_a; + t_sna_5d zarray_r, zarray_i; + + // Per InFlight Interaction + t_sna_3d uarray_r, uarray_i; + + Kokkos::View<double*, Kokkos::LayoutRight, DeviceType> bvec; + + // derivatives of data + Kokkos::View<double*[3], Kokkos::LayoutRight, DeviceType> dbvec; + t_sna_4d duarray_r, duarray_i; + t_sna_4d dbarray; + +private: + double rmin0, rfac0; + + //use indexlist instead of loops, constructor generates these + // Same accross all SNAKokkos + Kokkos::View<SNAKK_LOOPINDICES*, DeviceType> idxj,idxj_full; + int idxj_max,idxj_full_max; + // data for bispectrum coefficients + + // Same accross all SNAKokkos + t_sna_5d cgarray; + t_sna_2d rootpqarray; + + + static const int nmaxfactorial = 167; + KOKKOS_INLINE_FUNCTION + double factorial(int); + + KOKKOS_INLINE_FUNCTION + void create_team_scratch_arrays(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team); // SNAKokkos() + KOKKOS_INLINE_FUNCTION + void create_thread_scratch_arrays(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team); // SNAKokkos() + +inline + void init_clebsch_gordan(); // init() + +inline + void init_rootpqarray(); // init() + KOKKOS_INLINE_FUNCTION + void zero_uarraytot(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team); // compute_ui + KOKKOS_INLINE_FUNCTION + void addself_uarraytot(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, double); // compute_ui + KOKKOS_INLINE_FUNCTION + void add_uarraytot(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, double, double, double); // compute_ui + + KOKKOS_INLINE_FUNCTION + void compute_uarray(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, + double, double, double, + double, double); // compute_ui + KOKKOS_INLINE_FUNCTION + double deltacg(int, int, int); // init_clebsch_gordan + +inline + int compute_ncoeff(); // SNAKokkos() + KOKKOS_INLINE_FUNCTION + void compute_duarray(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, + double, double, double, // compute_duidrj + double, double, double, double, double); + + // if number of atoms are small use per atom arrays + // for twojmax arrays, rij, inside, bvec + // this will increase the memory footprint considerably, + // but allows parallel filling and reuse of these arrays + int use_shared_arrays; + + // Sets the style for the switching function + // 0 = none + // 1 = cosine + int switch_flag; + + // Self-weight + double wself; + + int bzero_flag; // 1 if bzero subtracted from barray + Kokkos::View<double*, Kokkos::LayoutRight, DeviceType> bzero; // array of B values for isolated atoms +}; + +} + +#include "sna_kokkos_impl.h" +#endif + +/* ERROR/WARNING messages: + +E: Invalid argument to factorial %d + +N must be >= 0 and <= 167, otherwise the factorial result is too +large. + +*/ diff --git a/src/KOKKOS/sna_kokkos_impl.h b/src/KOKKOS/sna_kokkos_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..086802573d9399361a0ab7242282255348ac554f --- /dev/null +++ b/src/KOKKOS/sna_kokkos_impl.h @@ -0,0 +1,1289 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: Christian Trott (SNL), Stan Moore (SNL) +------------------------------------------------------------------------- */ + +#include "sna_kokkos.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> + +using namespace LAMMPS_NS; + +static const double MY_PI = 3.14159265358979323846; // pi + +template<class DeviceType> +inline +SNAKokkos<DeviceType>::SNAKokkos(double rfac0_in, + int twojmax_in, int diagonalstyle_in, int use_shared_arrays_in, + double rmin0_in, int switch_flag_in, int bzero_flag_in) +{ + wself = 1.0; + + use_shared_arrays = use_shared_arrays_in; + rfac0 = rfac0_in; + rmin0 = rmin0_in; + switch_flag = switch_flag_in; + bzero_flag = bzero_flag_in; + + twojmax = twojmax_in; + diagonalstyle = diagonalstyle_in; + + ncoeff = compute_ncoeff(); + + //create_twojmax_arrays(); + + nmax = 0; + + build_indexlist(); + + int jdim = twojmax + 1; + + cgarray = t_sna_5d("SNAKokkos::cgarray",jdim,jdim,jdim,jdim,jdim); + rootpqarray = t_sna_2d("SNAKokkos::rootpqarray",jdim+1,jdim+1); + + if (bzero_flag) { + bzero = Kokkos::View<double*, Kokkos::LayoutRight, DeviceType>("sna:bzero",jdim); + auto h_bzero = Kokkos::create_mirror_view(bzero); + + double www = wself*wself*wself; + for(int j = 0; j <= twojmax; j++) + h_bzero[j] = www*(j+1); + Kokkos::deep_copy(bzero,h_bzero); + } +} + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +SNAKokkos<DeviceType>::SNAKokkos(const SNAKokkos<DeviceType>& sna, const typename Kokkos::TeamPolicy<DeviceType>::member_type& team) { + wself = sna.wself; + + use_shared_arrays = sna.use_shared_arrays; + rfac0 = sna.rfac0; + rmin0 = sna.rmin0; + switch_flag = sna.switch_flag; + bzero_flag = sna.bzero_flag; + + twojmax = sna.twojmax; + diagonalstyle = sna.diagonalstyle; + + ncoeff = sna.ncoeff; + nmax = sna.nmax; + idxj = sna.idxj; + idxj_max = sna.idxj_max; + idxj_full = sna.idxj_full; + idxj_full_max = sna.idxj_full_max; + cgarray = sna.cgarray; + rootpqarray = sna.rootpqarray; + bzero = sna.bzero; + create_team_scratch_arrays(team); + create_thread_scratch_arrays(team); +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +SNAKokkos<DeviceType>::~SNAKokkos() +{ +} + +template<class DeviceType> +inline +void SNAKokkos<DeviceType>::build_indexlist() +{ + if(diagonalstyle == 3) { + int idxj_count = 0; + int idxj_full_count = 0; + + for(int j1 = 0; j1 <= twojmax; j1++) + for(int j2 = 0; j2 <= j1; j2++) + for(int j = abs(j1 - j2); j <= MIN(twojmax, j1 + j2); j += 2) { + if (j >= j1) idxj_count++; + idxj_full_count++; + } + + // indexList can be changed here + + idxj = Kokkos::View<SNAKK_LOOPINDICES*, DeviceType>("SNAKokkos::idxj",idxj_count); + idxj_full = Kokkos::View<SNAKK_LOOPINDICES*, DeviceType>("SNAKokkos::idxj_full",idxj_full_count); + auto h_idxj = Kokkos::create_mirror_view(idxj); + auto h_idxj_full = Kokkos::create_mirror_view(idxj_full); + + idxj_max = idxj_count; + idxj_full_max = idxj_full_count; + + idxj_count = 0; + idxj_full_count = 0; + + for(int j1 = 0; j1 <= twojmax; j1++) + for(int j2 = 0; j2 <= j1; j2++) + for(int j = abs(j1 - j2); j <= MIN(twojmax, j1 + j2); j += 2) { + if (j >= j1) { + h_idxj[idxj_count].j1 = j1; + h_idxj[idxj_count].j2 = j2; + h_idxj[idxj_count].j = j; + idxj_count++; + } + h_idxj_full[idxj_full_count].j1 = j1; + h_idxj_full[idxj_full_count].j2 = j2; + h_idxj_full[idxj_full_count].j = j; + idxj_full_count++; + } + Kokkos::deep_copy(idxj,h_idxj); + Kokkos::deep_copy(idxj_full,h_idxj_full); + + } + +} +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +inline +void SNAKokkos<DeviceType>::init() +{ + init_clebsch_gordan(); + init_rootpqarray(); +} + +template<class DeviceType> +inline +void SNAKokkos<DeviceType>::grow_rij(int newnmax) +{ + if(newnmax <= nmax) return; + nmax = newnmax; +} +/* ---------------------------------------------------------------------- + compute Ui by summing over neighbors j +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::compute_ui(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, int jnum) +{ + double rsq, r, x, y, z, z0, theta0; + + // utot(j,ma,mb) = 0 for all j,ma,ma + // utot(j,ma,ma) = 1 for all j,ma + // for j in neighbors of i: + // compute r0 = (x,y,z,z0) + // utot(j,ma,mb) += u(r0;j,ma,mb) for all j,ma,mb + + if(team.team_rank() == 0) { + zero_uarraytot(team); + //Kokkos::single(Kokkos::PerThread(team), [&] (){ + addself_uarraytot(team,wself); + //}); + } + team.team_barrier(); + + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,jnum), + [&] (const int& j) { + //for(int j = 0; j < jnum; j++) { + x = rij(j,0); + y = rij(j,1); + z = rij(j,2); + rsq = x * x + y * y + z * z; + r = sqrt(rsq); + + theta0 = (r - rmin0) * rfac0 * MY_PI / (rcutij[j] - rmin0); + // theta0 = (r - rmin0) * rscale0; + z0 = r / tan(theta0); + + compute_uarray(team,x, y, z, z0, r); + //Kokkos::single(Kokkos::PerThread(team), [&] (){ + add_uarraytot(team,r, wj[j], rcutij[j]); + //}); + }); + +} + +/* ---------------------------------------------------------------------- + compute Zi by summing over products of Ui +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::compute_zi(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team) +{ + // for j1 = 0,...,twojmax + // for j2 = 0,twojmax + // for j = |j1-j2|,Min(twojmax,j1+j2),2 + // for ma = 0,...,j + // for mb = 0,...,jmid + // z(j1,j2,j,ma,mb) = 0 + // for ma1 = Max(0,ma+(j1-j2-j)/2),Min(j1,ma+(j1+j2-j)/2) + // sumb1 = 0 + // ma2 = ma-ma1+(j1+j2-j)/2; + // for mb1 = Max(0,mb+(j1-j2-j)/2),Min(j1,mb+(j1+j2-j)/2) + // mb2 = mb-mb1+(j1+j2-j)/2; + // sumb1 += cg(j1,mb1,j2,mb2,j) * + // u(j1,ma1,mb1) * u(j2,ma2,mb2) + // z(j1,j2,j,ma,mb) += sumb1*cg(j1,ma1,j2,ma2,j) + +#ifdef TIMING_INFO + clock_gettime(CLOCK_REALTIME, &starttime); +#endif + + // compute_dbidrj() requires full j1/j2/j chunk of z elements + // use zarray j1/j2 symmetry + + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,idxj_full_max), + [&] (const int& idx) { + const int j1 = idxj_full(idx).j1; + const int j2 = idxj_full(idx).j2; + const int j = idxj_full(idx).j; + + const int bound = (j+2)/2; + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,(j+1)*bound), + [&] (const int mbma ) { + //for(int mb = 0; 2*mb <= j; mb++) + //for(int ma = 0; ma <= j; ma++) { + const int ma = mbma%(j+1); + const int mb = mbma/(j+1); + + //zarray_r(j1,j2,j,ma,mb) = 0.0; + //zarray_i(j1,j2,j,ma,mb) = 0.0; + double z_r = 0.0; + double z_i = 0.0; + + for(int ma1 = MAX(0, (2 * ma - j - j2 + j1) / 2); + ma1 <= MIN(j1, (2 * ma - j + j2 + j1) / 2); ma1++) { + double sumb1_r = 0.0; + double sumb1_i = 0.0; + + const int ma2 = (2 * ma - j - (2 * ma1 - j1) + j2) / 2; + + for(int mb1 = MAX( 0, (2 * mb - j - j2 + j1) / 2); + mb1 <= MIN(j1, (2 * mb - j + j2 + j1) / 2); mb1++) { + + const int mb2 = (2 * mb - j - (2 * mb1 - j1) + j2) / 2; + const double cga = cgarray(j1,j2,j,mb1,mb2); + const double uat1_r = uarraytot_r(j1,ma1,mb1); + const double uat1_i = uarraytot_i(j1,ma1,mb1); + const double uat2_r = uarraytot_r(j2,ma2,mb2); + const double uat2_i = uarraytot_i(j2,ma2,mb2); + sumb1_r += cga * (uat1_r * uat2_r - uat1_i * uat2_i); + sumb1_i += cga * (uat1_r * uat2_i + uat1_i * uat2_r); + /*sumb1_r += cgarray(j1,j2,j,mb1,mb2) * + (uarraytot_r(j1,ma1,mb1) * uarraytot_r(j2,ma2,mb2) - + uarraytot_i(j1,ma1,mb1) * uarraytot_i(j2,ma2,mb2)); + sumb1_i += cgarray(j1,j2,j,mb1,mb2) * + (uarraytot_r(j1,ma1,mb1) * uarraytot_i(j2,ma2,mb2) + + uarraytot_i(j1,ma1,mb1) * uarraytot_r(j2,ma2,mb2));*/ + } // end loop over mb1 + + const double cga = cgarray(j1,j2,j,ma1,ma2); + z_r += sumb1_r * cga;//rray(j1,j2,j,ma1,ma2); + z_i += sumb1_i * cga;//rray(j1,j2,j,ma1,ma2); + } // end loop over ma1 + zarray_r(j1,j2,j,mb,ma) = z_r; + zarray_i(j1,j2,j,mb,ma) = z_i; + }); // end loop over ma, mb + // } + //} + }); + //} // end loop over j + //} // end loop over j1, j2 + +#ifdef TIMING_INFO + clock_gettime(CLOCK_REALTIME, &endtime); + timers[1] += (endtime.tv_sec - starttime.tv_sec + 1.0 * + (endtime.tv_nsec - starttime.tv_nsec) / 1000000000); +#endif +} + + +/* ---------------------------------------------------------------------- + compute Bi by summing conj(Ui)*Zi +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::compute_bi(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team) +{ + // for j1 = 0,...,twojmax + // for j2 = 0,twojmax + // for j = |j1-j2|,Min(twojmax,j1+j2),2 + // b(j1,j2,j) = 0 + // for mb = 0,...,jmid + // for ma = 0,...,j + // b(j1,j2,j) += + // 2*Conj(u(j,ma,mb))*z(j1,j2,j,ma,mb) + +#ifdef TIMING_INFO + clock_gettime(CLOCK_REALTIME, &starttime); +#endif + + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,idxj_max), + [&] (const int& idx) { + const int j1 = idxj(idx).j1; + const int j2 = idxj(idx).j2; + const int j = idxj(idx).j; + double b_j1_j2_j = 0.0; + + for(int mb = 0; 2*mb < j; mb++) + for(int ma = 0; ma <= j; ma++) { + b_j1_j2_j += + uarraytot_r(j,ma,mb) * zarray_r(j1,j2,j,mb,ma) + + uarraytot_i(j,ma,mb) * zarray_i(j1,j2,j,mb,ma); + } // end loop over ma, mb + + // For j even, special treatment for middle column + + if (j%2 == 0) { + const int mb = j/2; + for(int ma = 0; ma < mb; ma++) { + b_j1_j2_j += + uarraytot_r(j,ma,mb) * zarray_r(j1,j2,j,mb,ma) + + uarraytot_i(j,ma,mb) * zarray_i(j1,j2,j,mb,ma); + } + + const int ma = mb; + b_j1_j2_j += + (uarraytot_r(j,ma,mb) * zarray_r(j1,j2,j,mb,ma) + + uarraytot_i(j,ma,mb) * zarray_i(j1,j2,j,mb,ma))*0.5; + } + + b_j1_j2_j *= 2.0; + if (bzero_flag) + b_j1_j2_j -= bzero[j]; + + barray(j1,j2,j) = b_j1_j2_j; + }); + //} // end loop over j + //} // end loop over j1, j2 + +#ifdef TIMING_INFO + clock_gettime(CLOCK_REALTIME, &endtime); + timers[2] += (endtime.tv_sec - starttime.tv_sec + 1.0 * + (endtime.tv_nsec - starttime.tv_nsec) / 1000000000); +#endif + +} + +/* ---------------------------------------------------------------------- + copy Bi derivatives into a vector +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::copy_bi2bvec(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team) +{ + /* int ncount, j1, j2, j; + + ncount = 0; + + for(j1 = 0; j1 <= twojmax; j1++) { + for(j2 = 0; j2 <= j1; j2++) + for(j = abs(j1 - j2); + j <= MIN(twojmax, j1 + j2); j += 2) + if (j >= j1) {*/ + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,idxj_max), + [&] (const int& JJ) { + //for(int JJ = 0; JJ < idxj_max; JJ++) { + const int j1 = idxj[JJ].j1; + const int j2 = idxj[JJ].j2; + const int j = idxj[JJ].j; + bvec(JJ) = barray(j1,j2,j); + //ncount++; + }); +} + +/* ---------------------------------------------------------------------- + calculate derivative of Ui w.r.t. atom j +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::compute_duidrj(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, + double* rij, double wj, double rcut) +{ + double rsq, r, x, y, z, z0, theta0, cs, sn; + double dz0dr; + + x = rij[0]; + y = rij[1]; + z = rij[2]; + rsq = x * x + y * y + z * z; + r = sqrt(rsq); + double rscale0 = rfac0 * MY_PI / (rcut - rmin0); + theta0 = (r - rmin0) * rscale0; + cs = cos(theta0); + sn = sin(theta0); + z0 = r * cs / sn; + dz0dr = z0 / r - (r*rscale0) * (rsq + z0 * z0) / rsq; + +#ifdef TIMING_INFO + clock_gettime(CLOCK_REALTIME, &starttime); +#endif + + compute_duarray(team, x, y, z, z0, r, dz0dr, wj, rcut); + +#ifdef TIMING_INFO + clock_gettime(CLOCK_REALTIME, &endtime); + timers[3] += (endtime.tv_sec - starttime.tv_sec + 1.0 * + (endtime.tv_nsec - starttime.tv_nsec) / 1000000000); +#endif + +} + +/* ---------------------------------------------------------------------- + calculate derivative of Bi w.r.t. atom j + variant using indexlist for j1,j2,j + variant using symmetry relation +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::compute_dbidrj(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team) +{ + // for j1 = 0,...,twojmax + // for j2 = 0,twojmax + // for j = |j1-j2|,Min(twojmax,j1+j2),2 + // zdb = 0 + // for mb = 0,...,jmid + // for ma = 0,...,j + // zdb += + // Conj(dudr(j,ma,mb))*z(j1,j2,j,ma,mb) + // dbdr(j1,j2,j) += 2*zdb + // zdb = 0 + // for mb1 = 0,...,j1mid + // for ma1 = 0,...,j1 + // zdb += + // Conj(dudr(j1,ma1,mb1))*z(j,j2,j1,ma1,mb1) + // dbdr(j1,j2,j) += 2*zdb*(j+1)/(j1+1) + // zdb = 0 + // for mb2 = 0,...,j2mid + // for ma2 = 0,...,j2 + // zdb += + // Conj(dudr(j2,ma2,mb2))*z(j1,j,j2,ma2,mb2) + // dbdr(j1,j2,j) += 2*zdb*(j+1)/(j2+1) + + double* dudr_r, *dudr_i; + double jjjmambzarray_r; + double jjjmambzarray_i; + +#ifdef TIMING_INFO + clock_gettime(CLOCK_REALTIME, &starttime); +#endif + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,idxj_max), + [&] (const int& JJ) { + //for(int JJ = 0; JJ < idxj_max; JJ++) { + const int j1 = idxj[JJ].j1; + const int j2 = idxj[JJ].j2; + const int j = idxj[JJ].j; + +// dbdr = &dbarray(j1,j2,j,0); +// dbdr[0] = 0.0; +// dbdr[1] = 0.0; +// dbdr[2] = 0.0; + + t_scalar3<double> dbdr,sumzdu_r; + // Sum terms Conj(dudr(j,ma,mb))*z(j1,j2,j,ma,mb) + + // use zarray j1/j2 symmetry (optional) + + int j_,j1_,j2_; + if (j1 >= j2) { + //jjjzarray_r = &zarray_r(j1,j2,j); + //jjjzarray_i = &zarray_i(j1,j2,j); + j1_ = j1; + j2_ = j2; + j_ = j; + } else { + j1_ = j2; + j2_ = j1; + j_ = j; + //jjjzarray_r = &zarray_r(j2,j1,j); + //jjjzarray_i = &zarray_i(j2,j1,j); + } + + for(int mb = 0; 2*mb < j; mb++) + for(int ma = 0; ma <= j; ma++) { + + dudr_r = &duarray_r(j,mb,ma,0); + dudr_i = &duarray_i(j,mb,ma,0); + jjjmambzarray_r = zarray_r(j1_,j2_,j_,mb,ma); + jjjmambzarray_i = zarray_i(j1_,j2_,j_,mb,ma); + sumzdu_r.x += (dudr_r[0] * jjjmambzarray_r + dudr_i[0] * jjjmambzarray_i); + sumzdu_r.y += (dudr_r[1] * jjjmambzarray_r + dudr_i[1] * jjjmambzarray_i); + sumzdu_r.z += (dudr_r[2] * jjjmambzarray_r + dudr_i[2] * jjjmambzarray_i); + + } //end loop over ma mb + + // For j even, handle middle column + + if (j%2 == 0) { + int mb = j/2; + for(int ma = 0; ma <= mb; ma++) { + dudr_r = &duarray_r(j,mb,ma,0); + dudr_i = &duarray_i(j,mb,ma,0); + const double factor = ma==mb?0.5:1.0; + jjjmambzarray_r = zarray_r(j1_,j2_,j_,mb,ma) * factor; + jjjmambzarray_i = zarray_i(j1_,j2_,j_,mb,ma) * factor; + sumzdu_r.x += (dudr_r[0] * jjjmambzarray_r + dudr_i[0] * jjjmambzarray_i); + sumzdu_r.y += (dudr_r[1] * jjjmambzarray_r + dudr_i[1] * jjjmambzarray_i); + sumzdu_r.z += (dudr_r[2] * jjjmambzarray_r + dudr_i[2] * jjjmambzarray_i); + } + } // end if jeven + + dbdr += 2.0*sumzdu_r; + + // Sum over Conj(dudr(j1,ma1,mb1))*z(j,j2,j1,ma1,mb1) + + double j1fac = (j+1)/(j1+1.0); + + sumzdu_r.x = 0.0; sumzdu_r.y = 0.0; sumzdu_r.z = 0.0; + + // use zarray j1/j2 symmetry (optional) + + if (j >= j2) { + j1_ = j; + j2_ = j2; + j_ = j1; + + //jjjzarray_r = zarray_r(j,j2,j1); + //jjjzarray_i = zarray_i(j,j2,j1); + } else { + j1_ = j2; + j2_ = j; + j_ = j1; + //jjjzarray_r = zarray_r(j2,j,j1); + //jjjzarray_i = zarray_i(j2,j,j1); + } + + for(int mb1 = 0; 2*mb1 < j1; mb1++) + for(int ma1 = 0; ma1 <= j1; ma1++) { + + dudr_r = &duarray_r(j1,mb1,ma1,0); + dudr_i = &duarray_i(j1,mb1,ma1,0); + jjjmambzarray_r = zarray_r(j1_,j2_,j_,mb1,ma1); + jjjmambzarray_i = zarray_i(j1_,j2_,j_,mb1,ma1); + sumzdu_r.x += (dudr_r[0] * jjjmambzarray_r + dudr_i[0] * jjjmambzarray_i); + sumzdu_r.y += (dudr_r[1] * jjjmambzarray_r + dudr_i[1] * jjjmambzarray_i); + sumzdu_r.z += (dudr_r[2] * jjjmambzarray_r + dudr_i[2] * jjjmambzarray_i); + } //end loop over ma1 mb1 + + // For j1 even, handle middle column + + if (j1%2 == 0) { + const int mb1 = j1/2; + for(int ma1 = 0; ma1 <= mb1; ma1++) { + dudr_r = &duarray_r(j1,mb1,ma1,0); + dudr_i = &duarray_i(j1,mb1,ma1,0); + const double factor = ma1==mb1?0.5:1.0; + jjjmambzarray_r = zarray_r(j1_,j2_,j_,mb1,ma1) * factor; + jjjmambzarray_i = zarray_i(j1_,j2_,j_,mb1,ma1) * factor; + sumzdu_r.x += (dudr_r[0] * jjjmambzarray_r + dudr_i[0] * jjjmambzarray_i); + sumzdu_r.y += (dudr_r[1] * jjjmambzarray_r + dudr_i[1] * jjjmambzarray_i); + sumzdu_r.z += (dudr_r[2] * jjjmambzarray_r + dudr_i[2] * jjjmambzarray_i); + } + } // end if j1even + + dbdr += 2.0*sumzdu_r*j1fac; + + // Sum over Conj(dudr(j2,ma2,mb2))*z(j1,j,j2,ma2,mb2) + + double j2fac = (j+1)/(j2+1.0); + + sumzdu_r.x = 0.0; sumzdu_r.y = 0.0; sumzdu_r.z = 0.0; + + // use zarray j1/j2 symmetry (optional) + + if (j1 >= j) { + j1_ = j1; + j2_ = j; + j_ = j2; + //jjjzarray_r = zarray_r(j1,j,j2); + //jjjzarray_i = zarray_i(j1,j,j2); + } else { + j1_ = j; + j2_ = j1; + j_ = j2; + //jjjzarray_r = zarray_r(j,j1,j2); + //jjjzarray_i = zarray_i(j,j1,j2); + } + + for(int mb2 = 0; 2*mb2 < j2; mb2++) + for(int ma2 = 0; ma2 <= j2; ma2++) { + + dudr_r = &duarray_r(j2,mb2,ma2,0); + dudr_i = &duarray_i(j2,mb2,ma2,0); + jjjmambzarray_r = zarray_r(j1_,j2_,j_,mb2,ma2); + jjjmambzarray_i = zarray_i(j1_,j2_,j_,mb2,ma2); + sumzdu_r.x += (dudr_r[0] * jjjmambzarray_r + dudr_i[0] * jjjmambzarray_i); + sumzdu_r.y += (dudr_r[1] * jjjmambzarray_r + dudr_i[1] * jjjmambzarray_i); + sumzdu_r.z += (dudr_r[2] * jjjmambzarray_r + dudr_i[2] * jjjmambzarray_i); + } //end loop over ma2 mb2 + + // For j2 even, handle middle column + + if (j2%2 == 0) { + const int mb2 = j2/2; + for(int ma2 = 0; ma2 <= mb2; ma2++) { + dudr_r = &duarray_r(j2,mb2,ma2,0); + dudr_i = &duarray_i(j2,mb2,ma2,0); + const double factor = ma2==mb2?0.5:1.0; + jjjmambzarray_r = zarray_r(j1_,j2_,j_,mb2,ma2) * factor; + jjjmambzarray_i = zarray_i(j1_,j2_,j_,mb2,ma2) * factor; + sumzdu_r.x += (dudr_r[0] * jjjmambzarray_r + dudr_i[0] * jjjmambzarray_i); + sumzdu_r.y += (dudr_r[1] * jjjmambzarray_r + dudr_i[1] * jjjmambzarray_i); + sumzdu_r.z += (dudr_r[2] * jjjmambzarray_r + dudr_i[2] * jjjmambzarray_i); + } + } // end if j2even + + dbdr += 2.0*sumzdu_r*j2fac; + dbarray(j1,j2,j,0) = dbdr.x; + dbarray(j1,j2,j,1) = dbdr.y; + dbarray(j1,j2,j,2) = dbdr.z; + }); //end loop over j1 j2 j + +#ifdef TIMING_INFO + clock_gettime(CLOCK_REALTIME, &endtime); + timers[4] += (endtime.tv_sec - starttime.tv_sec + 1.0 * + (endtime.tv_nsec - starttime.tv_nsec) / 1000000000); +#endif + +} + +/* ---------------------------------------------------------------------- + copy Bi derivatives into a vector +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::copy_dbi2dbvec(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team) +{ + /* int ncount, j1, j2, j; + + ncount = 0; + + for(j1 = 0; j1 <= twojmax; j1++) { + for(j2 = 0; j2 <= j1; j2++) + for(j = abs(j1 - j2); + j <= MIN(twojmax, j1 + j2); j += 2) + if (j >= j1) {*/ + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,idxj_max), + [&] (const int& JJ) { + //for(int JJ = 0; JJ < idxj_max; JJ++) { + const int j1 = idxj[JJ].j1; + const int j2 = idxj[JJ].j2; + const int j = idxj[JJ].j; + dbvec(JJ,0) = dbarray(j1,j2,j,0); + dbvec(JJ,1) = dbarray(j1,j2,j,1); + dbvec(JJ,2) = dbarray(j1,j2,j,2); + //ncount++; + }); +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::zero_uarraytot(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team) +{ + { + double* const ptr = uarraytot_r.data(); + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,uarraytot_r.span()), + [&] (const int& i) { + ptr[i] = 0.0; + }); + } + { + double* const ptr = uarraytot_i.data(); + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,uarraytot_r.span()), + [&] (const int& i) { + ptr[i] = 0.0; + }); + } +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::addself_uarraytot(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, double wself_in) +{ + //for (int j = 0; j <= twojmax; j++) + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,twojmax+1), + [&] (const int& j) { + for (int ma = 0; ma <= j; ma++) { + uarraytot_r(j,ma,ma) = wself_in; + uarraytot_i(j,ma,ma) = 0.0; + } + }); +} + +/* ---------------------------------------------------------------------- + add Wigner U-functions for one neighbor to the total +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::add_uarraytot(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, double r, double wj, double rcut) +{ + const double sfac = compute_sfac(r, rcut) * wj; + +/* + for (int j = 0; j <= twojmax; j++) + for (int ma = 0; ma <= j; ma++) + for (int mb = 0; mb <= j; mb++) { + uarraytot_r_a(j,ma,mb) += + sfac * uarray_r(j,ma,mb); + uarraytot_i_a(j,ma,mb) += + sfac * uarray_i(j,ma,mb); + }*/ + const double* const ptr_r = uarray_r.data(); + const double* const ptr_i = uarray_i.data(); + double* const ptrtot_r = uarraytot_r.data(); + double* const ptrtot_i = uarraytot_i.data(); + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,uarraytot_r.span()), + [&] (const int& i) { + Kokkos::atomic_add(ptrtot_r+i, sfac * ptr_r[i]); + Kokkos::atomic_add(ptrtot_i+i, sfac * ptr_i[i]); + }); +} + +/* ---------------------------------------------------------------------- + compute Wigner U-functions for one neighbor +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::compute_uarray(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, + double x, double y, double z, + double z0, double r) +{ + double r0inv; + double a_r, b_r, a_i, b_i; + double rootpq; + + // compute Cayley-Klein parameters for unit quaternion + + r0inv = 1.0 / sqrt(r * r + z0 * z0); + a_r = r0inv * z0; + a_i = -r0inv * z; + b_r = r0inv * y; + b_i = -r0inv * x; + + // VMK Section 4.8.2 + + uarray_r(0,0,0) = 1.0; + uarray_i(0,0,0) = 0.0; + + for (int j = 1; j <= twojmax; j++) { + + // fill in left side of matrix layer from previous layer + + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,(j+2)/2), + [&] (const int& mb) { + //const int mb = 2*mb_2; + //for (int mb = 0; 2*mb <= j; mb++) { + uarray_r(j,0,mb) = 0.0; + uarray_i(j,0,mb) = 0.0; + + for (int ma = 0; ma < j; ma++) { + rootpq = rootpqarray(j - ma,j - mb); + uarray_r(j,ma,mb) += + rootpq * + (a_r * uarray_r(j - 1,ma,mb) + + a_i * uarray_i(j - 1,ma,mb)); + uarray_i(j,ma,mb) += + rootpq * + (a_r * uarray_i(j - 1,ma,mb) - + a_i * uarray_r(j - 1,ma,mb)); + + rootpq = rootpqarray(ma + 1,j - mb); + uarray_r(j,ma + 1,mb) = + -rootpq * + (b_r * uarray_r(j - 1,ma,mb) + + b_i * uarray_i(j - 1,ma,mb)); + uarray_i(j,ma + 1,mb) = + -rootpq * + (b_r * uarray_i(j - 1,ma,mb) - + b_i * uarray_r(j - 1,ma,mb)); + } + }); + + // copy left side to right side with inversion symmetry VMK 4.4(2) + // u[ma-j,mb-j] = (-1)^(ma-mb)*Conj([u[ma,mb)) + + //int mbpar = -1; + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,(j+2)/2), + [&] (const int& mb) { +// for (int mb = 0; 2*mb <= j; mb++) { + int mbpar = (mb)%2==0?1:-1; + int mapar = -mbpar; + for (int ma = 0; ma <= j; ma++) { + mapar = -mapar; + if (mapar == 1) { + uarray_r(j,j-ma,j-mb) = uarray_r(j,ma,mb); + uarray_i(j,j-ma,j-mb) = -uarray_i(j,ma,mb); + } else { + uarray_r(j,j-ma,j-mb) = -uarray_r(j,ma,mb); + uarray_i(j,j-ma,j-mb) = uarray_i(j,ma,mb); + } + //OK + //printf("%lf %lf %lf %lf %lf %lf %lf SNAP-COMPARE: UARRAY\n",x,y,z,z0,r,uarray_r(j,ma,mb),uarray_i(j,ma,mb)); + } + }); + } +} + + +/* ---------------------------------------------------------------------- + compute derivatives of Wigner U-functions for one neighbor + see comments in compute_uarray() +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::compute_duarray(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team, + double x, double y, double z, + double z0, double r, double dz0dr, + double wj, double rcut) +{ + double r0inv; + double a_r, a_i, b_r, b_i; + double da_r[3], da_i[3], db_r[3], db_i[3]; + double dz0[3], dr0inv[3], dr0invdr; + double rootpq; + + double rinv = 1.0 / r; + double ux = x * rinv; + double uy = y * rinv; + double uz = z * rinv; + + r0inv = 1.0 / sqrt(r * r + z0 * z0); + a_r = z0 * r0inv; + a_i = -z * r0inv; + b_r = y * r0inv; + b_i = -x * r0inv; + + dr0invdr = -pow(r0inv, 3.0) * (r + z0 * dz0dr); + + dr0inv[0] = dr0invdr * ux; + dr0inv[1] = dr0invdr * uy; + dr0inv[2] = dr0invdr * uz; + + dz0[0] = dz0dr * ux; + dz0[1] = dz0dr * uy; + dz0[2] = dz0dr * uz; + + for (int k = 0; k < 3; k++) { + da_r[k] = dz0[k] * r0inv + z0 * dr0inv[k]; + da_i[k] = -z * dr0inv[k]; + } + + da_i[2] += -r0inv; + + for (int k = 0; k < 3; k++) { + db_r[k] = y * dr0inv[k]; + db_i[k] = -x * dr0inv[k]; + } + + db_i[0] += -r0inv; + db_r[1] += r0inv; + + uarray_r(0,0,0) = 1.0; + duarray_r(0,0,0,0) = 0.0; + duarray_r(0,0,0,1) = 0.0; + duarray_r(0,0,0,2) = 0.0; + uarray_i(0,0,0) = 0.0; + duarray_i(0,0,0,0) = 0.0; + duarray_i(0,0,0,1) = 0.0; + duarray_i(0,0,0,2) = 0.0; + + for (int j = 1; j <= twojmax; j++) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,(j+2)/2), + [&] (const int& mb) { + + //for (int mb = 0; 2*mb <= j; mb++) { + uarray_r(j,0,mb) = 0.0; + duarray_r(j,mb,0,0) = 0.0; + duarray_r(j,mb,0,1) = 0.0; + duarray_r(j,mb,0,2) = 0.0; + uarray_i(j,0,mb) = 0.0; + duarray_i(j,mb,0,0) = 0.0; + duarray_i(j,mb,0,1) = 0.0; + duarray_i(j,mb,0,2) = 0.0; + + for (int ma = 0; ma < j; ma++) { + rootpq = rootpqarray(j - ma,j - mb); + uarray_r(j,ma,mb) += rootpq * + (a_r * uarray_r(j - 1,ma,mb) + + a_i * uarray_i(j - 1,ma,mb)); + uarray_i(j,ma,mb) += rootpq * + (a_r * uarray_i(j - 1,ma,mb) - + a_i * uarray_r(j - 1,ma,mb)); + + for (int k = 0; k < 3; k++) { + duarray_r(j,mb,ma,k) += + rootpq * (da_r[k] * uarray_r(j - 1,ma,mb) + + da_i[k] * uarray_i(j - 1,ma,mb) + + a_r * duarray_r(j - 1,mb,ma,k) + + a_i * duarray_i(j - 1,mb,ma,k)); + duarray_i(j,mb,ma,k) += + rootpq * (da_r[k] * uarray_i(j - 1,ma,mb) - + da_i[k] * uarray_r(j - 1,ma,mb) + + a_r * duarray_i(j - 1,mb,ma,k) - + a_i * duarray_r(j - 1,mb,ma,k)); + } + + rootpq = rootpqarray(ma + 1,j - mb); + uarray_r(j,ma + 1,mb) = + -rootpq * (b_r * uarray_r(j - 1,ma,mb) + + b_i * uarray_i(j - 1,ma,mb)); + uarray_i(j,ma + 1,mb) = + -rootpq * (b_r * uarray_i(j - 1,ma,mb) - + b_i * uarray_r(j - 1,ma,mb)); + + for (int k = 0; k < 3; k++) { + duarray_r(j,mb,ma + 1,k) = + -rootpq * (db_r[k] * uarray_r(j - 1,ma,mb) + + db_i[k] * uarray_i(j - 1,ma,mb) + + b_r * duarray_r(j - 1,mb,ma,k) + + b_i * duarray_i(j - 1,mb,ma,k)); + duarray_i(j,mb,ma + 1,k) = + -rootpq * (db_r[k] * uarray_i(j - 1,ma,mb) - + db_i[k] * uarray_r(j - 1,ma,mb) + + b_r * duarray_i(j - 1,mb,ma,k) - + b_i * duarray_r(j - 1,mb,ma,k)); + } + } + }); + + //int mbpar = -1; + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,(j+2)/2), + [&] (const int& mb) { +// for (int mb = 0; 2*mb <= j; mb++) { + int mbpar = (mb)%2==0?1:-1; + int mapar = -mbpar; + for (int ma = 0; ma <= j; ma++) { + mapar = -mapar; + if (mapar == 1) { + uarray_r(j,j-ma,j-mb) = uarray_r(j,ma,mb); + uarray_i(j,j-ma,j-mb) = -uarray_i(j,ma,mb); + for (int k = 0; k < 3; k++) { + duarray_r(j,j-mb,j-ma,k) = duarray_r(j,mb,ma,k); + duarray_i(j,j-mb,j-ma,k) = -duarray_i(j,mb,ma,k); + } + } else { + uarray_r(j,j-ma,j-mb) = -uarray_r(j,ma,mb); + uarray_i(j,j-ma,j-mb) = uarray_i(j,ma,mb); + for (int k = 0; k < 3; k++) { + duarray_r(j,j-mb,j-ma,k) = -duarray_r(j,mb,ma,k); + duarray_i(j,j-mb,j-ma,k) = duarray_i(j,mb,ma,k); + } + } + } + }); + } + + double sfac = compute_sfac(r, rcut); + double dsfac = compute_dsfac(r, rcut); + + sfac *= wj; + dsfac *= wj; + + for (int j = 0; j <= twojmax; j++) + for (int mb = 0; mb <= j; mb++) + for (int ma = 0; ma <= j; ma++) { + duarray_r(j,mb,ma,0) = dsfac * uarray_r(j,ma,mb) * ux + + sfac * duarray_r(j,mb,ma,0); + duarray_i(j,mb,ma,0) = dsfac * uarray_i(j,ma,mb) * ux + + sfac * duarray_i(j,mb,ma,0); + duarray_r(j,mb,ma,1) = dsfac * uarray_r(j,ma,mb) * uy + + sfac * duarray_r(j,mb,ma,1); + duarray_i(j,mb,ma,1) = dsfac * uarray_i(j,ma,mb) * uy + + sfac * duarray_i(j,mb,ma,1); + duarray_r(j,mb,ma,2) = dsfac * uarray_r(j,ma,mb) * uz + + sfac * duarray_r(j,mb,ma,2); + duarray_i(j,mb,ma,2) = dsfac * uarray_i(j,ma,mb) * uz + + sfac * duarray_i(j,mb,ma,2); + } +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::create_team_scratch_arrays(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team) +{ + int jdim = twojmax + 1; + uarraytot_r_a = uarraytot_r = t_sna_3d(team.team_scratch(1),jdim,jdim,jdim); + uarraytot_i_a = uarraytot_i = t_sna_3d(team.team_scratch(1),jdim,jdim,jdim); + zarray_r = t_sna_5d(team.team_scratch(1),jdim,jdim,jdim,jdim,jdim); + zarray_i = t_sna_5d(team.team_scratch(1),jdim,jdim,jdim,jdim,jdim); + + rij = t_sna_2d(team.team_scratch(1),nmax,3); + rcutij = t_sna_1d(team.team_scratch(1),nmax); + wj = t_sna_1d(team.team_scratch(1),nmax); + inside = t_sna_1i(team.team_scratch(1),nmax); +} + + +template<class DeviceType> +inline +T_INT SNAKokkos<DeviceType>::size_team_scratch_arrays() { + T_INT size = 0; + int jdim = twojmax + 1; + + size += t_sna_3d::shmem_size(jdim,jdim,jdim); // uarraytot_r_a + size += t_sna_3d::shmem_size(jdim,jdim,jdim); // uarraytot_i_a + size += t_sna_5d::shmem_size(jdim,jdim,jdim,jdim,jdim); // zarray_r + size += t_sna_5d::shmem_size(jdim,jdim,jdim,jdim,jdim); // zarray_i + + size += t_sna_2d::shmem_size(nmax,3); // rij + size += t_sna_1d::shmem_size(nmax); // rcutij + size += t_sna_1d::shmem_size(nmax); // wj + size += t_sna_1i::shmem_size(nmax); // inside + + return size; +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +void SNAKokkos<DeviceType>::create_thread_scratch_arrays(const typename Kokkos::TeamPolicy<DeviceType>::member_type& team) +{ + int jdim = twojmax + 1; + bvec = Kokkos::View<double*, Kokkos::LayoutRight, DeviceType>(team.thread_scratch(1),ncoeff); + barray = t_sna_3d(team.thread_scratch(1),jdim,jdim,jdim); + + dbvec = Kokkos::View<double*[3], Kokkos::LayoutRight, DeviceType>(team.thread_scratch(1),ncoeff); + dbarray = t_sna_4d(team.thread_scratch(1),jdim,jdim,jdim); + + uarray_r = t_sna_3d(team.thread_scratch(1),jdim,jdim,jdim); + uarray_i = t_sna_3d(team.thread_scratch(1),jdim,jdim,jdim); + duarray_r = t_sna_4d(team.thread_scratch(1),jdim,jdim,jdim); + duarray_i = t_sna_4d(team.thread_scratch(1),jdim,jdim,jdim); +} + +template<class DeviceType> +inline +T_INT SNAKokkos<DeviceType>::size_thread_scratch_arrays() { + T_INT size = 0; + int jdim = twojmax + 1; + size += Kokkos::View<double*, Kokkos::LayoutRight, DeviceType>::shmem_size(ncoeff); // bvec + size += t_sna_3d::shmem_size(jdim,jdim,jdim); // barray + + size += Kokkos::View<double*[3], Kokkos::LayoutRight, DeviceType>::shmem_size(ncoeff); // dbvec + size += t_sna_4d::shmem_size(jdim,jdim,jdim); // dbarray + + size += t_sna_3d::shmem_size(jdim,jdim,jdim); // uarray_r + size += t_sna_3d::shmem_size(jdim,jdim,jdim); // uarray_i + size += t_sna_4d::shmem_size(jdim,jdim,jdim); // duarray_r + size += t_sna_4d::shmem_size(jdim,jdim,jdim); // duarray_i + return size; +} + +/* ---------------------------------------------------------------------- + factorial n +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +double SNAKokkos<DeviceType>::factorial(int n) +{ + double result = 1.0; + for(int i=1; i<=n; i++) + result *= 1.0*i; + return result; +} + +/* ---------------------------------------------------------------------- + the function delta given by VMK Eq. 8.2(1) +------------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +double SNAKokkos<DeviceType>::deltacg(int j1, int j2, int j) +{ + double sfaccg = factorial((j1 + j2 + j) / 2 + 1); + return sqrt(factorial((j1 + j2 - j) / 2) * + factorial((j1 - j2 + j) / 2) * + factorial((-j1 + j2 + j) / 2) / sfaccg); +} + +/* ---------------------------------------------------------------------- + assign Clebsch-Gordan coefficients using + the quasi-binomial formula VMK 8.2.1(3) +------------------------------------------------------------------------- */ + +template<class DeviceType> +inline +void SNAKokkos<DeviceType>::init_clebsch_gordan() +{ + double sum,dcg,sfaccg; + int m, aa2, bb2, cc2; + int ifac; + auto h_cgarray = Kokkos::create_mirror_view(cgarray); + + for (int j1 = 0; j1 <= twojmax; j1++) + for (int j2 = 0; j2 <= twojmax; j2++) + for (int j = abs(j1 - j2); j <= MIN(twojmax, j1 + j2); j += 2) + for (int m1 = 0; m1 <= j1; m1 += 1) { + aa2 = 2 * m1 - j1; + + for (int m2 = 0; m2 <= j2; m2 += 1) { + + // -c <= cc <= c + + bb2 = 2 * m2 - j2; + m = (aa2 + bb2 + j) / 2; + + if(m < 0 || m > j) continue; + + sum = 0.0; + + for (int z = MAX(0, MAX(-(j - j2 + aa2) + / 2, -(j - j1 - bb2) / 2)); + z <= MIN((j1 + j2 - j) / 2, + MIN((j1 - aa2) / 2, (j2 + bb2) / 2)); + z++) { + ifac = z % 2 ? -1 : 1; + sum += ifac / + (factorial(z) * + factorial((j1 + j2 - j) / 2 - z) * + factorial((j1 - aa2) / 2 - z) * + factorial((j2 + bb2) / 2 - z) * + factorial((j - j2 + aa2) / 2 + z) * + factorial((j - j1 - bb2) / 2 + z)); + } + + cc2 = 2 * m - j; + dcg = deltacg(j1, j2, j); + sfaccg = sqrt(factorial((j1 + aa2) / 2) * + factorial((j1 - aa2) / 2) * + factorial((j2 + bb2) / 2) * + factorial((j2 - bb2) / 2) * + factorial((j + cc2) / 2) * + factorial((j - cc2) / 2) * + (j + 1)); + + h_cgarray(j1,j2,j,m1,m2) = sum * dcg * sfaccg; + //printf("SNAP-COMPARE: CG: %i %i %i %i %i %e\n",j1,j2,j,m1,m2,cgarray(j1,j2,j,m1,m2)); + } + } + Kokkos::deep_copy(cgarray,h_cgarray); +} + +/* ---------------------------------------------------------------------- + pre-compute table of sqrt[p/m2], p, q = 1,twojmax + the p = 0, q = 0 entries are allocated and skipped for convenience. +------------------------------------------------------------------------- */ + +template<class DeviceType> +inline +void SNAKokkos<DeviceType>::init_rootpqarray() +{ + auto h_rootpqarray = Kokkos::create_mirror_view(rootpqarray); + for (int p = 1; p <= twojmax; p++) + for (int q = 1; q <= twojmax; q++) + h_rootpqarray(p,q) = sqrt(static_cast<double>(p)/q); + Kokkos::deep_copy(rootpqarray,h_rootpqarray); +} + + +/* ---------------------------------------------------------------------- */ +template<class DeviceType> +inline +int SNAKokkos<DeviceType>::compute_ncoeff() +{ + int ncount; + + ncount = 0; + + for (int j1 = 0; j1 <= twojmax; j1++) + if(diagonalstyle == 0) { + for (int j2 = 0; j2 <= j1; j2++) + for (int j = abs(j1 - j2); + j <= MIN(twojmax, j1 + j2); j += 2) + ncount++; + } else if(diagonalstyle == 1) { + int j2 = j1; + + for (int j = abs(j1 - j2); + j <= MIN(twojmax, j1 + j2); j += 2) + ncount++; + } else if(diagonalstyle == 2) { + ncount++; + } else if(diagonalstyle == 3) { + for (int j2 = 0; j2 <= j1; j2++) + for (int j = abs(j1 - j2); + j <= MIN(twojmax, j1 + j2); j += 2) + if (j >= j1) ncount++; + } + + return ncount; +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +double SNAKokkos<DeviceType>::compute_sfac(double r, double rcut) +{ + if (switch_flag == 0) return 1.0; + if (switch_flag == 1) { + if(r <= rmin0) return 1.0; + else if(r > rcut) return 0.0; + else { + double rcutfac = MY_PI / (rcut - rmin0); + return 0.5 * (cos((r - rmin0) * rcutfac) + 1.0); + } + } + return 0.0; +} + +/* ---------------------------------------------------------------------- */ + +template<class DeviceType> +KOKKOS_INLINE_FUNCTION +double SNAKokkos<DeviceType>::compute_dsfac(double r, double rcut) +{ + if (switch_flag == 0) return 0.0; + if (switch_flag == 1) { + if(r <= rmin0) return 0.0; + else if(r > rcut) return 0.0; + else { + double rcutfac = MY_PI / (rcut - rmin0); + return -0.5 * sin((r - rmin0) * rcutfac) * rcutfac; + } + } + return 0.0; +} + +/* ---------------------------------------------------------------------- + memory usage of arrays +------------------------------------------------------------------------- */ + +template<class DeviceType> +double SNAKokkos<DeviceType>::memory_usage() +{ + int jdim = twojmax + 1; + double bytes; + bytes = jdim * jdim * jdim * jdim * jdim * sizeof(double); + bytes += 2 * jdim * jdim * jdim * sizeof(std::complex<double>); + bytes += 2 * jdim * jdim * jdim * sizeof(double); + bytes += jdim * jdim * jdim * 3 * sizeof(std::complex<double>); + bytes += jdim * jdim * jdim * 3 * sizeof(double); + bytes += ncoeff * sizeof(double); + bytes += jdim * jdim * jdim * jdim * jdim * sizeof(std::complex<double>); + return bytes; +} diff --git a/src/MANYBODY/pair_polymorphic.h b/src/MANYBODY/pair_polymorphic.h index 9917bcd96df565ec9ec5953fe5b135a5d50ac7e8..18eab4636578e3cbb6e254ad853a4dc055d7925a 100644 --- a/src/MANYBODY/pair_polymorphic.h +++ b/src/MANYBODY/pair_polymorphic.h @@ -21,6 +21,7 @@ PairStyle(polymorphic,PairPolymorphic) #define LMP_PAIR_POLYMORPHIC_H #include "pair.h" +#include <math.h> namespace LAMMPS_NS { diff --git a/src/MANYBODY/pair_tersoff_mod.h b/src/MANYBODY/pair_tersoff_mod.h index 8bc7ed37a8f7345f4665d589d957d95f2822a910..fea3919be315688871058e832596600a7a3a7d71 100644 --- a/src/MANYBODY/pair_tersoff_mod.h +++ b/src/MANYBODY/pair_tersoff_mod.h @@ -21,6 +21,7 @@ PairStyle(tersoff/mod,PairTersoffMOD) #define LMP_PAIR_TERSOFF_MOD_H #include "pair_tersoff.h" +#include <math.h> namespace LAMMPS_NS { diff --git a/src/SNAP/pair_snap.cpp b/src/SNAP/pair_snap.cpp index 696f910a1191a53ad84cbe6976c2ba4e76291bec..e8e57a72a23f848d896accab3f20201a9a1aa4e2 100644 --- a/src/SNAP/pair_snap.cpp +++ b/src/SNAP/pair_snap.cpp @@ -107,6 +107,8 @@ PairSNAP::PairSNAP(LAMMPS *lmp) : Pair(lmp) PairSNAP::~PairSNAP() { + if (copymode) return; + if (nelements) { for (int i = 0; i < nelements; i++) delete[] elements[i]; @@ -236,6 +238,10 @@ void PairSNAP::compute_regular(int eflag, int vflag) snaptr->compute_ui(ninside); snaptr->compute_zi(); + if (quadraticflag) { + snaptr->compute_bi(); + snaptr->copy_bi2bvec(); + } // for neighbors of I within cutoff: // compute dUi/drj and dBi/drj @@ -267,8 +273,6 @@ void PairSNAP::compute_regular(int eflag, int vflag) // quadratic contributions if (quadraticflag) { - snaptr->compute_bi(); - snaptr->copy_bi2bvec(); int k = ncoeff+1; for (int icoeff = 0; icoeff < ncoeff; icoeff++) { double bveci = snaptr->bvec[icoeff]; @@ -592,6 +596,10 @@ void PairSNAP::compute_optimized(int eflag, int vflag) sna[tid]->compute_zi(); } } + if (quadraticflag) { + sna[tid]->compute_bi(); + sna[tid]->copy_bi2bvec(); + } // for neighbors of I within cutoff: // compute dUi/drj and dBi/drj @@ -626,8 +634,6 @@ void PairSNAP::compute_optimized(int eflag, int vflag) // quadratic contributions if (quadraticflag) { - sna[tid]->compute_bi(); - sna[tid]->copy_bi2bvec(); int k = ncoeff+1; for (int icoeff = 0; icoeff < ncoeff; icoeff++) { double bveci = sna[tid]->bvec[icoeff]; @@ -677,8 +683,10 @@ void PairSNAP::compute_optimized(int eflag, int vflag) if (eflag&&pairs[iijj][1] == 0) { evdwl = coeffi[0]; - sna[tid]->compute_bi(); - sna[tid]->copy_bi2bvec(); + if (!quadraticflag) { + sna[tid]->compute_bi(); + sna[tid]->copy_bi2bvec(); + } // E = beta.B + 0.5*B^t.alpha.B // coeff[k] = beta[k-1] or @@ -1520,9 +1528,9 @@ void PairSNAP::coeff(int narg, char **arg) sna[tid]->grow_rij(nmax); } - printf("ncoeff = %d snancoeff = %d \n",ncoeff,sna[0]->ncoeff); - if (ncoeff != sna[0]->ncoeff) { + if (comm->me == 0) printf("ncoeff = %d snancoeff = %d \n",ncoeff,sna[0]->ncoeff); + if (ncoeff != sna[0]->ncoeff) { error->all(FLERR,"Incorrect SNAP parameter file"); } diff --git a/src/SNAP/pair_snap.h b/src/SNAP/pair_snap.h index 9dec211e8eb4adaf7b682e240adc7be548f8e301..9d330f0d6fb0a5434d86d9c2b3b6ef399a5a7ce5 100644 --- a/src/SNAP/pair_snap.h +++ b/src/SNAP/pair_snap.h @@ -28,14 +28,14 @@ class PairSNAP : public Pair { public: PairSNAP(class LAMMPS *); ~PairSNAP(); - void compute(int, int); + virtual void compute(int, int); void compute_regular(int, int); void compute_optimized(int, int); void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - double memory_usage(); + virtual void coeff(int, char **); + virtual void init_style(); + virtual double init_one(int, int); + virtual double memory_usage(); protected: int ncoeff, ncoeffq, ncoeffall; @@ -43,7 +43,7 @@ protected: class SNA** sna; int nmax; int nthreads; - void allocate(); + virtual void allocate(); void read_files(char *, char *); inline int equal(double* x,double* y); inline double dist2(double* x,double* y); diff --git a/src/info.cpp b/src/info.cpp index 03eb1e10ed5a6c865473d4ec5d9d7e984a502e8a..c8cf25d871d2a23bbdabef9139819cb09124c282 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -28,6 +28,10 @@ #include "force.h" #include "pair.h" #include "pair_hybrid.h" +#include "bond.h" +#include "angle.h" +#include "dihedral.h" +#include "improper.h" #include "group.h" #include "input.h" #include "modify.h" @@ -75,20 +79,21 @@ enum {COMPUTES=1<<0, VARIABLES=1<<8, SYSTEM=1<<9, COMM=1<<10, - ATOM_STYLES=1<<11, - INTEGRATE_STYLES=1<<12, - MINIMIZE_STYLES=1<<13, - PAIR_STYLES=1<<14, - BOND_STYLES=1<<15, - ANGLE_STYLES=1<<16, - DIHEDRAL_STYLES=1<<17, - IMPROPER_STYLES=1<<18, - KSPACE_STYLES=1<<19, - FIX_STYLES=1<<20, - COMPUTE_STYLES=1<<21, - REGION_STYLES=1<<22, - DUMP_STYLES=1<<23, - COMMAND_STYLES=1<<24, + COEFFS=1<<11, + ATOM_STYLES=1<<12, + INTEGRATE_STYLES=1<<13, + MINIMIZE_STYLES=1<<14, + PAIR_STYLES=1<<15, + BOND_STYLES=1<<16, + ANGLE_STYLES=1<<17, + DIHEDRAL_STYLES=1<<18, + IMPROPER_STYLES=1<<19, + KSPACE_STYLES=1<<20, + FIX_STYLES=1<<21, + COMPUTE_STYLES=1<<22, + REGION_STYLES=1<<23, + DUMP_STYLES=1<<24, + COMMAND_STYLES=1<<25, ALL=~0}; static const int STYLES = ATOM_STYLES | INTEGRATE_STYLES | MINIMIZE_STYLES @@ -183,6 +188,9 @@ void Info::command(int narg, char **arg) } else if (strncmp(arg[idx],"system",3) == 0) { flags |= SYSTEM; ++idx; + } else if (strncmp(arg[idx],"coeffs",3) == 0) { + flags |= COEFFS; + ++idx; } else if (strncmp(arg[idx],"styles",3) == 0) { if (idx+1 < narg) { ++idx; @@ -440,6 +448,69 @@ void Info::command(int narg, char **arg) } } + if (domain->box_exist && (flags & COEFFS)) { + Pair *pair=force->pair; + + fprintf(out,"\nCoeff information:\n"); + if (pair) { + fprintf(out,"Pair Coeffs:\n"); + for (int i=1; i <= atom->ntypes; ++i) + for (int j=i; j <= atom->ntypes; ++j) { + fprintf(out,"%3d %3d :",i,j); + if (pair->allocated && pair->setflag[i][j]) fputs(" is set\n",out); + else fputs (" is not set\n",out); + } + } + if (force->bond) { + Bond *bond=force->bond; + + if (bond) { + fprintf(out,"Bond Coeffs:\n"); + for (int i=1; i <= atom->nbondtypes; ++i) { + fprintf(out,"%3d :",i); + if (bond->allocated && bond->setflag[i]) fputs(" is set\n",out); + else fputs (" is not set\n",out); + } + } + } + if (force->angle) { + Angle *angle=force->angle; + + if (angle) { + fprintf(out,"Angle Coeffs:\n"); + for (int i=1; i <= atom->nangletypes; ++i) { + fprintf(out,"%3d :",i); + if (angle->allocated && angle->setflag[i]) fputs(" is set\n",out); + else fputs (" is not set\n",out); + } + } + } + if (force->dihedral) { + Dihedral *dihedral=force->dihedral; + + if (dihedral) { + fprintf(out,"Dihedral Coeffs:\n"); + for (int i=1; i <= atom->ndihedraltypes; ++i) { + fprintf(out,"%3d :",i); + if (dihedral->allocated && dihedral->setflag[i]) fputs(" is set\n",out); + else fputs (" is not set\n",out); + } + } + } + if (force->improper) { + Improper *b=force->improper; + + if (b) { + fprintf(out,"Improper Coeffs:\n"); + for (int i=1; i <= atom->nimpropertypes; ++i) { + fprintf(out,"%3d :",i); + if (b->allocated && b->setflag[i]) fputs(" is set\n",out); + else fputs (" is not set\n",out); + } + } + } + } + if (flags & GROUPS) { int ngroup = group->ngroup; char **names = group->names; diff --git a/src/neighbor.cpp b/src/neighbor.cpp index cc2e5d6d11a4c6e6df8f0799a5d3365fee7b8330..686552656a62854a3eeff382bafa66f535b8aa72 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1107,11 +1107,6 @@ void Neighbor::morph_halffull() if (!irq->half) continue; - // Kokkos doesn't yet support half from full - - if (irq->kokkos_host) continue; - if (irq->kokkos_device) continue; - // these lists are created other ways, no need for halffull // do want to process skip lists diff --git a/src/npair.cpp b/src/npair.cpp index dd3a73926e0d2b363da42231ad245a13b1386280..4d06850e659197846c426199673ca44747aa1312 100644 --- a/src/npair.cpp +++ b/src/npair.cpp @@ -32,12 +32,16 @@ NPair::NPair(LAMMPS *lmp) last_build = -1; mycutneighsq = NULL; molecular = atom->molecular; + copymode = 0; + execution_space = Host; } /* ---------------------------------------------------------------------- */ NPair::~NPair() { + if (copymode) return; + memory->destroy(mycutneighsq); } diff --git a/src/npair.h b/src/npair.h index 289a1348d92b7747f97196e7c7472fbace433c51..186f921a00f6618edbff4358becd1636e5f3baf2 100644 --- a/src/npair.h +++ b/src/npair.h @@ -134,6 +134,9 @@ class NPair : protected Pointers { } return 0; }; + + int copymode; + ExecutionSpace execution_space; }; } diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index 86c6c64d77feef8fc0b013925c6c54e82e1e6556..ce6c581ced627f62495623a9c10e8ca4af2e5d5a 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -48,6 +48,8 @@ PairZBL::PairZBL(LAMMPS *lmp) : Pair(lmp) {} PairZBL::~PairZBL() { + if (copymode) return; + if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); diff --git a/src/pair_zbl.h b/src/pair_zbl.h index 0dc01731d350b432dce618ea5ebd6b76927da1f1..b89dd680b2ef6905fde252b0f73462582995537f 100644 --- a/src/pair_zbl.h +++ b/src/pair_zbl.h @@ -31,8 +31,8 @@ class PairZBL : public Pair { virtual void compute(int, int); void settings(int, char **); void coeff(int, char **); - void init_style(); - double init_one(int, int); + virtual void init_style(); + virtual double init_one(int, int); double single(int, int, int, int, double, double, double, double &); protected: @@ -42,7 +42,7 @@ class PairZBL : public Pair { double **d1a,**d2a,**d3a,**d4a,**zze; double **sw1,**sw2,**sw3,**sw4,**sw5; - void allocate(); + virtual void allocate(); double e_zbl(double, int, int); double dzbldr(double, int, int); double d2zbldr2(double, int, int); diff --git a/src/variable.cpp b/src/variable.cpp index a8f195dbc886fa4e1da538e973f7504175879efd..2991f8c78a5784c37a7b0fcb11a4c89d76f71140 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -516,9 +516,12 @@ void Variable::set(int narg, char **arg) strcpy(names[nvar],arg[0]); for (int i = 0; i < n-1; i++) - if (!isalnum(names[nvar][i]) && names[nvar][i] != '_') - error->all(FLERR,"Variable name must be alphanumeric or " - "underscore characters"); + if (!isalnum(names[nvar][i]) && names[nvar][i] != '_') { + char errmsg[128]; + sprintf(errmsg,"Variable name '%s' must have only alphanumeric " + "characters or underscore",names[nvar]); + error->all(FLERR,errmsg); + } nvar++; } @@ -571,11 +574,15 @@ int Variable::next(int narg, char **arg) for (int iarg = 0; iarg < narg; iarg++) { ivar = find(arg[iarg]); - if (ivar < 0) error->all(FLERR,"Invalid variable in next command"); + if (ivar < 0) { + char errmsg[128]; + sprintf(errmsg,"Invalid variable '%s' in next command",arg[iarg]); + error->all(FLERR,errmsg); + } if (style[ivar] == ULOOP && style[find(arg[0])] == UNIVERSE) continue; else if (style[ivar] == UNIVERSE && style[find(arg[0])] == ULOOP) continue; else if (style[ivar] != style[find(arg[0])]) - error->all(FLERR,"All variables in next command must be same style"); + error->all(FLERR,"All variables in next command must have same style"); } // invalid styles: STRING, EQUAL, WORLD, ATOM, VECTOR, GETENV, @@ -822,7 +829,8 @@ char *Variable::retrieve(char *name) if (which[ivar] >= num[ivar]) return NULL; if (eval_in_progress[ivar]) - error->all(FLERR,"Variable has circular dependency"); + print_var_error(FLERR,"Variable has a circular dependency",ivar); + eval_in_progress[ivar] = 1; char *str = NULL; @@ -844,7 +852,7 @@ char *Variable::retrieve(char *name) strcpy(data[ivar][0],result); str = data[ivar][0]; } else if (style[ivar] == EQUAL) { - double answer = evaluate(data[ivar][0],NULL); + double answer = evaluate(data[ivar][0],NULL,ivar); sprintf(data[ivar][1],"%.15g",answer); str = data[ivar][1]; } else if (style[ivar] == FORMAT) { @@ -865,9 +873,12 @@ char *Variable::retrieve(char *name) strcpy(data[ivar][1],result); str = data[ivar][1]; } else if (style[ivar] == PYTHON) { - int ifunc = python->variable_match(data[ivar][0],names[ivar],0); - if (ifunc < 0) - error->all(FLERR,"Python variable does not match Python function"); + int ifunc = python->variable_match(data[ivar][0],name,0); + if (ifunc < 0) { + char errmsg[128]; + sprintf(errmsg,"Python variable '%s' does not match Python function",name); + error->all(FLERR,errmsg); + } python->invoke_function(ifunc,data[ivar][1]); str = data[ivar][1]; // if Python func returns a string longer than VALUELENGTH @@ -895,15 +906,17 @@ char *Variable::retrieve(char *name) double Variable::compute_equal(int ivar) { if (eval_in_progress[ivar]) - error->all(FLERR,"Variable has circular dependency"); + print_var_error(FLERR,"Variable has a circular dependency",ivar); + eval_in_progress[ivar] = 1; double value = 0.0; - if (style[ivar] == EQUAL) value = evaluate(data[ivar][0],NULL); + if (style[ivar] == EQUAL) value = evaluate(data[ivar][0],NULL,ivar); else if (style[ivar] == INTERNAL) value = dvalue[ivar]; else if (style[ivar] == PYTHON) { int ifunc = python->find(data[ivar][0]); - if (ifunc < 0) error->all(FLERR,"Python variable has no function"); + if (ifunc < 0) + print_var_error(FLERR,"Python variable has no function",ivar); python->invoke_function(ifunc,data[ivar][1]); value = atof(data[ivar][1]); } @@ -937,7 +950,8 @@ void Variable::compute_atom(int ivar, int igroup, double *vstore; if (eval_in_progress[ivar]) - error->all(FLERR,"Variable has circular dependency"); + print_var_error(FLERR,"Variable has a circular dependency",ivar); + eval_in_progress[ivar] = 1; if (style[ivar] == ATOM) { @@ -1011,16 +1025,19 @@ int Variable::compute_vector(int ivar, double **result) } if (eval_in_progress[ivar]) - error->all(FLERR,"Variable has circular dependency"); + print_var_error(FLERR,"Variable has a circular dependency",ivar); + eval_in_progress[ivar] = 1; treetype = VECTOR; evaluate(data[ivar][0],&tree); collapse_tree(tree); int nlen = size_tree_vector(tree); - if (nlen == 0) error->all(FLERR,"Vector-style variable has zero length"); - if (nlen < 0) error->all(FLERR, - "Inconsistent lengths in vector-style variable"); + if (nlen == 0) + print_var_error(FLERR,"Vector-style variable has zero length",ivar); + + if (nlen < 0) + print_var_error(FLERR,"Inconsistent lengths in vector-style variable",ivar); // (re)allocate space for results if necessary @@ -1148,7 +1165,7 @@ void Variable::copy(int narg, char **from, char **to) create a parse tree and return it ------------------------------------------------------------------------- */ -double Variable::evaluate(char *str, Tree **tree) +double Variable::evaluate(char *str, Tree **tree, int ivar) { int op,opprevious; double value1,value2; @@ -1177,11 +1194,12 @@ double Variable::evaluate(char *str, Tree **tree) // ---------------- else if (onechar == '(') { - if (expect == OP) error->all(FLERR,"Invalid syntax in variable formula"); + if (expect == OP) + print_var_error(FLERR,"Invalid syntax in variable formula",ivar); expect = OP; char *contents; - i = find_matching_paren(str,i,contents); + i = find_matching_paren(str,i,contents,ivar); i++; // evaluate contents and push on stack @@ -1199,7 +1217,8 @@ double Variable::evaluate(char *str, Tree **tree) // ---------------- } else if (isdigit(onechar) || onechar == '.') { - if (expect == OP) error->all(FLERR,"Invalid syntax in variable formula"); + if (expect == OP) + print_var_error(FLERR,"Invalid syntax in variable formula",ivar); expect = OP; // istop = end of number, including scientific notation @@ -1235,7 +1254,8 @@ double Variable::evaluate(char *str, Tree **tree) // ---------------- } else if (isalpha(onechar)) { - if (expect == OP) error->all(FLERR,"Invalid syntax in variable formula"); + if (expect == OP) + print_var_error(FLERR,"Invalid syntax in variable formula",ivar); expect = OP; // istop = end of word @@ -1256,8 +1276,8 @@ double Variable::evaluate(char *str, Tree **tree) if (strncmp(word,"c_",2) == 0 || strncmp(word,"C_",2) == 0) { if (domain->box_exist == 0) - error->all(FLERR, - "Variable evaluation before simulation box is defined"); + print_var_error(FLERR,"Variable evaluation before " + "simulation box is defined",ivar); // uppercase used to force access of // global vector vs global scalar, and global array vs global vector @@ -1267,7 +1287,7 @@ double Variable::evaluate(char *str, Tree **tree) int icompute = modify->find_compute(word+2); if (icompute < 0) - error->all(FLERR,"Invalid compute ID in variable formula"); + print_var_error(FLERR,"Invalid compute ID in variable formula",ivar); Compute *compute = modify->compute[icompute]; // parse zero or one or two trailing brackets @@ -1297,8 +1317,8 @@ double Variable::evaluate(char *str, Tree **tree) if (update->whichflag == 0) { if (compute->invoked_scalar != update->ntimestep) - error->all(FLERR,"Compute used in variable between runs " - "is not current"); + print_var_error(FLERR,"Compute used in variable between " + "runs is not current",ivar); } else if (!(compute->invoked_flag & INVOKED_SCALAR)) { compute->compute_scalar(); compute->invoked_flag |= INVOKED_SCALAR; @@ -1320,12 +1340,12 @@ double Variable::evaluate(char *str, Tree **tree) if (index1 > compute->size_vector && compute->size_vector_variable == 0) - error->all(FLERR,"Variable formula compute vector " - "is accessed out-of-range"); + print_var_error(FLERR,"Variable formula compute vector " + "is accessed out-of-range",ivar); if (update->whichflag == 0) { if (compute->invoked_vector != update->ntimestep) - error->all(FLERR,"Compute used in variable between runs " - "is not current"); + print_var_error(FLERR,"Compute used in variable between runs " + "is not current",ivar); } else if (!(compute->invoked_flag & INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= INVOKED_VECTOR; @@ -1349,15 +1369,15 @@ double Variable::evaluate(char *str, Tree **tree) if (index1 > compute->size_array_rows && compute->size_array_rows_variable == 0) - error->all(FLERR,"Variable formula compute array " - "is accessed out-of-range"); + print_var_error(FLERR,"Variable formula compute array " + "is accessed out-of-range",ivar); if (index2 > compute->size_array_cols) - error->all(FLERR,"Variable formula compute array " - "is accessed out-of-range"); + print_var_error(FLERR,"Variable formula compute array " + "is accessed out-of-range",ivar); if (update->whichflag == 0) { if (compute->invoked_array != update->ntimestep) - error->all(FLERR,"Compute used in variable between runs " - "is not current"); + print_var_error(FLERR,"Compute used in variable between runs " + "is not current",ivar); } else if (!(compute->invoked_flag & INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= INVOKED_ARRAY; @@ -1380,17 +1400,18 @@ double Variable::evaluate(char *str, Tree **tree) } else if (nbracket == 0 && compute->vector_flag) { if (tree == NULL) - error->all(FLERR, - "Compute global vector in equal-style variable formula"); + print_var_error(FLERR,"Compute global vector in " + "equal-style variable formula",ivar); if (treetype == ATOM) - error->all(FLERR, - "Compute global vector in atom-style variable formula"); - if (compute->size_vector == 0) - error->all(FLERR,"Variable formula compute vector is zero length"); + print_var_error(FLERR,"Compute global vector in " + "atom-style variable formula",ivar); + if (compute->size_vector == 0) + print_var_error(FLERR,"Variable formula compute " + "vector is zero length",ivar); if (update->whichflag == 0) { if (compute->invoked_vector != update->ntimestep) - error->all(FLERR,"Compute used in variable between runs " - "is not current"); + print_var_error(FLERR,"Compute used in variable between " + "runs is not current",ivar); } else if (!(compute->invoked_flag & INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= INVOKED_VECTOR; @@ -1399,7 +1420,7 @@ double Variable::evaluate(char *str, Tree **tree) Tree *newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = compute->vector; - newtree->nvector = compute->size_vector; + newtree->nvector = compute->size_vector; newtree->nstride = 1; newtree->selfalloc = 0; newtree->first = newtree->second = NULL; @@ -1411,17 +1432,18 @@ double Variable::evaluate(char *str, Tree **tree) } else if (nbracket == 1 && compute->array_flag) { if (tree == NULL) - error->all(FLERR, - "Compute global vector in equal-style variable formula"); + print_var_error(FLERR,"Compute global vector in " + "equal-style variable formula",ivar); if (treetype == ATOM) - error->all(FLERR, - "Compute global vector in atom-style variable formula"); - if (compute->size_array_rows == 0) - error->all(FLERR,"Variable formula compute array is zero length"); + print_var_error(FLERR,"Compute global vector in " + "atom-style variable formula",ivar); + if (compute->size_array_rows == 0) + print_var_error(FLERR,"Variable formula compute array " + "is zero length",ivar); if (update->whichflag == 0) { if (compute->invoked_array != update->ntimestep) - error->all(FLERR,"Compute used in variable between runs " - "is not current"); + print_var_error(FLERR,"Compute used in variable between " + "runs is not current",ivar); } else if (!(compute->invoked_flag & INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= INVOKED_ARRAY; @@ -1430,7 +1452,7 @@ double Variable::evaluate(char *str, Tree **tree) Tree *newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = &compute->array[0][index1-1]; - newtree->nvector = compute->size_array_rows; + newtree->nvector = compute->size_array_rows; newtree->nstride = compute->size_array_cols; newtree->selfalloc = 0; newtree->first = newtree->second = NULL; @@ -1444,8 +1466,8 @@ double Variable::evaluate(char *str, Tree **tree) if (update->whichflag == 0) { if (compute->invoked_peratom != update->ntimestep) - error->all(FLERR,"Compute used in variable between runs " - "is not current"); + print_var_error(FLERR,"Compute used in variable " + "between runs is not current",ivar); } else if (!(compute->invoked_flag & INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= INVOKED_PERATOM; @@ -1460,12 +1482,12 @@ double Variable::evaluate(char *str, Tree **tree) compute->size_peratom_cols > 0) { if (index2 > compute->size_peratom_cols) - error->all(FLERR,"Variable formula compute array " - "is accessed out-of-range"); + print_var_error(FLERR,"Variable formula compute " + "array is accessed out-of-range",ivar); if (update->whichflag == 0) { if (compute->invoked_peratom != update->ntimestep) - error->all(FLERR,"Compute used in variable between runs " - "is not current"); + print_var_error(FLERR,"Compute used in variable " + "between runs is not current",ivar); } else if (!(compute->invoked_flag & INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= INVOKED_PERATOM; @@ -1486,15 +1508,15 @@ double Variable::evaluate(char *str, Tree **tree) compute->size_peratom_cols == 0) { if (tree == NULL) - error->all(FLERR, - "Per-atom compute in equal-style variable formula"); + print_var_error(FLERR,"Per-atom compute in " + "equal-style variable formula",ivar); if (treetype == VECTOR) - error->all(FLERR, - "Per-atom compute in vector-style variable formula"); + print_var_error(FLERR,"Per-atom compute in " + "vector-style variable formula",ivar); if (update->whichflag == 0) { if (compute->invoked_peratom != update->ntimestep) - error->all(FLERR,"Compute used in variable between runs " - "is not current"); + print_var_error(FLERR,"Compute used in variable " + "between runs is not current",ivar); } else if (!(compute->invoked_flag & INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= INVOKED_PERATOM; @@ -1515,18 +1537,18 @@ double Variable::evaluate(char *str, Tree **tree) compute->size_peratom_cols > 0) { if (tree == NULL) - error->all(FLERR, - "Per-atom compute in equal-style variable formula"); + print_var_error(FLERR,"Per-atom compute in " + "equal-style variable formula",ivar); if (treetype == VECTOR) - error->all(FLERR, - "Per-atom compute in vector-style variable formula"); + print_var_error(FLERR,"Per-atom compute in " + "vector-style variable formula",ivar); if (index1 > compute->size_peratom_cols) - error->all(FLERR,"Variable formula compute array " - "is accessed out-of-range"); + print_var_error(FLERR,"Variable formula compute array " + "is accessed out-of-range",ivar); if (update->whichflag == 0) { if (compute->invoked_peratom != update->ntimestep) - error->all(FLERR,"Compute used in variable between runs " - "is not current"); + print_var_error(FLERR,"Compute used in variable " + "between runs is not current",ivar); } else if (!(compute->invoked_flag & INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= INVOKED_PERATOM; @@ -1544,7 +1566,7 @@ double Variable::evaluate(char *str, Tree **tree) newtree->nextra = 0; treestack[ntreestack++] = newtree; - } else error->all(FLERR,"Mismatched compute in variable formula"); + } else print_var_error(FLERR,"Mismatched compute in variable formula",ivar); // ---------------- // fix @@ -1552,8 +1574,7 @@ double Variable::evaluate(char *str, Tree **tree) } else if (strncmp(word,"f_",2) == 0 || strncmp(word,"F_",2) == 0) { if (domain->box_exist == 0) - error->all(FLERR, - "Variable evaluation before simulation box is defined"); + print_var_error(FLERR,"Variable evaluation before simulation box is defined",ivar); // uppercase used to force access of // global vector vs global scalar, and global array vs global vector @@ -1562,7 +1583,11 @@ double Variable::evaluate(char *str, Tree **tree) if (word[0] == 'F') lowercase = 0; int ifix = modify->find_fix(word+2); - if (ifix < 0) error->all(FLERR,"Invalid fix ID in variable formula"); + if (ifix < 0) { + char msg[128]; + sprintf(msg,"Invalid fix ID '%s' in variable formula",word+2); + print_var_error(FLERR,msg,ivar); + } Fix *fix = modify->fix[ifix]; // parse zero or one or two trailing brackets @@ -1591,7 +1616,8 @@ double Variable::evaluate(char *str, Tree **tree) if (nbracket == 0 && fix->scalar_flag && lowercase) { if (update->whichflag > 0 && update->ntimestep % fix->global_freq) - error->all(FLERR,"Fix in variable not computed at compatible time"); + print_var_error(FLERR,"Fix in variable not computed " + "at a compatible time",ivar); value1 = fix->compute_scalar(); if (tree) { @@ -1609,10 +1635,11 @@ double Variable::evaluate(char *str, Tree **tree) if (index1 > fix->size_vector && fix->size_vector_variable == 0) - error->all(FLERR,"Variable formula fix vector is " - "accessed out-of-range"); + print_var_error(FLERR,"Variable formula fix vector is " + "accessed out-of-range",ivar); if (update->whichflag > 0 && update->ntimestep % fix->global_freq) - error->all(FLERR,"Fix in variable not computed at compatible time"); + print_var_error(FLERR,"Fix in variable not computed " + "at a compatible time",ivar); value1 = fix->compute_vector(index1-1); if (tree) { @@ -1630,13 +1657,11 @@ double Variable::evaluate(char *str, Tree **tree) if (index1 > fix->size_array_rows && fix->size_array_rows_variable == 0) - error->all(FLERR, - "Variable formula fix array is accessed out-of-range"); + print_var_error(FLERR,"Variable formula fix array is accessed out-of-range",ivar); if (index2 > fix->size_array_cols) - error->all(FLERR, - "Variable formula fix array is accessed out-of-range"); + print_var_error(FLERR,"Variable formula fix array is accessed out-of-range",ivar); if (update->whichflag > 0 && update->ntimestep % fix->global_freq) - error->all(FLERR,"Fix in variable not computed at compatible time"); + print_var_error(FLERR,"Fix in variable not computed at a compatible time",ivar); value1 = fix->compute_array(index1-1,index2-1); if (tree) { @@ -1653,15 +1678,13 @@ double Variable::evaluate(char *str, Tree **tree) } else if (nbracket == 0 && fix->vector_flag) { if (update->whichflag > 0 && update->ntimestep % fix->global_freq) - error->all(FLERR,"Fix in variable not computed at compatible time"); + print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar); if (tree == NULL) - error->all(FLERR,"Fix global vector in " - "equal-style variable formula"); + print_var_error(FLERR,"Fix global vector in ""equal-style variable formula",ivar); if (treetype == ATOM) - error->all(FLERR,"Fix global vector in " - "atom-style variable formula"); - if (fix->size_vector == 0) - error->all(FLERR,"Variable formula fix vector is zero length"); + print_var_error(FLERR,"Fix global vector in ""atom-style variable formula",ivar); + if (fix->size_vector == 0) + print_var_error(FLERR,"Variable formula fix vector is zero length",ivar); int nvec = fix->size_vector; double *vec; @@ -1672,7 +1695,7 @@ double Variable::evaluate(char *str, Tree **tree) Tree *newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = vec; - newtree->nvector = nvec; + newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 1; newtree->first = newtree->second = NULL; @@ -1684,26 +1707,27 @@ double Variable::evaluate(char *str, Tree **tree) } else if (nbracket == 1 && fix->array_flag) { if (update->whichflag > 0 && update->ntimestep % fix->global_freq) - error->all(FLERR,"Fix in variable not computed at compatible time"); + print_var_error(FLERR,"Fix in variable not computed " + "at a compatible time",ivar); if (tree == NULL) - error->all(FLERR,"Fix global vector in " - "equal-style variable formula"); + print_var_error(FLERR,"Fix global vector in " + "equal-style variable formula",ivar); if (treetype == ATOM) - error->all(FLERR,"Fix global vector in " - "atom-style variable formula"); - if (fix->size_array_rows == 0) - error->all(FLERR,"Variable formula fix array is zero length"); + print_var_error(FLERR,"Fix global vector in " + "atom-style variable formula",ivar); + if (fix->size_array_rows == 0) + print_var_error(FLERR,"Variable formula fix array is zero length",ivar); - int nvec = fix->size_array_rows; - double *vec; - memory->create(vec,nvec,"variable:values"); - for (int m = 0; m < nvec; m++) - vec[m] = fix->compute_array(m,index1-1); + int nvec = fix->size_array_rows; + double *vec; + memory->create(vec,nvec,"variable:values"); + for (int m = 0; m < nvec; m++) + vec[m] = fix->compute_array(m,index1-1); Tree *newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = vec; - newtree->nvector = nvec; + newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 1; newtree->first = newtree->second = NULL; @@ -1717,8 +1741,8 @@ double Variable::evaluate(char *str, Tree **tree) if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq) - error->all(FLERR, - "Fix in variable not computed at compatible time"); + print_var_error(FLERR,"Fix in variable not computed " + "at a compatible time",ivar); peratom2global(1,NULL,fix->vector_atom,1,index1, tree,treestack,ntreestack,argstack,nargstack); @@ -1729,11 +1753,12 @@ double Variable::evaluate(char *str, Tree **tree) fix->size_peratom_cols > 0) { if (index2 > fix->size_peratom_cols) - error->all(FLERR, - "Variable formula fix array is accessed out-of-range"); + print_var_error(FLERR,"Variable formula fix array is " + "accessed out-of-range",ivar); if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq) - error->all(FLERR,"Fix in variable not computed at compatible time"); + print_var_error(FLERR,"Fix in variable not computed " + "at a compatible time",ivar); if (fix->array_atom) peratom2global(1,NULL,&fix->array_atom[0][index2-1], @@ -1750,10 +1775,10 @@ double Variable::evaluate(char *str, Tree **tree) fix->size_peratom_cols == 0) { if (tree == NULL) - error->all(FLERR,"Per-atom fix in equal-style variable formula"); + print_var_error(FLERR,"Per-atom fix in equal-style variable formula",ivar); if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq) - error->all(FLERR,"Fix in variable not computed at compatible time"); + print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar); Tree *newtree = new Tree(); newtree->type = ATOMARRAY; @@ -1770,13 +1795,13 @@ double Variable::evaluate(char *str, Tree **tree) fix->size_peratom_cols > 0) { if (tree == NULL) - error->all(FLERR,"Per-atom fix in equal-style variable formula"); + print_var_error(FLERR,"Per-atom fix in equal-style variable formula",ivar); if (index1 > fix->size_peratom_cols) - error->all(FLERR, - "Variable formula fix array is accessed out-of-range"); + print_var_error(FLERR,"Variable formula fix array " + "is accessed out-of-range",ivar); if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq) - error->all(FLERR,"Fix in variable not computed at compatible time"); + print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar); Tree *newtree = new Tree(); newtree->type = ATOMARRAY; @@ -1790,7 +1815,7 @@ double Variable::evaluate(char *str, Tree **tree) newtree->nextra = 0; treestack[ntreestack++] = newtree; - } else error->all(FLERR,"Mismatched fix in variable formula"); + } else print_var_error(FLERR,"Mismatched fix in variable formula",ivar); // ---------------- // variable @@ -1800,9 +1825,10 @@ double Variable::evaluate(char *str, Tree **tree) int ivar = find(word+2); if (ivar < 0) - error->all(FLERR,"Invalid variable name in variable formula"); + print_var_error(FLERR,"Invalid variable reference " + "in variable formula",ivar); if (eval_in_progress[ivar]) - error->all(FLERR,"Variable has circular dependency"); + print_var_error(FLERR,"Variable has circular dependency",ivar); // parse zero or one trailing brackets // point i beyond last bracket @@ -1842,7 +1868,7 @@ double Variable::evaluate(char *str, Tree **tree) char *var = retrieve(word+2); if (var == NULL) - error->all(FLERR,"Invalid variable evaluation in variable formula"); + print_var_error(FLERR,"Invalid variable evaluation in variable formula",ivar); if (tree) { Tree *newtree = new Tree(); newtree->type = VALUE; @@ -1858,11 +1884,11 @@ double Variable::evaluate(char *str, Tree **tree) } else if (nbracket == 0 && style[ivar] == ATOM) { if (tree == NULL) - error->all(FLERR, - "Atom-style variable in equal-style variable formula"); - if (treetype == VECTOR) - error->all(FLERR, - "Atom-style variable in vector-style variable formula"); + print_var_error(FLERR,"Atom-style variable in " + "equal-style variable formula",ivar); + if (treetype == VECTOR) + print_var_error(FLERR,"Atom-style variable in " + "vector-style variable formula",ivar); Tree *newtree; evaluate(data[ivar][0],&newtree); @@ -1873,11 +1899,11 @@ double Variable::evaluate(char *str, Tree **tree) } else if (nbracket == 0 && style[ivar] == ATOMFILE) { if (tree == NULL) - error->all(FLERR,"Atomfile-style variable in " - "equal-style variable formula"); - if (treetype == VECTOR) - error->all(FLERR,"Atomfile-style variable in " - "vector-style variable formula"); + print_var_error(FLERR,"Atomfile-style variable in " + "equal-style variable formula",ivar); + if (treetype == VECTOR) + print_var_error(FLERR,"Atomfile-style variable in " + "vector-style variable formula",ivar); Tree *newtree = new Tree(); newtree->type = ATOMARRAY; @@ -1894,11 +1920,11 @@ double Variable::evaluate(char *str, Tree **tree) } else if (nbracket == 0 && style[ivar] == VECTOR) { if (tree == NULL) - error->all(FLERR, - "Vector-style variable in equal-style variable formula"); + print_var_error(FLERR,"Vector-style variable in " + "equal-style variable formula",ivar); if (treetype == ATOM) - error->all(FLERR, - "Vector-style variable in atom-style variable formula"); + print_var_error(FLERR,"Vector-style variable in " + "atom-style variable formula",ivar); double *vec; int nvec = compute_vector(ivar,&vec); @@ -1941,7 +1967,7 @@ double Variable::evaluate(char *str, Tree **tree) double *vec; int nvec = compute_vector(ivar,&vec); if (index <= 0 || index > nvec) - error->all(FLERR,"Invalid index into vector-style variable"); + print_var_error(FLERR,"Invalid index into vector-style variable",ivar); int m = index; // convert from tagint to int if (tree) { @@ -1953,7 +1979,7 @@ double Variable::evaluate(char *str, Tree **tree) treestack[ntreestack++] = newtree; } else argstack[nargstack++] = vec[m-1]; - } else error->all(FLERR,"Mismatched variable in variable formula"); + } else print_var_error(FLERR,"Mismatched variable in variable formula",ivar); // ---------------- // math/group/special function or atom value/vector or @@ -1968,7 +1994,7 @@ double Variable::evaluate(char *str, Tree **tree) if (str[i] == '(') { char *contents; - i = find_matching_paren(str,i,contents); + i = find_matching_paren(str,i,contents,ivar); i++; if (math_function(word,contents,tree, @@ -1977,8 +2003,12 @@ double Variable::evaluate(char *str, Tree **tree) treestack,ntreestack,argstack,nargstack)); else if (special_function(word,contents,tree, treestack,ntreestack,argstack,nargstack)); - else error->all(FLERR,"Invalid math/group/special function " - "in variable formula"); + else { + char msg[128]; + sprintf(msg,"Invalid math/group/special function '%s()'" + "in variable formula", word); + print_var_error(FLERR,msg,ivar); + } delete [] contents; // ---------------- @@ -1987,8 +2017,8 @@ double Variable::evaluate(char *str, Tree **tree) } else if (str[i] == '[') { if (domain->box_exist == 0) - error->all(FLERR, - "Variable evaluation before simulation box is defined"); + print_var_error(FLERR,"Variable evaluation before " + "simulation box is defined",ivar); ptr = &str[i]; tagint id = int_between_brackets(ptr,1); @@ -2003,8 +2033,8 @@ double Variable::evaluate(char *str, Tree **tree) } else if (is_atom_vector(word)) { if (domain->box_exist == 0) - error->all(FLERR, - "Variable evaluation before simulation box is defined"); + print_var_error(FLERR,"Variable evaluation before " + "simulation box is defined",ivar); atom_vector(word,tree,treestack,ntreestack); @@ -2029,12 +2059,15 @@ double Variable::evaluate(char *str, Tree **tree) } else { if (domain->box_exist == 0) - error->all(FLERR, - "Variable evaluation before simulation box is defined"); + print_var_error(FLERR,"Variable evaluation before " + "simulation box is defined",ivar); int flag = output->thermo->evaluate_keyword(word,&value1); - if (flag) - error->all(FLERR,"Invalid thermo keyword in variable formula"); + if (flag) { + char msg[128]; + sprintf(msg,"Invalid thermo keyword '%s' in variable formula",word); + print_var_error(FLERR,msg,ivar); + } if (tree) { Tree *newtree = new Tree(); newtree->type = VALUE; @@ -2061,7 +2094,7 @@ double Variable::evaluate(char *str, Tree **tree) else if (onechar == '^') op = CARAT; else if (onechar == '=') { if (str[i+1] != '=') - error->all(FLERR,"Invalid syntax in variable formula"); + print_var_error(FLERR,"Invalid syntax in variable formula",ivar); op = EQ; i++; } else if (onechar == '!') { @@ -2083,13 +2116,13 @@ double Variable::evaluate(char *str, Tree **tree) } } else if (onechar == '&') { if (str[i+1] != '&') - error->all(FLERR,"Invalid syntax in variable formula"); + print_var_error(FLERR,"Invalid syntax in variable formula",ivar); op = AND; i++; } else if (onechar == '|') { if (str[i+1] == '|') op = OR; else if (str[i+1] == '^') op = XOR; - else error->all(FLERR,"Invalid syntax in variable formula"); + else print_var_error(FLERR,"Invalid syntax in variable formula",ivar); i++; } else op = DONE; @@ -2104,7 +2137,8 @@ double Variable::evaluate(char *str, Tree **tree) continue; } - if (expect == ARG) error->all(FLERR,"Invalid syntax in variable formula"); + if (expect == ARG) + print_var_error(FLERR,"Invalid syntax in variable formula",ivar); expect = ARG; // evaluate stack as deep as possible while respecting precedence @@ -2140,17 +2174,17 @@ double Variable::evaluate(char *str, Tree **tree) argstack[nargstack++] = value1 * value2; else if (opprevious == DIVIDE) { if (value2 == 0.0) - error->all(FLERR,"Divide by 0 in variable formula"); + print_var_error(FLERR,"Divide by 0 in variable formula",ivar); argstack[nargstack++] = value1 / value2; } else if (opprevious == MODULO) { if (value2 == 0.0) - error->all(FLERR,"Modulo 0 in variable formula"); + print_var_error(FLERR,"Modulo 0 in variable formula",ivar); argstack[nargstack++] = fmod(value1,value2); } else if (opprevious == CARAT) { if (value2 == 0.0) argstack[nargstack++] = 1.0; else if ((value1 == 0.0) && (value2 < 0.0)) - error->all(FLERR,"Invalid power expression in variable formula"); + print_var_error(FLERR,"Invalid power expression in variable formula",ivar); else argstack[nargstack++] = pow(value1,value2); } else if (opprevious == UNARY) { argstack[nargstack++] = -value2; @@ -2197,20 +2231,22 @@ double Variable::evaluate(char *str, Tree **tree) opstack[nopstack++] = op; - } else error->all(FLERR,"Invalid syntax in variable formula"); + } else print_var_error(FLERR,"Invalid syntax in variable formula",ivar); } - if (nopstack) error->all(FLERR,"Invalid syntax in variable formula"); + if (nopstack) print_var_error(FLERR,"Invalid syntax in variable formula",ivar); // for atom-style variable, return remaining tree // for equal-style variable, return remaining arg if (tree) { - if (ntreestack != 1) error->all(FLERR,"Invalid syntax in variable formula"); + if (ntreestack != 1) + print_var_error(FLERR,"Invalid syntax in variable formula",ivar); *tree = treestack[0]; return 0.0; } else { - if (nargstack != 1) error->all(FLERR,"Invalid syntax in variable formula"); + if (nargstack != 1) + print_var_error(FLERR,"Invalid syntax in variable formula",ivar); return argstack[0]; } } @@ -3133,7 +3169,7 @@ void Variable::free_tree(Tree *tree) return loc or right paren ------------------------------------------------------------------------- */ -int Variable::find_matching_paren(char *str, int i,char *&contents) +int Variable::find_matching_paren(char *str, int i, char *&contents, int ivar) { // istop = matching ')' at same level, allowing for nested parens @@ -3146,7 +3182,7 @@ int Variable::find_matching_paren(char *str, int i,char *&contents) else if (str[i] == ')' && ilevel) ilevel--; else if (str[i] == ')') break; } - if (!str[i]) error->all(FLERR,"Invalid syntax in variable formula"); + if (!str[i]) print_var_error(FLERR,"Invalid syntax in variable formula",ivar); int istop = i; int n = istop - istart - 1; @@ -3929,8 +3965,11 @@ int Variable::special_function(char *word, char *contents, Tree **tree, } else index = 0; int icompute = modify->find_compute(&args[0][2]); - if (icompute < 0) - error->all(FLERR,"Invalid compute ID in variable formula"); + if (icompute < 0) { + char msg[128]; + sprintf(msg,"Invalid compute ID '%s' in variable formula",word+2); + print_var_error(FLERR,msg,ivar); + } compute = modify->compute[icompute]; if (index == 0 && compute->vector_flag) { if (update->whichflag == 0) { @@ -4548,6 +4587,21 @@ char *Variable::find_next_comma(char *str) return NULL; } + +/* ---------------------------------------------------------------------- + debug routine for printing formula tree recursively +------------------------------------------------------------------------- */ + +void Variable::print_var_error(const char *srcfile, int lineno, + const char *errmsg, int ivar) +{ + const char *varname = (const char*)"(unknown)"; + if ((ivar >= 0) && (ivar < nvar)) varname = names[ivar]; + + char msg[128]; + sprintf(msg,"Variable %s: %s",varname,errmsg); + error->all(srcfile,lineno,msg);} + /* ---------------------------------------------------------------------- debug routine for printing formula tree recursively ------------------------------------------------------------------------- */ diff --git a/src/variable.h b/src/variable.h index 886dd7b42219dec379f3f4c69dbd54e32d8faf69..49d00d975aeae70ab8a10725306a7dd3cf82b937 100644 --- a/src/variable.h +++ b/src/variable.h @@ -97,13 +97,13 @@ class Variable : protected Pointers { void remove(int); void grow(); void copy(int, char **, char **); - double evaluate(char *, Tree **); + double evaluate(char *, Tree **, int ivar=-1); double collapse_tree(Tree *); double eval_tree(Tree *, int); int size_tree_vector(Tree *); int compare_tree_vector(int, int); void free_tree(Tree *); - int find_matching_paren(char *, int, char *&); + int find_matching_paren(char *, int, char *&, int ivar=-1); int math_function(char *, char *, Tree **, Tree **, int &, double *, int &); int group_function(char *, char *, Tree **, Tree **, int &, double *, int &); int region_function(char *); @@ -117,6 +117,7 @@ class Variable : protected Pointers { double constant(char *); int parse_args(char *, char **); char *find_next_comma(char *); + void print_var_error(const char *, int, const char *, int); void print_tree(Tree *, int); };