Ejemplo n.º 1
0
 def test_update_existing_conf(self):
     rism_toluene = RISM_3D_calculation('test/toluene')
     rism_toluene_copy = RISM_3D_calculation('test/toluene_copy')
     can = 'Cc1ccccc1'
     wr = Writer(self.ses)
     wr.write_rism(rism_toluene)
     dbi = DBInterface(self.ses)
     db_mol = dbi.get_molecule(can)
     db_conf = db_mol.find_0rmsd_conformation()
     assert str(db_conf.Source) == 'None'
     wr.write_rism(rism_toluene_copy, {'Source': 'David'})
     dbi = DBInterface(self.ses)
     db_mol = dbi.get_molecule(can)
     db_conf = db_mol.find_0rmsd_conformation()
     assert str(db_conf.Source) == 'David'
     self.ses.rollback()
Ejemplo n.º 2
0
    def test_parse_rism_folder_files(self):
        folder = 'test/toluene'
        calculation = RISM_3D_calculation(folder)
        results = """dGhyd(KH)= 2.09294808E+001 kcal/mol
dGhyd(GF)= 1.34305025E+001 kcal/mol
PMV= 1.51209629E+002 AA^3
dGhyd(UC)= -2.21336115625 kcal/mol
"""
        assert calculation.file_dic['results'] == results
Ejemplo n.º 3
0
 def test_write_new_mol_and_new_conf_and_conf_props(self):
     rism_toluene = RISM_3D_calculation('test/toluene')
     can = 'Cc1ccccc1'
     wr = Writer(self.ses)
     wr.write_rism(rism_toluene, {'Source': 'David'})
     dbi = DBInterface(self.ses)
     db_mol = dbi.get_molecule(can)
     db_conf = db_mol.find_0rmsd_conformation()
     assert str(db_conf.Source) == 'David'
     self.ses.rollback()
Ejemplo n.º 4
0
 def test_write_rism_calculation(self):
     rism_toluene = RISM_3D_calculation('test/toluene')
     can = 'Cc1ccccc1'
     wr = Writer(self.ses)
     wr.write_rism(rism_toluene, {'Source': 'David'})
     dbi = DBInterface(self.ses)
     db_mol = dbi.get_molecule(can)
     db_conf = db_mol.find_0rmsd_conformation()
     db_calc = db_conf.get_rism_calculations()[0]
     assert db_calc.SolvE == 1.34305025E+001
     assert db_calc.Temperature == '298'
     self.ses.rollback()
Ejemplo n.º 5
0
 def test_write_new_mol_and_new_0_conf(self):
     rism_toluene = RISM_3D_calculation('test/toluene')
     can = 'Cc1ccccc1'
     wr = Writer(self.ses)
     wr.write_rism(rism_toluene)
     dbi = DBInterface(self.ses)
     db_mol = dbi.get_molecule(can)
     db_can = str(db_mol.SMILES)
     db_conf = db_mol.find_0rmsd_conformation()
     pymol = pybel.readstring('mol', str(db_conf.Mol))
     assert can == db_can
     #        assert xyz == db_xyz
     self.ses.rollback()
Ejemplo n.º 6
0
def parse_rism_folders(folders):
    """Accepts list (or tuple) of folders and writes
    3DRISM_calculation data to db.
    """
    ses = create_session()
    wr = Writer(ses)    
    for folder in folders:
        try:
            rism = RISM_3D_calculation(folder)
            wr.write_rism(rism, conf_attributes, rism_attributes)
            ses.commit()
            print folder + ' written'
        except OSError, e:
            warnings.warn(str(e), UserWarning)
        except TypeError, e:
            warnings.warn(str(e), UserWarning)
Ejemplo n.º 7
0
 def test_parse_rism_folder_rism_paths(self):
     folder = 'test/toluene'
     calculation = RISM_3D_calculation(folder)
     assert calculation.rism3d_folder == "test/toluene"
     assert calculation.file_path_dic['topology'] == 'test/toluene/toluene.prmtop'
     assert calculation.file_path_dic['input'] == \
         'test/toluene/toluene.pdb'
     assert calculation.file_path_dic['parameters'] == \
         'test/toluene/run3drismgaff.sh'
     assert calculation.file_path_dic['results'] == \
         'test/toluene/results.txt'
     assert calculation.file_path_dic['output'] == \
         'test/toluene/out.425966'
     assert calculation.file_path_dic['solvent'] == \
         'test/toluene/solvent_gen_file.sh'
     assert calculation.runtime == 2790 
Ejemplo n.º 8
0
 def test_parse_rism_folder_mol_conversion(self):
     folder = 'test/toluene'
     calculation = RISM_3D_calculation(folder)
     smi = 'Cc1ccccc1'
     assert calculation.pymol.write('can').strip() == smi
Ejemplo n.º 9
0
 def test_parse_rism_folder_energy(self):
     folder = 'test/toluene'
     calculation = RISM_3D_calculation(folder)
     energy = 1.34305025E+001
     assert calculation.solvation_energy == energy
Ejemplo n.º 10
0
    def test_parse_rism_folder_input(self):
        folder = 'test/toluene'
        calculation = RISM_3D_calculation(folder)
        assert calculation.file_dic['input'] == \
"""ATOM      1  C1  MOL     1       3.537   1.423   0.000  1.00  0.00
Ejemplo n.º 11
0
 def test_parse_rism_folder_unambigious(self):
     folder = 'test/scary'
     with pytest.raises(TypeError) as excinfo:
         RISM_3D_calculation(folder)
     info = """Found multiple files of type *.prmtop in folder {}.""".format(folder)
     assert excinfo.value.message == info
Ejemplo n.º 12
0
 def test_parse_rism_folder_empty_folder(self):
     folder = 'test/stupid_empty_folder'
     with pytest.raises(TypeError) as excinfo:
         RISM_3D_calculation(folder)
     info = """Couldn't find *.prmtop file in folder {}.""".format(folder)
     assert excinfo.value.message == info
Ejemplo n.º 13
0
 def test_initialization(self):
     with pytest.raises(OSError) as excinfo:
         RISM_3D_calculation('not_a_folder')
     assert excinfo.value.message == 'not_a_folder is not a folder.'