def load_opls(cls, atom_types, pfile_name=None, restrict=None): ''' Given a parameter file, inport the LJ parameters if possible. **Parameters** atom_types: *list, dict, ...* Atom types from a parsed opls parameter file. pfile_name: *str* The name of a parameter file to be parsed. If specified, then pfile is ignored (you may simply pass None as pfile). restrict: *list, str, optional* A list of atom labels to include when loading. If not specified, everything is loaded. **Returns** lj_objs: *list,* :class:`squid.forcefields.lj.LJ`, or *None* Returns a list of LJ objects if possible, else None. ''' # Ensure correct pfile format, and that we even need to parse it. import squid.forcefields.opls as opls_utils if pfile_name is not None: atom_types, _, _, _ = opls_utils.parse_pfile(pfile_name) return [ cls(index=t["index"], sigma=t["vdw_r"], epsilon=t["vdw_e"]) for t in atom_types if check_restriction(t, restrict) ]
def load_opls(cls, atom_types, pfptr=None, restrict=None): """ Given a parameter file, importthe Coulomb parameters if possible. **Parameters** atom_types: *list,* :class:`structures.Struct` Atom types from a parsed opls parameter file. pfptr: *str* The name of a parameter file to be parsed. If specified, then pfile is ignored (you may simply pass None as pfile). **Returns** coul_objs: *list, Coul*, or *None* Returns a list of Coul objects if possible, else None. """ import squid.forcefields.opls as opls_utils # Ensure correct pfile format, and that we even need to parse it. if pfptr is not None: atom_types, _, _, _ = opls_utils.parse_pfile(pfptr) return [ cls(index=t.index, charge=t.charge, mass=t.mass, element=(elem_i2s(t.element) if t.element != 0 else "X")) for t in atom_types if check_restriction(t, restrict) ]
def load_opls(cls, atom_types, pfile_name=None, restrict=None): ''' Given a parameter file, import the Coulomb parameters if possible. **Parameters** atom_types: *list, dict, ...* Atom types from a parsed opls parameter file. pfile_name: *str* The name of a parameter file to be parsed. If specified, then pfile is ignored (you may simply pass None as pfile). restrict: *list, str, optional* A list of atom labels to include when loading. If not specified, everything is loaded. **Returns** coul_objs: *list,* :class:`squid.forcefields.coulomb.Coul`, or *None* Returns a list of Coul objects if possible, else None. ''' import squid.forcefields.opls as opls_utils # Ensure correct pfile format, and that we even need to parse it. if pfile_name is not None: atom_types, _, _, _ = opls_utils.parse_pfile(pfile_name) return [ cls(index=t["index"], charge=t["charge"], mass=t["mass"], element=(elem_i2s(t["element"]) if t["element"] != 0 else "X")) for t in atom_types if check_restriction(t, restrict) ]
def load_opls(cls, dihedral_types, pfile_name=None, restrict=None): ''' Given a parameter file, inport the Dihedral parameters if possible. **Parameters** dihedral_types: *list, dict* Dihedral types from a parsed opls parameter file. pfile_name: *str* The name of a parameter file to be parsed. If specified, then pfile is ignored (you may simply pass None as pfile). restrict: *list, str, optional* A list of atom labels to include when loading. If not specified, everything is loaded. **Returns** dihedral_objs: *list, Dihedral*, or *None* Returns a list of Dihedral objects if possible, else None. ''' import squid.forcefields.opls as opls_utils if pfile_name is not None: _, _, _, dihedral_types = opls_utils.parse_pfile(pfile_name) return [ cls(indices=t["index2s"], energies=t["e"], equilibs=[]) for t in dihedral_types if check_restriction( t["index2s"], restrict) ]
def load_opls(cls, dihedral_types, pfptr=None, restrict=None): """ Given a parameter file, inport the Dihedral parameters if possible. **Parameters** dihedral_types: *list,* :class:`structures.Struct` Dihedral types from a parsed opls parameter file. pfptr: *str* The name of a parameter file to be parsed. If specified, then pfile is ignored (you may simply pass None as pfile). **Returns** dihedral_objs: *list, Dihedral*, or *None* Returns a list of Dihedral objects if possible, else None. """ import squid.forcefields.opls as opls_utils if pfptr is not None: _, _, _, dihedral_types = opls_utils.parse_pfile(pfptr) return [ cls(indices=t.index2s, energies=t.e, equilibs=[]) for t in dihedral_types if check_restriction(t.index2s, restrict) ]
def load_opls(cls, atom_types, pfptr=None, restrict=None): ''' Given a parameter file, inport the LJ parameters if possible. **Parameters** atom_types: *list,* :class:`structures.Struct` Atom types from a parsed opls parameter file. pfptr: *str* The name of a parameter file to be parsed. If specified, then pfile is ignored (you may simply pass None as pfile). **Returns** lj_objs: *list, LJ*, or *None* Returns a list of LJ objects if possible, else None. ''' # Ensure correct pfile format, and that we even need to parse it. import squid.forcefields.opls as opls_utils if pfptr is not None: atom_types, _, _, _ = opls_utils.parse_pfile(pfptr) return [ cls(index=t.index, sigma=t.vdw_r, epsilon=t.vdw_e) for t in atom_types if check_restriction(t, restrict) ]