Commit f7f79b04 authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Initial Amoeba

parent 5003591d
/* -------------------------------------------------------------------------- *
* Amoeba OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/ContextImpl.h"
#include "internal/AmoebaMultipoleForceImpl.h"
#include "amoebaKernels.h"
using namespace OpenMM;
using std::vector;
AmoebaMultipoleForceImpl::AmoebaMultipoleForceImpl(AmoebaMultipoleForce& owner) : owner(owner) {
}
AmoebaMultipoleForceImpl::~AmoebaMultipoleForceImpl() {
}
void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaMultipoleForceKernel::Name(), context);
dynamic_cast<CalcAmoebaMultipoleForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
}
void AmoebaMultipoleForceImpl::calcForces(ContextImpl& context ) {
dynamic_cast<CalcAmoebaMultipoleForceKernel&>(kernel.getImpl()).executeForces(context);
}
double AmoebaMultipoleForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaMultipoleForceKernel&>(kernel.getImpl()).executeEnergy(context);
}
std::vector<std::string> AmoebaMultipoleForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaMultipoleForceKernel::Name());
return names;
}
/* -------------------------------------------------------------------------- *
* AmoebaOpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
#include "AmoebaOutOfPlaneBendForce.h"
#include "internal/AmoebaOutOfPlaneBendForceImpl.h"
using namespace OpenMM;
AmoebaOutOfPlaneBendForce::AmoebaOutOfPlaneBendForce() {
_globalCubicK = -0.1400000E-01;
_globalQuarticK = 0.5600000E-04;
_globalPenticK = -0.7000000E-06;
_globalSexticK = 0.2200000E-07;
}
double AmoebaOutOfPlaneBendForce::getAmoebaGlobalOutOfPlaneBendCubic( void ) const {
return _globalCubicK;
}
void AmoebaOutOfPlaneBendForce::setAmoebaGlobalOutOfPlaneBendCubic(double cubicK ) {
_globalCubicK = cubicK;
}
double AmoebaOutOfPlaneBendForce::getAmoebaGlobalOutOfPlaneBendQuartic( void ) const {
return _globalQuarticK;
}
void AmoebaOutOfPlaneBendForce::setAmoebaGlobalOutOfPlaneBendQuartic(double quarticK ) {
_globalQuarticK = quarticK;
}
double AmoebaOutOfPlaneBendForce::getAmoebaGlobalOutOfPlaneBendPentic( void ) const {
return _globalPenticK;
}
void AmoebaOutOfPlaneBendForce::setAmoebaGlobalOutOfPlaneBendPentic(double penticK ) {
_globalPenticK = penticK;
}
double AmoebaOutOfPlaneBendForce::getAmoebaGlobalOutOfPlaneBendSextic( void ) const {
return _globalSexticK;
}
void AmoebaOutOfPlaneBendForce::setAmoebaGlobalOutOfPlaneBendSextic(double sexticK ) {
_globalSexticK = sexticK;
}
int AmoebaOutOfPlaneBendForce::addOutOfPlaneBend(int particle1, int particle2, int particle3, int particle4, double k) {
outOfPlaneBends.push_back(OutOfPlaneBendInfo(particle1, particle2, particle3, particle4, k));
return outOfPlaneBends.size()-1;
}
void AmoebaOutOfPlaneBendForce::getOutOfPlaneBendParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4,
double& k ) const {
particle1 = outOfPlaneBends[index].particle1;
particle2 = outOfPlaneBends[index].particle2;
particle3 = outOfPlaneBends[index].particle3;
particle4 = outOfPlaneBends[index].particle4;
k = outOfPlaneBends[index].k;
}
void AmoebaOutOfPlaneBendForce::setOutOfPlaneBendParameters(int index, int particle1, int particle2, int particle3, int particle4,
double k) {
outOfPlaneBends[index].particle1 = particle1;
outOfPlaneBends[index].particle2 = particle2;
outOfPlaneBends[index].particle3 = particle3;
outOfPlaneBends[index].particle4 = particle4;
outOfPlaneBends[index].k = k;
}
ForceImpl* AmoebaOutOfPlaneBendForce::createImpl() {
return new AmoebaOutOfPlaneBendForceImpl(*this);
}
/* -------------------------------------------------------------------------- *
* Amoeba OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/ContextImpl.h"
#include "internal/AmoebaOutOfPlaneBendForceImpl.h"
#include "amoebaKernels.h"
using namespace OpenMM;
using std::pair;
using std::vector;
using std::set;
AmoebaOutOfPlaneBendForceImpl::AmoebaOutOfPlaneBendForceImpl(AmoebaOutOfPlaneBendForce& owner) : owner(owner) {
}
AmoebaOutOfPlaneBendForceImpl::~AmoebaOutOfPlaneBendForceImpl() {
}
void AmoebaOutOfPlaneBendForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaOutOfPlaneBendForceKernel::Name(), context);
dynamic_cast<CalcAmoebaOutOfPlaneBendForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
}
void AmoebaOutOfPlaneBendForceImpl::calcForces(ContextImpl& context ) {
dynamic_cast<CalcAmoebaOutOfPlaneBendForceKernel&>(kernel.getImpl()).executeForces(context);
}
double AmoebaOutOfPlaneBendForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaOutOfPlaneBendForceKernel&>(kernel.getImpl()).executeEnergy(context);
}
std::vector<std::string> AmoebaOutOfPlaneBendForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaOutOfPlaneBendForceKernel::Name());
return names;
}
/* -------------------------------------------------------------------------- *
* AmoebaOpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
#include "AmoebaPiTorsionForce.h"
#include "internal/AmoebaPiTorsionForceImpl.h"
using namespace OpenMM;
AmoebaPiTorsionForce::AmoebaPiTorsionForce() {
}
int AmoebaPiTorsionForce::addPiTorsion(int particle1, int particle2, int particle3, int particle4, int particle5, int particle6, double k) {
piTorsions.push_back(PiTorsionInfo(particle1, particle2, particle3, particle4, particle5, particle6, k));
return piTorsions.size()-1;
}
void AmoebaPiTorsionForce::getPiTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, int& particle5, int& particle6, double& k ) const {
particle1 = piTorsions[index].particle1;
particle2 = piTorsions[index].particle2;
particle3 = piTorsions[index].particle3;
particle4 = piTorsions[index].particle4;
particle5 = piTorsions[index].particle5;
particle6 = piTorsions[index].particle6;
k = piTorsions[index].k;
}
void AmoebaPiTorsionForce::setPiTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, int particle5, int particle6, double k ) {
piTorsions[index].particle1 = particle1;
piTorsions[index].particle2 = particle2;
piTorsions[index].particle3 = particle3;
piTorsions[index].particle4 = particle4;
piTorsions[index].particle5 = particle5;
piTorsions[index].particle6 = particle6;
piTorsions[index].k = k;
}
ForceImpl* AmoebaPiTorsionForce::createImpl() {
return new AmoebaPiTorsionForceImpl(*this);
}
/* -------------------------------------------------------------------------- *
* Amoeba OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/ContextImpl.h"
#include "internal/AmoebaPiTorsionForceImpl.h"
#include "amoebaKernels.h"
using namespace OpenMM;
using std::pair;
using std::vector;
using std::set;
AmoebaPiTorsionForceImpl::AmoebaPiTorsionForceImpl(AmoebaPiTorsionForce& owner) : owner(owner) {
}
AmoebaPiTorsionForceImpl::~AmoebaPiTorsionForceImpl() {
}
void AmoebaPiTorsionForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaPiTorsionForceKernel::Name(), context);
dynamic_cast<CalcAmoebaPiTorsionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
}
void AmoebaPiTorsionForceImpl::calcForces(ContextImpl& context ) {
dynamic_cast<CalcAmoebaPiTorsionForceKernel&>(kernel.getImpl()).executeForces(context);
}
double AmoebaPiTorsionForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaPiTorsionForceKernel&>(kernel.getImpl()).executeEnergy(context);
}
std::vector<std::string> AmoebaPiTorsionForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaPiTorsionForceKernel::Name());
return names;
}
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
#include "AmoebaSASAForce.h"
#include "internal/AmoebaSASAForceImpl.h"
using namespace OpenMM;
AmoebaSASAForce::AmoebaSASAForce() : probeRadius(0.14) {
}
int AmoebaSASAForce::addParticle( double radius, double weight) {
particles.push_back(ParticleInfo(radius, weight));
return particles.size()-1;
}
void AmoebaSASAForce::getParticleParameters(int index, double& radius, double& weight) const {
radius = particles[index].radius;
weight = particles[index].weight;
}
void AmoebaSASAForce::setParticleParameters(int index, double radius, double weight) {
particles[index].radius = radius;
particles[index].weight = weight;
}
double AmoebaSASAForce::getProbeRadius() const {
return probeRadius;
}
void AmoebaSASAForce::setProbeRadius(double distance) {
probeRadius = distance;
}
ForceImpl* AmoebaSASAForce::createImpl() {
return new AmoebaSASAForceImpl(*this);
}
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "internal/AmoebaSASAForceImpl.h"
#include "openmm/internal/ContextImpl.h"
#include "amoebaKernels.h"
using namespace OpenMM;
using std::vector;
AmoebaSASAForceImpl::AmoebaSASAForceImpl(AmoebaSASAForce& owner) : owner(owner) {
}
void AmoebaSASAForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaSASAForceKernel::Name(), context);
if (owner.getNumParticles() != context.getSystem().getNumParticles())
throw OpenMMException("AmoebaSASAForce must have exactly as many particles as the System it belongs to.");
dynamic_cast<CalcAmoebaSASAForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
}
void AmoebaSASAForceImpl::calcForces(ContextImpl& context) {
dynamic_cast<CalcAmoebaSASAForceKernel&>(kernel.getImpl()).executeForces(context);
}
double AmoebaSASAForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaSASAForceKernel&>(kernel.getImpl()).executeEnergy(context);
}
std::vector<std::string> AmoebaSASAForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaSASAForceKernel::Name());
return names;
}
/* -------------------------------------------------------------------------- *
* AmoebaOpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
#include "AmoebaStretchBendForce.h"
#include "internal/AmoebaStretchBendForceImpl.h"
using namespace OpenMM;
AmoebaStretchBendForce::AmoebaStretchBendForce() {
}
int AmoebaStretchBendForce::addStretchBend(int particle1, int particle2, int particle3,
double lengthAB, double lengthCB, double angle, double k) {
stretchBends.push_back(StretchBendInfo(particle1, particle2, particle3, lengthAB, lengthCB, angle, k));
return stretchBends.size()-1;
}
void AmoebaStretchBendForce::getStretchBendParameters(int index, int& particle1, int& particle2, int& particle3,
double& lengthAB, double& lengthCB, double& angle, double& k ) const {
particle1 = stretchBends[index].particle1;
particle2 = stretchBends[index].particle2;
particle3 = stretchBends[index].particle3;
lengthAB = stretchBends[index].lengthAB;
lengthCB = stretchBends[index].lengthCB;
angle = stretchBends[index].angle;
k = stretchBends[index].k;
}
void AmoebaStretchBendForce::setStretchBendParameters(int index, int particle1, int particle2, int particle3,
double lengthAB, double lengthCB, double angle, double k) {
stretchBends[index].particle1 = particle1;
stretchBends[index].particle2 = particle2;
stretchBends[index].particle3 = particle3;
stretchBends[index].lengthAB = lengthAB;
stretchBends[index].lengthCB = lengthCB;
stretchBends[index].angle = angle;
stretchBends[index].k = k;
}
ForceImpl* AmoebaStretchBendForce::createImpl() {
return new AmoebaStretchBendForceImpl(*this);
}
/* -------------------------------------------------------------------------- *
* Amoeba OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/ContextImpl.h"
#include "internal/AmoebaStretchBendForceImpl.h"
#include "amoebaKernels.h"
using namespace OpenMM;
using std::pair;
using std::vector;
using std::set;
AmoebaStretchBendForceImpl::AmoebaStretchBendForceImpl(AmoebaStretchBendForce& owner) : owner(owner) {
}
AmoebaStretchBendForceImpl::~AmoebaStretchBendForceImpl() {
}
void AmoebaStretchBendForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaStretchBendForceKernel::Name(), context);
dynamic_cast<CalcAmoebaStretchBendForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
}
void AmoebaStretchBendForceImpl::calcForces(ContextImpl& context ) {
dynamic_cast<CalcAmoebaStretchBendForceKernel&>(kernel.getImpl()).executeForces(context);
}
double AmoebaStretchBendForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaStretchBendForceKernel&>(kernel.getImpl()).executeEnergy(context);
}
std::vector<std::string> AmoebaStretchBendForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaStretchBendForceKernel::Name());
return names;
}
/* -------------------------------------------------------------------------- *
* AmoebaOpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
#include "AmoebaTorsionForce.h"
#include "internal/AmoebaTorsionForceImpl.h"
using namespace OpenMM;
AmoebaTorsionForce::AmoebaTorsionForce() {
}
int AmoebaTorsionForce::addTorsion(int particle1, int particle2, int particle3, int particle4,
std::vector<double> torsion1, std::vector<double> torsion2, std::vector<double> torsion3 ) {
torsions.push_back(TorsionInfo(particle1, particle2, particle3, particle4, torsion1, torsion2, torsion3));
return torsions.size()-1;
}
void AmoebaTorsionForce::getTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4,
std::vector<double>& torsion1, std::vector<double>& torsion2, std::vector<double>& torsion3 ) const {
particle1 = torsions[index].particle1;
particle2 = torsions[index].particle2;
particle3 = torsions[index].particle3;
particle4 = torsions[index].particle4;
torsion1.resize( AmoebaTorsionForce::ParametersPerTorsion );
torsion2.resize( AmoebaTorsionForce::ParametersPerTorsion );
torsion3.resize( AmoebaTorsionForce::ParametersPerTorsion );
for( unsigned int ii = 0; ii < AmoebaTorsionForce::ParametersPerTorsion; ii++ ){
torsion1[ii] = torsions[index].torsionParameters[0][ii];
torsion2[ii] = torsions[index].torsionParameters[1][ii];
torsion3[ii] = torsions[index].torsionParameters[2][ii];
}
}
void AmoebaTorsionForce::setTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4,
std::vector<double> torsion1, std::vector<double> torsion2, std::vector<double> torsion3 ) {
torsions[index].particle1 = particle1;
torsions[index].particle2 = particle2;
torsions[index].particle3 = particle3;
torsions[index].particle4 = particle4;
torsions[index].copyTorsionParameter( 0, torsion1 );
torsions[index].copyTorsionParameter( 1, torsion2 );
torsions[index].copyTorsionParameter( 2, torsion3 );
}
ForceImpl* AmoebaTorsionForce::createImpl() {
return new AmoebaTorsionForceImpl(*this);
}
/* -------------------------------------------------------------------------- *
* Amoeba OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/ContextImpl.h"
#include "internal/AmoebaTorsionForceImpl.h"
#include "amoebaKernels.h"
using namespace OpenMM;
using std::pair;
using std::vector;
using std::set;
AmoebaTorsionForceImpl::AmoebaTorsionForceImpl(AmoebaTorsionForce& owner) : owner(owner) {
}
AmoebaTorsionForceImpl::~AmoebaTorsionForceImpl() {
}
void AmoebaTorsionForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaTorsionForceKernel::Name(), context);
dynamic_cast<CalcAmoebaTorsionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
}
void AmoebaTorsionForceImpl::calcForces(ContextImpl& context ) {
dynamic_cast<CalcAmoebaTorsionForceKernel&>(kernel.getImpl()).executeForces(context);
}
double AmoebaTorsionForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaTorsionForceKernel&>(kernel.getImpl()).executeEnergy(context);
}
std::vector<std::string> AmoebaTorsionForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaTorsionForceKernel::Name());
return names;
}
/* -------------------------------------------------------------------------- *
* AmoebaOpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
#include "AmoebaTorsionTorsionForce.h"
#include "internal/AmoebaTorsionTorsionForceImpl.h"
using namespace OpenMM;
AmoebaTorsionTorsionForce::AmoebaTorsionTorsionForce() {
}
int AmoebaTorsionTorsionForce::addTorsionTorsion(int particle1, int particle2, int particle3,
int particle4, int particle5, int chiralCheckAtomIndex,
int gridIndex) {
torsionTorsions.push_back(TorsionTorsionInfo(particle1, particle2, particle3, particle4, particle5, chiralCheckAtomIndex, gridIndex));
return torsionTorsions.size()-1;
}
void AmoebaTorsionTorsionForce::getTorsionTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4,
int& particle5, int& chiralCheckAtomIndex, int& gridIndex) const {
particle1 = torsionTorsions[index].particle1;
particle2 = torsionTorsions[index].particle2;
particle3 = torsionTorsions[index].particle3;
particle4 = torsionTorsions[index].particle4;
particle5 = torsionTorsions[index].particle5;
chiralCheckAtomIndex = torsionTorsions[index].chiralCheckAtomIndex;
gridIndex = torsionTorsions[index].gridIndex;
}
void AmoebaTorsionTorsionForce::setTorsionTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4,
int particle5, int chiralCheckAtomIndex, int gridIndex) {
torsionTorsions[index].particle1 = particle1;
torsionTorsions[index].particle2 = particle2;
torsionTorsions[index].particle3 = particle3;
torsionTorsions[index].particle4 = particle4;
torsionTorsions[index].particle5 = particle5;
torsionTorsions[index].chiralCheckAtomIndex = chiralCheckAtomIndex;
torsionTorsions[index].gridIndex = gridIndex;
}
void AmoebaTorsionTorsionForce::getTorsionTorsionGrid(int index, TorsionTorsionGrid& grid ) const {
grid = torsionTorsionGrids[index];
}
void AmoebaTorsionTorsionForce::setTorsionTorsionGrid(int index, TorsionTorsionGrid& grid ) {
if( index >= torsionTorsionGrids.size() ){
torsionTorsionGrids.resize( index + 1);
}
torsionTorsionGrids[index] = grid;
}
ForceImpl* AmoebaTorsionTorsionForce::createImpl() {
return new AmoebaTorsionTorsionForceImpl(*this);
}
/* -------------------------------------------------------------------------- *
* Amoeba OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/ContextImpl.h"
#include "internal/AmoebaTorsionTorsionForceImpl.h"
#include "amoebaKernels.h"
using namespace OpenMM;
using std::pair;
using std::vector;
using std::set;
AmoebaTorsionTorsionForceImpl::AmoebaTorsionTorsionForceImpl(AmoebaTorsionTorsionForce& owner) : owner(owner) {
}
AmoebaTorsionTorsionForceImpl::~AmoebaTorsionTorsionForceImpl() {
}
void AmoebaTorsionTorsionForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaTorsionTorsionForceKernel::Name(), context);
dynamic_cast<CalcAmoebaTorsionTorsionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
}
void AmoebaTorsionTorsionForceImpl::calcForces(ContextImpl& context ) {
dynamic_cast<CalcAmoebaTorsionTorsionForceKernel&>(kernel.getImpl()).executeForces(context);
}
double AmoebaTorsionTorsionForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaTorsionTorsionForceKernel&>(kernel.getImpl()).executeEnergy(context);
}
std::vector<std::string> AmoebaTorsionTorsionForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaTorsionTorsionForceKernel::Name());
return names;
}
/* -------------------------------------------------------------------------- *
* AmoebaOpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
#include "AmoebaVdwForce.h"
#include "internal/AmoebaVdwForceImpl.h"
using namespace OpenMM;
AmoebaVdwForce::AmoebaVdwForce() {
}
int AmoebaVdwForce::addParticle(int ivIndex, int classIndex, double sigma, double sigma4, double epsilon, double epsilon4, double reductionFactor ) {
parameters.push_back(VdwInfo(ivIndex, classIndex, sigma, sigma4, epsilon, epsilon4, reductionFactor));
return parameters.size()-1;
}
void AmoebaVdwForce::getParticleParameters(int particleIndex, int& ivIndex, int& classIndex,
double& sigma, double& sigma4, double& epsilon, double& epsilon4, double& reductionFactor ) const {
ivIndex = parameters[particleIndex].ivIndex;
classIndex = parameters[particleIndex].classIndex;
sigma = parameters[particleIndex].sigma;
sigma4 = parameters[particleIndex].sigma4;
epsilon = parameters[particleIndex].epsilon;
epsilon4 = parameters[particleIndex].epsilon4;
reductionFactor = parameters[particleIndex].reductionFactor;
}
void AmoebaVdwForce::setParticleParameters(int particleIndex, int ivIndex, int classIndex,
double sigma, double sigma4, double epsilon, double epsilon4, double reductionFactor ) {
parameters[particleIndex].ivIndex = ivIndex;
parameters[particleIndex].classIndex = classIndex;
parameters[particleIndex].sigma = sigma;
parameters[particleIndex].sigma4 = sigma4;
parameters[particleIndex].epsilon = epsilon;
parameters[particleIndex].epsilon4 = epsilon4;
parameters[particleIndex].reductionFactor = reductionFactor;
}
void AmoebaVdwForce::setSigEpsTableSize(int tableSize ) {
sigEpsTable.resize( tableSize );
for( unsigned int ii = 0; ii < tableSize; ii++ ){
sigEpsTable[ii].resize( tableSize );
}
}
int AmoebaVdwForce::getSigEpsTableSize(void ) const {
return static_cast<int>(sigEpsTable.size( ));
}
void AmoebaVdwForce::setSigEpsTableEntry(int indexI, int indexJ, double combinedSigma, double combinedEpsilon, double combinedSigma4, double combinedEpsilon4 ) {
sigEpsTable[indexI][indexJ].resize( 4 );
sigEpsTable[indexI][indexJ][0] = combinedSigma;
sigEpsTable[indexI][indexJ][1] = combinedEpsilon;
sigEpsTable[indexI][indexJ][2] = combinedSigma4;
sigEpsTable[indexI][indexJ][3] = combinedEpsilon4;
}
void AmoebaVdwForce::getSigEpsTableEntry(int indexI, int indexJ, double& combinedSigma, double& combinedEpsilon, double& combinedSigma4, double& combinedEpsilon4 ) const {
combinedSigma = sigEpsTable[indexI][indexJ][0];
combinedEpsilon = sigEpsTable[indexI][indexJ][1];
combinedSigma4 = sigEpsTable[indexI][indexJ][2];
combinedEpsilon4 = sigEpsTable[indexI][indexJ][3];
}
void AmoebaVdwForce::setSigmaCombiningRule(std::string& inputSigmaCombiningRule ) {
sigmaCombiningRule = inputSigmaCombiningRule;
}
std::string AmoebaVdwForce::getSigmaCombiningRule( void ) const {
return sigmaCombiningRule;
}
void AmoebaVdwForce::setEpsilonCombiningRule(std::string& inputEpsilonCombiningRule ) {
epsilonCombiningRule = inputEpsilonCombiningRule;
}
std::string AmoebaVdwForce::getEpsilonCombiningRule( void ) const {
return epsilonCombiningRule;
}
void AmoebaVdwForce::setParticleExclusions( int particleIndex, std::vector< int >& inputExclusions ) {
if( exclusions.size() < parameters.size() ){
exclusions.resize( parameters.size() );
}
if( exclusions.size() < particleIndex ){
exclusions.resize( particleIndex + 10 );
}
for( unsigned int ii = 0; ii < inputExclusions.size(); ii++ ){
exclusions[particleIndex].push_back( inputExclusions[ii] );
}
}
void AmoebaVdwForce::getParticleExclusions( int particleIndex, std::vector< int >& outputExclusions ) const {
outputExclusions.resize( exclusions[particleIndex].size() );
for( unsigned int ii = 0; ii < exclusions[particleIndex].size(); ii++ ){
outputExclusions[ii] = exclusions[particleIndex][ii];
}
}
ForceImpl* AmoebaVdwForce::createImpl() {
return new AmoebaVdwForceImpl(*this);
}
/* -------------------------------------------------------------------------- *
* Amoeba OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/ContextImpl.h"
#include "internal/AmoebaVdwForceImpl.h"
#include "amoebaKernels.h"
using namespace OpenMM;
using std::pair;
using std::vector;
using std::set;
AmoebaVdwForceImpl::AmoebaVdwForceImpl(AmoebaVdwForce& owner) : owner(owner) {
}
AmoebaVdwForceImpl::~AmoebaVdwForceImpl() {
}
void AmoebaVdwForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaVdwForceKernel::Name(), context);
dynamic_cast<CalcAmoebaVdwForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
}
void AmoebaVdwForceImpl::calcForces(ContextImpl& context ) {
dynamic_cast<CalcAmoebaVdwForceKernel&>(kernel.getImpl()).executeForces(context);
}
double AmoebaVdwForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaVdwForceKernel&>(kernel.getImpl()).executeEnergy(context);
}
std::vector<std::string> AmoebaVdwForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaVdwForceKernel::Name());
return names;
}
/* -------------------------------------------------------------------------- *
* AmoebaOpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
#include "AmoebaWcaDispersionForce.h"
#include "internal/AmoebaWcaDispersionForceImpl.h"
#include <cmath>
using namespace OpenMM;
AmoebaWcaDispersionForce::AmoebaWcaDispersionForce() {
epso = 0.1100;
epsh = 0.0135;
rmino = 1.7025;
rminh = 1.3275;
awater = 0.033428;
slevy = 1.0;
shctd = 0.81;
dispoff = 0.26;
}
int AmoebaWcaDispersionForce::addParticle( double radius, double epsilon ) {
parameters.push_back(WcaDispersionInfo( radius, epsilon));
return parameters.size()-1;
}
void AmoebaWcaDispersionForce::getParticleParameters(int particleIndex, double& radius, double& epsilon ) const {
radius = parameters[particleIndex].radius;
epsilon = parameters[particleIndex].epsilon;
}
void AmoebaWcaDispersionForce::setParticleParameters(int particleIndex, double radius, double epsilon ) {
parameters[particleIndex].radius = radius;
parameters[particleIndex].epsilon = epsilon;
}
void AmoebaWcaDispersionForce::getMaximumDispersionEnergy(int particleIndex, double& maxDispersionEnergy ) const {
const double pi = 3.1415926535897;
// from last loop in subroutine knp in ksolv.f
double rdisp, epsi;
getParticleParameters( particleIndex, rdisp, epsi );
if( epsi <= 0.0 || rdisp <= 0.0 ){
maxDispersionEnergy = 0.0;
return;
}
double rmini = rdisp;
rdisp += getDispoff();
double epso = getEpso();
double emixo = std::sqrt(epso) + std::sqrt(epsi);
emixo = 4.0*epso*epsi/(emixo*emixo);
double rmino = getRmino();
double rmino2 = rmino*rmino;
double rmini2 = rmini*rmini;
double rmixo = 2.0*(rmino2*rmino + rmini2*rmini) / (rmino2 + rmini2);
double rmixo3 = rmixo*rmixo*rmixo;
double rmixo7 = rmixo*rmixo3*rmixo3;
double ao = emixo*rmixo7;
double epsh = getEpsh();
double emixh = std::sqrt(epsh) + std::sqrt(epsi);
emixh = 4.0*epsh*epsi/(emixh*emixh);
double rminh = getRminh();
double rminh2 = rminh*rminh;
double rmixh = rminh*rminh + rmini2;
rmixh = 2.0 * (rminh2*rminh + rmini2*rmini) / (rminh2 + rmini2);
double rmixh3 = rmixh*rmixh*rmixh;
double rmixh7 = rmixh3*rmixh3*rmixh;
double ah = emixh*rmixh7;
double rdisp3 = rdisp*rdisp*rdisp;
double rdisp7 = rdisp*rdisp3*rdisp3;
double rdisp11 = rdisp7*rdisp3*rdisp;
double cdisp;
if( rdisp < rmixh) {
cdisp = -4.0*pi*emixh*(rmixh3-rdisp3)/3.0 - emixh*18.0/11.0*rmixh3*pi;
} else {
cdisp = 2.0*pi*(2.0*rmixh7-11.0*rdisp7)*ah/ (11.0*rdisp11);
}
cdisp *= 2.0;
if (rdisp < rmixo ) {
cdisp -= 4.0*pi*emixo*(rmixo3-rdisp3)/3.0;
cdisp -= emixo*18.0/11.0*rmixo3*pi;
} else {
cdisp += 2.0*pi*(2.0*rmixo7-11.0*rdisp7) * ao/(11.0*rdisp11);
}
maxDispersionEnergy = getSlevy()*getAwater()*cdisp;
// (void) fprintf( stderr,"Wca %5d %14.7e %14.7e %14.7e %14.7e %14.7e %14.7e %14.7e %14.7e\n",
// particleIndex, rdisp,rmini,epsi, emixh,rmixh,emixo,rmixo,cdisp );
return;
}
double AmoebaWcaDispersionForce::getTotalMaximumDispersionEnergy( void ) const {
double totalMaximumDispersionEnergy = 0.0;
for( int ii = 0; ii < getNumParticles(); ii++ ){
double maximumDispersionEnergy;
getMaximumDispersionEnergy( ii, maximumDispersionEnergy );
totalMaximumDispersionEnergy += maximumDispersionEnergy;
}
return totalMaximumDispersionEnergy;
}
double AmoebaWcaDispersionForce::getEpso( void ) const {
return epso;
}
double AmoebaWcaDispersionForce::getEpsh( void ) const {
return epsh;
}
double AmoebaWcaDispersionForce::getRmino( void ) const {
return rmino;
}
double AmoebaWcaDispersionForce::getRminh( void ) const {
return rminh;
}
double AmoebaWcaDispersionForce::getAwater( void ) const {
return awater;
}
double AmoebaWcaDispersionForce::getShctd( void ) const {
return shctd;
}
double AmoebaWcaDispersionForce::getDispoff( void ) const {
return dispoff;
}
double AmoebaWcaDispersionForce::getSlevy( void ) const {
return slevy;
}
void AmoebaWcaDispersionForce::setEpso( double inputEpso ){
epso = inputEpso;
}
void AmoebaWcaDispersionForce::setEpsh( double inputEpsh ){
epsh = inputEpsh;
}
void AmoebaWcaDispersionForce::setRmino( double inputRmino ){
rmino = inputRmino;
}
void AmoebaWcaDispersionForce::setRminh( double inputRminh ){
rminh = inputRminh;
}
void AmoebaWcaDispersionForce::setAwater( double inputAwater ){
awater = inputAwater;
}
void AmoebaWcaDispersionForce::setShctd( double inputShctd ){
shctd = inputShctd;
}
void AmoebaWcaDispersionForce::setDispoff( double inputDispoff ){
dispoff = inputDispoff;
}
void AmoebaWcaDispersionForce::setSlevy( double inputSlevy ){
slevy = inputSlevy;
}
ForceImpl* AmoebaWcaDispersionForce::createImpl() {
return new AmoebaWcaDispersionForceImpl(*this);
}
/* -------------------------------------------------------------------------- *
* Amoeba OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/ContextImpl.h"
#include "internal/AmoebaWcaDispersionForceImpl.h"
#include "amoebaKernels.h"
using namespace OpenMM;
using std::pair;
using std::vector;
using std::set;
AmoebaWcaDispersionForceImpl::AmoebaWcaDispersionForceImpl(AmoebaWcaDispersionForce& owner) : owner(owner) {
}
AmoebaWcaDispersionForceImpl::~AmoebaWcaDispersionForceImpl() {
}
void AmoebaWcaDispersionForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaWcaDispersionForceKernel::Name(), context);
dynamic_cast<CalcAmoebaWcaDispersionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
}
void AmoebaWcaDispersionForceImpl::calcForces(ContextImpl& context ) {
dynamic_cast<CalcAmoebaWcaDispersionForceKernel&>(kernel.getImpl()).executeForces(context);
}
double AmoebaWcaDispersionForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaWcaDispersionForceKernel&>(kernel.getImpl()).executeEnergy(context);
}
std::vector<std::string> AmoebaWcaDispersionForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaWcaDispersionForceKernel::Name());
return names;
}
#---------------------------------------------------
# OpenMMAmoeba CUDA Platform
#
# Creates OpenMM library, base name=OpenMMAmoebaCuda.
# Default libraries are shared & optimized. Variants
# are created for static (_static) and debug (_d).
#
# Windows:
# OpenMMAmoebaCuda[_d].dll
# OpenMMAmoebaCuda[_d].lib
# OpenMMAmoebaCuda_static[_d].lib
# Unix:
# libOpenMMAmoebaCuda[_d].so
# libOpenMMAmoebaCuda_static[_d].a
#----------------------------------------------------
# ----------------------------------------------------------------------------
# logging
SET(LOG FALSE)
IF(LOG)
SET(LOG_FILE "CMakeLog.txt" )
FILE( WRITE ${LOG_FILE} "In plugins/amoeba/platforms/cuda\n")
ENDIF(LOG)
IF(LOG)
MACRO(LOG_DIR LOG_FILE DIR_LIST )
FILE( APPEND ${LOG_FILE} "\n${DIR_LIST}\n")
FOREACH(currentFile ${ARGN})
FILE( APPEND ${LOG_FILE} " ${currentFile}\n" )
ENDFOREACH(currentFile)
ENDMACRO(LOG_DIR)
ENDIF(LOG)
# ----------------------------------------------------------------------------
# Only run tests when cuda-enabled GPU is found
SET(DO_TESTS FALSE)
IF(NOT DEFINED CUDA_HAVE_GPU)
SET(DO_TESTS TRUE)
ENDIF(NOT DEFINED CUDA_HAVE_GPU)
IF(CUDA_HAVE_GPU)
SET(DO_TESTS TRUE)
ENDIF(CUDA_HAVE_GPU)
IF(DO_TESTS)
SUBDIRS (tests)
ENDIF(DO_TESTS)
# The source is organized into subdirectories, but we handle them all from
# this CMakeLists file rather than letting CMake visit them as SUBDIRS.
SET(OPENMM_AMOEBA_SOURCE_SUBDIRS .)
# Collect up information about the version of the OpenMM library we're building
# and make it available to the code so it can be built into the binaries.
SET(OPENMMCUDA_LIBRARY_NAME OpenMMAmoebaCuda)
SET(SHARED_TARGET ${OPENMMCUDA_LIBRARY_NAME})
SET(STATIC_TARGET ${OPENMMCUDA_LIBRARY_NAME}_static)
# Ensure that debug libraries have "_d" appended to their names.
# CMake gets this right on Windows automatically with this definition.
IF (${CMAKE_GENERATOR} MATCHES "Visual Studio")
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE INTERNAL "" FORCE)
ENDIF (${CMAKE_GENERATOR} MATCHES "Visual Studio")
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_TARGET ${SHARED_TARGET}_d)
SET(STATIC_TARGET ${STATIC_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
# These are all the places to search for header files which are
# to be part of the API.
SET(API_AMOEBA_INCLUDE_DIRS) # start empty
FOREACH(subdir ${OPENMM_AMOEBA_SOURCE_SUBDIRS})
# append
SET(API_AMOEBA_INCLUDE_DIRS ${API_AMOEBA_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/include ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/include/internal)
ENDFOREACH(subdir)
## ----------------------------------------------------------------------------
IF(LOG)
LOG_DIR( ${LOG_FILE} "OPENMM_SOURCE_SUBDIRS" ${OPENMM_SOURCE_SUBDIRS} )
LOG_DIR( ${LOG_FILE} "OPENMM_AMOEBA_SOURCE_SUBDIRS" ${OPENMM_AMOEBA_SOURCE_SUBDIRS} )
LOG_DIR( ${LOG_FILE} "API_AMOEBA_INCLUDE_DIRS" ${API_AMOEBA_INCLUDE_DIRS} )
LOG_DIR( ${LOG_FILE} "CMAKE_CURRENT_SOURCE_DIR" ${CMAKE_CURRENT_SOURCE_DIR} )
ENDIF(LOG)
## ----------------------------------------------------------------------------
# We'll need both *relative* path names, starting with their API_AMOEBA_INCLUDE_DIRS,
# and absolute pathnames.
SET(API_AMOEBA_REL_INCLUDE_FILES) # start these out empty
SET(API_AMOEBA_ABS_INCLUDE_FILES)
FOREACH(dir ${API_AMOEBA_INCLUDE_DIRS})
FILE(GLOB fullpaths ${dir}/*.h) # returns full pathnames
SET(API_AMOEBA_ABS_INCLUDE_FILES ${API_AMOEBA_ABS_INCLUDE_FILES} ${fullpaths})
FOREACH(pathname ${fullpaths})
GET_FILENAME_COMPONENT(filename ${pathname} NAME)
SET(API_AMOEBA_REL_INCLUDE_FILES ${API_AMOEBA_REL_INCLUDE_FILES} ${dir}/${filename})
ENDFOREACH(pathname)
ENDFOREACH(dir)
## ----------------------------------------------------------------------------
IF(LOG)
LOG_DIR( ${LOG_FILE} "API_AMOEBA_REL_INCLUDE_FILES" ${API_AMOEBA_REL_INCLUDE_FILES} )
LOG_DIR( ${LOG_FILE} "OPENMM_DIR" ${OPENMM_DIR} )
ENDIF(LOG)
## ----------------------------------------------------------------------------
# collect up source files
SET(SOURCE_FILES) # empty
SET(SOURCE_INCLUDE_FILES)
FOREACH(subdir ${OPENMM_AMOEBA_SOURCE_SUBDIRS})
FILE(GLOB_RECURSE src_files ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/src/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/src/*.c)
FILE(GLOB incl_files ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/src/*.h)
SET(SOURCE_FILES ${SOURCE_FILES} ${src_files}) #append
SET(SOURCE_INCLUDE_FILES ${SOURCE_INCLUDE_FILES} ${incl_files})
IF(LOG)
LOG_DIR( ${LOG_FILE} "Adding include dir: " ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/include )
ENDIF(LOG)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/include)
ENDFOREACH(subdir)
INCLUDE_DIRECTORIES(${OPENMM_DIR}/platforms/cuda/include)
INCLUDE_DIRECTORIES(${OPENMM_DIR}/platforms/cuda/src)
INCLUDE_DIRECTORIES(${OPENMM_DIR}/platforms/cuda/src/kernels)
IF(LOG)
LOG_DIR( ${LOG_FILE} "CMAKE_CURRENT_SOURCE_DIR" ${CMAKE_CURRENT_SOURCE_DIR} )
FILE( APPEND ${LOG_FILE} "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}\n" )
LOG_DIR( ${LOG_FILE} "SOURCE_FILES" ${SOURCE_FILES} )
LOG_DIR( ${LOG_FILE} "SOURCE_INCLUDE_FILES" ${SOURCE_INCLUDE_FILES} )
ENDIF(LOG)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
# SET(FINDCUDA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cuda-cmake)
# SUBDIRS (sharedTarget staticTarget)
SUBDIRS (sharedTarget)
#ifndef AMOEBA_OPENMM_CUDAKERNELFACTORY_H_
#define AMOEBA_OPENMM_CUDAKERNELFACTORY_H_
/* -------------------------------------------------------------------------- *
* AmoebaOpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* -------------------------------------------------------------------------- */
#include "openmm/KernelFactory.h"
namespace OpenMM {
/**
* This KernelFactory creates all kernels for AmoebaCudaPlatform.
*/
class AmoebaCudaKernelFactory : public KernelFactory {
public:
KernelImpl* createKernelImpl(std::string name, const Platform& platform, ContextImpl& context) const;
};
} // namespace OpenMM
#endif /*AMOEBA_OPENMM_CUDAKERNELFACTORY_H_*/
#
# Include CUDA related files.
#
# ----------------------------------------------------------------------------
# logging
SET(LOG FALSE)
IF(LOG)
SET(LOG_FILE "CMakeLog.txt" )
FILE( WRITE ${LOG_FILE} "In amoeba/platforms/cuda/sharedTarget Cmake\n")
# FILE( APPEND ${LOG_FILE} "BROOK_LIB_PATH=${BROOK_LIB_PATH}\n")
ENDIF(LOG)
IF(LOG)
MACRO(LOG_DIR LOG_FILE DIR_LIST )
FILE( APPEND ${LOG_FILE} "\n${DIR_LIST}\n")
FOREACH(currentFile ${ARGN})
FILE( APPEND ${LOG_FILE} " ${currentFile}\n" )
ENDFOREACH(currentFile)
ENDMACRO(LOG_DIR)
ENDIF(LOG)
# ----------------------------------------------------------------------------
SET(OPENMM_BUILD_AMOEBA_PATH ${CMAKE_SOURCE_DIR}/plugins/amoeba)
# ----------------------------------------------------------------------------
IF(LOG)
LOG_DIR( ${LOG_FILE} "Pre OPENMM_SOURCE_SUBDIRS" ${OPENMM_SOURCE_SUBDIRS} )
LOG_DIR( ${LOG_FILE} "Pre OPENMM_AMOEBA_SOURCE_SUBDIRS " ${OPENMM_AMOEBA_SOURCE_SUBDIRS} )
LOG_DIR( ${LOG_FILE} "Pre SOURCE_FILES" ${SOURCE_FILES} )
ENDIF(LOG)
## ----------------------------------------------------------------------------
# message("CUDA_NVCC_FLAGS = ${CUDA_NVCC_FLAGS}")
# INCLUDE(${FINDCUDA_DIR}/FindCuda.cmake)
# message("CUDA_NVCC_FLAGS = ${CUDA_NVCC_FLAGS}")
INCLUDE_DIRECTORIES(${CUDA_INCLUDE})
LINK_DIRECTORIES(${CUDA_TARGET_LINK})
FOREACH(subdir ${OPENMM_AMOEBA_SOURCE_SUBDIRS})
FILE(GLOB src_files ${OPENMM_BUILD_AMOEBA_PATH}/platforms/cuda/${subdir}/src/*.cu ${OPENMM_BUILD_AMOEBA_PATH}/platforms/cuda/src/*/*.cu)
SET(SOURCE_FILES ${SOURCE_FILES} ${src_files})
CUDA_INCLUDE_DIRECTORIES(BEFORE ${OPENMM_BUILD_AMOEBA_PATH}/platforms/cuda/../${subdir}/include)
ENDFOREACH(subdir)
# ----------------------------------------------------------------------------
IF(LOG)
LOG_DIR( ${LOG_FILE} "OPENMM_BUILD_AMOEBA_PATH" ${OPENMM_BUILD_AMOEBA_PATH} )
FILE( APPEND ${LOG_FILE} "OPENMM_BUILD_AMOEBA_PATH=${OPENMM_BUILD_AMOEBA_PATH}\n")
LOG_DIR( ${LOG_FILE} "OPENMM_SOURCE_SUBDIRS" ${OPENMM_SOURCE_SUBDIRS} )
LOG_DIR( ${LOG_FILE} "CMAKE_SOURCE_DIR" ${CMAKE_SOURCE_DIR} )
LOG_DIR( ${LOG_FILE} "CUDA_INCLUDE" ${CUDA_INCLUDE} )
LOG_DIR( ${LOG_FILE} "CUDA_TARGET_LINK" ${CUDA_TARGET_LINK} )
LOG_DIR( ${LOG_FILE} "SHARED_TARGET" ${SHARED_TARGET} )
LOG_DIR( ${LOG_FILE} "OPENMM_DIR" ${OPENMM_DIR} )
LOG_DIR( ${LOG_FILE} "SOURCE_FILES" ${SOURCE_FILES} )
ENDIF(LOG)
## ----------------------------------------------------------------------------
# CUDA_INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/jama/include)
CUDA_INCLUDE_DIRECTORIES(${OPENMM_BUILD_AMOEBA_PATH}/platforms/cuda/../src
${OPENMM_BUILD_AMOEBA_PATH}/platforms/cuda/include
${OPENMM_DIR}/platforms/cuda/src
${OPENMM_DIR}/platforms/cuda/include
${OPENMM_DIR}/platforms/cuda/src/kernels
${OPENMM_DIR}/openmmapi/include )
CUDA_ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${OPENMM_LIBRARY_NAME}_d optimized ${OPENMM_LIBRARY_NAME} )
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${OPENMM_LIBRARY_NAME}Cuda_d optimized ${OPENMM_LIBRARY_NAME}Cuda )
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${OPENMM_AMOEBA_LIBRARY_NAME}_d optimized ${OPENMM_AMOEBA_LIBRARY_NAME} )
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "-DOPENMMCUDAAMOEBA_BUILDING_SHARED_LIBRARY")
INSTALL_TARGETS(/lib/plugins RUNTIME_DIRECTORY /lib/plugins ${SHARED_TARGET})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment