Example #1
0
def example_valinomycin_pureLinK_vs_LinKwithDF():
    # read inputs
    # args = read_arguments()
    # path_to_file1 = os.path.abspath(args.file_mol1)
    # path_to_file2 = os.path.abspath(args.file_mol2)
    path_to_file1 = "/home/ctcc2/Documents/CODE-DEV/xyz2top/xyz2top/tests/files/valinomycin_geomOpt_DFT-b3lyp_cc-pVTZ.xyz"
    path_to_file2 = "/home/ctcc2/Documents/CODE-DEV/xyz2top/xyz2top/tests/files/valinomycin_geomOpt_DFT-b3lyp-noDF_cc-pVTZ.xyz"
    import xyz2molecule as xyz
    molecule1 = xyz.parse_XYZ(path_to_file1)
    molecule2 = xyz.parse_XYZ(path_to_file2)
    diff = topologyDiff(molecule1, molecule2, covRadFactor=1.3)
Example #2
0
 def test_jsonOutput_Histidine_molecule(self):
     import json
     with open(self.path_to_json_topology) as json_file:
         json_topology = json.load(json_file)
     with open(self.path_to_XYZ_format, 'r') as f:
         histidine = xyz.parse_XYZ(self.path_to_XYZ_format)
         histidineXYZ_Object = histidine.get_object()
         for key, value in histidineXYZ_Object.iteritems():
             if (key not in ['comments']):
                 self.assertEqual(value, json_topology["molecule"][key])
Example #3
0
 def setUp(self):
     self.path_to_XYZ_format = "../../files/histidine.xyz"
     self.histidine_moleculeObject = xyz.parse_XYZ(self.path_to_XYZ_format)
     self.histidine_topologyObject = topology.topology(
         self.histidine_moleculeObject)
     #self.histidine_topologyObject.build_topology()
     [
         self.filename_config, self.filename_bonds, self.filename_angles,
         self.filename_dihedralAngles
     ] = self.histidine_topologyObject.write_topology_files()
     self.path_to_stored_files = "./files/"
Example #4
0
def main():
    # read inputs
    args = read_arguments()
    path_to_file = os.path.abspath(args.filename)
    if (args.covRadFactor == None):
        print "no factor for bond distance specified\n>> default covalent radius factor will apply.\n(Run './main.py --help' for more options.)"
    else:
        print "Covalent radius factor set to ", args.covRadFactor
        if args.verbose:
            print "Approximate the molecular topology stored in {} \n  \
            with connections detected as covalent bonds if pair-atomic \
            distance goes below {} times the sum of the covalent radii.\
            ".format(args.filename, args.covRadFactor)
    ### parse_molecule_XYZ()
    molecule = xyz.parse_XYZ(path_to_file)
    #print molecule.get_object()
    #print molecule

    ### compute the topology
    if (args.covRadFactor != None):
        molecular_topology = topology(molecule, args.covRadFactor)
    else:
        molecular_topology = topology(molecule)
    molecular_topology.build_topology()
    #    print molecular_topology.get_as_JSON()
    print molecular_topology

    ### print topology to file
    jsonString = molecular_topology.get_as_JSON()
    with open('./topology.json', 'w') as outfile:
        outfile.write(jsonString)

    print "\nZmatrix format: (not done yet)"
    print molecular_topology.get_as_Zmatrix()

    print "\nZmatrix format with variables: (not done yet)"
    print molecular_topology.get_as_Zmatrix(useVariables=True)

    print "\nCreate 3 topology files for bonds, angles and dihedrals + config.txt"
    [
        filename_config, filename_bonds, filename_angles,
        filename_dihedralAngles
    ] = molecular_topology.write_topology_files()
    print "files generated:" \
        + "\n\t- " + filename_config \
        + "\n\t- " + filename_bonds \
        + "\n\t- " + filename_angles \
        + "\n\t- " + filename_dihedralAngles
Example #5
0
 def setUp(self):
     self.path_to_XYZ_format = "../../files/histidine.xyz"
     self.maxDiff = None
     self.histidine_moleculeObject = xyz.parse_XYZ(self.path_to_XYZ_format)
     self.histidine_topologyObject = topology.topology(
         self.histidine_moleculeObject)
Example #6
0
 def test_extracting_data_from_XYZ_format(self):
     str1 = str(xyz.parse_XYZ(self.path_to_XYZ_format))
     stringDATA = ""
     with open(self.path_to_XYZ_format, 'r') as f:
         stringDATA = f.read()
     self.assertEqual(str1.strip(), stringDATA.strip())