def addCoeffs(self, itype, filename, type):
         """
         Each processor takes the broadcasted interpolation type,
         filename and particle type
         """
         if pmi.workerIsActive():
             self.cxxclass.addCoeffs(self, itype, filename, type)
Ejemplo n.º 2
0
    def scaleVolume(self, *args):

        if pmi.workerIsActive():
          if len(args) == 1:
            arg0 = args[0]
            if isinstance(arg0, Real3D):
              #print arg0," is a Real3D object"
              self.cxxclass.scaleVolume( arg0 )
            elif hasattr(arg0, '__iter__'):
              if len(arg0) == 3:
                #print args, " has iterator and length 3"
                self.cxxclass.scaleVolume(self, toReal3DFromVector(arg0) )
              elif len(arg0) == 1:
                #print args, " has iterator and length 1"
                self.cxxclass.scaleVolume(self, toReal3DFromVector(arg0[0], arg0[0], arg0[0]) )
              else:
                print args, " is invalid"
            else:
              #print args, " is scalar"
              self.cxxclass.scaleVolume(self, toReal3DFromVector( [arg0, arg0, arg0] ) )
          elif len(args) == 3:          
            #print args, " is 3 numbers"
            self.cxxclass.scaleVolume(self, toReal3DFromVector(*args) )
          else:
            print args, " is invalid"
Ejemplo n.º 3
0
 def removeInteractionByName(self, name):
     if pmi.workerIsActive():
         if name not in self._interaction2id:
             raise RuntimeError("Interaction {} not found".format(name))
         interaction_id = self._interaction2id[name]
         self.cxxclass.removeInteraction(self, interaction_id)
         self._interaction2id = {k: v if v < interaction_id else v - 1 for k, v in self._interaction2id.iteritems()}
         self._interaction_pid = max(self._interaction2id.values()) + 1
Ejemplo n.º 4
0
 def addSingles(self, singlelist):
     """
     Each processor takes the broadcasted singlelist and
     adds those particles that are owned by this processor.
     """
     
     if pmi.workerIsActive():
         for pid in singlelist:
             self.cxxclass.add(self, pid)
Ejemplo n.º 5
0
    def getAllTriples(self):

        if pmi.workerIsActive():
            triples=[]
            ntriples=self.localSize()
            for i in range(ntriples):
              triple=self.cxxclass.getTriple(self, i+1)
              triples.append(triple)
            return triples
Ejemplo n.º 6
0
    def getAllPairs(self):

        if pmi.workerIsActive():
            pairs=[]
            npairs=self.localSize()
            for i in range(npairs):
              pair=self.cxxclass.getPair(self, i+1)
              pairs.append(pair)
            return pairs 
Ejemplo n.º 7
0
 def addTriples(self, triplelist):
     """
     Each processor takes the broadcasted triplelist and
     adds those triples whose first particle is owned by
     this processor.
     """
     if pmi.workerIsActive():
         for triple in triplelist:
             pid1, pid2, pid3 = triple
             self.cxxclass.add(self, pid1, pid2, pid3)
Ejemplo n.º 8
0
    def addInteraction(self, interaction, name=None):

        if pmi.workerIsActive():
            ret_val = self.cxxclass.addInteraction(self, interaction)
            if name is not None:
                if name in self._interaction2id:
                    raise RuntimeError('Interaction with name {} already defined.'.format(name))
                self._interaction2id[name] = self._interaction_pid
            self._interaction_pid += 1
            return ret_val
Ejemplo n.º 9
0
 def addAdrParticles(self, pids, rebuild=True):
     """
     Each processor takes the broadcasted atomistic particles
     and adds it to its list.
     """
     if pmi.workerIsActive():
         for pid in pids:
             self.cxxclass.addAdrParticle(self, pid)
         if rebuild:
             # rebuild list with adress particles
             self.cxxclass.rebuild(self)
Ejemplo n.º 10
0
    def addQuadruples(self, quadruplelist):
        """
        Each processor takes the broadcasted quadruplelist and
        adds those quadruples whose first particle is owned by
        this processor.
        """

        if pmi.workerIsActive():
            for quadruple in quadruplelist:
                pid1, pid2, pid3, pid4 = quadruple
                self.cxxclass.add(self, pid1, pid2, pid3, pid4)
