def test_system(): system = System(np.array([50., 50., 50.])) system.add_strands(generate_helix(10, double=True)) print(system.lammps) print(system.bonds) return system
def main(strands: bool = True, edges: bool = False): system = System(np.array([30., 30., 30.])) if strands: system.add_strands(with_strands()) if edges: system.add_strands(with_edges()) system.write_oxDNA('connect') return
def generate_system(box: np.ndarray) -> System: """Generate a simple oxDNA system""" system = System(box) strand = generate_helix(40, double=False)[0] new = [] for nt in strand.nucleotides[10:30]: new.append(nt.make_across()) new = Strand(nucleotides=new[::-1]) system.add_strands([strand, new]) return system
def main(): strand = long_strand() print(f"Strand:\n {strand}") print(f" Length between bases of the end nucleotides: {strand_length(strand)}") route = long_route() print(f"\nSingle-Edge Route:\n {route}") print(f" Length between bases of the end nucleotides: {strand_length(route)}") multi = multi_route() print(f"\nDouble-Edge Route:\n {multi}") print(f" Length between bases of the end nucleotides: {strand_length(multi)}") system = System(np.array([50., 50., 50.])) system.add_strands([strand, route, multi]) system.write_oxDNA('route') return
def generate_system(length=16, n_strands=10, stapled=5): # generate a strand strands = [] doubles = [] strand, double = generate_helix(n=length, double=True) strands.append(strand.copy()) doubles.append(double.copy()) for i in range(n_strands-1): last_nuc = strands[-1].nucleotides[-1] direction = -last_nuc._a3 a1 = -last_nuc._a1 # ensure the backbone position is FENE_LENGTH away from # the backbone position of the previous nucleotide start = last_nuc.pos_back + (FENE_LENGTH - POS_BACK) * a1 # generate strand above that's going in opposite direction strand, double = generate_helix( n=length, start_position=start, direction=direction, a1=a1, double=True, ) strands.append(strand) doubles.append(double) # using the two previously created strands create a new strand that is added to the system nucleotides = [] for strand in strands: nucleotides += strand.nucleotides strand = Strand(nucleotides=nucleotides) # create system and add the final completed strand main_system = System(np.array([80.0, 80.0, 80.0])) main_system.add_strand(strand) actual_doubles = [] for strand in doubles: nucleotides = strand.nucleotides[:stapled] actual_doubles.append(Strand(nucleotides=nucleotides)) main_system.add_strands(actual_doubles) #main_system.write_oxDNA('turns') return main_system
def test_System(): system = System(np.array([50.0, 50.0, 50.0])) strand_1 = Strand( [ Nucleotide( "A", np.array([1.0, 0.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), Nucleotide( "A", np.array([2.0, 0.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), Nucleotide( "A", np.array([3.0, 0.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), Nucleotide( "A", np.array([4.0, 0.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), Nucleotide( "A", np.array([5.0, 0.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), Nucleotide( "A", np.array([6.0, 0.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), ] ) strand_2 = Strand( [ Nucleotide( "T", np.array([1.0, 2.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), Nucleotide( "T", np.array([2.0, 2.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), Nucleotide( "T", np.array([3.0, 2.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), Nucleotide( "T", np.array([4.0, 2.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), Nucleotide( "T", np.array([5.0, 2.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), Nucleotide( "T", np.array([6.0, 2.0, 0.0]), np.array([1.0, 0.0, 0.0]), np.array([0, 0.0, 1.0]), ), ] ) system.add_strands([strand_1, strand_2]) assert isinstance(system, System) assert system.E_tot == 0.0 assert len(system.dataframe.count()) == 10 assert len(system.configuration.count()) == 5 assert len(system.topology.count()) == 4 assert len(system.strands) == 2 assert len(system.nucleotides) == 12 system.strands[0].sequence = "AGAGAG" system.add_strand(system.strands[0].copy()) system.strands[0].sequence = "TATATA" assert len(system.strands) == 3 assert len(system.nucleotides) == 18 assert system.strands[0].sequence == "TATATA" assert system.strands[2].sequence == "AGAGAG" strand_3 = system.strands[1].copy() strand_3.sequence = "CCCGGG" strand_4 = strand_3.copy() strand_4.sequence = "AAATTT" system.add_strands({ 0 : strand_3, 1 : strand_4 }) assert len(system.strands) == 5 assert len(system.nucleotides) == 30 print(system.strands) assert system.strands[0].sequence == "CCCGGG" assert system.strands[1].sequence == "AAATTT" assert system.strands[2].sequence == "TATATA" print(system) print(system.dataframe) # system.write_oxDNA() return