def run(parm_file_name, traj_file_name, asu_prmtop_file_name, asu_rst7_file_name, prop_a, prob_b, prop_c, target_unit_cell, atoms_per_uc, wrap, buffer, spacegroup = ' '): print "loading prmtop %s" %parm_file_name parm = AmberParm(parm_file_name) print "loading trajec %s" %traj_file_name traj = NetCDFTraj.open_old(traj_file_name) n_frames = traj.frame U, invU, UCbox = get_U_invU(asu_rst7_file_name) start_atm, end_atm = calc_start_end_atm(atoms_per_uc, target_unit_cell, prop_a, prop_b, prop_c) for frame in range(n_frames): # for frame in range(0,1): coords = traj.coordinates(frame) frac_crds = get_frac_crds(coords, traj, U) cntred_frac_crds = center_frac_coords(frac_crds, parm, start_atm, end_atm) print frame if wrap: wrap_coords(parm, frac_crds, cntred_frac_crds, prop_a, prop_b, prop_c, buffer, solvent=True) atom_selection = select_atoms(cntred_frac_crds, parm, buffer, solvent=True) frac_crds = rev_translate_frac_crds(frac_crds, target_unit_cell, prop_a, prop_b, prop_c) coords = get_cart_crds(frac_crds, traj, invU).flatten() write_pdb(coords, parm, atom_selection, 'PDBDATA_UC%02d/%04d' %(target_unit_cell,frame), UCbox, spacegroup) # import code; code.interact(local=dict(globals(), **locals())) return atom_selection
def testScientificPython(self): """ Test ScientificPython parsing """ import chemistry.amber as amber if utils.has_scientific(): amber.use('Scientific') from chemistry.amber.netcdffiles import NetCDFTraj, NetCDFRestart traj = NetCDFTraj.open_old(get_fn('tz2.truncoct.nc')) self._check_traj(traj) rst = NetCDFRestart.open_old(get_fn('ncinpcrd.rst7')) self._check_rst(rst) else: self.assertRaises(ImportError, lambda: amber.use('Scientific'))
def run(parm_file_name, traj_file_name, asu_prmtop_file_name, asu_rst7_file_name, prop_a, prob_b, prop_c, target_unit_cell, atoms_per_uc, wrap, buffer, spacegroup=' '): parm = AmberParm(parm_file_name) traj = NetCDFTraj.open_old(traj_file_name) n_frames = traj.frame U, invU, UCbox = get_U_invU(asu_rst7_file_name) start_atm, end_atm = calc_start_end_atm(atoms_per_uc, target_unit_cell, prop_a, prop_b, prop_c) # for frame in range(n_frames): # parm = AmberParm(parm_file_name) for frame in range(0, 1): coords = traj.coordinates(frame) frac_crds = get_frac_crds(coords, traj, U) cntred_frac_crds = center_frac_coords(frac_crds, parm, start_atm, end_atm) # atom_selection1 = select_atoms(cntred_frac_crds, parm, buffer, solvent=True) print frame # print atom_selection1 # print frac_crds[9794] # print cntred_frac_crds[9794] # if wrap: # wrap_coords(parm, frac_crds, cntred_frac_crds, prop_a, prop_b, prop_c, buffer, solvent=True) atom_selection = select_atoms(cntred_frac_crds, parm, buffer, solvent=True) frac_crds = rev_translate_frac_crds(frac_crds, target_unit_cell, prop_a, prop_b, prop_c) coords = get_cart_crds(frac_crds, traj, invU).flatten() # print atom_selection # print cntred_frac_crds[9794] write_pdb(coords, parm, atom_selection, 'uc%d_frame%d' % (target_unit_cell, frame), UCbox, spacegroup) # write_pdb(coords, parm, atom_selection1, 'uc%d_frame%d_nowrap' %(target_unit_cell,frame)) write_amber_files(coords, parm, 'uc%d_frame%d' % (target_unit_cell, frame), atom_selection) # import code; code.interact(local=dict(globals(), **locals())) return atom_selection
def run(parm_file_name, traj_file_name, asu_prmtop_file_name, asu_rst7_file_name, prop_a, prob_b, prop_c, target_unit_cell, atoms_per_uc, wrap, buffer, spacegroup = ' '): parm = AmberParm(parm_file_name) traj = NetCDFTraj.open_old(traj_file_name) n_frames = traj.frame U, invU, UCbox = get_U_invU(asu_rst7_file_name) start_atm, end_atm = calc_start_end_atm(atoms_per_uc, target_unit_cell, prop_a, prop_b, prop_c) # for frame in range(n_frames): # parm = AmberParm(parm_file_name) for frame in range(0,1): coords = traj.coordinates(frame) frac_crds = get_frac_crds(coords, traj, U) cntred_frac_crds = center_frac_coords(frac_crds, parm, start_atm, end_atm) # atom_selection1 = select_atoms(cntred_frac_crds, parm, buffer, solvent=True) print frame # print atom_selection1 # print frac_crds[9794] # print cntred_frac_crds[9794] # if wrap: # wrap_coords(parm, frac_crds, cntred_frac_crds, prop_a, prop_b, prop_c, buffer, solvent=True) atom_selection = select_atoms(cntred_frac_crds, parm, buffer, solvent=True) frac_crds = rev_translate_frac_crds(frac_crds, target_unit_cell, prop_a, prop_b, prop_c) coords = get_cart_crds(frac_crds, traj, invU).flatten() # print atom_selection # print cntred_frac_crds[9794] write_pdb(coords, parm, atom_selection, 'uc%d_frame%d' %(target_unit_cell,frame), UCbox, spacegroup) # write_pdb(coords, parm, atom_selection1, 'uc%d_frame%d_nowrap' %(target_unit_cell,frame)) write_amber_files(coords, parm, 'uc%d_frame%d' %(target_unit_cell,frame), atom_selection) # import code; code.interact(local=dict(globals(), **locals())) return atom_selection