def test_wrong_ff_fail(self): qlib = QLib("amber", ignore_errors=True) with pytest.raises(QLibError): qlib.read_ffld("data/ace_ash_nma.ffld11", None) qlib = QLib("oplsaa", ignore_errors=True) with pytest.raises(QLibError): qlib.read_amber_lib("data/ff-amber14/lib/amino12.lib") with pytest.raises(QLibError): qlib.read_prepin_impropers("data/ff-amber14/lib/amino12.lib") with pytest.raises(QLibError): qlib.read_mol2("data/all_amino_acids.mol2")
def test_read_ffld(self): qlib = QLib("oplsaa") qstruct = QStruct("data/ace_ash_nma.pdb", "pdb") qlib.read_ffld("data/ace_ash_nma.ffld11", qstruct) assert len(qlib.residue_dict) == 3 assert len(qlib.residue_dict["ACE"].atoms) == 6 assert len(qlib.residue_dict["ASH"].atoms) == 13 assert len(qlib.residue_dict["NMA"].atoms) == 6 ash = qlib.residue_dict["ASH"] assert ash.atoms[1].atom_type == "ash.CA" assert is_close(ash.atoms[1].charge, 0.14) assert "tail C" in ash.connections assert "head N" in ash.connections
try: qstruct = QStruct(args.pdb, "pdb", ignore_errors=args.ignore_errors) except QStructError as err: print "FATAL! Problem with pdb: {}".format(err) sys.exit(1) try: qprm.read_ffld(args.ffld_output, qstruct) except QPrmError as err: print "FATAL! Problem with ffld file: {}".format(err) sys.exit(1) try: qlib.read_ffld(args.ffld_output, qstruct) except QLibError as err: print "FATAL! Problem with ffld file: {}".format(err) sys.exit(1) try: qtop = QTopology(qlib, qprm, qstruct) except QTopologyError as err: print "FATAL! Problem building the topology: {}".format(err) sys.exit(1) # # get total and max energies and number of parameters # data, total_e, max_e, nprm = {}, {}, {}, {}
def test_read_ffld_wrong_order_fail(self): # see if it fails with PDB with wrong atom-order qlib = QLib("oplsaa") qstruct = QStruct("data/ace_ash_nma_bad.pdb", "pdb") with pytest.raises(QLibError): qlib.read_ffld("data/ace_ash_nma.ffld11", qstruct)
def test_read_ffld_fail(self): # no residues found qlib = QLib("oplsaa") qstruct = QStruct("data/ace_ash_nma.pdb", "pdb") with pytest.raises(QLibError): qlib.read_ffld("data/ace_ash_nma.pdb", qstruct)
def test_convert_oplsaa(self): qlib = QLib("oplsaa") qstruct = QStruct("data/ace_ash_nma.pdb", "pdb") qlib.read_ffld("data/ace_ash_nma.ffld11", qstruct) ql_str = qlib.get_string() assert ql_str == open("data/ace_ash_nma.lib").read()