Unverified Commit 9dc9cdf5 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

Merge branch 'master' into progguide

parents c7bcdf47 6576c4cb
Loading
Loading
Loading
Loading
+9 −6
Original line number Original line Diff line number Diff line
@@ -23,14 +23,17 @@ if(ENABLE_TESTING)
        OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
        OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
      include(CheckCXXCompilerFlag)
      include(CheckCXXCompilerFlag)
      set(CMAKE_CUSTOM_LINKER_DEFAULT default)
      set(CMAKE_CUSTOM_LINKER_DEFAULT default)
      check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER)
      check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)
      check_cxx_compiler_flag(-fuse-ld=gold HAVE_GOLD_LINKER)
      check_cxx_compiler_flag(-fuse-ld=gold HAVE_GOLD_LINKER_FLAG)
      check_cxx_compiler_flag(-fuse-ld=bfd HAVE_BFD_LINKER)
      check_cxx_compiler_flag(-fuse-ld=bfd HAVE_BFD_LINKER_FLAG)
      if(HAVE_LLD_LINKER)
      find_program(HAVE_LLD_LINKER_BIN lld ld.lld)
      find_program(HAVE_GOLD_LINKER_BIN ld.gold)
      find_program(HAVE_BFD_LINKER_BIN ld.bfd)
      if(HAVE_LLD_LINKER_FLAG AND HAVE_LLD_LINKER_BIN)
        set(CMAKE_CUSTOM_LINKER_DEFAULT lld)
        set(CMAKE_CUSTOM_LINKER_DEFAULT lld)
      elseif(HAVE_GOLD_LINKER)
      elseif(HAVE_GOLD_LINKER_FLAG AND HAVE_GOLD_LINKER_BIN)
        set(CMAKE_CUSTOM_LINKER_DEFAULT gold)
        set(CMAKE_CUSTOM_LINKER_DEFAULT gold)
      elseif(HAVE_BFD_LINKER)
      elseif(HAVE_BFD_LINKER_FLAG AND HAVE_BFD_LINKER_BIN)
        set(CMAKE_CUSTOM_LINKER_DEFAULT bfd)
        set(CMAKE_CUSTOM_LINKER_DEFAULT bfd)
      endif()
      endif()
      set(CMAKE_CUSTOM_LINKER_VALUES lld gold bfd default)
      set(CMAKE_CUSTOM_LINKER_VALUES lld gold bfd default)
+2 −4
Original line number Original line Diff line number Diff line
@@ -94,10 +94,8 @@ of a run:


**Mixing, shift, table, tail correction, restart, rRESPA info**\ :
**Mixing, shift, table, tail correction, restart, rRESPA info**\ :


For atom type pairs I,J and I != J, the A coefficient and cutoff
For atom type pairs I,J and I != J, the epsilon and sigma coefficients and cutoff
distance for this pair style can be mixed.  A is always mixed via a
distance for this pair style can be mixed. The default mix value is *geometric*\ .  See the
*geometric* rule.  The cutoff is mixed according to the pair_modify
mix value.  The default mix value is *geometric*\ .  See the
"pair_modify" command for details.
"pair_modify" command for details.


This pair style support the :doc:`pair_modify <pair_modify>` shift option for the energy of the pair interaction.
This pair style support the :doc:`pair_modify <pair_modify>` shift option for the energy of the pair interaction.
+59 −51
Original line number Original line Diff line number Diff line
#!/usr/bin/env python3
#!/usr/bin/env python3


from __future__ import print_function
import os, re, sys
from glob import glob
from glob import glob
from argparse import ArgumentParser
from argparse import ArgumentParser
import os, re, sys


parser = ArgumentParser(prog='check-packages.py',
parser = ArgumentParser(prog='check-packages.py',
                        description="Check package table completeness")
                        description="Check package table completeness")


parser.add_argument("-v", "--verbose",
parser.add_argument("-v", "--verbose",
                    action='store_const',
                    action='store_true',
                    const=True, default=False,
                    help="Enable verbose output")
                    help="Enable verbose output")


