def make_quasi_mode_input(self, mode=1, firstter=None, lastter=None): f_inp = path.join(self.inp_folder, 'quasi_mode.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) dcd_inp = path.join(self.mode_traj_folder, 'mode.{0}.dcd'.format(str(mode))) inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm() inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) inp.read_traj(dcd_inp) inp.calculate_avg() inp.coor_copy() inp.write_quasi(vect=False) inp.quasi_end() inp.close_unit(21) inp.end()
def make_no_h_crd_input(self, amber=False, firstter=None, lastter=None): if self.type_na == 'arna+arna': supplement1 = None supplement2 = None elif self.type_na == 'bdna+bdna': supplement1 = get_patch(self.seq1, 1) supplement2 = get_patch(self.seq2, 2) f_inp = path.join(self.inp_folder, 'write_no_h_crd.inp') crd_inp = path.join(self.mkcrd_folder, '{0}.crd'.format(self.type_na)) crd_out = path.join(self.heavy_folder, '{0}.nohydrogen.crd'.format(self.type_na)) inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm(amber=amber) inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') if supplement1 is not None: inp.write_supplement(supplement1) inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') if supplement2 is not None: inp.write_supplement(supplement2) inp.gen_angle_dihedral() inp.read_crd(crd_inp) inp.delete_selection() inp.write_crd(crd_out) inp.end()
def fit_dcd_to_avg_input(self, amber=False, begin=1, frame_num=10000, massweighted=False, firstter=None, lastter=None, dcd_out=None): if self.type_na == 'arna+arna': supplement1 = None supplement2 = None elif self.type_na == 'bdna+bdna': supplement1 = get_patch(self.seq1, 1) supplement2 = get_patch(self.seq2, 2) f_inp = path.join(self.inp_folder, 'fit_dcd_to_avg.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) dcd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.dcd'.format(self.type_na)) if dcd_out is None: dcd_out = path.join(self.heavy_folder, '{0}.nohydrogen.fitavg.dcd'.format(self.type_na)) inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm(amber=amber) inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') if supplement1 is not None: inp.write_supplement(supplement1) inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') if supplement2 is not None: inp.write_supplement(supplement2) inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) inp.coor_copy() inp.read_traj(dcd_inp) inp.open_write_traj(dcd_out) inp.write_noh_dcd(begin=begin, frame_num=frame_num, mass_weighted=massweighted) inp.close_unit(21) inp.close_unit(30) inp.end()
def make_convert_avg_to_dcd_input(self, amber=False, supplement1=None, supplement2=None, firstter=None, lastter=None): f_inp = path.join(self.inp_folder, 'convert_avgcrd_avgdcd.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) dcd_out = path.join(self.mode_traj_folder, 'aa.avg.dcd') inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm(amber=amber) inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') if supplement1 is not None: inp.write_supplement(supplement1) inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') if supplement2 is not None: inp.write_supplement(supplement2) inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) inp.convert_avg_to_dcd(dcd_out) inp.end()
def make_gen_diff_crd(self, mode=1, n_frame=1000, firstter=None, lastter=None): f_inp = path.join(self.inp_folder, 'gen_diff_crd.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) dcd_inp = path.join(self.mode_traj_folder, 'mode.{0}.dcd'.format(str(mode))) dcd_out = path.join(self.diff_folder, 'mode.{0}.dcd'.format(str(mode))) inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm() inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) inp.coor_copy() inp.make_diff_to_avg(dcd_inp, dcd_out, n_frame) inp.end()
def make_get_eigenvector_input(self, modeid=1, firstter=None, lastter=None): f_inp = path.join(self.inp_folder, 'get_eigenvectors.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) mode_inp = path.join(self.nm_folder, 'quasi.nmvector.crd') inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm() inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) inp.read_normal_mode(mode_inp) inp.print_eigenvector(modeid) inp.quasi_end() inp.end()
def make_gen_mode_input(self, modeid, phase='3.6', ncyc=10, temp=310, tfre=1, amber=False, supplement1=None, supplement2=None, firstter=None, lastter=None): f_inp = path.join(self.inp_folder, 'gen_mode.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) mode_inp = path.join(self.nm_folder, 'quasi.nmvector.crd') dcd_out = path.join(self.mode_traj_folder, 'mode.{0}.dcd'.format(str(modeid))) inp = Script(f_inp, mode='write', description='generate mode {0}'.format(modeid)) inp.write_bomlev() inp.initialize_rtf_prm(amber=amber) inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') if supplement1 is not None: inp.write_supplement(supplement1) inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') if supplement2 is not None: inp.write_supplement(supplement2) inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) inp.read_normal_mode(mode_inp) inp.write_quasi_mode_dcd(dcd_out, modeid, phase=phase, ncyc=ncyc, temp=temp, tfre=tfre) inp.quasi_end() inp.end()
def make_quasi_input(self, mass_all_same=False, amber=False, supplement1=None, supplement2=None, begin=1, stop=10000, firstter=None, lastter=None): f_inp = path.join(self.inp_folder, 'quasi.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) dcd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.fitavg.dcd'.format(self.type_na)) crd_out = path.join(self.nm_folder, 'quasi.nmvector.crd') inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm(amber=amber) inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') if supplement1 is not None: inp.write_supplement(supplement1) inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') if supplement2 is not None: inp.write_supplement(supplement2) inp.gen_angle_dihedral() inp.delete_selection() if mass_all_same: inp.set_all_mass_same() inp.read_crd(crd_inp) inp.read_traj(dcd_inp) inp.calculate_avg(begin=begin, stop=stop) inp.coor_copy() inp.write_quasi() inp.write_quasi_mode_crd(crd_out) inp.quasi_end() inp.close_unit(21) inp.end()
def make_no_h_dcd_input(self, mass_weighted=True, amber=False, supplement1=None, supplement2=None, begin=1, frame_num=10000, firstter=None, lastter=None): f_inp = path.join(self.inp_folder, 'write_no_h_dcd.inp') crd_inp = path.join(self.mkcrd_folder, '{0}.crd'.format(self.type_na)) dcd_out = path.join(self.heavy_folder, '{0}.nohydrogen.dcd'.format(self.type_na)) inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm(amber=amber) inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') if supplement1 is not None: inp.write_supplement(supplement1) inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') if supplement2 is not None: inp.write_supplement(supplement2) inp.gen_angle_dihedral() inp.read_crd(crd_inp) inp.coor_copy() inp.read_traj(self.inp_dcd) inp.open_write_traj(dcd_out) inp.write_noh_dcd(mass_weighted=mass_weighted, begin=begin, frame_num=frame_num) inp.close_unit(21) inp.close_unit(30) inp.end()
def make_gen_mode_superimpose_input(self, modeid): f_inp = path.join(self.inp_folder, 'gen_mode.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) mode_inp = path.join(self.nm_folder, 'quasi.nmvector.crd') dcd_out = path.join(self.mode_traj_folder, 'mode.1to{0}.dcd'.format(str(modeid))) inp = Script(f_inp, mode='write', description='generate mode {0}'.format(modeid)) inp.write_bomlev() inp.initialize_rtf_prm() inp.write_seq(self.seq1, segid='strand1') inp.write_seq(self.seq2, segid='strand2') inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) inp.read_normal_mode(mode_inp) inp.write_quasi_mode_supe_dcd(dcd_out, modeid) inp.quasi_end() inp.end()
def make_covariance_mat_input(self, modeid=0): f_inp = path.join(self.inp_folder, 'write_covar_mat.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) dcd_inp = path.join(self.mode_traj_folder, 'mode.{0}.dcd'.format(str(modeid))) crd_out = path.join(self.covar_folder, 'covar.{0}.crd'.format(str(modeid))) inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm() inp.write_seq(self.seq1, segid='strand1') inp.write_seq(self.seq2, segid='strand2') inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) inp.read_traj(dcd_inp) inp.write_covar_mat_crd(crd_out) inp.close_unit(15) inp.close_unit(21) inp.end()
def make_avg_crd_input(self, selection='all', amber=False, supplement1=None, supplement2=None, firstter=None, lastter=None): f_inp = path.join(self.inp_folder, 'write_no_h_avg_crd.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.crd'.format(self.type_na)) dcd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.dcd'.format(self.type_na)) crd_out = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm(amber=amber) inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') if supplement1 is not None: inp.write_supplement(supplement1) inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') if supplement2 is not None: inp.write_supplement(supplement2) inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) inp.read_traj(dcd_inp) inp.calculate_avg(selection=selection) inp.coor_copy() inp.write_crd(crd_out, comp=True) inp.end()
def make_proj_md_to_mode_input(self, mode): f_inp = path.join(self.inp_folder, 'proj_md_to_mode.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) mode_inp = path.join(self.nm_folder, 'quasi.nmvector.crd') dcd_inp = path.join(self.diff_folder, 'mode.0.dcd') crd_out = path.join(self.coef_folder, 'proj.md.onto.mode.{0}.crd'.format(str(mode))) inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm() inp.write_seq(self.seq1, segid='strand1') inp.write_seq(self.seq2, segid='strand2') inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) # inp.coor_copy() inp.read_traj(dcd_inp) inp.read_normal_mode(mode_inp) inp.write_proj_mode_crd(crd_out, mode) inp.quasi_end() inp.close_unit(21) inp.end()
def make_get_eigenvector_input_v1(self, modeid=1, amber=False, supplement1=None, supplement2=None, firstter=None, lastter=None): f_inp = path.join(self.inp_folder, 'get_eigenvectors.inp') crd_inp = path.join(self.heavy_folder, '{0}.nohydrogen.avg.crd'.format(self.type_na)) mode_inp = path.join(self.nm_folder, 'quasi.nmvector.crd') crd_out = path.join(self.nm_single_folder, 'mode.{0}.crd'.format(modeid)) inp = Script(f_inp) inp.write_bomlev() inp.initialize_rtf_prm(amber=amber) inp.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') if supplement1 is not None: inp.write_supplement(supplement1) inp.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') if supplement2 is not None: inp.write_supplement(supplement2) inp.gen_angle_dihedral() inp.delete_selection() inp.read_crd(crd_inp) inp.read_normal_mode(mode_inp) inp.write_quasi_single_mode_crd(modeid, crd_out) inp.quasi_end() inp.end()
def make_crd_input(self, amber=False, firstter=None, lastter=None): if self.type_na == 'arna+arna': na = 'arna' supplement1 = None supplement2 = None elif self.type_na == 'bdna+bdna': na = 'bdna' supplement1 = get_patch(self.seq1, 1) supplement2 = get_patch(self.seq2, 2) crd1 = path.join(self.mkcrd_folder, '{0}1.crd'.format(na)) inp1 = Script(path.join(self.mkcrd_folder, '{0}1.inp'.format(na))) inp1.write_bomlev() inp1.initialize_rtf_prm(amber=amber) inp1.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') if supplement1 is not None: inp1.write_supplement(supplement1) inp1.gen_angle_dihedral() inp1.read_pdb(path.join(self.mkcrd_folder, '{0}1.1.pdb'.format(na))) inp1.write_crd(crd1) inp1.end() crd2 = path.join(self.mkcrd_folder, '{0}2.crd'.format(na)) inp2 = Script(path.join(self.mkcrd_folder, '{0}2.inp'.format(na))) inp2.write_bomlev() inp2.initialize_rtf_prm(amber=amber) inp2.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') if supplement2 is not None: inp2.write_supplement(supplement2) inp2.gen_angle_dihedral() inp2.read_pdb(path.join(self.mkcrd_folder, '{0}2.1.pdb'.format(na))) inp2.write_crd(crd2) inp2.end() inp3 = Script(path.join(self.mkcrd_folder, '{0}.inp'.format(self.type_na))) inp3.write_bomlev() inp3.initialize_rtf_prm(amber=amber) inp3.write_seq(self.seq1, firstter=firstter, lastter=lastter, segid='strand1') if supplement1 is not None: inp3.write_supplement(supplement1) inp3.write_seq(self.seq2, firstter=firstter, lastter=lastter, segid='strand2') if supplement2 is not None: inp3.write_supplement(supplement2) inp3.gen_angle_dihedral() inp3.read_crd(crd1, selection='segid strand1', ignore=True) inp3.read_crd(crd2, selection='segid strand2', ignore=True) inp3.write_crd(path.join(self.mkcrd_folder, '{0}.crd'.format(self.type_na))) inp3.end()