Ejemplo n.º 11
0
 def addBonds(self, bondlist):
     """
     Each processor takes the broadcasted bondlist and
     adds those pairs whose first particle is owned by
     this processor.
     """
     
     if pmi.workerIsActive():
         for bond in bondlist:
             pid1, pid2 = bond
             self.cxxclass.add(self, pid1, pid2)
Ejemplo n.º 12
0
    def __init__(self, system, interaction, compute_method=None):
        if pmi.workerIsActive():
            if compute_method is None:
                compute_method = "ALL"
            if compute_method not in ["AT", "CG", "ALL"]:
                raise ValueError("Wrong compute_method, should be ALL, AT or CG")

            if compute_method == "ALL":
                cxxinit(self, analysis_PotentialEnergy, system, interaction)
            else:
                cxxinit(self, analysis_PotentialEnergy, system, interaction, compute_method == "AT")
Ejemplo n.º 13
0
 def exclude(self, exclusionlist):
     """
     Each processor takes the broadcasted exclusion list
     and adds it to its list.
     """
     if pmi.workerIsActive():
         for pair in exclusionlist:
             pid1, pid2 = pair
             self.cxxclass.exclude(self, pid1, pid2)
         # rebuild list with exclusions
         self.cxxclass.rebuild(self)
Ejemplo n.º 14
0
 def addTuples(self, tuplelist):
     """
     Each processor takes the broadcasted tuplelist and
     adds those tuples whose virtual particle is owned by
     this processor.
     """
     if pmi.workerIsActive():
         for tuple in tuplelist: 
             for pid in tuple:
                 self.cxxclass.add(self, pid)
             self.cxxclass.addTs(self);
Ejemplo n.º 15
0
    def getInteraction(self, number):

        if pmi.workerIsActive():
            ni = self.getNumberOfInteractions()
            if ni > 0:
                if number >=0 and number < ni: 
                    return self.cxxclass.getInteraction(self, number)
                else:
                    raise Error("Interaction number %i does not exist" % number)
            else:
                raise Error("interaction list of system is empty")
Ejemplo n.º 16
0
    def __init__(self, system, cutoff, exclusionlist=[]):

        if pmi.workerIsActive():
            if (exclusionlist == []):
                # rebuild list in constructor
                cxxinit(self, _espressopp.VerletList, system, cutoff, True)
            else:
                # do not rebuild list in constructor
                cxxinit(self, _espressopp.VerletList, system, cutoff, False)
                # add exclusions
                for pair in exclusionlist:
                    pid1, pid2 = pair
                    self.cxxclass.exclude(self, pid1, pid2)
                # now rebuild list with exclusions
                self.cxxclass.rebuild(self)
Ejemplo n.º 17
0
    def __init__(self, system, cutoff, exclusionlist=[]):

        if pmi.workerIsActive():
          '''
          cxxinit(self, _espressopp.VerletListTriple, system, cutoff, True)
          if (exclusionlist != []):
            print 'Warning! Exclusion list is not yet implemented to the triple verlet \
                  list. Nothing happend to exclusion list'
          '''

          if (exclusionlist == []):
            # rebuild list in constructor
            cxxinit(self, _espressopp.VerletListTriple, system, cutoff, True)
          else:
            # do not rebuild list in constructor
            cxxinit(self, _espressopp.VerletListTriple, system, cutoff, False)
            # add exclusions
            for pid in exclusionlist:
                self.cxxclass.exclude(self, pid)
            # now rebuild list with exclusions
            self.cxxclass.rebuild(self)
