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() could not define some bonds #64

Closed arifin-chemist89 closed 4 years ago

arifin-chemist89 commented 4 years ago

Hello,

I tried to get the bonds dictionary by using the code below.

xyz.get_bonds()

Problem description

I found that some of the bonds are missing. The reason is because the distance is pretty long. In my case, I have C-S bonds that where the distance are around 1.8-1.9 angstroms.

Do you have any suggestion to solve this problem?

Thank you in advance.

mcocdawc commented 4 years ago

Hello,

As you probably know, there is not one single correct definition for the atomic radius, so yes it has to be possible to change atomic radii at runtime.

As it is explained in the documentation there are three possibilities to modify the atomic radii:

  1. You can change the atomic radius of specific atoms with the modified_properties keyword argument.
  2. You can change the atomic radius definition for all elements (e.g. van der Vaals vs ionic) with the atomic_radius_data. This selects the corresponding column in constants.elements.
  3. You can add columns to constants.elements with your atomic radii for different atoms and select it with the atomic_radius_data keyword.

If the documentation should be updated to better explain it, I am happy to hear suggestions.

arifin-chemist89 commented 4 years ago

Thank you very much for your quick response.

I tried the options 1 and 2 that you mentioned above. I think I can solve my problem by using the first option. In this case, I would like to confirm that index1 in modified_properties = {index1: 1.5}corresponds to the atom_index - 1, isn't it?

Although this way is effective, but finding the index of the specific atoms is a bit tedious. Is there any way to modify the properties of a element, without adding new columns to constants.elements?

mcocdawc commented 4 years ago

In this case, I would like to confirm that index1 in modified_properties = {index1: 1.5} corresponds to the atom_index - 1, isn't it?

If I use pandas terminonoly, index and label based indexing is AFAIK more or less used interchangeably. So the atom index is the label you see in the printout and can be used as is. It is important to realize that you can use more or less any value as atom label. Even strings! By default pandas.DataFrames and hence my classes use numbers as index. It might help to have a look here. The index is the same you would pass to loc.

Although this way is effective, but finding the index of the specific atoms is a bit tedious. Is there any way to modify the properties of a element, without adding new columns to constants.elements?

If you want to just change one element permanently in a column, you could in theory modify this column, but I would rather copy this column and modify the copy.

arifin-chemist89 commented 4 years ago

If you want to just change one element permanently in a column, you could in theory modify this column, but I would rather copy this column and modify the copy.

I am completely agree with this point. Thank you very much for your comments and kind supports.