def fill_LJ(self): """ Fills the LJ_radius, LJ_depth arrays and LJ_types dictionary with data from LENNARD_JONES_ACOEF and LENNARD_JONES_BCOEF sections of the prmtop files, by undoing the canonical combining rules. """ AmberParm.fill_LJ(self) acoef = self.parm_data['LENNARD_JONES_14_ACOEF'] bcoef = self.parm_data['LENNARD_JONES_14_BCOEF'] ntypes = self.pointers['NTYPES'] self.LJ_14_radius = [] # empty LJ_radii so it can be re-filled self.LJ_14_depth = [] # empty LJ_depths so it can be re-filled one_sixth = 1.0 / 6.0 # we need to raise some numbers to the 1/6th power for i in range(ntypes): lj_index = self.parm_data["NONBONDED_PARM_INDEX"][ntypes * i + i] - 1 if acoef[lj_index] < 1.0e-6: self.LJ_14_radius.append(0) self.LJ_14_depth.append(0) else: factor = 2 * acoef[lj_index] / bcoef[lj_index] self.LJ_14_radius.append(pow(factor, one_sixth) * 0.5) self.LJ_14_depth.append(bcoef[lj_index] / 2 / factor)
def fill_LJ(self): """ Fills the LJ_radius, LJ_depth arrays and LJ_types dictionary with data from LENNARD_JONES_ACOEF and LENNARD_JONES_BCOEF sections of the prmtop files, by undoing the canonical combining rules. """ AmberParm.fill_LJ(self) acoef = self.parm_data['LENNARD_JONES_14_ACOEF'] bcoef = self.parm_data['LENNARD_JONES_14_BCOEF'] ntypes = self.pointers['NTYPES'] self.LJ_14_radius = [] # empty LJ_radii so it can be re-filled self.LJ_14_depth = [] # empty LJ_depths so it can be re-filled one_sixth = 1.0 / 6.0 # we need to raise some numbers to the 1/6th power for i in range(ntypes): lj_index = self.parm_data["NONBONDED_PARM_INDEX"][ntypes*i+i] - 1 if acoef[lj_index] < 1.0e-6: self.LJ_14_radius.append(0) self.LJ_14_depth.append(0) else: factor = 2 * acoef[lj_index] / bcoef[lj_index] self.LJ_14_radius.append(pow(factor, one_sixth) * 0.5) self.LJ_14_depth.append(bcoef[lj_index] / 2 / factor)
def initialize_topology(self, xyz=None, box=None): """ Initializes topology data structures, like the list of atoms, bonds, etc., after the topology file has been read. The following methods are called: """ self.LJ_14_radius = [] self.LJ_14_depth = [] AmberParm.initialize_topology(self, xyz, box)
def load_pointers(self): """ Loads the data in POINTERS section into a pointers dictionary with each key being the pointer name according to http://ambermd.org/formats.html """ AmberParm.load_pointers(self) # Other pointers nub, nubtypes = self.parm_data['CHARMM_UREY_BRADLEY_COUNT'][:2] self.pointers['NUB'] = nub self.pointers['NUBTYPES'] = nubtypes self.pointers['NIMPHI'] = self.parm_data['CHARMM_NUM_IMPROPERS'][0] self.pointers['NIMPRTYPES'] = self.parm_data['CHARMM_NUM_IMPR_TYPES'][0] # If CMAP is not present, don't load the pointers if self.has_cmap: self.pointers['CMAP'] = self.parm_data['CHARMM_CMAP_COUNT'][0] self.pointers['CMAP_TYPES'] = self.parm_data['CHARMM_CMAP_COUNT'][1]
def recalculate_LJ(self): """ Takes the values of the LJ_radius and LJ_depth arrays and recalculates the LENNARD_JONES_A/BCOEF topology sections from the canonical combining rules. """ AmberParm.recalculate_LJ(self) ntypes = self.pointers['NTYPES'] acoef = self.parm_data['LENNARD_JONES_14_ACOEF'] bcoef = self.parm_data['LENNARD_JONES_14_BCOEF'] for i in range(ntypes): for j in range(i, ntypes): index = self.parm_data['NONBONDED_PARM_INDEX'][ntypes*i+j] - 1 rij = self.LJ_14_radius[i] + self.LJ_14_radius[j] wdij = sqrt(self.LJ_14_depth[i] * self.LJ_14_depth[j]) acoef[index] = wdij * rij ** 12 bcoef[index] = 2 * wdij * rij**6
def recalculate_LJ(self): """ Takes the values of the LJ_radius and LJ_depth arrays and recalculates the LENNARD_JONES_A/BCOEF topology sections from the canonical combining rules. """ AmberParm.recalculate_LJ(self) ntypes = self.pointers['NTYPES'] acoef = self.parm_data['LENNARD_JONES_14_ACOEF'] bcoef = self.parm_data['LENNARD_JONES_14_BCOEF'] for i in range(ntypes): for j in range(i, ntypes): index = self.parm_data['NONBONDED_PARM_INDEX'][ntypes * i + j] - 1 rij = self.LJ_14_radius[i] + self.LJ_14_radius[j] wdij = sqrt(self.LJ_14_depth[i] * self.LJ_14_depth[j]) acoef[index] = wdij * rij**12 bcoef[index] = 2 * wdij * rij**6
def load_pointers(self): """ Loads the data in POINTERS section into a pointers dictionary with each key being the pointer name according to http://ambermd.org/formats.html """ AmberParm.load_pointers(self) # Other pointers nub, nubtypes = self.parm_data['CHARMM_UREY_BRADLEY_COUNT'][:2] self.pointers['NUB'] = nub self.pointers['NUBTYPES'] = nubtypes self.pointers['NIMPHI'] = self.parm_data['CHARMM_NUM_IMPROPERS'][0] self.pointers['NIMPRTYPES'] = self.parm_data['CHARMM_NUM_IMPR_TYPES'][ 0] # If CMAP is not present, don't load the pointers if self.has_cmap: self.pointers['CMAP'] = self.parm_data['CHARMM_CMAP_COUNT'][0] self.pointers['CMAP_TYPES'] = self.parm_data['CHARMM_CMAP_COUNT'][ 1]