Ertl and Schuffenhauer, who developed the synthetic accessibility score, provide an implementation packaged with RDKit called sascorer.py.
This is provided in the Contrib folder of the RDKit repo; what this means is it isn't formally part of RDKit, but with a little work can be accessed from RDKit. An example of how to do this is given in an issue on the ...
I know this was long ago, but for those that find the same problem in the future, the sisl python package might be useful. It has a generic Grid object and it knows how to read the grids from VASP:
grid = sisl.get_sile("path/to/your/CHGCAR").read_grid()
Then grid is a sisl Grid object, so:
grid.grid contains the numpy array of values ...
Just adding some timings for @Antimon's answer. Using numpy.outer is definitely the way to go IMO.
def list_version(shots, lens):
list_total = 
for shot in list_shot:
list_out = 
for lens in list_lens:
val = shot * lens
Assuming that your sample code is really what you are looking for (which I doubt judging by the full code example you had posted originally), the answer by @vtan707 would work, but is very awkward because of its requirement for specifically shaped 2D arrays. Having to do nested calls of np.array on a single-element list of a function output kinda gives it ...
What you're trying to do can actually be done very quickly, without any loops, and can even be ported to make valuable use of a GPU.
Here's a quick example that you can test yourself in octave-online:
lens = 0:10
The outputs are as follows:
shots=[0 50 100 150 200 250]
lens =[0 1 2 3 4 5 ...
Here are a couple of extra links that might be helpful in your (now 5months old) quest: , .
It would be helpful for all of us if you could put up that green chekmarck on the answers you found helpful and maybe tell us how you ended up resolving your issue, if you already have that is ...
Your best bet is to keep the molecule (e.g., as a .mol or .sdf file) around and then simply update the coordinates from the .xyz file as you wish.
As you mention, reading bond orders from XYZ is imperfect - the file simply doesn't contain them and you have to guess. There is no perfect way to do that. Even a highly accurate algorithm for bond order ...
Here is an updated version of your code that I believe now works. I had to add in a few of the values that were computed elsewhere in your code, but otherwise it is mostly the same.
import numpy as np
nb = 4
S = np.zeros([nb,nb]) # nb is the number of basis set and I have it in the code
distancess=np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.4]])
#is an array ...