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)
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"
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
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)
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
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
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)
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
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)
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)
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)
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")
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)
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);
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")
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)
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)
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)
def getParams(self): if pmi.workerIsActive(): return self.cxxclass.getParams(self)
def getPotential(self, type1, type2): if pmi.workerIsActive(): return self.cxxclass.getPotential(self, type1, type2)
def setFixedTuplesAdress(self, fixedtuples): if pmi.workerIsActive(): self.cxxclass.setFixedTuplesAdress(self, fixedtuples)
def getNameOfInteraction(self, number): if pmi.workerIsActive(): for name, iid in self._interaction2id.items(): if iid == number: return name
def getInteractionByName(self, name): if pmi.workerIsActive(): return self.getInteraction(self._interaction2id[name])
def getAllInteractions(self): if pmi.workerIsActive(): return { k: self.getInteraction(v) for k, v in self._interaction2id.items() }
def unexclude(self, pid1, pid2): if pmi.workerIsActive(): self.cxxclass.unexclude(self, pid1, pid2)
def __init__(self, system, atrp_activator): if pmi.workerIsActive(): cxxinit(self, analysis_ATRPActivatorStats, system, atrp_activator)
def getTuples(self): if pmi.workerIsActive(): tuples=self.cxxclass.getTuples(self) return tuples
def getLongtimeMaxBondLocal(self): if pmi.workerIsActive(): mxsqr = self.cxxclass.getLongtimeMaxBondSqr(self) return sqrt(mxsqr)
def add(self, pid1, pid2): if pmi.workerIsActive(): return self.cxxclass.add(self, pid1, pid2)
def __init__(self, system, ftl): if pmi.workerIsActive(): cxxinit(self, interaction_FixedTripleListTypesTabulatedSubEnsAngular, system, ftl)
def setFixedTripleList(self, ftl): if pmi.workerIsActive(): self.cxxclass.setFixedTripleList(self, ftl)
def observe_triple(self, ftl): if pmi.workerIsActive(): self.cxxclass.observe_triple(self, ftl)
def __init__(self, storage): if pmi.workerIsActive(): cxxinit(self, _espressopp.FixedTupleList, storage)
def getAllInteractions(self): if pmi.workerIsActive(): return {k: self.getInteraction(v) for k, v in self._interaction2id.items()}
def getNumberOfInteractions(self): if pmi.workerIsActive(): return self.cxxclass.getNumberOfInteractions(self)
def size(self): if pmi.workerIsActive(): return self.cxxclass.size(self)
def run(self, niter, verbose=False): if pmi.workerIsActive(): return self.cxxclass.run(self, niter, verbose)
def exclude_from(self, exclusionlist): if pmi.workerIsActive(): for e1, e2 in exclusionlist: self.exclude(e1, e2)
def setTrace(self, switch): if pmi.workerIsActive(): self.cxxclass.setTrace(self, switch)
def add(self, pid1, pid2, pid3): if pmi.workerIsActive(): return self.cxxclass.add(self, pid1, pid2, pid3)
def observe_quadruple(self, fql): if pmi.workerIsActive(): self.cxxclass.observe_quadruple(self, fql)
def __init__(self, system, ftl, potential): if pmi.workerIsActive(): cxxinit(self, interaction_FixedTripleListLambdaTabulatedAngular, system, ftl, potential)
def localSize(self): if pmi.workerIsActive(): return self.cxxclass.localSize(self)
def totalSize(self): if pmi.workerIsActive(): return self.cxxclass.totalSize(self)
def resetLongtimeMaxBond(self): if pmi.workerIsActive(): self.cxxclass.resetLongtimeMaxBondSqr(self)
def __init__(self, storage): if pmi.workerIsActive(): cxxinit(self, _espressopp.FixedPairList, storage)
def __init__(self, system, fql): if pmi.workerIsActive(): cxxinit(self, interaction_FixedQuadrupleListTypesDihedralRB, system, fql)
def setFixedQuadrupleList(self, fixedlist): if pmi.workerIsActive(): self.cxxclass.setFixedQuadrupleList(self, fixedlist)
def getBonds(self): if pmi.workerIsActive(): bonds=self.cxxclass.getBonds(self) return bonds
def getFixedQuadrupleList(self): if pmi.workerIsActive(): return self.cxxclass.getFixedQuadrupleList(self)
def removeInteraction(self, number): if pmi.workerIsActive(): self.cxxclass.removeInteraction(self, number)
def __init__(self, itype, cutoff=infinity): if pmi.workerIsActive(): cxxinit(self, interaction_MultiMixedTabulated, itype, cutoff)
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)
def __init__(self, vl): if pmi.workerIsActive(): cxxinit(self, interaction_VerletListMultiMixedTabulated, vl)
def setPotential(self, type1, type2, potential): if pmi.workerIsActive(): self.cxxclass.setPotential(self, type1, type2, potential)