コード例 #1
0
def test_benzene_reflection_should_not_change_bonding():
    mol = Molecule(read=benzene_xyz)
    mol.reflect('xy')
    mol.get_bonds()
    assert np.allclose(mol.bonds, benzene_bonds)
    mol.reflect('yz')
    mol.get_bonds()
    assert np.allclose(mol.bonds, benzene_bonds)
    mol.reflect('xz')
    mol.get_bonds()
    assert np.allclose(mol.bonds, benzene_bonds)
コード例 #2
0
        for i, (atom, coor) in enumerate(zip(elements, coordinates)):
            rm.write('%2i %2s_%3s % 5.4f % 5.4f % 5.4f\n' % (i, atom, code, coor[0], coor[1], coor[2]))

        rm.write(
            "# Chiral centers Bond  BondDipoles Bend  UrayBradley InvBend  Torsion Imp." +
            " Torsion Bond/Bond Stretch/Bend Bend/Bend Bend/Torsion IntraVDW IntraCoulomb\n" +
            "               0  %3i            0    0            0       0            0" % len(bonds) +
            "             0            0         0         0       0        0            0\n" +
            "# Bond stretch: atom n1-n2, type, parameters\n"
        )
        # Write bonds
        for b in bonds:
            rm.write("%2i %2i RIGID_BOND\n" % (b[0], b[1]))
        rm.write("# Number of config moves\n0\n")


mol_file = os.path.abspath(sys.argv[1])
print('Reading -> %s' % mol_file)
mol = Molecule(read=mol_file)
mol.get_bonds()

if len(sys.argv) > 2:
    mol_name = os.path.basename(sys.argv[2]).split('.')[0]
    raspa_molecule_file = os.path.abspath(sys.argv[2])
else:
    mol_name = os.path.basename(mol_file).split('.')[0]
    raspa_molecule_file = os.path.join(os.path.split(mol_file)[0], '%s.def' % mol_name)

print('Writing -> %s' % raspa_molecule_file)
write_raspa_molecule(mol, raspa_molecule_file)