11
$\begingroup$

I have a xyz file of a system that doesn't contain any cell information, but which has all its coordinates wrapped inside the same (triclinic) cell.

I would like to have a rough guess of the cell that would fit the positions of the atoms. Do you know of any software (ranging from a python library to the GUI interface of a visualisation software) that can suggest such a guess?

This problem occurs rather frequently when I recover some coordinate files from the Supporting Information/reply to a data request of an older paper of another group I'm interested in. I've attached an example coordinate file and inserted snapshots here (with an orthogonal cell displayed that doesn't fit the structure at all): Snapshot of the system

  276

C       6.676339    0.192796   12.145936
C      11.366235   16.834216   11.495125
H      12.019625   16.145506   12.044248
C       6.280053    1.639054   12.103951
N      11.303223   18.196153   11.753643
Zn      9.200748    0.750607   13.658523
C       3.578268   11.370255    5.453809
C      13.699914   14.021615    9.570215
H      12.622041   13.861431    9.425111
C       4.881148   10.804871    4.968113
N      14.651099   13.166309    9.051709
Zn      2.194846    9.249976    3.894082
C      13.573519   19.782104    9.372003
C       9.650302    3.129888   11.785367
H       9.451958    3.777791   12.648844
C      13.402220   18.347024    9.002673
H      12.345544   18.034597    9.157673
H      14.047492   17.692827    9.624574
H      13.635063   18.196773    7.929953
N       9.589721    1.748789   11.888965
C      15.251869    8.903745    9.292279
C       4.734553    7.487697    4.402852
H       5.345935    8.231599    3.879621
C      13.931488    8.795944    9.990504
H      14.017715    9.209606   11.023534
H      13.127887    9.358163    9.470857
H      13.626476    7.728751   10.050790
N       3.391155    7.702228    4.636291
C      11.492100   17.969934    5.910694
C       7.710219    1.633914    6.953133
H       7.897343    2.609658    6.500153
C      11.871790   16.533542    5.695331
N       8.178834    0.474885    6.374283
Zn      8.846073    0.518570    4.431922
C      18.018082   13.102289   12.089180
C       7.797038   10.609563    7.407416
H       8.784880   10.150691    7.245500
C      16.657250   12.770488   12.624026
N       6.763390    9.912517    8.004245
Zn      7.287796    8.218983    8.950470
C      10.959897    1.902131    5.766770
C      15.458254   18.472285    3.835431
H      15.619357   17.600477    3.184691
C      10.384827    3.289231    5.783887
H      10.357980    3.670437    6.828553
H       9.376720    3.355456    5.333419
H      11.038229    3.972835    5.192128
N      14.527956   19.452798    3.525318
C       6.342419    5.444221    7.934236
C      17.113192    9.230065   12.448452
H      16.684351   10.209479   12.678873
C       7.704913    4.889852    7.656142
H       7.822026    4.588041    6.590487
H       8.455953    5.684095    7.859673
H       7.945187    4.014297    8.299972
N      18.454457    9.068402   12.177065
C       9.150045    7.564927    3.845904
C      15.627362    7.011960   16.210630
H      16.393699    7.326585   15.489868
C       8.851551    7.546020    5.316240
N      15.743846    7.267011   17.568874
Zn     10.881452    9.948103    3.612691
C      11.145352    7.154075   14.519854
C       6.557603    8.929112    1.998930
H       7.052734    9.054566    2.971215
C      10.658971    6.077478   13.597495
H       9.856155    5.474559   14.070719
H      10.269273    6.513559   12.655227
H      11.484152    5.374205   13.345025
N       6.105426    7.713129    1.510008
Zn      6.441266    5.975540    2.582166
C       6.404807   13.131627   -0.068408
C      12.198581   11.819676   12.116357
H      12.054318   11.306461   11.154472
C       5.791880   13.267054    1.289376
N      11.396191   11.536675   13.207880
Zn      4.827434   10.628725   -1.166858
C      14.708173   11.008743   16.156150
C       8.760805   13.306559    3.389321
H       8.537568   14.287203    3.822534
C      14.989668   10.335533   14.851565
H      14.513397    9.329954   14.835542
H      14.588745   10.931067   14.001634
H      16.084894   10.186719   14.721887
N       8.943752   13.119624    2.028267
Zn      8.974391   14.689065    0.715995
C       8.957609   12.087290    4.020148
H       8.830571   11.799461    5.071521
N       9.302096   11.149530    3.064910
C      14.411036    6.387805   15.992968
H      13.932985    6.077246   15.052492
H       9.451037    8.301016    5.866746
H       7.773858    7.742585    5.519121
H       9.097844    6.543566    5.737511
N      13.778078    6.224194   17.210264
C       6.409791    9.870768    1.003454
H       6.694736   10.928033    1.004326
N       5.861515    9.257696   -0.106418
C      13.122867   12.785623   12.490837
H      13.884957   13.294078   11.889375
H       5.282716   12.338508    1.616533
H       6.568851   13.530815    2.037771
H       5.018093   14.065592    1.286679
N      12.902468   13.103341   13.817350
C      14.361578   15.019237   10.279061
H      13.953930   15.861465   10.855413
H       5.210771    9.921468    5.563887
H       5.696809   11.557275    5.019954
H       4.780339   10.493639    3.901870
N      15.720511   14.787374   10.186987
Zn      4.883603   13.676186    7.099788
C      16.518190    7.980776   12.372815
H      15.462931    7.717038   12.558776
N      17.470848    7.043292   11.993391
Zn      3.698399    3.885889    6.509382
C       7.021785    1.310142    8.110820
H       6.476066    1.966490    8.806051
H      12.964522   16.448503    5.492520
H      11.642687   15.930883    6.600439
H      11.351254   16.080459    4.818441
N       7.058305   -0.066374    8.248390
Zn      5.605027   -0.855441    9.405391
C       7.377646   11.913600    7.207342
H       7.933338   12.773177    6.814760
H      16.090698   12.101319   11.935914
H      16.063653   13.704578   12.715967
H      16.723050   12.279741   13.622794
N       6.069967   12.025230    7.647205
C      16.122306   18.847337    4.996570
H      16.931240   18.367845    5.561867
N      15.609299   20.060653    5.407419
Zn     11.831287    2.129986    8.598593
C       5.089420    6.240094    4.923489
H       6.085073    5.782511    5.048832
N       3.951057    5.671853    5.475388
C      10.495529   16.545199   10.461760
H      10.289254   15.598051    9.941104
H       5.639666    1.852151   11.222702
H       5.697997    1.925936   13.012591
H       7.177800    2.294591   12.045937
N       9.883230   17.725185   10.068031
C       9.981367    3.449550   10.474937
H      10.141440    4.433533   10.011337
N      10.142927    2.274214    9.757123
C      11.952749   10.995966    6.353089
C      12.924023    9.132919    6.976836
H      13.577486    8.444173    7.525805
C      11.556381   12.442200    6.309941
H      10.977568   12.730516    7.220191
H      10.912590   12.653326    5.430602
H      12.453734   13.097901    6.247413
N      12.861250   10.494961    7.235182
C      10.583560    2.867395   15.223300
C       8.422659    3.219908   15.361987
H       7.344928    3.061655   15.213243
C      11.887920    2.296486   14.748249
N       9.373705    2.361576   14.848012
C       2.849498    9.771594    0.879751
C       2.644522   11.625157    2.016552
H       2.445590   12.273815    2.879387
C       2.677488    8.336578    0.511679
H       1.621396    8.024033    0.669918
H       3.324797    7.683127    1.132015
H       2.907623    8.186361   -0.561608
N       2.583383   10.244325    2.121776
C      13.691144   16.605953   13.812624
C      15.455798   17.490102   12.888514
H      16.066028   18.231683   12.360407
C      12.371224   16.501461   14.512298
H      12.456320   16.922138   15.542526
H      11.567069   17.059744   13.989177
H      12.066300   15.434776   14.579607
N      14.113422   17.706478   13.125200
C      18.498397    9.470541   15.674439
C      18.432633   11.638650   15.441743
H      18.617730   12.614280   14.987584
C      18.878699    8.034254   15.459276
H      19.971301    7.949825   15.255754
H      18.357994    7.580634   14.582736
H      18.650537    7.431765   16.364690
N      18.902116   10.479782   14.863272
C       7.292364    3.098945    3.604161
C       9.351903    2.908406    2.886974
H      10.338837    2.448752    2.721417
C       5.931916    2.767843    4.140624
N       8.319390    2.211875    3.486264
C       9.403366    9.598629   10.286638
C      10.183092    7.665480    9.625597
H      10.343840    6.794842    8.973125
C       8.826690   10.984979   10.307664
N       9.251716    8.646213    9.318397
C      11.618348   16.249488    2.138670
C      10.107938   17.733136    2.682860
H       9.679497   18.712967    2.912353
C      12.979846   15.693885    1.859437
N      11.448761   17.570307    2.410926
C       7.591857   15.265255    8.364377
C       8.620988   15.511532    6.446866
H       9.387277   15.826260    5.726124
C       7.293663   15.246474    9.834714
N       8.737671   15.766467    7.805192
C      16.420287   17.959168    8.726646
C      17.282844   18.933153   10.487683
H      17.778615   19.057765   11.459793
C      15.932109   16.883716    7.803773
H      15.132099   16.278529    8.278923
H      15.538136   17.321515    6.864105
H      16.757532   16.182705    7.546097
N      16.830091   17.717610    9.998126
C      13.409549    4.631698    9.700958
C      13.751948    4.124945    7.601212
H      13.606555    3.613167    6.638576
C      12.799797    4.762886   11.060487
N      12.952290    3.837898    8.693737
C       3.983815    1.003710    7.666170
C       3.486453    2.502152    9.182446
H       3.265221    3.482883    9.616429
C       4.262643    0.330836    6.360686
H       3.857125    0.925200    5.512164
H       5.357721    0.184763    6.225916
H       3.788984   -0.675966    6.346499
N       3.668735    2.315695    7.821205
C       3.682358    1.282530    9.812661
H       3.555263    0.994473   10.863971
N       4.025498    0.344799    8.856823
C       7.404745   14.887350    6.229280
H       6.926596   14.576855    5.288762
H       7.893022   16.001456   10.385187
H       6.216105   15.442423   10.037940
H       7.540673   14.244188   10.256112
N       6.771946   14.723560    7.446784
C      17.133827   19.875679    9.493507
H      17.418293   20.933009    9.494627
N      16.584285   19.263818    8.383598
C      14.675333    5.091639    7.976442
H      15.435798    5.603354    7.375640
H      12.287128    3.835318   11.384690
H      13.579083    5.020359   11.808656
H      12.029410    5.564680   11.062451
N      14.457176    5.405465    9.304289
C       9.084182    4.217835   16.070651
H       8.676372    5.061912   16.644301
H      12.200391    1.403125   15.338224
H      12.709503    3.040405   14.821799
H      11.801647    1.997339   13.677582
N      10.442824    3.983175   15.982713
C       9.511779   16.484270    2.607088
H       8.456197   16.221770    2.792915
H      13.098038   15.394683    0.793158
H      13.218182   14.816382    2.501108
H      13.732070   16.486198    2.065473
N      10.463176   15.546256    2.227365
C      17.745363   11.314796   16.600117
H      17.199739   11.971024   17.295520
N      17.782875    9.938371   16.738177
C       8.933336    4.213156    2.689531
H       9.488643    5.072535    2.295944
H       5.340738    3.702882    4.236765
H       5.997850    2.274170    5.137781
H       5.362367    2.102016    3.451829
N       7.626978    4.325471    3.133351
C      10.849316    8.039228   10.785877
H      11.660254    7.560108   11.348636
H       8.795260   11.361674   11.353896
H       9.482138   11.671424    9.721257
H       7.820973   11.051876    9.853019
N      10.336688    9.252251   11.199172
C      15.810234   16.242616   13.410065
H      16.805472   15.783387   13.532764
N      14.672437   15.676581   13.965184
C      12.053319    8.843934    5.943410
H      11.846943    7.896801    5.422855
N      11.441470   10.023948    5.549504
C       2.975958   11.942980    0.705818
H       3.135644   12.926508    0.240909
N       3.137256   10.766848   -0.010427
$\endgroup$
8
  • 4
    $\begingroup$ Is this material really crystalline? Or do you want just to do periodic calculation with it? $\endgroup$
    – Camps
    Nov 8, 2021 at 18:25
  • 1
    $\begingroup$ No it's amorphous and I do indeed want to do periodic calculation (rdf, angle distribution, ring statistics, etc.) $\endgroup$
    – Hebo
    Nov 9, 2021 at 9:51
  • 2
    $\begingroup$ Have you tried equilibrating with strong position restraints or constraints? If you lock (or nearly lock) the atoms in place and simulate with a flexible box that is the right shape but perhaps not the right dimensions, you might get a reasonable box out of it. (Would be my first try, at least.) $\endgroup$
    – dwhswenson
    Nov 10, 2021 at 23:13
  • 1
    $\begingroup$ Some of the atoms are close enough to each other to look like 2-methyl-imidazole. What is the origin of the data, is it part of the SI of a publication? Briefly (because of Zn) I thought about ZnPc (Pc as in phthalocyanine dyes), though this pattern would not match with the former. Any chance to compute a tight box which would enclose all atoms more tightly than the current on (looks tetragonal, perhaps even cubic in shape)? Conceptually, if regular enough, the set could become a candidate for a routine like e.g., Platon's addsym. $\endgroup$
    – Buttonwood
    Nov 15, 2021 at 16:51
  • 3
    $\begingroup$ Interesting problem. My initial guess was to calculate a surface from all the points (eg a convex hull) and then simplify that surface and somehow derive lattice vectors from the resulting points. Second guess is a constrained-optimization approach, defining lattice vectors, starting with a cube, and optimizing for smallest volume with all points contained within them (i.e. using an optimization library, rather than an atomic simulation code). Not sure however...if someone solves this problem elegantly, I would be interested too! $\endgroup$ Nov 16, 2021 at 5:49

1 Answer 1

8
$\begingroup$

It is possible to approximate the cell parameters by determining the convex hull of the molecule and then computing the smallest parallelepiped that encloses it. This will automatically give the dimensions together with the vertices of the parallelepiped from which the angles can be computed.

This problem was first investigated by Vivien and Wicker (2002)1, and their quickest algorithm runs in $\mathcal O(n\log n+v^2)$, where $n$ is the number of atoms and $v$ is the number of vertices of the convex hull. The pseudocode on page 13 revolves around the idea of building faces from normal vectors and iteratively minimising the volume.

The C++ code is available to download as a tar file here (click on the parallelepiped link instead of Download as the latter doesn't work).


Reference

[1a] Vivien, F., Wicker, N. (2002). Minimal enclosing parallelepiped in 3D. [Research Report] RR-4685, LIP RR-2002-49, INRIA, LIP. inria-00071901.

[1b] Vivien, F., Wicker, N. Minimal enclosing parallelepiped in 3D in Comput. Geom. 2004, 29, 177–190; doi 10.1016/j.comgeo.2004.01.009, the author's copy.

$\endgroup$
4
  • $\begingroup$ +1. Welcome back TheSimpliFire! I'm also happy to see some algorithm efficiency analysis here! $\endgroup$ Nov 16, 2021 at 17:23
  • $\begingroup$ Thanks Nike (I was alerted to this post through a chat ping). $\endgroup$ Nov 16, 2021 at 17:32
  • $\begingroup$ You're welcome. In which chat room? $\endgroup$ Nov 16, 2021 at 17:40
  • $\begingroup$ The main chatroom (the last comment by Buttonwood on OP's question). $\endgroup$ Nov 16, 2021 at 17:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .