# Explanation of the 'properties':
#
# It is cheap to compute r^2, and the kernels require various other functions of r for
# different kinds of interaction. Depending on the needs of the kernel and the available
# processor instructions, this will be done in different ways.
#
# 'rinv' means we need 1/r, which is calculated as 1/sqrt(r^2).
# 'rinvsq' means we need 1/(r*r). This is calculated as rinv*rinv if we already did rinv, otherwise 1/r^2.
# 'r' is similarly calculated as r^2*rinv when needed
# 'table' means the interaction is tabulated, in which case we will calculate a table index before the interaction
# 'shift' means the interaction will be modified by a constant to make it zero at the cutoff.
# 'cutoff' means the interaction is set to 0.0 outside the cutoff
#

FileHeader = create_copyright_header('2012,2013,2014')
FileHeader += """/*
 * Note: this file was generated by the GROMACS """+Arch+""" kernel generator.
 */
"""

###############################################
# ELECTROSTATICS
# Interactions and flags for them
###############################################
ElectrostaticsList = {
    'None'                    : [],
    'Coulomb'                 : ['rinv','rinvsq'],
    'ReactionField'           : ['rinv','rinvsq'],
    'GeneralizedBorn'         : ['rinv','r'],
    'CubicSplineTable'        : ['rinv','r','table'],
Example #2
0
# Explanation of the 'properties':
#
# It is cheap to compute r^2, and the kernels require various other functions of r for
# different kinds of interaction. Depending on the needs of the kernel and the available
# processor instructions, this will be done in different ways.
#
# 'rinv' means we need 1/r, which is calculated as 1/sqrt(r^2).
# 'rinvsq' means we need 1/(r*r). This is calculated as rinv*rinv if we already did rinv, otherwise 1/r^2.
# 'r' is similarly calculated as r^2*rinv when needed
# 'table' means the interaction is tabulated, in which case we will calculate a table index before the interaction
# 'shift' means the interaction will be modified by a constant to make it zero at the cutoff.
# 'cutoff' means the interaction is set to 0.0 outside the cutoff
#

FileHeader = create_copyright_header("2012,2013,2014")
FileHeader += (
    """/*
 * Note: this file was generated by the GROMACS """
    + Arch
    + """ kernel generator.
 */
"""
)

###############################################
# ELECTROSTATICS
# Interactions and flags for them
###############################################
ElectrostaticsList = {
    "None": [],
# Note that while functions for both nbnxn kernel structures are
# compiled and built into an mdrun executable, because that executable
# is not portable, only the functions for the useful nbnxn kernel
# structure for the hardware selected at CMake time contain real
# kernel logic. A run-time error occurs if an inappropriate kernel
# dispatcher function is called (but that is normally impossible).

import re
import sys
import os
os.chdir(os.path.dirname(os.path.abspath(__file__)))
import collections  # Requires Python 2.7
sys.path.append('../../../../../admin')
from copyright import create_copyright_header

FileHeader = create_copyright_header('2012,2013,2014')
FileHeader += """/*
 * Note: this file was generated by the Verlet kernel generator for
 * kernel type {0}.
 */

"""


def read_kernel_template(filename):
    with open(filename, "r") as TemplateFile:
        TemplateText = TemplateFile.read()
    copyright_re = r'/\*\n \* This file is part of the GROMACS molecular simulation package\.\n( \*.*\n)* \*/\n'
    match = re.match(copyright_re, TemplateText)
    if match:
        TemplateText = TemplateText[match.end():]
# Explanation of the 'properties':
#
# It is cheap to compute r^2, and the kernels require various other functions of r for
# different kinds of interaction. Depending on the needs of the kernel and the available
# processor instructions, this will be done in different ways.
#
# 'rinv' means we need 1/r, which is calculated as 1/sqrt(r^2).
# 'rinvsq' means we need 1/(r*r). This is calculated as rinv*rinv if we already did rinv, otherwise 1/r^2.
# 'r' is similarly calculated as r^2*rinv when needed
# 'table' means the interaction is tabulated, in which case we will calculate a table index before the interaction
# 'shift' means the interaction will be modified by a constant to make it zero at the cutoff.
# 'cutoff' means the interaction is set to 0.0 outside the cutoff
#

FileHeader = create_copyright_header('2012,2013,2014,2015,2017,2018')
FileHeader += """/*
 * Note: this file was generated by the GROMACS """+Arch+""" kernel generator.
 */
"""

###############################################
# ELECTROSTATICS
# Interactions and flags for them
###############################################
ElectrostaticsList = {
    'None'                    : [],
    'Coulomb'                 : ['rinv','rinvsq'],
    'ReactionField'           : ['rinv','rinvsq'],
    'CubicSplineTable'        : ['rinv','r','table'],
    'Ewald'                   : ['rinv','rinvsq','r'],
# Explanation of the 'properties':
#
# It is cheap to compute r^2, and the kernels require various other functions of r for
# different kinds of interaction. Depending on the needs of the kernel and the available
# processor instructions, this will be done in different ways.
#
# 'rinv' means we need 1/r, which is calculated as 1/sqrt(r^2).
# 'rinvsq' means we need 1/(r*r). This is calculated as rinv*rinv if we already did rinv, otherwise 1/r^2.
# 'r' is similarly calculated as r^2*rinv when needed
# 'table' means the interaction is tabulated, in which case we will calculate a table index before the interaction
# 'shift' means the interaction will be modified by a constant to make it zero at the cutoff.
# 'cutoff' means the interaction is set to 0.0 outside the cutoff
#

FileHeader = create_copyright_header('2012,2013,2014,2015,2017,2018')
FileHeader += """/*
 * Note: this file was generated by the GROMACS """ + Arch + """ kernel generator.
 */
"""

###############################################
# ELECTROSTATICS
# Interactions and flags for them
###############################################
ElectrostaticsList = {
    'None': [],
    'Coulomb': ['rinv', 'rinvsq'],
    'ReactionField': ['rinv', 'rinvsq'],
    'CubicSplineTable': ['rinv', 'r', 'table'],
    'Ewald': ['rinv', 'rinvsq', 'r'],