New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crystal(.cif,.pdb.etc)covert to print 3d format .stl ,open babel cannot cov #2679
Comments
Thanks for opening your first issue here! Be sure to follow the issue template! |
@SteelDominic In its current form, it is not clear what you want to achieve with an export to .stl except (now guessing:) perhaps some sort of 3D print with some properties. But which one? There are instances a molecular surface around an individual molecule is good enough, e.g. for packing models and the .stl format provides enough information. There are instances where an additional information is provided, encoded in color, on an isosurface, e.g. (Mark A. Spackman and Dylan Jayatilaka, CrystEngComm, 2009, 11, 19-32) for which an .obj file (for the surface) and .mtl file (for the color) is an acceptable format for 3D printing. (Though .obj files can contain color information, and .vrml files are an other acceptable data container format.) Else, do you want to generate a 3D print with either a single molecule on a plinth? Or a crystal packing of a unit cell? |
THANKs for your reply! |
I'm not 100% sure of your desired outcome, but if you choose to go via the .pov-format instead of stl you have the possibility to have the output as ball-and-stick instead of space-filling (you choose the ball-and-stick type with |
@SteelDominic I think OpenBabel is not the right tool for this. Before trying to convert batches of molecules for 3D print (similar to NIH's 3d print exchange, or CCDC's printing contests), one better would define if one wants a ball-and-stick model, or one of van der Waals-spheres; if the model is about individual molecules, or a packing; if the object should be free and isolated, or on a plinth; if the result is good enough in as a structure (where a .stl is enough), or requires colour (.obj, .vmrl). Note, Scalfani et al. address a similar a task with Jmol and data by the COD in their open access publication Programmatic conversion of crystal structures into 3D printable files using Jmol (link). The authors equally mention cif2vrml by Werner Kaminsky as an executable for the Windows operating system, too. Both approaches target vrml (VRML V2.0 utf8) as output format, though Jmol alternatively can provide .obj, or .stl files as well. Jmol's documentation compiles some additional hints on its wiki (link). # name : Jmol3DP.spt
# source : Scalfani et al, J Cheminform 8, 66 (2016). https://doi.org/10.1186/s13321-016-0181-z
# purpose: convert with Jmol individual .cif into .vrml97 suitable for 3D printing
#
# "G:/CIF files" # indicate the folder containing the list of cif to process
var alist=load("CIF_list_filenames.txt").lines
for (var i = 1; i < alist.length;i++) {
try{
load @{alist[i]} {1 1 1}
info = getProperty("moleculeInfo")
nmax = getProperty(info, "nAtoms").max
m = getProperty(info, "[select (number) where nAtoms == nmax]")[1]
print {molecule=m}
select on molecule=m
delete molecule !=m
axes OFF
set exportScale (10.0)
write @{alist[i]+".wrl"}
} catch (e) {jm
print e;
var a = e + "\n"+load(alist[i]);
write inline @a @{alist[i]+".error"};
}
} With an additional entry in
it suffices to cd into the folder with the list of cif files to process and to launch Jmol without a header $ jm -ions ./Jmol3DP.spt The paper announces https://chemapps.stolaf.edu/jmol/3dprint as a repository of 30k+ VRML/stl files; however somewhere between 2016 and today the page's address was changed, merged into an other interface, or the repository was retired (perhaps the public mailing list contains some info, or request help with a mail to jmol-users@lists.sourceforge.net). Interestingly, blender became useful for 3D printing of molecules, too, but I can't say if it is efficient for batch conversions. See for instance atomic blender, and publications in JChemEduc (example, and an other just found by keyword |
This would be awesome because so far, I didn't find one to provide / reconstruct both the geometry as well as color of the objects of the scene. |
I haven't seen a .pov => .obj converter. That's why I've used VRML (via Python) and as needed, used Blender for the final OBJ or STL conversion. |
OK, I may have been a bit fast on that. I just did a search and found a bunch of online offerings so I assumed that there would be converters to be found. But I haven't really looked at them nor tried to find one for myself. |
it's clear,when you try to convert a molecular to 3D format ,open babel cannot give correct response.
The text was updated successfully, but these errors were encountered: