partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
248 stars 61 forks source link

Can't generate 3D Structures from molecule objects. #240

Open sahilsujeet1 opened 3 years ago

sahilsujeet1 commented 3 years ago

I am trying to generate 3D structures from 2D molecules of composer. I have installed Kekule.js using npm and I am using it in an Angular application. I get the following error: Screenshot from 2021-07-15 15-34-42

Is this a real bug or am I doing a mistake. I followed the kekule.js at master but still got this error.

partridgejiang commented 3 years ago

Hi @sahilsujeet1, could you please check the value of Kekule.VERSION? I myself can not reproduce those errors in generating 3D structures with kekule.min.js in the latest dist, :(.

sahilsujeet1 commented 3 years ago

Hi @sahilsujeet1, could you please check the value of Kekule.VERSION? I myself can not reproduce those errors in generating 3D structures with kekule.min.js in the latest dist, :(.

The version I am using is 0.9.3 Screenshot from 2021-07-16 10-46-01

partridgejiang commented 3 years ago

Not the version setting in package.json, but the actual Kekule.VERSION value evaluated in the console of browser. You may also inspect the value of Kekule.scriptSrcInfo to check whether it is properly set.

sahilsujeet1 commented 3 years ago

Have a look at my console outputs. Screenshot from 2021-07-17 19-26-18

partridgejiang commented 3 years ago

Please try download the latest files in /dist directory of this repo and use them to replace the old ones in node_modules/kekule/dist/. With those manually replacement, the Kekule.VERSION should be 0.9.7 and Kekule.scriptSrcInfo should be set with proper values. Then please rerun your 3D structure generation code to check whether the issue is resolved.

sahilsujeet1 commented 3 years ago

Please try download the latest files in /dist directory of this repo and use them to replace the old ones in node_modules/kekule/dist/. With those manually replacement, the Kekule.VERSION should be 0.9.7 and Kekule.scriptSrcInfo should be set with proper values. Then please rerun your 3D structure generation code to check whether the issue is resolved.

I did what you said but now I get a different error: Screenshot from 2021-07-17 21-16-07

partridgejiang commented 3 years ago

Hi @sahilsujeet1, the 3D generation function is performed in a web worker in which some extra js files need to be loaded apart from the bundled script.js. So please copy the kekule/dist/extra directory to your script root dir (the path in browser should be http://localhost:5200/extra) and rerun the codes, :).

sahilsujeet1 commented 3 years ago

Hi @sahilsujeet1, the 3D generation function is performed in a web worker in which some extra js files need to be loaded apart from the bundled script.js. So please copy the kekule/dist/extra directory to your script root dir (the path in browser should be http://localhost:5200/extra) and rerun the codes, :).

I don't think this is possible in an Angular application

partridgejiang commented 3 years ago

Why not? Just deploy some additional files.

lsdsjy commented 3 years ago

Hi @sahilsujeet1, the 3D generation function is performed in a web worker in which some extra js files need to be loaded apart from the bundled script.js. So please copy the kekule/dist/extra directory to your script root dir (the path in browser should be http://localhost:5200/extra) and rerun the codes, :).

I don't think this is possible in an Angular application

You can use assets field in angular.json to copy files into your dist directory.