Ejemplo n.º 18
0
    def __init__(self, system, cutoff, adrcut, dEx, dHy, adrCenter=[], pids=[], exclusionlist=[], sphereAdr=False):

        if pmi.workerIsActive():
            cxxinit(self, _espressopp.VerletListAdress, system, cutoff, adrcut, False, dEx, dHy)
            #self.cxxclass.setAtType(self, atType)
            # check for exclusions
            if (exclusionlist != []):
                # add exclusions
                for pair in exclusionlist:
                    pid1, pid2 = pair
                    self.cxxclass.exclude(self, pid1, pid2)
            # add adress particles
            if (pids != []):
                for pid in pids:
                    self.cxxclass.addAdrParticle(self, pid)
            # set adress center
            if (adrCenter != []):
                self.cxxclass.setAdrCenter(self, adrCenter[0], adrCenter[1], adrCenter[2])
            # set adress region type (slab or spherical)
            self.cxxclass.setAdrRegionType(self,sphereAdr)
            
            # rebuild list now
            self.cxxclass.rebuild(self)
Ejemplo n.º 19
0
 def getParams(self):
     if pmi.workerIsActive():
         return self.cxxclass.getParams(self)
Ejemplo n.º 20
0
 def getPotential(self, type1, type2):
     if pmi.workerIsActive():
         return self.cxxclass.getPotential(self, type1, type2)
Ejemplo n.º 21
0
 def setFixedTuplesAdress(self, fixedtuples):
     if pmi.workerIsActive():
         self.cxxclass.setFixedTuplesAdress(self, fixedtuples)
Ejemplo n.º 22
0
 def getNameOfInteraction(self, number):
     if pmi.workerIsActive():
         for name, iid in self._interaction2id.items():
             if iid == number:
                 return name
Ejemplo n.º 23
0
 def getInteractionByName(self, name):
     if pmi.workerIsActive():
         return self.getInteraction(self._interaction2id[name])
Ejemplo n.º 24
0
 def getAllInteractions(self):
     if pmi.workerIsActive():
         return {
             k: self.getInteraction(v)
             for k, v in self._interaction2id.items()
         }
Ejemplo n.º 25
0
 def unexclude(self, pid1, pid2):
     if pmi.workerIsActive():
         self.cxxclass.unexclude(self, pid1, pid2)
Ejemplo n.º 26
0
 def __init__(self, system, atrp_activator):
     if pmi.workerIsActive():
         cxxinit(self, analysis_ATRPActivatorStats, system, atrp_activator)
Ejemplo n.º 27
0
    def getTuples(self):

        if pmi.workerIsActive():
            tuples=self.cxxclass.getTuples(self)
            return tuples
Ejemplo n.º 28
0
    def getLongtimeMaxBondLocal(self):

        if pmi.workerIsActive(): 
            mxsqr = self.cxxclass.getLongtimeMaxBondSqr(self)
            return sqrt(mxsqr)
Ejemplo n.º 29
0
    def add(self, pid1, pid2):

        if pmi.workerIsActive():
            return self.cxxclass.add(self, pid1, pid2)
Ejemplo n.º 30
0
 def __init__(self, system, ftl):
     if pmi.workerIsActive():
         cxxinit(self,
                 interaction_FixedTripleListTypesTabulatedSubEnsAngular,
                 system, ftl)
Ejemplo n.º 31
0
 def setFixedTripleList(self, ftl):
     if pmi.workerIsActive():
         self.cxxclass.setFixedTripleList(self, ftl)
Ejemplo n.º 32
0
 def observe_triple(self, ftl):
     if pmi.workerIsActive():
         self.cxxclass.observe_triple(self, ftl)
Ejemplo n.º 33
0
    def __init__(self, storage):

        if pmi.workerIsActive():
            cxxinit(self, _espressopp.FixedTupleList, storage)
Ejemplo n.º 34
0
 def getAllInteractions(self):
     if pmi.workerIsActive():
         return {k: self.getInteraction(v) for k, v in self._interaction2id.items()}
Ejemplo n.º 35
0
    def getNumberOfInteractions(self):

        if pmi.workerIsActive():
            return self.cxxclass.getNumberOfInteractions(self)
Ejemplo n.º 36
0
    def size(self):

        if pmi.workerIsActive():
            return self.cxxclass.size(self)
Ejemplo n.º 37
0
 def run(self, niter, verbose=False):
     if pmi.workerIsActive():
         return self.cxxclass.run(self, niter, verbose)
