def set_nmonomers(sefl,nmonomers): """Set the number of monomers to be in the chain and rebuild the monomer list.""" self.nmonomers = nmonomers self.mono = [] for i in range(self.nmonomers): self.mono.append(monomer(i+1))
def initialize_monomers(self): self.monomers = [] for i in self.settings.monomers: self.monomers.append(monomer(i, self.settings, inv_cnt=1, s_id=0)) self.probabilities = [i.probability for i in self.monomers] if sum(self.probabilities) != 1: raise ValueError("Sum of probabilities is not equal to 1")
def __init__(self,nmonomers=-1,poly_id=1): """Initialize empty lists which will need to be filled.""" # id number self.poly_id = poly_id # polymer type coefficients self.coeff = {"atom":[],"bond":[],"angle":[],"pair":[],"dihedral":[],"improper":[]} # polymer final arrays for writing self.value = {"atom":[],"bond":[],"angle":[],"dihedral":[],"improper":[]} # polymer pre-assignment prior to build self.type_id = {"atom":[],"bond":[],"angle":[],"dihedral":[],"improper":[]} self.unique_id = {"atom":[],"bond":[],"angle":[],"pair":[],"dihedral":[],"improper":[]} self.connector_id = [] # monomer object if nmonomers > 0: self.nmonomers = nmonomers self.mono = [] for i in range(self.nmonomers): self.mono.append(monomer(i+1))