Esempio n. 1
0
                        # Check if this is a valid/sane/usable combination
                        if not KeepKernel(KernelElec, KernelElecMod, KernelVdw, KernelVdwMod, KernelGeom, KernelVF):
                            continue

                        # The overall kernel settings determine what the _kernel_ calculates, but for the water
                        # kernels this does not mean that every pairwise interaction has e.g. Vdw interactions.
                        # This routine sets defines of what to calculate for each pair of particles in those cases.
                        SetDefines(KernelElec, KernelElecMod, KernelVdw, KernelVdwMod, KernelGeom, KernelVF, defines)

                        if DoHeader == 1:
                            fpkernel.write(FileHeader)

                        gmxpreprocess(
                            "nb_kernel_template_" + Arch + ".pre",
                            KernelName + ".tmp",
                            defines,
                            force=1,
                            contentType="C",
                        )
                        numKernels = numKernels + 1

                        defines["INCLUDE_HEADER"] = 0  # Header has been included once now
                        DoHeader = 0

                        # Append temp file contents to the common kernelfile
                        fptmp = open(KernelName + ".tmp", "r")
                        fpkernel.writelines(fptmp.readlines())
                        fptmp.close()
                        os.remove(KernelName + ".tmp")

                        # Add a declaration for this kernel
                        defines['KERNEL_NAME'] = KernelName
                        defines['KERNEL_VF']   = KernelVF

                        # Check if this is a valid/sane/usable combination
                        if not KeepKernel(KernelElec,KernelElecMod,KernelVdw,KernelVdwMod,KernelGeom,KernelVF):
                            continue;

                        # The overall kernel settings determine what the _kernel_ calculates, but for the water
                        # kernels this does not mean that every pairwise interaction has e.g. Vdw interactions.
                        # This routine sets defines of what to calculate for each pair of particles in those cases.
                        SetDefines(KernelElec,KernelElecMod,KernelVdw,KernelVdwMod,KernelGeom,KernelVF,defines)

                        if(DoHeader==1):
                            fpkernel.write( FileHeader )

                        gmxpreprocess('nb_kernel_template_' + Arch + '.pre', KernelName+'.tmp' , defines, force=1,contentType='C')
                        numKernels = numKernels + 1

                        defines['INCLUDE_HEADER'] = 0   # Header has been included once now
                        DoHeader=0

                        # Append temp file contents to the common kernelfile
                        fptmp = open(KernelName+'.tmp','r')
                        fpkernel.writelines(fptmp.readlines())
                        fptmp.close()
                        os.remove(KernelName+'.tmp')

                        # Add a declaration for this kernel
                        fpdecl.write('nb_kernel_t ' + KernelName + ';\n');

                        # Add declaration to the buffer
                        defines['KERNEL_NAME'] = KernelName
                        defines['KERNEL_VF']   = KernelVF

                        # Check if this is a valid/sane/usable combination
                        if not KeepKernel(KernelElec,KernelElecMod,KernelVdw,KernelVdwMod,KernelGeom,KernelVF):
                            continue;

                        # The overall kernel settings determine what the _kernel_ calculates, but for the water
                        # kernels this does not mean that every pairwise interaction has e.g. Vdw interactions.
                        # This routine sets defines of what to calculate for each pair of particles in those cases.
                        SetDefines(KernelElec,KernelElecMod,KernelVdw,KernelVdwMod,KernelGeom,KernelVF,defines)

                        if(DoHeader==1):
                            fpkernel.write( FileHeader )

                        gmxpreprocess('nb_kernel_template_' + Arch + '.pre', KernelName+'.tmp' , defines, force=1,contentType='C')
                        numKernels = numKernels + 1

                        defines['INCLUDE_HEADER'] = 0   # Header has been included once now
                        DoHeader=0

                        # Append temp file contents to the common kernelfile
                        fptmp = open(KernelName+'.tmp','r')
                        fpkernel.writelines(fptmp.readlines())
                        fptmp.close()
                        os.remove(KernelName+'.tmp')

                        # Add a declaration for this kernel
                        fpdecl.write('nb_kernel_t ' + KernelName + ';\n');

                        # Add declaration to the buffer