Ejemplo n.º 38
0
 def exclude_from(self, exclusionlist):
     if pmi.workerIsActive():
         for e1, e2 in exclusionlist:
             self.exclude(e1, e2)
Ejemplo n.º 39
0
    def setTrace(self, switch):

        if pmi.workerIsActive():
            self.cxxclass.setTrace(self, switch)
Ejemplo n.º 40
0
    def add(self, pid1, pid2, pid3):

        if pmi.workerIsActive():
            return self.cxxclass.add(self, pid1, pid2, pid3)
Ejemplo n.º 41
0
 def observe_quadruple(self, fql):
     if pmi.workerIsActive():
         self.cxxclass.observe_quadruple(self, fql)
Ejemplo n.º 42
0
 def __init__(self, system, ftl, potential):
     if pmi.workerIsActive():
         cxxinit(self, interaction_FixedTripleListLambdaTabulatedAngular,
                 system, ftl, potential)
Ejemplo n.º 43
0
    def localSize(self):

        if pmi.workerIsActive():
            return self.cxxclass.localSize(self)
Ejemplo n.º 44
0
    def totalSize(self):

        if pmi.workerIsActive():
            return self.cxxclass.totalSize(self)
Ejemplo n.º 45
0
    def resetLongtimeMaxBond(self):

        if pmi.workerIsActive():
          self.cxxclass.resetLongtimeMaxBondSqr(self)
Ejemplo n.º 46
0
    def localSize(self):

        if pmi.workerIsActive():
            return self.cxxclass.localSize(self)
Ejemplo n.º 47
0
    def __init__(self, storage):

        if pmi.workerIsActive():
            cxxinit(self, _espressopp.FixedPairList, storage)
Ejemplo n.º 48
0
 def __init__(self, system, fql):
     if pmi.workerIsActive():
         cxxinit(self, interaction_FixedQuadrupleListTypesDihedralRB,
                 system, fql)
Ejemplo n.º 49
0
    def size(self):

        if pmi.workerIsActive():
            return self.cxxclass.size(self)
Ejemplo n.º 50
0
 def setFixedQuadrupleList(self, fixedlist):
     if pmi.workerIsActive():
         self.cxxclass.setFixedQuadrupleList(self, fixedlist)
Ejemplo n.º 51
0
    def getBonds(self):

        if pmi.workerIsActive():
          bonds=self.cxxclass.getBonds(self)
          return bonds
Ejemplo n.º 52
0
 def getFixedQuadrupleList(self):
     if pmi.workerIsActive():
         return self.cxxclass.getFixedQuadrupleList(self)
Ejemplo n.º 53
0
    def removeInteraction(self, number):

        if pmi.workerIsActive():
            self.cxxclass.removeInteraction(self, number)
Ejemplo n.º 54
0
 def __init__(self, itype, cutoff=infinity):
     if pmi.workerIsActive():
         cxxinit(self, interaction_MultiMixedTabulated, itype, cutoff)
Ejemplo n.º 55
0
    def getNumberOfInteractions(self):

        if pmi.workerIsActive():
            return self.cxxclass.getNumberOfInteractions(self)
Ejemplo n.º 56
0
 def register_table(self, tab1, tab2, chem_conv_obs, min_value, max_value):
     if pmi.workerIsActive():
         self.cxxclass.register_table(self, tab1, tab2, chem_conv_obs,
                                      min_value, max_value)
Ejemplo n.º 57
0
 def getInteractionByName(self, name):
     if pmi.workerIsActive():
         return self.getInteraction(self._interaction2id[name])
Ejemplo n.º 58
0
 def __init__(self, vl):
     if pmi.workerIsActive():
         cxxinit(self, interaction_VerletListMultiMixedTabulated, vl)
Ejemplo n.º 59
0
    def setTrace(self, switch):

        if pmi.workerIsActive():
            self.cxxclass.setTrace(self, switch)
Ejemplo n.º 60
0
 def setPotential(self, type1, type2, potential):
     if pmi.workerIsActive():
         self.cxxclass.setPotential(self, type1, type2, potential)