Skip to content
Snippets Groups Projects
Commit 12f78739 authored by Marco Biasini's avatar Marco Biasini
Browse files

fix pdb output for alt atom locations

parent 619babe6
Branches
Tags
No related merge requests found
......@@ -136,7 +136,8 @@ void write_atom(std::ostream& ostr, FormattedLine& line,
} else {
for (std::vector<String>::const_iterator
i=names.begin(), e=names.end(); i!=e; ++i) {
p=atom.GetAltPos(*i);
geom::Mat4 tf=atom.GetEntity().GetTransformationMatrix();
p=geom::Vec3(tf*geom::Vec4(atom.GetAltPos(*i)));
line(30, 50).Clear();
if (i->size()>1) {
......
......@@ -364,6 +364,31 @@ BOOST_AUTO_TEST_CASE(write_conect)
"testfiles/pdb/conect-out.pdb"));
}
BOOST_AUTO_TEST_CASE(alt_loc_tf)
{
String fname("testfiles/pdb/alt-loc.pdb");
// this scope is required to force the writer stream to be closed before
// opening the file again in compare_files. Avoids a race condition.
mol::EntityHandle ent=mol::CreateEntity();
PDBReader reader(fname);
reader.Import(ent);
String out_name("testfiles/pdb/alt-loc-tf-out.pdb");
{
PDBWriter writer(out_name);
geom::Mat4 shift;
shift.PasteTranslation(geom::Vec3(10,20,30));
ent.RequestXCSEditor().ApplyTransform(shift);
writer.Write(ent);
}
PDBReader r2(out_name);
mol::EntityHandle ent2=mol::CreateEntity();
r2.Import(ent2);
mol::ResidueHandle res1=ent2.FindResidue("A", mol::ResNum(1));
mol::AtomHandle a1=res1.FindAtom("N");
BOOST_CHECK_EQUAL(res1.GetAltAtomPos(a1, "A"), geom::Vec3(26,84,30));
BOOST_CHECK_EQUAL(res1.GetAltAtomPos(a1, "B"), geom::Vec3(18,-108,30));
}
BOOST_AUTO_TEST_CASE(res_name_too_long)
{
std::stringstream out;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment