def test_pubchem(): from ase.data.pubchem import pubchem_search, pubchem_conformer_search from ase.data.pubchem import pubchem_atoms_search from ase.data.pubchem import pubchem_atoms_conformer_search # check class functionality data = pubchem_search('ammonia', mock_test=True) data.get_atoms() data.get_pubchem_data() # XXX maybe verify some of this data? # check the various entry styles and the functions that return atoms pubchem_search(cid=241, mock_test=True).get_atoms() pubchem_atoms_search(smiles='CCOH', mock_test=True) pubchem_atoms_conformer_search('octane', mock_test=True) # (maybe test something about some of the returned atoms) # check conformer searching confs = pubchem_conformer_search('octane', mock_test=True) for conf in confs: pass try: # check that you can't pass in two args pubchem_search(name='octane', cid=222, mock_test=True) raise Exception('Test Failed') except ValueError: pass try: # check that you must pass at least one arg pubchem_search(mock_test=True) raise Exception('Test Failed') except ValueError: pass
return ASE_new_positions ''' Main Program Begins Here ''' #TRAPPE #Collect TRAPPE input params TRAPPE_fname = 'trappe_parameters_99.txt' TRAPPE_atoms, TRAPPE_bonds, TRAPPE_name = get_TRAPPE_params(TRAPPE_fname) #ASE #Convert Smiles string into Atoms object. SMILES = 'O=C(C=C)OCCCCCCCC' atoms = pubchem_atoms_search(smiles=SMILES) #Determine psuedo-atoms of molecule and remove hydrogens. psuedo_atoms = get_psuedoatoms(atoms,TRAPPE_atoms,TRAPPE_bonds) ana = Analysis(psuedo_atoms) #Create geometry analysis object from Atoms object. organized_ASE_atoms = Order_atoms_wrt_TRAPPE(psuedo_atoms,ana,TRAPPE_bonds,TRAPPE_atoms) #Center the psuedo_atoms. FEASST requires atom[0] to be located within origin! for atm in organized_ASE_atoms: if atm[0] == 1: center_about = np.copy(atm[-1]) break for atm in organized_ASE_atoms:
positions=[[0, L / 2, L / 2]], cell=[d, L, L], pbc=[1, 0, 0]) add_to_dict(AseAtomsAdaptor.get_structure(wire), metal + '_Wire') """ for metal in ['Au', 'Pt', 'Mo']: atoms = bulk(metal, cubic=True) if metal == 'Fe': atoms *= (1, 2, 2) atoms.set_cell([atoms.cell[0][0]] + [12] * 2) atoms.center() add_to_dict(AseAtomsAdaptor.get_structure(atoms), metal + '_wire') # this code is about to get pretty serious if you are trying to follow it atoms = pubchem_atoms_search('ethane') vector = atoms[1].position - atoms[0].position methyl = Atoms([atoms[a] for a in [1, 6, 5, 7]]) del atoms[7] del atoms[6] del atoms[5] del atoms[1] methyl.rotate(120, v=vector, center=methyl[0].position) atoms += methyl del atoms[7] del atoms[3] atoms.rotate(180, v=vector) atoms.positions -= atoms[0].position bl = np.linalg.norm(vector)
add_to_dict(atoms, 'water', 300) # CO2 atoms = make_box_of_molecules(molecule('CO2'), 25, [20] * 3) print(len(atoms)) add_to_dict(atoms, 'CO2', 70 + 273.15) # Al atoms = read('Al.xyz') add_to_dict(atoms, 'Al', 10000) # natural gas CH4 = pubchem_atoms_search('methane') C2H6 = pubchem_atoms_search('ethane') C3H8 = pubchem_atoms_search('propane') atoms = make_box_of_molecules([CH4, C2H6, C3H8], [18, 6, 6], [15] * 3) add_to_dict(atoms, 'LNG', 273.15 - 162) # Battery with open('Li-ion_electrolyte_interface_318.txt', 'r') as f: txt = f.read() lattice = txt.split('lattice vectors (au):')[1] lattice, positions = txt.split('Atom types and positions (au):') lattice = lattice.splitlines()[1:] lattice = [[float(b) * Bohr for b in a.split()] for a in lattice]
struct = AseAtomsAdaptor.get_structure(atoms) add_to_dict(struct) atoms = molecule('HF') for atom in atoms: if atom.symbol == 'F': atom.symbol = 'Br' atoms.set_distance(0, 1, 1.43) atoms.set_cell([10, 10, 10]) atoms.center() struct = AseAtomsAdaptor.get_structure(atoms) add_to_dict(struct) atoms = pubchem_atoms_search(cid=807) # I2 atoms.set_cell([10, 10, 10]) atoms.center() struct = AseAtomsAdaptor.get_structure(atoms) add_to_dict(struct, 'I2') # nano-particles import ase from ase.cluster.cubic import FaceCenteredCubic surfaces = [(1, 0, 0), (1, 1, 0), (1, 1, 1)] layers = [3, 3, 3] lc = 3.61000 atoms = FaceCenteredCubic('Cu',
from ase.data.pubchem import pubchem_search, pubchem_conformer_search from ase.data.pubchem import pubchem_atoms_search from ase.data.pubchem import pubchem_atoms_conformer_search # check class functionality data = pubchem_search('ammonia', mock_test=True) atoms = data.get_atoms() entry_data = data.get_pubchem_data() # check the various entry styles and the functions that return atoms atoms = pubchem_search(cid=241, mock_test=True).get_atoms() atoms = pubchem_atoms_search(smiles='CCOH', mock_test=True) atoms = pubchem_atoms_conformer_search('octane', mock_test=True) # check conformer searching confs = pubchem_conformer_search('octane', mock_test=True) for conf in confs: pass try: # check that you can't pass in two args atoms = pubchem_search(name='octane', cid=222, mock_test=True) raise Exception('Test Failed') except ValueError: pass try: # check that you must pass at least one arg atoms = pubchem_search(mock_test=True) raise Exception('Test Failed') except ValueError: pass