parser.add_argument("-d", "--doc",
parser.add_argument("-d", "--doc",
@@ -20,20 +18,28 @@ parser.add_argument("-s", "--src",


args = parser.parse_args()
args = parser.parse_args()
verbose = args.verbose
verbose = args.verbose
src = args.src
src_dir = args.src
doc = args.doc
doc_dir = args.doc

LAMMPS_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..'))

if not src_dir:
    src_dir = os.path.join(LAMMPS_DIR , 'src')

if not doc_dir:
    doc_dir = os.path.join(LAMMPS_DIR, 'doc', 'src')


if not args.src or not args.doc:
if not src_dir or not doc_dir:
    parser.print_help()
    parser.print_help()
    sys.exit(1)
    sys.exit(1)


if not os.path.isdir(src):
if not os.path.isdir(src_dir):
    sys.exit("LAMMPS source path %s does not exist" % src)
    sys.exit(f"LAMMPS source path {src_dir} does not exist")


if not os.path.isdir(doc):
if not os.path.isdir(doc_dir):
    sys.exit("LAMMPS documentation source path %s does not exist" % doc)
    sys.exit(f"LAMMPS documentation source path {doc_dir} does not exist")


pkgdirs = glob(os.path.join(src, '[A-Z][A-Z]*'))
pkgdirs = glob(os.path.join(src_dir, '[A-Z][A-Z]*'))
dirs = re.compile(".*/([0-9A-Z-]+)$")
dirs = re.compile(".*/([0-9A-Z-]+)$")
user = re.compile("USER-.*")
user = re.compile("USER-.*")


@@ -46,52 +52,54 @@ usrpkg = []


for d in pkgdirs:
for d in pkgdirs:
    pkg = dirs.match(d).group(1)
    pkg = dirs.match(d).group(1)
  if not os.path.isdir(os.path.join(src,pkg)): continue
    if not os.path.isdir(os.path.join(src_dir, pkg)): continue
  files = glob(os.path.join(src,pkg,"*.cpp"))
    # skip over folders without C++ source files
    files = glob(os.path.join(src_dir, pkg, "*.cpp"))
    if len(files) == 0: continue
    if len(files) == 0: continue
    # skip over known non-package folders
    if pkg in ['DEPEND','MAKE','STUBS']: continue
    if pkg in ['DEPEND','MAKE','STUBS']: continue
    if user.match(pkg):
    if user.match(pkg):
        usrpkg.append(pkg)
        usrpkg.append(pkg)
    else:
    else:
        stdpkg.append(pkg)
        stdpkg.append(pkg)


print("Found %d standard and %d user packages" % (len(stdpkg),len(usrpkg)))
print(f"Found {len(stdpkg)} standard and {len(usrpkg)} user packages")


counter = 0
counter = 0
fp = open(os.path.join(doc,'Packages_standard.rst'))

with open(os.path.join(doc_dir, 'Packages_standard.rst')) as fp:
    text = fp.read()
    text = fp.read()
fp.close()

matches = re.findall(':ref:`([A-Z0-9-]+) <[A-Z0-9-]+>`',text,re.MULTILINE)
matches = set(re.findall(':ref:`([A-Z0-9-]+) <[A-Z0-9-]+>`', text, re.MULTILINE))
for p in stdpkg:
for p in stdpkg:
  if not p in matches:
  if not p in matches:
    ++counter
    counter += 1
    print("Standard package %s missing in Packages_standard.rst" % p)
    print(f"Standard package {p} missing in Packages_standard.rst")


fp = open(os.path.join(doc,'Packages_user.rst'))
with open(os.path.join(doc_dir, 'Packages_user.rst')) as fp:
    text = fp.read()
    text = fp.read()
fp.close()

matches = re.findall(':ref:`([A-Z0-9-]+) <[A-Z0-9-]+>`',text,re.MULTILINE)
matches = set(re.findall(':ref:`([A-Z0-9-]+) <[A-Z0-9-]+>`', text, re.MULTILINE))
for p in usrpkg:
for p in usrpkg:
  if not p in matches:
  if not p in matches:
    ++counter
    counter += 1
    print("User package %s missing in Packages_user.rst" % p)
    print(f"User package {p} missing in Packages_user.rst")


fp = open(os.path.join(doc,'Packages_details.rst'))
with open(os.path.join(doc_dir, 'Packages_details.rst')) as fp:
    text = fp.read()
    text = fp.read()
fp.close()

matches = re.findall(':ref:`([A-Z0-9]+) <PKG-\\1>`',text,re.MULTILINE)
matches = set(re.findall(':ref:`([A-Z0-9]+) <PKG-\\1>`', text, re.MULTILINE))
for p in stdpkg:
for p in stdpkg:
    if not p in matches:
    if not p in matches:
    ++counter
        counter += 1
    print("Standard package %s missing in Packages_details.rst"
        print(f"Standard package {p} missing in Packages_details.rst")
          % p)

matches = re.findall(':ref:`(USER-[A-Z0-9]+) <PKG-\\1>`',text,re.MULTILINE)
matches = set(re.findall(':ref:`(USER-[A-Z0-9]+) <PKG-\\1>`', text, re.MULTILINE))
for p in usrpkg:
for p in usrpkg:
    if not p in matches:
    if not p in matches:
    ++counter
        counter +=1 
    print("User package %s missing in Packages_details.rst"
        print(f"User package {p} missing in Packages_details.rst")
          % p)


if counter:
if counter:
    print("Found %d issue(s) with package lists" % counter)
    print(f"Found {counter} issue(s) with package lists")
+141 −140
Original line number Original line Diff line number Diff line
#!/usr/bin/env python3
#!/usr/bin/env python3


from __future__ import print_function
import os, re, sys
from glob import glob
from glob import glob
from argparse import ArgumentParser
from argparse import ArgumentParser
import os, re, sys


parser = ArgumentParser(prog='check-styles.py',
parser = ArgumentParser(prog='check-styles.py',
                        description="Check style table completeness")
                        description="Check style table completeness")


parser.add_argument("-v", "--verbose",
parser.add_argument("-v", "--verbose",
                    action='store_const',
                    action='store_true',
                    const=True, default=False,
                    help="Enable verbose output")
                    help="Enable verbose output")


parser.add_argument("-d", "--doc",
parser.add_argument("-d", "--doc",
@@ -20,21 +18,29 @@ parser.add_argument("-s", "--src",


args = parser.parse_args()
args = parser.parse_args()
verbose = args.verbose
verbose = args.verbose
src = args.src
src_dir = args.src
doc = args.doc
doc_dir = args.doc

LAMMPS_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..'))

if not src_dir:
    src_dir = os.path.join(LAMMPS_DIR , 'src')

if not doc_dir:
    doc_dir = os.path.join(LAMMPS_DIR, 'doc', 'src')


if not args.src or not args.doc:
if not src_dir or not doc_dir:
  parser.print_help()
  parser.print_help()
  sys.exit(1)
  sys.exit(1)


if not os.path.isdir(src):
if not os.path.isdir(src_dir):
    sys.exit("LAMMPS source path %s does not exist" % src)
    sys.exit(f"LAMMPS source path {src_dir} does not exist")


if not os.path.isdir(doc):
if not os.path.isdir(doc_dir):
    sys.exit("LAMMPS documentation source path %s does not exist" % doc)
    sys.exit(f"LAMMPS documentation source path {doc_dir} does not exist")


headers = glob(os.path.join(src, '*', '*.h'))
headers = glob(os.path.join(src_dir, '*', '*.h'))
headers += glob(os.path.join(src, '*.h'))
headers += glob(os.path.join(src_dir, '*.h'))


angle = {}
angle = {}
atom = {}
atom = {}
@@ -54,6 +60,7 @@ reader = {}
region = {}
region = {}
total = 0
total = 0


style_pattern = re.compile(r"(.+)Style\((.+),(.+)\)")
upper = re.compile("[A-Z]+")
upper = re.compile("[A-Z]+")
gpu = re.compile("(.+)/gpu$")
gpu = re.compile("(.+)/gpu$")
intel = re.compile("(.+)/intel$")
intel = re.compile("(.+)/intel$")
@@ -63,61 +70,54 @@ omp = re.compile("(.+)/omp$")
opt = re.compile("(.+)/opt$")
opt = re.compile("(.+)/opt$")
removed = re.compile("(.*)Deprecated$")
removed = re.compile("(.*)Deprecated$")


def register_style(list,style,info):
def register_style(styles, name, info):
    if style in list.keys():
    if name in styles:
        list[style]['gpu'] += info['gpu']
        for key, value in info.items():
        list[style]['intel'] += info['intel']
            styles[name][key] += value
        list[style]['kokkos'] += info['kokkos']
        list[style]['omp'] += info['omp']
        list[style]['opt'] += info['opt']
        list[style]['removed'] += info['removed']
    else:
    else:
        list[style] = info
        styles[name] = info


def add_suffix(list,style):
def add_suffix(styles, name):
    suffix = ""
    suffix = ""
    if list[style]['gpu']:
    if styles[name]['gpu']:
        suffix += 'g'
        suffix += 'g'
    if list[style]['intel']:
    if styles[name]['intel']:
        suffix += 'i'
        suffix += 'i'
    if list[style]['kokkos']:
    if styles[name]['kokkos']:
        suffix += 'k'
        suffix += 'k'
    if list[style]['omp']:
    if styles[name]['omp']:
        suffix += 'o'
        suffix += 'o'
    if list[style]['opt']:
    if styles[name]['opt']:
        suffix += 't'
        suffix += 't'
    if suffix:
    if suffix:
        return style + ' (' + suffix + ')'
        return f"{name} ({suffix})"
    else:
    else:
        return style
        return name

def check_style(filename, dirname, pattern, styles, name, suffix=False, skip=set()):
    with open(os.path.join(dirname, filename)) as f:
        text = f.read()


def check_style(file,dir,pattern,list,name,suffix=False,skip=()):
    f = os.path.join(dir, file)
    fp = open(f)
    text = fp.read()
    fp.close()
    matches = re.findall(pattern, text, re.MULTILINE)
    matches = re.findall(pattern, text, re.MULTILINE)

    counter = 0
    counter = 0
    for c in list.keys():
    for c in styles:
        # known undocumented aliases we need to skip
        # known undocumented aliases we need to skip
        if c in skip: continue
        if c in skip: continue
        s = c
        s = c
        if suffix: s = add_suffix(list,c)
        if suffix: s = add_suffix(styles, c)
        if not s in matches:
        if not s in matches:
            if not list[c]['removed']:
            if not styles[c]['removed']:
                print("%s style entry %s" % (name,s),
                print(f"{name} style entry {s} is missing or incomplete in {filename}")
                      "is missing or incomplete in %s" % file)
                counter += 1
                counter += 1
    return counter
    return counter


for h in headers:
for header in headers:
    if verbose: print("Checking ", h)
    if verbose: print("Checking ", header)
    fp = open(h)
    with open(header) as f:
    text = fp.read()
        for line in f:
    fp.close()
            matches = style_pattern.findall(line)
    matches = re.findall("(.+)Style\((.+),(.+)\)",text,re.MULTILINE)
            for m in matches:
            for m in matches:

                # skip over internal styles w/o explicit documentation
                # skip over internal styles w/o explicit documentation
                style = m[1]
                style = m[1]
                total += 1
                total += 1
@@ -202,44 +202,45 @@ print("""Parsed style names w/o suffixes from C++ tree in %s:
   Reader styles:    %3d    Region styles:    %3d
   Reader styles:    %3d    Region styles:    %3d
----------------------------------------------------
----------------------------------------------------
Total number of styles (including suffixes): %d""" \
Total number of styles (including suffixes): %d""" \
      % (src, len(angle), len(atom), len(body), len(bond),   \
      % (src_dir, len(angle), len(atom), len(body), len(bond),   \
       len(command), len(compute), len(dihedral), len(dump), \
       len(command), len(compute), len(dihedral), len(dump), \
       len(fix), len(improper), len(integrate), len(kspace), \
       len(fix), len(improper), len(integrate), len(kspace), \
       len(minimize), len(pair), len(reader), len(region), total))
       len(minimize), len(pair), len(reader), len(region), total))



counter = 0
counter = 0


counter += check_style('Commands_all.rst',doc,":doc:`(.+) <.+>`",
counter += check_style('Commands_all.rst', doc_dir, ":doc:`(.+) <.+>`",
                       command,'Command',suffix=False)
                       command,'Command',suffix=False)
counter += check_style('Commands_compute.rst',doc,":doc:`(.+) <compute.+>`",
counter += check_style('Commands_compute.rst', doc_dir, ":doc:`(.+) <compute.+>`",
                       compute,'Compute',suffix=True)
                       compute,'Compute',suffix=True)
counter += check_style('compute.rst',doc,":doc:`(.+) <compute.+>` -",
counter += check_style('compute.rst', doc_dir, ":doc:`(.+) <compute.+>` -",
                       compute,'Compute',suffix=False)
                       compute,'Compute',suffix=False)
counter += check_style('Commands_fix.rst',doc,":doc:`(.+) <fix.+>`",
counter += check_style('Commands_fix.rst', doc_dir, ":doc:`(.+) <fix.+>`",
                       fix,'Fix',skip=('python'),suffix=True)
                       fix,'Fix',skip=('python', 'NEIGH_HISTORY/omp'),suffix=True)
counter += check_style('fix.rst',doc,":doc:`(.+) <fix.+>` -",
counter += check_style('fix.rst', doc_dir, ":doc:`(.+) <fix.+>` -",
                       fix,'Fix',skip=('python'),suffix=False)
                       fix,'Fix',skip=('python', 'NEIGH_HISTORY/omp'),suffix=False)
counter += check_style('Commands_pair.rst',doc,":doc:`(.+) <pair.+>`",
counter += check_style('Commands_pair.rst', doc_dir, ":doc:`(.+) <pair.+>`",
                       pair,'Pair',skip=('meam','lj/sf'),suffix=True)
                       pair,'Pair',skip=('meam','lj/sf'),suffix=True)
counter += check_style('pair_style.rst',doc,":doc:`(.+) <pair.+>` -",
counter += check_style('pair_style.rst', doc_dir, ":doc:`(.+) <pair.+>` -",
                       pair,'Pair',skip=('meam','lj/sf'),suffix=False)
                       pair,'Pair',skip=('meam','lj/sf'),suffix=False)
counter += check_style('Commands_bond.rst',doc,":doc:`(.+) <bond.+>`",
counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) <bond.+>`",
                       bond,'Bond',suffix=True)
                       bond,'Bond',suffix=True)
counter += check_style('bond_style.rst',doc,":doc:`(.+) <bond.+>` -",
counter += check_style('bond_style.rst', doc_dir, ":doc:`(.+) <bond.+>` -",
                       bond,'Bond',suffix=False)
                       bond,'Bond',suffix=False)
counter += check_style('Commands_bond.rst',doc,":doc:`(.+) <angle.+>`",
counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) <angle.+>`",
                       angle,'Angle',suffix=True)
                       angle,'Angle',suffix=True)
counter += check_style('angle_style.rst',doc,":doc:`(.+) <angle.+>` -",
counter += check_style('angle_style.rst', doc_dir, ":doc:`(.+) <angle.+>` -",
                       angle,'Angle',suffix=False)
                       angle,'Angle',suffix=False)
counter += check_style('Commands_bond.rst',doc,":doc:`(.+) <dihedral.+>`",
counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) <dihedral.+>`",
                       dihedral,'Dihedral',suffix=True)
                       dihedral,'Dihedral',suffix=True)
counter += check_style('dihedral_style.rst',doc,":doc:`(.+) <dihedral.+>` -",
counter += check_style('dihedral_style.rst', doc_dir, ":doc:`(.+) <dihedral.+>` -",
                       dihedral,'Dihedral',suffix=False)
                       dihedral,'Dihedral',suffix=False)
counter += check_style('Commands_bond.rst',doc,":doc:`(.+) <improper.+>`",
counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) <improper.+>`",
                       improper,'Improper',suffix=True)
                       improper,'Improper',suffix=True)
counter += check_style('improper_style.rst',doc,":doc:`(.+) <improper.+>` -",
counter += check_style('improper_style.rst', doc_dir, ":doc:`(.+) <improper.+>` -",
                       improper,'Improper',suffix=False)
                       improper,'Improper',suffix=False)
counter += check_style('Commands_kspace.rst',doc,":doc:`(.+) <kspace_style>`",
counter += check_style('Commands_kspace.rst', doc_dir, ":doc:`(.+) <kspace_style>`",
                       kspace,'KSpace',suffix=True)
                       kspace,'KSpace',suffix=True)


if counter:
if counter:
+15 −16
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@ template <class numtyp, class acctyp>
int UFMT::init(const int ntypes,
int UFMT::init(const int ntypes,
                          double **host_cutsq, double **host_uf1,
                          double **host_cutsq, double **host_uf1,
                          double **host_uf2, double **host_uf3,
                          double **host_uf2, double **host_uf3,
                          double **host_uf4, double **host_offset, 
                          double **host_offset,
                          double *host_special_lj, const int nlocal,
                          double *host_special_lj, const int nlocal,
                          const int nall, const int max_nbors,
                          const int nall, const int max_nbors,
                          const int maxspecial, const double cell_size,
                          const int maxspecial, const double cell_size,
@@ -81,7 +81,7 @@ int UFMT::init(const int ntypes,
                         host_cutsq);
                         host_cutsq);


  uf3.alloc(lj_types*lj_types,*(this->ucl_device),UCL_READ_ONLY);
  uf3.alloc(lj_types*lj_types,*(this->ucl_device),UCL_READ_ONLY);
  this->atom->type_pack4(ntypes,lj_types,uf3,host_write,host_uf3,host_uf4,
  this->atom->type_pack4(ntypes,lj_types,uf3,host_write,host_uf3,host_uf2,
                         host_offset);
                         host_offset);


  UCL_H_Vec<double> dview;
  UCL_H_Vec<double> dview;
@@ -96,8 +96,7 @@ int UFMT::init(const int ntypes,


template <class numtyp, class acctyp>
template <class numtyp, class acctyp>
void UFMT::reinit(const int ntypes, double **host_cutsq, double **host_uf1,
void UFMT::reinit(const int ntypes, double **host_cutsq, double **host_uf1,
                 double **host_uf2, double **host_uf3,
                 double **host_uf2, double **host_uf3, double **host_offset) {
                 double **host_uf4, double **host_offset) {
  // Allocate a host write buffer for data initialization
  // Allocate a host write buffer for data initialization
  UCL_H_Vec<numtyp> host_write(_lj_types*_lj_types*32,*(this->ucl_device),
  UCL_H_Vec<numtyp> host_write(_lj_types*_lj_types*32,*(this->ucl_device),
                               UCL_WRITE_ONLY);
                               UCL_WRITE_ONLY);
@@ -107,7 +106,7 @@ void UFMT::reinit(const int ntypes, double **host_cutsq, double **host_uf1,


  this->atom->type_pack4(ntypes,_lj_types,uf1,host_write,host_uf1,host_uf2,
  this->atom->type_pack4(ntypes,_lj_types,uf1,host_write,host_uf1,host_uf2,
                         host_cutsq);
                         host_cutsq);
  this->atom->type_pack4(ntypes,_lj_types,uf3,host_write,host_uf3,host_uf4,
  this->atom->type_pack4(ntypes,_lj_types,uf3,host_write,host_uf3,host_uf2,
                         host_offset);
                         host_offset);
}
}


Loading