PYTHON/utils.py
def add_interactions(atom_dist_df,crystal):
    '''
    Add intermolecular interaction types to bond distances
    '''
    atom_dicts = []
    for idx in atom_dist_df.index:
        m1_idx = atom_dist_df.at[idx,'mol1s']
        m2_idx = atom_dist_df.at[idx,'mol2s']
        a1_idx = atom_dist_df.at[idx,'atom1s']
        a2_idx = atom_dist_df.at[idx,'atom2s']
        atom1 = crystal.molecules[m1_idx].atoms[a1_idx]
        atom2 = crystal.molecules[m2_idx].atoms[a2_idx]
        disp = atom2.coordinates - atom1.coordinates
        dist = np.sqrt(disp.dot(disp))
        atom_dict = {'mol1s':m1_idx,'mol2s':m2_idx,'atom1':a1_idx,'atom2':a2_idx,'dist':dist}
        interaction = Interaction(atom1,atom2)
        atom_dict.update(interaction.to_dict())
        atom_dicts.append(atom_dict)
    atom_df = pd.DataFrame(atom_dicts)
    
    return atom_df.set_index(['mol1s','mol2s'])

    Add intermolecular interaction types to bond distances
    
Add intermolecular interaction types to bond distances
Add intermolecular interaction types to bond distances
def add_interactions(atom_dist_df,crystal):
    atom_dicts = []
    for idx in atom_dist_df.index:
        m1_idx = atom_dist_df.at[idx,'mol1s']
        m2_idx = atom_dist_df.at[idx,'mol2s']
        a1_idx = atom_dist_df.at[idx,'atom1s']
        a2_idx = atom_dist_df.at[idx,'atom2s']
        atom1 = crystal.molecules[m1_idx].atoms[a1_idx]
        atom2 = crystal.molecules[m2_idx].atoms[a2_idx]
        disp = atom2.coordinates - atom1.coordinates
        dist = np.sqrt(disp.dot(disp))
        atom_dict = {'mol1s':m1_idx,'mol2s':m2_idx,'atom1':a1_idx,'atom2':a2_idx,'dist':dist}
        interaction = Interaction(atom1,atom2)
        atom_dict.update(interaction.to_dict())
        atom_dicts.append(atom_dict)
    atom_df = pd.DataFrame(atom_dicts)
    return atom_df.set_index(['mol1s','mol2s'])
def add_interactions ( atom_dist_df , crystal ) : atom_dicts = [ ] for idx in atom_dist_df . index : m1_idx = atom_dist_df . at [ idx , 'mol1s' ] m2_idx = atom_dist_df . at [ idx , 'mol2s' ] a1_idx = atom_dist_df . at [ idx , 'atom1s' ] a2_idx = atom_dist_df . at [ idx , 'atom2s' ] atom1 = crystal . molecules [ m1_idx ] . atoms [ a1_idx ] atom2 = crystal . molecules [ m2_idx ] . atoms [ a2_idx ] disp = atom2 . coordinates - atom1 . coordinates dist = np . sqrt ( disp . dot ( disp ) ) atom_dict = { 'mol1s' : m1_idx , 'mol2s' : m2_idx , 'atom1' : a1_idx , 'atom2' : a2_idx , 'dist' : dist } interaction = Interaction ( atom1 , atom2 ) atom_dict . update ( interaction . to_dict ( ) ) atom_dicts . append ( atom_dict ) atom_df = pd . DataFrame ( atom_dicts ) return atom_df . set_index ( [ 'mol1s' , 'mol2s' ] )
Add intermolecular interaction types to bond distances
Add intermolecular interaction types to bond distances
'''
    Add intermolecular interaction types to bond distances
    '''
atom_dist_df
crystal