espressopp/espressopp

View on GitHub
src/interaction/LennardJonesEnergyCapped.py

Summary

Maintainability
A
1 hr
Test Coverage
#  Copyright (C) 2012,2013
#      Max Planck Institute for Polymer Research
#  Copyright (C) 2008,2009,2010,2011
#      Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
#  This file is part of ESPResSo++.
#
#  ESPResSo++ is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  ESPResSo++ 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 General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.


r"""
***********************************************
espressopp.interaction.LennardJonesEnergyCapped
***********************************************

.. math::

        V(r) = 4 \varepsilon \left[ \left( \frac{\sigma}{r} \right)^{12} -
        \left( \frac{\sigma}{r} \right)^{6} \right]

where `r` is either the distance or the capped distance, depending on which is
greater.






.. function:: espressopp.interaction.LennardJonesEnergyCapped(epsilon, sigma, cutoff, caprad, shift)

                :param epsilon: (default: 1.0)
                :param sigma: (default: 1.0)
                :param cutoff: (default: infinity)
                :param caprad: (default: 0.0)
                :param shift: (default: "auto")
                :type epsilon: real
                :type sigma: real
                :type cutoff:
                :type caprad: real
                :type shift:

.. function:: espressopp.interaction.VerletListLennardJonesEnergyCapped(vl)

                :param vl:
                :type vl:

.. function:: espressopp.interaction.VerletListLennardJonesEnergyCapped.getPotential(type1, type2)

                :param type1:
                :param type2:
                :type type1:
                :type type2:
                :rtype:

.. function:: espressopp.interaction.VerletListLennardJonesEnergyCapped.setPotential(type1, type2, potential)

                :param type1:
                :param type2:
                :param potential:
                :type type1:
                :type type2:
                :type potential:

.. function:: espressopp.interaction.VerletListAdressLennardJonesEnergyCapped(vl, fixedtupleList)

                :param vl:
                :param fixedtupleList:
                :type vl:
                :type fixedtupleList:

.. function:: espressopp.interaction.VerletListAdressLennardJonesEnergyCapped.getPotentialAT(type1, type2)

                :param type1:
                :param type2:
                :type type1:
                :type type2:
                :rtype:

.. function:: espressopp.interaction.VerletListAdressLennardJonesEnergyCapped.getPotentialCG(type1, type2)

                :param type1:
                :param type2:
                :type type1:
                :type type2:
                :rtype:

.. function:: espressopp.interaction.VerletListAdressLennardJonesEnergyCapped.setPotentialAT(type1, type2, potential)

                :param type1:
                :param type2:
                :param potential:
                :type type1:
                :type type2:
                :type potential:

.. function:: espressopp.interaction.VerletListAdressLennardJonesEnergyCapped.setPotentialCG(type1, type2, potential)

                :param type1:
                :param type2:
                :param potential:
                :type type1:
                :type type2:
                :type potential:

.. function:: espressopp.interaction.VerletListHadressLennardJonesEnergyCapped(vl, fixedtupleList)

                :param vl:
                :param fixedtupleList:
                :type vl:
                :type fixedtupleList:

.. function:: espressopp.interaction.VerletListHadressLennardJonesEnergyCapped.getPotentialAT(type1, type2)

                :param type1:
                :param type2:
                :type type1:
                :type type2:
                :rtype:

.. function:: espressopp.interaction.VerletListHadressLennardJonesEnergyCapped.getPotentialCG(type1, type2)

                :param type1:
                :param type2:
                :type type1:
                :type type2:
                :rtype:

.. function:: espressopp.interaction.VerletListHadressLennardJonesEnergyCapped.setPotentialAT(type1, type2, potential)

                :param type1:
                :param type2:
                :param potential:
                :type type1:
                :type type2:
                :type potential:

.. function:: espressopp.interaction.VerletListHadressLennardJonesEnergyCapped.setPotentialCG(type1, type2, potential)

                :param type1:
                :param type2:
                :param potential:
                :type type1:
                :type type2:
                :type potential:

.. function:: espressopp.interaction.CellListLennardJonesEnergyCapped(stor)

                :param stor:
                :type stor:

.. function:: espressopp.interaction.CellListLennardJonesEnergyCapped.getPotential(type1, type2)

                :param type1:
                :param type2:
                :type type1:
                :type type2:
                :rtype:

.. function:: espressopp.interaction.CellListLennardJonesEnergyCapped.setPotential(type1, type2, potential)

                :param type1:
                :param type2:
                :param potential:
                :type type1:
                :type type2:
                :type potential:

.. function:: espressopp.interaction.FixedPairListLennardJonesEnergyCapped(system, vl, potential)

                :param system:
                :param vl:
                :param potential:
                :type system:
                :type vl:
                :type potential:

.. function:: espressopp.interaction.FixedPairListLennardJonesEnergyCapped.getPotential()

                :rtype:

.. function:: espressopp.interaction.FixedPairListLennardJonesEnergyCapped.setPotential(potential)

                :param potential:
                :type potential:
"""
from espressopp import pmi, infinity
from espressopp.esutil import *

from espressopp.interaction.Potential import *
from espressopp.interaction.Interaction import *
from _espressopp import interaction_LennardJonesEnergyCapped, \
                      interaction_VerletListLennardJonesEnergyCapped, \
                      interaction_VerletListAdressLennardJonesEnergyCapped, \
                      interaction_VerletListHadressLennardJonesEnergyCapped, \
                      interaction_CellListLennardJonesEnergyCapped, \
                      interaction_FixedPairListLennardJonesEnergyCapped

