def read_files(): for file in flhn.files: mdsys_tmp = agum.Unification() if file.endswith(".gau"): if settings is None: mdsys_tmp.read_gau(file) else: mdsys_tmp.read_gau(file, **settings) elif file.endswith(".gau.out"): if settings is None: mdsys_tmp.read_gau_log(file) else: mdsys_tmp.read_gau_log(file, **settings) elif file.endswith(".pwscf_in"): mdsys_tmp.read_pwin(file) elif file.endswith(".pwscf_out"): if settings is None: mdsys_tmp.read_pwout(file) else: mdsys_tmp.read_pwout(file, **settings) else: print("Unkown type of file {},\n skipping.".format( file.endswith()))
def ucell_vects(supercell_dcd, fa, fb, fc, frame_id=-1): """ Get the unit cell vectors from a super cell according to the multiplication factors. Parameters ---------- supercell_dcd : str the dcd file to get the super cell lattice vectors from fa : int or float the factor to divide the super cell lattice vector a by in order to get the unit cell vector a fb : int or float the factor to divide the super cell lattice vector b by in order to get the unit cell vector b fc : int or float the factor to divide the super cell lattice vector c by in order to get the unit cell vector c """ scell = agum.Unification() scell.import_dcd(supercell_dcd) scell.read_frames() scell.ts_boxes[frame_id].box_lmp2cart() ucell_a = np.array(scell.ts_boxes[frame_id].crt_a) / fa ucell_b = np.array(scell.ts_boxes[frame_id].crt_b) / fb ucell_c = np.array(scell.ts_boxes[frame_id].crt_c) / fc return (ucell_a, ucell_b, ucell_c)
def create_lmpdat(lmptop, xyz, output_name="foobar"): """ Create the lammps data file for the dimer to scan from the dimer given. Parameters ---------- lmptop : str lammps-data file of the monomer xyz : str xyz file of the system that shall be build from the monomer """ sys_lmptop = agum.Unification() sys_lmptop.read_lmpdat(lmptop) sys_coords = agum.Unification() sys_coords.read_xyz(xyz) # replace original topology atom coordinates sys_lmptop.ts_coords = sys_coords.ts_coords # replicate topology if necessary num_topo_atms = len(sys_lmptop.atoms) num_topo_coords = len(sys_lmptop.ts_coords[-1]) n = num_topo_coords / num_topo_atms if n.is_integer(): # replicate topology sys_lmptop.add_topology_replicate(int(n - 1), refresh_bonds=True) else: raise Warning( "Number of atoms in coordinates file is not a multiple of atoms in topology file!" ) #pdb.set_trace() sys_lmptop.change_indices(incr=1, mode="increase") sys_lmptop.write_lmpdat(output_name, cgcmm=True)
def ucell_scell_factors(lmpdat_ucell, lmpdat_scell): """ Get the factors the unit cell was multiplied by to gain the super cell. Parameters ---------- lmpdat_ucell : str lammps data file of the unit cell lmpdat_scell : str lammps data file of the super cell """ supercell = agum.Unification() supercell.read_lmpdat(lmpdat_scell) unitcell = agum.Unification() unitcell.read_lmpdat(lmpdat_ucell) supercell.ts_boxes[-1].box_lmp2lat() unitcell.ts_boxes[-1].box_lmp2lat() fa = int(supercell.ts_boxes[-1].ltc_a / unitcell.ts_boxes[-1].ltc_a) fb = int(supercell.ts_boxes[-1].ltc_b / unitcell.ts_boxes[-1].ltc_b) fc = int(supercell.ts_boxes[-1].ltc_c / unitcell.ts_boxes[-1].ltc_c) del (supercell, unitcell) return [fa, fb, fc]
def ab_initio2xyz(mainpath, filetype=".gau.out"): FH = ag_fileio.FileHandler() FH.find_files(ABINITIO_SOURCEPATH, FILEENDING) FH.files_to_strings() MAINSYS = agum.Unification() for gaufile in FH.files: if gaufile.endswith(".gau.out"): MAINSYS.read_gau_log(gaufile, read_summary=True) frame_ids = range(len(MAINSYS.ts_coords)) MAINSYS.write_xyz("tmp.xyz", *frame_ids, title="DEFAULT", guess_element=False)
def get_entities(gau_log, geom_entities): """ Bla. Extract all entities from gaussian output file. """ # pull all other entities (bonds, angles, dihedrals) from gaussian output sys_gau = agum.Unification() sys_gau.read_gau_log(gau_log) entities = [] for geom_entity in geom_entities: cur_entities = sys_gau.gaussian_other_info[geom_entity] entities.append(cur_entities) return (entities, len(entities[0]))
def _dist_and_energy_single_geom(self, filename, idxs1, idxs2, filetype=None): """ Read the distance and the energy from a single output file. This method only works with the following setup: > Each calculation has only ONE geometry to optimize and/or to calculate the energy from > if more geometries are scanned (in a single output file), only the last one will be evaluated, since only the last frame is processed Parameters ---------- filename : str name of the file to process idxs1 : tuple or list of ints atom indices to form the first cog idxs2 : tuple or list of ints atom indices to form the second cog filetype : bool type of file to read ('.pwscf_out' or '.gau_out') """ dimer_sys = agum.Unification() # convert filename to str since PosixPath does not have an 'endswith' method filename = str(filename) if filename.endswith(".pwscf_out") or filetype == "pwscf_out": dimer_sys.read_pwout(filename, read_crystal_sections=True) energy = dimer_sys.pw_other_info["ENERGIES"][-1] elif filename.endswith(".gau_out") or filetype == "gau_out": dimer_sys.read_gau_log(filename, read_summary=True) energy = dimer_sys.gaussian_other_info[ "Counterpoise corrected energy"] else: raise IOError("File of unknown type {}".format(filetype)) distance = self._get_distance(dimer_sys, idxs1, idxs2) return (distance, energy)
def calculate_distance(gau_out_file, idxs_atm1, idxs_atm2): dimer_sys = agum.Unification() dimer_sys.read_gau_log(gau_out_file, read_summary=True) #pdb.set_trace() if len(idxs_atm1) == 1: cog1 = dimer_sys.ts_coords[-1][idxs_atm1[0]] else: cog1 = dimer_sys.get_cog(-1, *idxs_atm1) if len(idxs_atm2) == 1: cog2 = dimer_sys.ts_coords[-1][idxs_atm2[0]] else: cog2 = dimer_sys.get_cog(-1, *idxs_atm2) distance = np.linalg.norm(cog1 - cog2) return distance
def measure_geometry(lmpdat, dcd, atm_ids): """ Bla. Measure the actual bond, angle, dihedral achieved by restraining it. """ sys_md = agum.Unification() sys_md.read_lmpdat(lmpdat) sys_md.import_dcd(dcd) sys_md.read_frames(frame=-2, to_frame=-1, frame_by="index") # read only the last frame # decrement atom indices since for sys_md they start with 0, whereas # for lammps and gaussian they start with 1 atm_idxs = [i - 1 for i in atm_ids] # dummy value, good for debugging geometry_value = None # bond if len(atm_idxs) == 2: geometry_value = np.linalg.norm(sys_md.ts_coords[-1][atm_idxs[0]] - sys_md.ts_coords[-1][atm_idxs[1]]) # angle elif len(atm_idxs) == 3: geometry_value = agg.get_angle(sys_md.ts_coords[-1][atm_idxs[0]], sys_md.ts_coords[-1][atm_idxs[1]], sys_md.ts_coords[-1][atm_idxs[2]]) # dihedral elif len(atm_idxs) == 4: geometry_value = agg.new_dihedral([ sys_md.ts_coords[-1][atm_idxs[0]], sys_md.ts_coords[-1][atm_idxs[1]], sys_md.ts_coords[-1][atm_idxs[2]], sys_md.ts_coords[-1][atm_idxs[3]] ]) else: raise IOError("Wrong number of atom ids!") if len(atm_idxs) > 2: geometry_value = np.degrees(geometry_value) return geometry_value
def process_lmp(self, lmplog, dcd, idxs1, idxs2, frame=-1): """ Extract the distance and energy from lammps output done by using 'displace_atoms' command in lammps. This method is reading ONE output file for the energy and for the coordinates which has several geometries that were optimized or single point calculations were carried out on. """ log_data = agul.LogUnification() log_data.read_lmplog(lmplog) dimer_sys = agum.Unification() dimer_sys.import_dcd(dcd) dimer_sys.read_frames() nframes = range(len(dimer_sys.ts_coords)) for frame_id in nframes: distance = self._get_distance(dimer_sys, idxs1, idxs2, frame_id) energy = log_data.data[frame_id]["PotEng"][frame] self.results.append((distance, energy)) self._norm_results()
import pdb parser = argparse.ArgumentParser() parser.add_argument( "pwscf_out", metavar="*.pwscf_out", help= "Quantum Espresso (PW) output file (needed for coordinates and box vectors)." ) parser.add_argument( "-o", default="foo.xyz", metavar="*.xyz", help="XYZ-file with coordinates and box vectors from 'pwscf_out'") args = parser.parse_args() pw_file_handler = agum.Unification() # read last frame from pw output file pw_file_handler.read_pwout(args.pwscf_out) #pdb.set_trace() pdb.set_trace() try: pw_file_handler.ts_boxes[-1].box_cart2lat() except IndexError: print("No boxes found?") pw_file_handler.write_xyz(args.o, "From {}".format(args.pwscf_out), False, -1)
in that particular order") parser.add_argument("-sysname", default="UNK", type=str, help="Name of the molecule/system") parser.add_argument("-out", default="DEFAULTNAME.lmpdat", action="store", help="Name of output-file.") args = parser.parse_args() # Topology and Force Field ----------------------------------------------------- amber_topology = agum.Unification() amber_topology.read_prmtop(args.prmtop) # convert units from kcal to eV amber_topology.ui_convert_units(energy_unit_out='eV', ang_unit_out="deg", cvff_style=False) amber_topology.mix_pair_types(mode="ij") # Coordinates ------------------------------------------------------------------ if args.xyz: amber_topology.read_xyz(args.xyz, overwrite_data=False) else: amber_topology.read_inpcrd(args.inpcrd) # Box definition --------------------------------------------------------------- if args.box is None:
help="Lammps data file. Provides topology and force field parameters.") parser.add_argument("-dcd", help="Lammps dcd-file.") parser.add_argument("-start", default=0, help="First frame to start analysis with.") parser.add_argument( "-out", default="FOO.txt", help="Name of output file which has angles, dihedrals and impropers.") args = parser.parse_args() cbz = agum.Unification() cbz.read_lmpdat(args.lmpdat) cbz.import_dcd(args.dcd) cbz.read_frames(frame=args.start) with open(args.out, "w") as f_out: f_out.write("{:>9}{:>17}{:>17}{:>17}{:>17}\n".format( "Step", "ang_C13_N8_C5", "ang_C13_N8_C9", "ang_C9_N8_C5", "ang_b1_N8_b2")) for n, frame in enumerate(cbz.ts_coords[args.start:]): # omega-1/-2/-3 - angles between carbon and nitrogen ang_C13_N8_C5 = cgt.angle_between_vectors(frame[24] - frame[15], frame[24] - frame[7]) ang_C13_N8_C9 = cgt.angle_between_vectors(frame[24] - frame[15],
parser.add_argument("-multiplicity", default=1, action="store", type=int, help="Multiplicity (2S+1) of the molecule." ) parser.add_argument("-out", default="DEFAULTNAME", help="Name of output-files." ) args = parser.parse_args() # Read mae-file ---------------------------------------------------------------- mae = agum.Unification() # get conformers and bonding orders from maestro's jaguar calculation mae.read_mae(args.mae) # frame-ids frame_ids = list(range(len(mae.ts_coords))) # write amber trajectory for paramfit mae.write_mdcrd(args.out+".mdcrd", frame_ids) # define the rest mae.nproc = args.nproc mae.mem = args.mem mae.job_type = args.job_type mae.method = args.method mae.basis_set = args.basis_set
#!/usr/bin/env python import pdb import argparse import ag_unify_md as agum if __name__ == "__main__": PARSER = argparse.ArgumentParser() PARSER.add_argument("lmpt") PARSER.add_argument("-epsilon", type=float, default=None) PARSER.add_argument("-sigma", type=float, default=None) PARSER.add_argument("-atmtype", type=int, default=0) PARSER.add_argument("-o", default="foobar.lmpdat") ARGS = PARSER.parse_args() SYSTEM = agum.Unification() # force field and topology SYSTEM.read_lmpdat(ARGS.lmpt) if ARGS.sigma is not None: SYSTEM.atm_types[ARGS.atmtype].sigma = ARGS.sigma if ARGS.epsilon is not None: SYSTEM.atm_types[ARGS.atmtype].epsilon = ARGS.epsilon SYSTEM.mix_pair_types(mode="ij") SYSTEM.change_indices(incr=1, mode="increase") SYSTEM.write_lmpdat(ARGS.o, cgcmm=True)
#!/usr/bin/env python import argparse import ag_unify_md as agum """ Convert a gaussian output-/log-file (very last entry) to a xyz-file. """ # Argument Parsing ------------------------------------------------------------- parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description="") parser.add_argument("gau_out", metavar="foo.out|foo.log", help="Gaussian output-/logfile") parser.add_argument("pwin", metavar="foo.pwscf_in", help="PW input file") parser.add_argument("-out", metavar="bar.pwscf_in", default="bar.pwscf_in", help="Name of pw input-file which will be written.") args = parser.parse_args() # read gaussian log file system = agum.Unification() system.read_pwin(args.pwin) system.read_gau_log(args.gau_out, read_summary=True) system.write_pwin(-1, args.out)
default=None, help="indices of atoms that form dihedrals/impropers") PARSER.add_argument( "-offset", type=int, default=30, help="number of atoms a molecule/scan-block consists of") PARSER.add_argument("-o", default="DEFAULTNAME", help="Prefix of output files") ARGS = PARSER.parse_args() # container COMPLETE_DATA = ag_clmsv.Clmsv() MOLSYS = agum.Unification() if ARGS.lmpdat is not None: MOLSYS.read_lmpdat(ARGS.lmpdat) if ARGS.dcd is not None: # read last frame from dcd file MOLSYS.import_dcd(ARGS.dcd) MOLSYS.read_frames(frame=-2) #=== split the indices === if ARGS.bonds is not None: ENTITY_IDXS = chunks(ARGS.bonds, 2) process_entity_idxs(COMPLETE_DATA.data, MOLSYS.ts_coords[-1], ENTITY_IDXS,
action="store_true", ) parser.add_argument("-gau_argument_line", default=None, metavar="*.lmpdat", help="Gaussian log/output-file.") parser.add_argument("-o", default=None, metavar="*.lmpdat", help="Lammps' data-file of the main system.") args = parser.parse_args() # get coordinates from last gaussian log file dimeric_sys = agum.Unification() dimeric_sys.read_lmpdat(args.top) # read a gaussian input file for basic information if args.gau_in is not None: dimeric_sys.read_gau(args.gau_in, overwrite=True) if args.gau_out is not None: dimeric_sys.read_gau_log(args.gau_out, overwrite=True) # define job settings if args.gau_argument_line is None: dimeric_sys.job_settings = "#P SP MP2(FullDirect, FC)/aug-cc-pVTZ geom=connectivity" else: dimeric_sys.job_settings = args.gau_argument_line
help="Lammps data file. Provides topology and force field parameters.") parser.add_argument( "-name_by_type", action="store_true", help="Name the atom names by their types or keep the current " + "naming scheme") parser.add_argument("-sysname", metavar="UNK", default="UNK", help="Name of the molecule/system") parser.add_argument("-out", metavar="foobar.xyz", default="foobar.xyz", help="Name of output-file.") args = parser.parse_args() # File type conversion --------------------------------------------------------- # read lammps data file lmpdat = agum.Unification() lmpdat.read_lmpdat(args.lmpdat) if args.name_by_type is True: lmpdat.guess_atomtypes(by_typename=True, overwrite=True) lmpdat.write_xyz(args.out)
#cif_energies = (6.1, 5.72, 6.41, 5.95, 0.0) for polymorph, (ucell_file, energy) in cif_ucell_files.items(): cur_polymorph = Polymorph(30) cur_polymorph.read_file(ucell_file, "cif") cur_polymorph.get_volume_p_molecule() cur_polymorph.energy_gain = energy exp_polymorphs[polymorph] = cur_polymorph del cur_polymorph #################################### # ab initio (quantum espresso) # #################################### pw_cbz_single = "/home/gadelmeier/SSHFS/hades/Research.new/carbamazepine/2.ab_initio/1.geom_opt/1.single/2.quantum_espresso/CBZIII_residue0_box_40_40_40_gamma/CBZIII_residue0_box_40_40_40.pwscf_out" PW_SINGLE_MOLECULE = agum.Unification() PW_SINGLE_MOLECULE.read_pwout(pw_cbz_single) main_path = "/home/gadelmeier/SSHFS/hades/Research.new/carbamazepine/2.ab_initio/1.geom_opt/3.unit_cell/3.vc_relax/{}" pw_cbzi = main_path.format("CBZI/CBZI_vc_relax.pwscf_out") pw_cbzii = main_path.format("CBZII/CBZII_vc_relax.pwscf_out") pw_cbziii = main_path.format("CBZIII/CBZIII_vc_relax.pwscf_out") pw_cbziv = main_path.format("CBZIV/CBZIV_vc_relax.pwscf_out") pw_cbzv = main_path.format("CBZV/CBZV_vc_relax.pwscf_out") #pw_ucell_files = (pw_cbzi, pw_cbzii, pw_cbziii, pw_cbziv, pw_cbzv) pw_ucell_files = { "I": pw_cbzi, "II": pw_cbzii, "III": pw_cbziii, "IV": pw_cbziv, "V": pw_cbzv
def files_to_xyz(path, file_extension, settings=None, xyz_out="DEFAULT.xyz", xyz_settings=None): """Find and read gaussian or pw files from a given path. Read gaussian in- and output files and pw in- and output files. The files may be in subfolders of 'path'; 'settings' may be omitted, if the files shall be read using the standard settings. If non-standard settings should be used, read the documentation of the according functions. Parameters ---------- path : {str} Path to files (may be in subfolders). file_extension : {str} Extension of file. Currently only '.gau', '.gau.out', '.pwscf_in', '.pwscf_out' supported. settings : {dict}, optional Settings for each file extension when read (the default is None, which all arguments are set to False). xyz_out : {str} Name of output file. xyz_settings : {dict} Settings that will be used when writing an xyz file. The dicitonary may look like this: { 'frame_ids': [int, int, ...], 'title': "DEFAULT", 'guess_element': False } """ import ag_unify_md as agum def read_files(): for file in flhn.files: mdsys_tmp = agum.Unification() if file.endswith(".gau"): if settings is None: mdsys_tmp.read_gau(file) else: mdsys_tmp.read_gau(file, **settings) elif file.endswith(".gau.out"): if settings is None: mdsys_tmp.read_gau_log(file) else: mdsys_tmp.read_gau_log(file, **settings) elif file.endswith(".pwscf_in"): mdsys_tmp.read_pwin(file) elif file.endswith(".pwscf_out"): if settings is None: mdsys_tmp.read_pwout(file) else: mdsys_tmp.read_pwout(file, **settings) else: print("Unkown type of file {},\n skipping.".format( file.endswith())) flhn = FileHandler() flhn.find_files(path, file_extension) flhn.files_to_strings() flhn.sort_files() mdsys = agum.Unification() read_files() nframes = range(len(mdsys.ts_coords)) pdb.set_trace() # write the xyz-file if xyz_settings is None: mdsys.write_xyz(xyz_out, *nframes) else: mdsys.write_xyz(xyz_out, *nframes, **xyz_settings) return md_sys
import ag_unify_md as agum import ag_geometry as agm import ag_unify_log as agul import time import sys """ Rearrange the atom order from a VESTA output file according to a given pattern. Single atoms, which have no bonding partners are deleted during the process. """ s, pdb = sys.argv lmpdat = "/home/gadelmeier/Research/FORCE_FIELDS/AMBER/Molecules/CBZ_gaff2/4.1.results/Iteration-3-2_best.lmpdat" # read output vesta_output = agum.Unification() vesta_output.read_pdb(pdb) # mark atoms which are to delete delete_atoms = [] # find single atom fragments for mol in vesta_output.molecules: if len(mol) == 1: idx = list(mol) delete_atoms.append(idx[0]) # delete all single atoms vesta_output.delete_atoms(*delete_atoms) vesta_output.write_xyz("tmp.xyz")
#parser.add_argument("-lmpdat", # default=None, # help="Lammps' data-file" # ) parser.add_argument("pwin") parser.add_argument("pwout") parser.add_argument( "-sf", type=float, default=1.00, help="Scaling factor for enlarging the box and its atom coordinates") parser.add_argument("-o", default="Default") args = parser.parse_args() pw_sys = agum.Unification() # coordinates pw_sys.read_pwin(args.pwin) pw_sys.read_pwout(args.pwout) # enlarge coordinates by scaling factor for idx, coord in enumerate(pw_sys.ts_coords[-1]): coord *= args.sf pw_sys.ts_coords[-1][idx] = coord # enlarge box by 1 % pw_sys.ts_boxes[-1].crt_a = [i * args.sf for i in pw_sys.ts_boxes[-1].crt_a] pw_sys.ts_boxes[-1].crt_b = [i * args.sf for i in pw_sys.ts_boxes[-1].crt_b] pw_sys.ts_boxes[-1].crt_c = [i * args.sf for i in pw_sys.ts_boxes[-1].crt_c] # change calculation type to single point calculation
help="Lammps' DCD-file.") parser.add_argument( "-f", "--frame", default=-1, type=int, help="Index (!) of frame to convert (negative indices allowed).") parser.add_argument("-o", "--out", default="DEFAULTNAME", action="store", help="Output file name.") args = parser.parse_args() frame = args.frame mydata = agum.Unification() mydata.read_lmpdat(args.data) mydata.import_dcd(args.dcd) mydata.read_frames(frame=None, to_frame=-1, frame_by="index") # read only the last frame # convert box to lammps box print("***Info: Converting box lammps' box format.") mydata.change_indices(incr=1, mode="increase") mydata.write_lmpdat(args.out + ".lmpdat", frame_id=frame, title="Frame {} of {}".format(frame, args.dcd), cgcmm=True)
#!/usr/bin/env python import pdb import argparse import math import numpy as np import md_box as mdb import ag_unify_md as agum if __name__ == "__main__": parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) parser.add_argument("pwout") parser.add_argument("pwin") parser.add_argument("-a", nargs=2, type=int, default=(0, 0), metavar=12, help="replicate cell in cell vector a direction this many times.") parser.add_argument("-b", nargs=2, type=int, default=(0, 0), metavar=5, help="replicate cell in cell vector b direction this many times.") parser.add_argument("-c", nargs=2, type=int, default=(0, 0), metavar=8, help="replicate cell in cell vector c direction this many times.") parser.add_argument("-out", default="foobar.pwin", help="Name of output-file.") args = parser.parse_args() sys = agum.Unification() sys.read_pwin(args.pwin) sys.read_pwout(args.pwout) sys.replicate_cell(n_start=args.a[0], n_stop=args.a[1], direction="a", frame_id=-1, adjust_box=True) sys.replicate_cell(n_start=args.b[0], n_stop=args.b[1], direction="b", frame_id=-1, adjust_box=True) sys.replicate_cell(n_start=args.c[0], n_stop=args.c[1], direction="c", frame_id=-1, adjust_box=True) sys.write_pwin(-1, args.out)
help="lammps' dcd-file with box coordinates to cut.") parser.add_argument("-dcdbox_frame", type=int, default=-1, metavar="*.lmpdat", help="frame of the dcd file to use box information from.") parser.add_argument("-inverse", default=False, action="store_true", help="Selection: box (normal), negative of box (inverted)") args = parser.parse_args() sys = agum.Unification() print("Reading...") sys.read_lmpdat(args.lmpdat) if args.dcd is not None: sys.import_dcd(args.dcd) sys.read_frames(frame=args.frame, to_frame=args.frame + 1) #sys_box = copy.deepcopy(sys.ts_boxes[-1]) #sys_box.box_lmp2cart() if args.lmpbox is False or args.dcdbox is False: if args.boxtype == "lammps": box = mdb.Box(boxtype=args.boxtype, lmp_xlo=args.box[0], lmp_xhi=args.box[1],
parser.add_argument("mainfile", metavar="*.lmpdat", help="lammps' data-file") parser.add_argument( "coordinates_file", metavar="*.xyz", help="File with coordinates which are used to cut from mainfile.") parser.add_argument("-out", default="foo.lmpdat", metavar="foo.lmpdat", help="Output-File.") args = parser.parse_args() mainsys = agum.Unification() mainsys.read_lmpdat(args.mainfile) #mainsys.ts_coords[-1] = [round(i, 3) for j in mainsys.ts_coords[-1] for i in j] cutsys = agum.Unification() #cutsys.read_pdb(args.coordinates_file) cutsys.read_xyz(args.coordinates_file) delete_atoms = [] mainsys.ts_coords[-1] = [ list([round(j, 3) for j in i]) for i in mainsys.ts_coords[-1] ] cutsys.ts_coords[-1] = [ list([round(j, 3) for j in i]) for i in cutsys.ts_coords[-1] ] for atm_idx, mainsys_coords in enumerate(mainsys.ts_coords[-1]):
) cell.add_argument("-cbcif", "--cell_by_ciffile", default=None, help="Get cell information from a cif file") parser.add_argument("-out", metavar="foobar.lmpdat", default="foobar.lmpdat", help="Name of output-file.") args = parser.parse_args() # Modeling --------------------------------------------------------------------- sys_coords = agum.Unification() # coordinates sys_topo_ff = agum.Unification() # force field and topology # read topology and force field parameters if args.prmtop is not None: sys_topo_ff.read_prmtop(args.prmtop) sys_topo_ff.ui_convert_units(energy_unit_out='eV', ang_unit_out="deg", cvff_style=False) sys_topo_ff.mix_pair_types(mode="ij") elif args.lmpdat_top is not None: sys_topo_ff.read_lmpdat(args.lmpdat_top, energy_unit="eV", angle_unit="deg") else: raise Warning("This should not have happened (1).")
#!/usr/bin/env python import argparse import ag_unify_md as agum """ Convert a gaussian output-/log-file (very last entry) to a xyz-file. """ # Argument Parsing ------------------------------------------------------------- parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description="") parser.add_argument("gau_out", metavar="foo.out|foo.log", help="Gaussian output-/logfile") parser.add_argument("-out", metavar="bar.mdcrd", default="bar.mdcrd", help="Name of mdcrd-file which will be written.") args = parser.parse_args() # read gaussian log file gau_output = agum.Unification() gau_output.read_gau_log(args.gau_out) gau_output.write_mdcrd(args.out, *list(range(len(gau_output.ts_coords))))