def test_empty_mol_list(setup_teardown): with pytest.raises(ValueError): drg = Dragon() # print(drg, drg.getattr()) df = drg.represent(mol_list=[], output_directory=setup_teardown, dropna=False)
def test_v7_molFile_exception(data_path, setup_teardown): with pytest.raises(ValueError): drg = Dragon(molFile=[]) drg.script_wizard(script='new', output_directory=setup_teardown)
def test_v7_molinput_exception(setup_teardown): with pytest.raises(ValueError): drg = Dragon(molInput='stdin') drg.script_wizard(script='new', output_directory=setup_teardown)
def test_v7_blocks_exception(setup_teardown): with pytest.raises(ValueError): drg = Dragon(blocks=list(range(2, 32))) drg.script_wizard(script='new', output_directory=setup_teardown)
def test_v7_weights_exception(setup_teardown): with pytest.raises(ValueError): drg = Dragon(Weights=['a']) drg.script_wizard(script='new', output_directory=setup_teardown)
def test_new_script_v7(setup_teardown): # test script exists drg = Dragon() drg.script_wizard(script='new', output_directory=setup_teardown) assert os.path.exists(os.path.join(drg.output_directory, 'Dragon_script.drs')) == 1 drg.printout()
def test_existing_script_exception(data_path, setup_teardown): with pytest.warns(RuntimeWarning): with pytest.raises(ValueError): drg = Dragon() drg.script_wizard(script=os.path.join(data_path, 'Dragon_script_broken.drs'), output_directory=setup_teardown)
def test_blocks_exception(setup_teardown, chemml_molecule_list): with pytest.raises(ValueError): drg = Dragon(blocks=list(range(2, 32))) df = drg.represent(mol_list=chemml_molecule_list, output_directory=setup_teardown)
def test_new_script_v8(): with pytest.raises(ValueError): drg = Dragon(version=8)
def test_run(setup_teardown): with pytest.raises(ImportError): drg = Dragon(version=6, blocks=list(range(1, 30))) drg.script_wizard(script='new', output_directory=setup_teardown) drg.run()
###### DRAGON TRIAL ###### import pandas as pd from chemml.chem import Dragon import numpy as np #df=pd.read_csv('energy.csv') #l=df['index'].tolist() #print min(l) #print max(l) #m={j+1:{'file':'dragon_trial1/Li1_Opt_C%i.mol2'%i} for i,j in zip(l,range(len(l)))} m='Li1_Opt_C1.mol2' #print m model = Dragon(version=7, blocks = range(1,31), molFile = m, molInput='file') model.script_wizard(script='new', output_directory='./') model.run() print (model.data_path) df_path = model.data_path print (df_path) #df = pd.read_csv(df_path,delimiter='\t', engine='python') #df = df.drop(['No.','NAME'],axis=1) #df = df.loc[:, (df != df.ix[0]).any()] #df1= df.replace(to_replace='nan',value=np.nan) #df1=df1.replace(to_replace='na',value=np.nan) #df1.dropna(axis=1,inplace=True) #df1.to_csv('final_energy.csv',header=True)
def test_dragon_df(setup_teardown, chemml_molecule_list): drg = Dragon() df = drg.represent(mol_list=chemml_molecule_list, output_directory=setup_teardown) assert df.shape[0] == 4
def test_input_list(setup_teardown): with pytest.raises(ValueError): drg = Dragon() df = drg.represent(mol_list=['CC'], output_directory=setup_teardown)
def test_new_script_v6(setup_teardown): # test script exists drg = Dragon(version=6, blocks=list(range(1,30))) drg.script_wizard(script='new', output_directory=setup_teardown) assert os.path.exists(os.path.join(drg.output_directory, 'Dragon_script.drs')) == 1
def test_existing_script(data_path, setup_teardown): drg = Dragon() drg.script_wizard(script=os.path.join(data_path, 'Dragon_script.drs'), output_directory=setup_teardown)
def test_v6_molFile_exception(setup_teardown): with pytest.raises(ValueError): drg = Dragon(version=6, blocks=list(range(1,30)), molFile=[]) drg.script_wizard(script='new', output_directory=setup_teardown)
def test_weights_exception(setup_teardown, chemml_molecule_list): with pytest.raises(ValueError): drg = Dragon(Weights=['a']) df = drg.represent(mol_list=chemml_molecule_list, output_directory=setup_teardown)