class LennardJonesEnergyCappedLocal(PotentialLocal, interaction_LennardJonesEnergyCapped):

    def __init__(self, epsilon=1.0, sigma=1.0,
                 cutoff=infinity, caprad=0.0 ,shift="auto"):
        """Initialize the local Lennard Jones object."""
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            if shift =="auto":
                cxxinit(self, interaction_LennardJonesEnergyCapped,
                        epsilon, sigma, cutoff, caprad)
            else:
                cxxinit(self, interaction_LennardJonesEnergyCapped,
                        epsilon, sigma, cutoff, caprad, shift)

class VerletListLennardJonesEnergyCappedLocal(InteractionLocal, interaction_VerletListLennardJonesEnergyCapped):

    def __init__(self, vl):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            cxxinit(self, interaction_VerletListLennardJonesEnergyCapped, vl)

    def setPotential(self, type1, type2, potential):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            self.cxxclass.setPotential(self, type1, type2, potential)

    def getPotential(self, type1, type2):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            return self.cxxclass.getPotential(self, type1, type2)

class VerletListAdressLennardJonesEnergyCappedLocal(InteractionLocal, interaction_VerletListAdressLennardJonesEnergyCapped):

    def __init__(self, vl, fixedtupleList):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            cxxinit(self, interaction_VerletListAdressLennardJonesEnergyCapped, vl, fixedtupleList)

    def setPotentialAT(self, type1, type2, potential):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            self.cxxclass.setPotentialAT(self, type1, type2, potential)

    def setPotentialCG(self, type1, type2, potential):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            self.cxxclass.setPotentialCG(self, type1, type2, potential)

    def getPotentialAT(self, type1, type2):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            return self.cxxclass.getPotentialAT(self, type1, type2)

    def getPotentialCG(self, type1, type2):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            return self.cxxclass.getPotentialCG(self, type1, type2)

class VerletListHadressLennardJonesEnergyCappedLocal(InteractionLocal, interaction_VerletListHadressLennardJonesEnergyCapped):

    def __init__(self, vl, fixedtupleList):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            cxxinit(self, interaction_VerletListHadressLennardJonesEnergyCapped, vl, fixedtupleList)

    def setPotentialAT(self, type1, type2, potential):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            self.cxxclass.setPotentialAT(self, type1, type2, potential)

    def setPotentialCG(self, type1, type2, potential):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            self.cxxclass.setPotentialCG(self, type1, type2, potential)

    def getPotentialAT(self, type1, type2):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            return self.cxxclass.getPotentialAT(self, type1, type2)

    def getPotentialCG(self, type1, type2):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            return self.cxxclass.getPotentialCG(self, type1, type2)

class CellListLennardJonesEnergyCappedLocal(InteractionLocal, interaction_CellListLennardJonesEnergyCapped):

    def __init__(self, stor):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            cxxinit(self, interaction_CellListLennardJonesEnergyCapped, stor)

    def setPotential(self, type1, type2, potential):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            self.cxxclass.setPotential(self, type1, type2, potential)

    def getPotential(self, type1, type2):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            return self.cxxclass.getPotential(self, type1, type2)

class FixedPairListLennardJonesEnergyCappedLocal(InteractionLocal, interaction_FixedPairListLennardJonesEnergyCapped):

    def __init__(self, system, vl, potential):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            cxxinit(self, interaction_FixedPairListLennardJonesEnergyCapped, system, vl, potential)

    def setPotential(self, potential):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            self.cxxclass.setPotential(self, potential)

    def getPotential(self):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
            return self.cxxclass.getPotential(self)

if pmi.isController:
    class LennardJonesEnergyCapped(Potential):
        'The Lennard-Jones potential.'
        pmiproxydefs = dict(
            cls = 'espressopp.interaction.LennardJonesEnergyCappedLocal',
            pmiproperty = ['epsilon', 'sigma', 'cutoff', 'caprad']
            )

    class VerletListLennardJonesEnergyCapped(Interaction, metaclass=pmi.Proxy):
        pmiproxydefs = dict(
            cls =  'espressopp.interaction.VerletListLennardJonesEnergyCappedLocal',
            pmicall = ['setPotential', 'getPotential']
            )

    class VerletListAdressLennardJonesEnergyCapped(Interaction, metaclass=pmi.Proxy):
        pmiproxydefs = dict(
            cls =  'espressopp.interaction.VerletListAdressLennardJonesEnergyCappedLocal',
            pmicall = ['setPotentialAT', 'setPotentialCG', 'getPotentialAT', 'getPotentialCG']
            )

    class VerletListHadressLennardJonesEnergyCapped(Interaction, metaclass=pmi.Proxy):
        pmiproxydefs = dict(
            cls =  'espressopp.interaction.VerletListHadressLennardJonesEnergyCappedLocal',
            pmicall = ['setPotentialAT', 'setPotentialCG', 'getPotentialAT', 'getPotentialCG']
            )

    class CellListLennardJonesEnergyCapped(Interaction, metaclass=pmi.Proxy):
        pmiproxydefs = dict(
            cls =  'espressopp.interaction.CellListLennardJonesEnergyCappedLocal',
            pmicall = ['setPotential', 'getPotential']
            )

    class FixedPairListLennardJonesEnergyCapped(Interaction, metaclass=pmi.Proxy):
        pmiproxydefs = dict(
            cls =  'espressopp.interaction.FixedPairListLennardJonesEnergyCappedLocal',
            pmicall = ['setPotential']
            )