mcocdawc / chemcoord

A python module for manipulating cartesian and internal coordinates.
GNU Lesser General Public License v3.0
72 stars 19 forks source link

get_bonds() failing #88

Closed p-walt closed 1 year ago

p-walt commented 1 year ago

Code Sample, a copy-pastable example if possible

compound = cc.Cartesian.read_xyz('mm.xyz', start_index=1)

print(compound) connection_table = compound.getbonds() print(connection_table)


#### Problem description
Hi there, I have been trying to use chemcoord to extract bonding information for a variety of compounds. I am able to create a Cartesian object through reading the .xyz file but when I try to get the connection table I receive the following error:

connection_table = compound.getbonds()
AttributeError: 'Cartesian' object has no attribute 'getbonds'

The print of the Cartesian object works (shown below):
   atom        x        y        z
1     C -4.12308 -1.85490  0.57827
2     C -4.29279 -0.34522  0.35453
3     C -3.91457  0.40759  1.63497
4     N -3.90732  1.77081  1.58718
5     O -3.70275 -0.15325  2.70766
6     C -3.57547  0.19312 -0.90198
7     N -3.84103 -0.58332 -2.12228
8     C -2.10263  0.42784 -0.71428
9     N -1.52591  1.61346 -0.65547
10    C -0.18811  1.36643 -0.46954
11    C  0.88138  2.25724 -0.34279
12    C  2.17458  1.74036 -0.15444
13    C  2.42768  0.35621 -0.08824
14    C  3.84728 -0.20965  0.12462
15    C  4.94834  0.87199  0.20641
16    C  3.89047 -1.00727  1.44572
17    C  4.21821 -1.14568 -1.04655
18    C  1.33644 -0.53474 -0.21558
19    C  0.06034  0.00458 -0.40573
20    N -1.17282 -0.57296 -0.56277
21    H -4.72839 -2.18653  1.43016
22    H -3.08580 -2.12104  0.80146
23    H -4.45314 -2.43454 -0.28888
24    H -5.37075 -0.17526  0.21785
25    H -3.57636  2.20392  2.44179
26    H -3.58797  2.24273  0.74734
27    H -4.01176  1.18116 -1.10504
28    H -3.43430 -0.08160 -2.91409
29    H -3.37909 -1.48732 -2.08978
30    H  0.70942  3.32671 -0.38947
31    H  2.97850  2.46572 -0.05900
32    H  4.99633  1.46839 -0.71220
33    H  4.78371  1.55358  1.04903
34    H  5.93706  0.41942  0.34897
35    H  3.21151 -1.86695  1.43280
36    H  4.89696 -1.39602  1.63998
37    H  3.60644 -0.37669  2.29659
38    H  3.55680 -2.01667 -1.10825
39    H  4.15954 -0.61865 -2.00623
40    H  5.23980 -1.52856 -0.93808
41    H  1.47382 -1.61003 -0.16514
42    H -1.36057 -1.56441 -0.56038

but I cannot understand why the get_bonds() function does not work.

Many thanks.
mcocdawc commented 1 year ago

There is a get_bonds but no getbonds method, which is exactly the error you get.

p-walt commented 1 year ago

Apologies for wasting your time I really should have seen that! Thank you for your quick reply.

mcocdawc commented 1 year ago

No problem, errors happen. ;-)