def bonds_mat2(raw_topo, Nc): """Create bond matrix from topology string and number of chains""" bead_list, Nmc = pt.parse_beads(raw_topo) Nbm = len(bead_list) bonds = pt.construct_bonds(bead_list, Nmc, 0) for i in range(1, Nc): bonds = np.vstack( (bonds, pt.construct_bonds(bead_list, Nmc, i*Nmc*Nbm)) ) return bonds
Natoms = NA * rho_el[elmat] * Vcl/(elem_wts["C"]*1e-3) elif elmat == "quartz": Natoms = NA * rho_el[elmat] * Vcl/((elem_wts["Si"] + 2*elem_wts["O"])*1e-3) elif elmat == "silica": Natoms = NA * rho_el[elmat] * Vcl/((elem_wts["Si"] + 2*elem_wts["O"])*1e-3) print("CL:", int(Natoms/Nelb*rc**3), "electrode atoms per bead at density", rho_el[elmat]) print("Electrode beads: %i | Platinum beads: %i" % (Nelb, NPt)) else: Lcl, Vcl = 0.0, 0.0 print("Electrodes off.") # ===== set polymer parameters if args["--parsetopo"]: raw_topo = data["topology"] print("Topology:", raw_topo) bead_list, Nmc = pt.parse_beads(raw_topo) # information about connectivity Nbm = len(bead_list) bead_dict = pt.gen_bead_dict(raw_topo) # dict of beads in one monomer bead_types = sorted("".join(bead_dict.keys()) + "W") Nbt = len(bead_types) coeff2num = dict((coeff, num) for num, coeff in zip(range(1, Nbt+1), bead_types)) beads = [] [[beads.append(coeff2num[k]) for i in range(v)] for k, v in sorted(bead_dict.items())] else: Nbm, Nmc = 5, data["mono-per-chain"] bead_types = "ABCW" beads = [1, 1, 1, 2, 3] Nbt = len(bead_types) print("Nmc: %i, Nbm: %i" % (Nmc, Nbm)) # ===== setting numbers