-
Notifications
You must be signed in to change notification settings - Fork 4
/
g_lomepro.c
3544 lines (3202 loc) · 118 KB
/
g_lomepro.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* This source code is part of
*
* G R O M A C S
*
* GROningen MAchine for Chemical Simulations
*
* VERSION 3.1
* Copyright (c) 1991-2001, University of Groningen, The Netherlands
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* If you want to redistribute modifications, please consider that
* scientific software is very special. Version control is crucial -
* bugs must be traceable. We will be happy to consider code for
* inclusion in the official distribution, but derived work must not
* be called official GROMACS. Details are found in the README & COPYING
* files - if they are missing, get the official version at www.gromacs.org.
*
* To help us fund GROMACS development, we humbly ask that you cite
* the papers on the package - you can find them in the top README file.
*
* For more info, check our website at http://www.gromacs.org
*
* And Hey:
* GROningen Mixture of Alchemy and Childrens' Stories
*/
/* #define _VERBOSE */
#define true 1
#define false 0
#include <string.h>
#include <math.h>
#include <omp.h>
#include "main.h"
#include "macros.h"
#include "statutil.h"
#include "copyrite.h"
#include "sysstuff.h"
#include "typedefs.h"
#include "txtdump.h"
#include "gmx_fatal.h"
#include "xtcio.h"
#include "enxio.h"
#include "assert.h"
#include "smalloc.h"
#include "names.h"
#include "gmxfio.h"
#include "tpxio.h"
#include "trnio.h"
#include "txtdump.h"
#include "vec.h"
#include "statutil.h"
//#include "gp_memory.h"
#include "index.h"
#include "confio.h"
#include "pbc.h"
//#include <lap.h>
#include "pdbio.h"
#include "gstat.h"
#include "headers.h"
//#include <fftw3.h>
int main(int argc,char *argv[])
{
const char *desc[] = {
"[PAR]",
"________________[PAR]",
"Basic Options.[PAR]",
"----------------[PAR]",
"g_lomepro is a grid based tool to calculate Local Membrane Properties ",
"of molecular dynamics trajectories [REF].",
"Thickness (-thick), area per lipid (APL) (-apl), Curvature (-curve) and ",
"SCD Order parameters (-order) can be calculated.[PAR]",
"The user should specify a reference structure file (option -s) and a trajectoy file (option -f).",
"An index group (option -n) together with the option -num_lip are used to specify the representative lipid atom(s)",
"(Phosphorous, headgroups, whole lipid, etc.) and the total number of lipids.[PAR]",
"The number of grid elements in x and y axes can be specified (default 10) with -binx and -biny.[PAR]",
"With the option -prot a group of atoms (i.e. Protein) embedded in the membrane can be",
"explicitly considered for membrane property calculation.",
"If relevant, the center of mass displacement removal of the Protein group in the",
"trajectory file should be done *before* running g_lomepro (i.e. 'trjconv -fit').[PAR]",
"-precision option (default 1.5) defines the radius (nm) used to search for lipids when considering protein atoms.[PAR]",
"_________________________[PAR]",
"Property Specific Options[PAR]",
"-------------------------[PAR]",
//"...........................................................................[PAR]",
"Thickness (-thick):[PAR]",
"output: time averages (avg) and standard deviation (sd)",
"as matrix (dat) files and as pdb files with the thickness values in the B-factor field.[PAR]",
"-prot_val (default 0) specifies the thickness value for the grid elements occupied by the protein group on both leaflets.[PAR]",
"-scale factor (default 0.75) scales the thickness value in a grid element",
"in the situations where a grid cell is assigned a protein atom on one leaflet and the corresponding",
"grid cell on another leaflet has a lipid assigned[PAR]",
"...........................................................................[PAR]",
"APL option outputs (-apl):[PAR]",
"output: time averages (avg) and standard deviation (sd)",
"as matrix (dat) files and as pdb files with the APL values in the B-factor field.",
"In addition APL values for every lipid/protein averaged over trajectory are printed out,",
"as well as the APL value for every lipid/protein at every time step. [PAR]",
"...........................................................................[PAR]",
"Curvature (-curve):[PAR]",
"output: time averaged mean and gaussian curvature for the top and bottom leaflets separately",
"(in pdb and matrix.dat formats)[PAR]",
"-r_filter_low (default 0) relatively set lower bound for filtering in",
"frequency space (after FFT) controls high pass or band pass filters[PAR]",
"-r_filter_high (default -1) relatively set higher bound for filtering in",
"frequency space (after FFT) controls low pass or band pass filters[PAR]",
"-q_filter_low (default 0) absolute value of lower bound (nm^-1) for filtering in",
"frequency space (after FFT) controls high pass or band pass filters[PAR]",
"-q_filter_high (default 100000) absolute value of higher bound (nm^-1) for ",
"filtering in frequency space (after FFT) controls low pass or band pass filters[PAR]",
"-scale_mcurve (default 1) mean curvature values may be small, apply scaling",
" when printing pdb (no scaling for matrix output)[PAR]",
"-scale_gcurve (default 1) gaussian curvature values may be small, ",
"apply scaling when printing pdb (no scaling for matrix output)[PAR]",
"-inv_mean_curve (default FALSE) allows inverting the signs of the mean curvature.",
"In the original g_lomepro paper, the sign of the mean curvature was determined from a point of view of an observer looking down onto a bilayer leaflet.",
"This way the positive mean curvature was assigned to the surface which bent towards the bilayer center.",
"Setting this flag to TRUE inverts the sign: the mean curvature becomes positive when the surface bends away from the bilayer midpoint.",
"...........................................................................[PAR]",
"Scd Order parameter (-order):[PAR]",
"output: time averaged pdb and data matrices containing -Scd order parameters are written for",
"every acyl chain atom for the top and bottom leaflets separately. ",
"Also the average -Scd values for every lipid are printed out.[PAR]",
"NOTE: many output files are generated (acyl_chain_atoms x top_down_leaflets)[PAR]",
"Index file is required to contain separate groups for sn1 and sn2 chains with the acyl chain carbon atoms.[PAR]",
"-unsat option (default 0) defines the number of unsaturated acyl chains [0|1|2].",
"Currently one double bond is allowed per acyl chain.",
"The carbons around a double bond need to be defined in a separate group in the index file.",
"In case one double bond is selected, the chain with the double bond needs to be selected as chain-1 (sn-1) [PAR]. ",
"In combination with -prot, -order_val controls the Scd values (default -1) asigned to the grid points occupied by protein atoms.[PAR]",
"-nt (number of threads) option can be used to speed up the Scd calculation by running on a number of threads in parallel.[PAR]",
"________________[PAR]",
"Other Options.[PAR]",
"----------------[PAR]",
"-normal flag allows to selecting axis normal to the bilayer (default 2, z-axis).[PAR]",
"If -breath option is set the grid is modified according to the box at every step.",
"This may be useful for highly fluctuating boxes.[PAR]",
"-swapxy may be useful in combination with the -normal flag, when the normal axis is not matching Oz.",
"If the flag is set to TRUE, Ox and Oy axes are swapped. [PAR]",
"-nonflat option can be used to treat highly curved bilayers.",
"If the option is set, a group of lipid tail atoms will be required in an index file.",
"The tail atoms will be used to split the leaflets into top/bottom layers.[PAR]",
"-mov_pdb and -mov_dat can be used to export multiple-model pdb files or movie matrix files.",
"Since pdb files may quickly increase in size, only one pdb file is generated, irrespective of the number of selected properties.",
"The pdb movie file contains, the coordinates of a grid. In case -thick option is selected, the pdb movie file",
"also contains membrane thickness in the B-factor field (for the other options the field is left blank).",
"The supplementary Perl scripts distributed together with the g_lomepro can be used to conveniently",
"merge matrix movie output with the pdb movie.",
"-mov_dat prints data matrix for -thick, -apl and -order options.",
"For -order a separate file for every acyl chain carbon is generated.",
"A movie output option for the -curve is currently disabled. [PAR]",
"The -smooth option defines the number of frames over which a running average will be calculated",
"to smoothen the movie output.[PAR]",
"---------\n"
" Citation:\n",
"---------\n",
"Vytautas Gapsys, Bert L. de Groot, Rodolfo Briones\n",
"Computational analysis of local membrane properties\n",
"Journal of Computer-Aided Molecular Design, 2013\n",
"doi:10.1007/s10822-013-9684-0\n",
"software version: 1.0.2\n",
"---------\n",
"[PAR]"
};
t_filenm fnm[] = {
{ efTRX, "-f", NULL, ffREAD },
{ efNDX, "-n", "index.ndx", ffREAD},
{ efTPS, "-s", "tpr.tpr", ffREAD },
{ efOUT, "-thick", "thickness", ffOPTWR },
{ efOUT, "-apl", "apl", ffOPTWR},
{ efOUT, "-curve", "curvature", ffOPTWR},
{ efOUT, "-order", "order", ffOPTWR},
//{ efOUT, "-diffus", "diffusion", ffOPTWR},
{ efTRX, "-mov_pdb", "mov_pdb.pdb", ffOPTWR},
{ efOUT, "-mov_mat", "mov_mat", ffOPTWR}
};
#define NFILE asize(fnm)
/* Command line options */
const char *in_file;
const char *index_file;
// const char *tpr_file;
static int lipid_num=0;
static gmx_bool is_prot = FALSE;
static int binx = 10;
static int biny = 10;
static real prot_val = 0.0;
static real order_val = -1.0;
static real precision = 1.5;
static real scale = 0.75;
static int curve_step_x = 0;
static int curve_step_y = 0;
static real r_filter_low = 0.0;
static real r_filter_high = -1.0;
static real q_filter_low = 0.0;
static real q_filter_high = 99999.99;
static gmx_bool nonflat=FALSE;
static gmx_bool inv_mean_curve=FALSE;
// static gmx_bool rm_pbc=FALSE;
static int normal=2;
static gmx_bool swapxy=FALSE;
static gmx_bool breath=FALSE;
static int unsat=0;
static int nt=1, smooth=1, i=0, j=0;
static real mcurve_scale = 1.0, gcurve_scale = 1.0;
int foo=0; //use this for a temporary integer
output_env_t oenv;
t_pargs pa[] = {
{ "-lip_num", FALSE, etINT, {&lipid_num},
"Number of lipids" },
{ "-breath", FALSE, etBOOL, {&breath},
"If set, the grid is modified according to the box at every step" },
{ "-prot", FALSE, etBOOL, {&is_prot},
"Put this flag if there is a protein in your membrane" },
{ "-unsat", FALSE, etINT, {&unsat},
"Number of unsaturated acyl chains [0|1|2] (important for order parameters)" },
{ "-prot_val", FALSE, etREAL, {&prot_val},
"Value of the thickness in a grid element in case protein atoms are on both layers" },
{ "-order_val", FALSE, etREAL, {&order_val},
"Value of the order parameter Scd in a grid element in case it is assigned to a protein" },
{ "-scale", FALSE, etREAL, {&scale},
"Value of the thickness in a grid element in case protein atom is on one layer and lipid atom is on another layer" },
{ "-binx", FALSE, etINT, {&binx},
"Number of bins in x direction"
},
{ "-biny", FALSE, etINT, {&biny},
"Number of bins in y direction"
},
{ "-precision", FALSE, etREAL, {&precision},
"Precision value: radius (nm) to search for the lipids when considering protein atoms"
},
// { "-curvature_step_x", FALSE, etINT, {&curve_step_x},
// "step size in x direction for curvature calculation. By default step is 0, thus making "
// "the step size to be equal 1 bin size in x direction"
// },
// { "-curvature_step_y", FALSE, etINT, {&curve_step_y},
// "step size in y direction for curvature calculation. By default step is 0, thus making "
// "the step size to be equal 1 bin size in y direction"
// },
{ "-r_filter_low", FALSE, etREAL, {&r_filter_low},
"Relatively set lower bound for filtering in frequency space (after FFT)"
" controls high pass or band pass filters"
},
{ "-r_filter_high", FALSE, etREAL, {&r_filter_high},
"Relatively set higher bound for filtering in frequency space (after FFT)"
" controls low pass or band pass filters"
},
{ "-q_filter_low", FALSE, etREAL, {&q_filter_low},
"Absolute value of lower bound (nm^-1) for filtering in frequency space (after FFT)"
" controls high pass or band pass filters"
},
{ "-q_filter_high", FALSE, etREAL, {&q_filter_high},
"Absolute value of higher bound (nm^-1) for filtering in frequency space (after FFT)"
" controls low pass or band pass filters"
},
{ "-scale_mcurve", FALSE, etREAL, {&mcurve_scale},
"Mean curvature values may be small,"
"apply scaling when printing pdb (no scaling for matrix output)"
},
{ "-scale_gcurve", FALSE, etREAL, {&gcurve_scale},
"Gaussian curvature values may be small,"
"apply scaling when printing pdb (no scaling for matrix output)"
},
{ "-inv_mean_curve", FALSE, etBOOL, {&inv_mean_curve},
"Invert the sign of the mean curvature" },
{ "-nonflat", FALSE, etBOOL, {&nonflat},
"Put this flag if the membrane is highly curved" },
{ "-normal", FALSE, etINT, {&normal},
"Choose axis normal to the surface of the membrane: 0 - x, 1 - y or 2 - z" },
{ "-swapxy", FALSE, etBOOL, {&swapxy},
"If the normal to the bilayer is not parallel to Oz axis and the -normal flag was set to 0 or 1, it may be necessary to swap Ox and Oy axes" },
{ "-smooth", FALSE, etINT, {&smooth},
"Number of frames over which to run averaging for the -mov_mat flag" },
{ "-nt", FALSE, etINT, {&nt},
"Number of threads to use (for -order option only)" },
};
CopyRight(stderr,argv[0]);
parse_common_args(&argc,argv, PCA_CAN_TIME | PCA_BE_NICE ,NFILE,fnm,asize(pa),pa,
asize(desc),desc,0,NULL,&oenv);
in_file= opt2fn("-f",NFILE,fnm);
index_file= opt2fn("-n",NFILE,fnm);
//tpr_file= opt2fn("-s",NFILE,fnm);
//deal with the topology file
t_topology top;
int ePBC;
char title[STRLEN];
rvec *xtop;
matrix box;
t_pbc pbc;
read_tps_conf(ftp2fn(efTPS,NFILE,fnm),title,&top,&ePBC,&xtop,NULL,box,TRUE);
set_pbc(&pbc,ePBC,box);
int nlip, nprot, ntail, norder1, norder2, nunsat1, nunsat2; //number of atoms
atom_id *idlip, *idprot, *idtail, *idorder1, *idorder2, *idunsat1, *idunsat2; //IDs of the atoms
char *namelip, *nameprot, *nametail, *nameorder; //names of the groups
//check if lipid_num was specified
if(lipid_num == 0)
{
printf("\nMust specify the number of lipids: -lip_num \n");
return(0);
}
//deal with index files
printf("\nChoose the lipid group\n");
rd_index(index_file,1,&nlip,&idlip,&namelip);
if(is_prot)
{
printf("\nChoose the protein group:\n");
rd_index(index_file,1,&nprot,&idprot,&nameprot);
}
if(nonflat)
{
printf("\nChoose the group of a lipid tail end atom:\n");
rd_index(index_file,1,&ntail,&idtail,&nametail);
}
int mean_curve_sign_up = 1;
int mean_curve_sign_down = -1;
if(inv_mean_curve)
{
mean_curve_sign_up = -1;
mean_curve_sign_down = 1;
}
gmx_bool order = FALSE;
order = opt2bSet("-order",NFILE,fnm);
if(order)
{
printf("\nChoose the group of atoms in sn-1 acyl chain for order parameter calculation:\n");
rd_index(index_file,1,&norder1,&idorder1,&nameorder);
printf("\nChoose the group of atoms in sn-2 acyl chain for order parameter calculation:\n");
rd_index(index_file,1,&norder2,&idorder2,&nameorder);
if(unsat==1)
{
printf("\nChoose the group of atoms for unsaturated lipids (two atoms around double bond for every lipid):\n");
rd_index(index_file,1,&nunsat1,&idunsat1,&nameorder);
}
else if(unsat==2)
{
printf("\nChoose the group of atoms for unsaturated lipids from the chain sn-1 (two atoms around double bond for every lipid):\n");
rd_index(index_file,1,&nunsat1,&idunsat1,&nameorder);
printf("\nChoose the group of atoms for unsaturated lipids from the chain sn-2 (two atoms around double bond for every lipid):\n");
rd_index(index_file,1,&nunsat2,&idunsat2,&nameorder);
}
}
/************************ File names and booleans ***************************/
/************************ File names and booleans ***************************/
/************************ File names and booleans ***************************/
/************************ File names and booleans ***************************/
gmx_bool pdb = opt2bSet("-mov_pdb",NFILE,fnm);
gmx_bool mat = opt2bSet("-mov_mat",NFILE,fnm);
/*------------ THICKNESS -------------------*/
/*------------ THICKNESS -------------------*/
char *thick_name_avg_dat, *thick_name_sd_dat, *thick_name_avg_pdb, *thick_name_sd_pdb;
FILE *thick_fp_avg_dat, *thick_fp_sd_dat, *thick_fp_avg_pdb, *thick_fp_sd_pdb;
char *thick_name_mov_pdb, *thick_name_mov_mat;
FILE *fp_mov_pdb_thick, *fp_mov_mat_thick;
//for lipid index and thickness of each
char *thick_name_lipids_up, *thick_name_lipids_down, *thick_name_over_time;
FILE *thick_fp_lipids_up, *thick_fp_lipids_down, *thick_fp_over_time;
gmx_bool thick = opt2bSet("-thick",NFILE,fnm);
if(thick)
{
const char *foo_name = opt2fn("-thick",NFILE,fnm);
//first deal with lipid index files
snew(thick_name_lipids_up,strlen(foo_name)+20);
strcpy(thick_name_lipids_up,foo_name);
strcat(thick_name_lipids_up,"_up_lipids.dat");
snew(thick_name_lipids_down,strlen(foo_name)+20);
strcpy(thick_name_lipids_down,foo_name);
strcat(thick_name_lipids_down,"_down_lipids.dat");
snew(thick_name_over_time,strlen(foo_name)+20);
strcpy(thick_name_over_time,foo_name);
strcat(thick_name_over_time,"_over_time.dat");
//lipid index
thick_fp_lipids_up = fopen(thick_name_lipids_up,"w");
thick_fp_lipids_down = fopen(thick_name_lipids_down,"w");
thick_fp_over_time = fopen(thick_name_over_time,"w");
// then the others
snew(thick_name_avg_dat,strlen(foo_name)+20);
strcpy(thick_name_avg_dat,foo_name);
strcat(thick_name_avg_dat,"_avg.dat");
snew(thick_name_sd_dat,strlen(foo_name)+20);
strcpy(thick_name_sd_dat,foo_name);
strcat(thick_name_sd_dat,"_sd.dat");
snew(thick_name_avg_pdb,strlen(foo_name)+20);
strcpy(thick_name_avg_pdb,foo_name);
strcat(thick_name_avg_pdb,"_avg.pdb");
snew(thick_name_sd_pdb,strlen(foo_name)+20);
strcpy(thick_name_sd_pdb,foo_name);
strcat(thick_name_sd_pdb,"_sd.pdb");
thick_fp_sd_dat = fopen(thick_name_sd_dat,"w");
thick_fp_avg_pdb = fopen(thick_name_avg_pdb,"w");
thick_fp_sd_pdb = fopen(thick_name_sd_pdb,"w");
thick_fp_avg_dat = fopen(thick_name_avg_dat,"w");
if(pdb)
{
foo_name = opt2fn("-mov_pdb",NFILE,fnm);
snew(thick_name_mov_pdb,strlen(foo_name)+20);
strcpy(thick_name_mov_pdb,foo_name);
strcat(thick_name_mov_pdb,"_thickness.pdb");
fp_mov_pdb_thick=ffopen(thick_name_mov_pdb,"w");
}
if(mat)
{
foo_name = opt2fn("-mov_mat",NFILE,fnm);
snew(thick_name_mov_mat,strlen(foo_name)+20);
strcpy(thick_name_mov_mat,foo_name);
strcat(thick_name_mov_mat,"_thickness.dat");
fp_mov_mat_thick=ffopen(thick_name_mov_mat,"w");
}
}
else //pdb movie may be outputted without thickness being declared
if(pdb)
{
const char *foo_name = opt2fn("-mov_pdb",NFILE,fnm);
fp_mov_pdb_thick=ffopen(foo_name,"w");
}
/*------------ THICKNESS -------------------*/
/*------------ THICKNESS -------------------*/
/*------------- APL ---------------*/
/*------------- APL ---------------*/
char *apl_up_name_avg_dat,*apl_up_name_sd_dat,*apl_down_name_avg_dat,*apl_down_name_sd_dat;
char *apl_name_avg_pdb,*apl_name_sd_pdb;
FILE *apl_up_fp_avg_dat,*apl_up_fp_sd_dat,*apl_down_fp_avg_dat,*apl_down_fp_sd_dat;
FILE *apl_fp_avg_pdb,*apl_fp_sd_pdb;
char *apl_up_name_mov_mat, *apl_down_name_mov_mat;
FILE *fp_mov_mat_apl_up, *fp_mov_mat_apl_down;
//for lipid index and apl of each
char *apl_name_lipids_up, *apl_name_lipids_down, *apl_name_over_time;
FILE *apl_fp_lipids_up, *apl_fp_lipids_down, *apl_fp_over_time;
gmx_bool apl = opt2bSet("-apl",NFILE,fnm);
if(apl)
{
const char *foo_name = opt2fn("-apl",NFILE,fnm);
//first deal with lipid index files
snew(apl_name_lipids_up,strlen(foo_name)+20);
strcpy(apl_name_lipids_up,foo_name);
strcat(apl_name_lipids_up,"_up_lipids.dat");
snew(apl_name_lipids_down,strlen(foo_name)+20);
strcpy(apl_name_lipids_down,foo_name);
strcat(apl_name_lipids_down,"_down_lipids.dat");
snew(apl_name_over_time,strlen(foo_name)+20);
strcpy(apl_name_over_time,foo_name);
strcat(apl_name_over_time,"_over_time.dat");
//then the others
snew(apl_up_name_avg_dat,strlen(foo_name)+20);
strcpy(apl_up_name_avg_dat,foo_name);
strcat(apl_up_name_avg_dat,"_up_avg.dat");
snew(apl_down_name_avg_dat,strlen(foo_name)+20);
strcpy(apl_down_name_avg_dat,foo_name);
strcat(apl_down_name_avg_dat,"_down_avg.dat");
snew(apl_up_name_sd_dat,strlen(foo_name)+20);
strcpy(apl_up_name_sd_dat,foo_name);
strcat(apl_up_name_sd_dat,"_up_sd.dat");
snew(apl_down_name_sd_dat,strlen(foo_name)+20);
strcpy(apl_down_name_sd_dat,foo_name);
strcat(apl_down_name_sd_dat,"_down_sd.dat");
snew(apl_name_avg_pdb,strlen(foo_name)+20);
strcpy(apl_name_avg_pdb,foo_name);
strcat(apl_name_avg_pdb,"_avg.pdb");
snew(apl_name_sd_pdb,strlen(foo_name)+20);
strcpy(apl_name_sd_pdb,foo_name);
strcat(apl_name_sd_pdb,"_sd.pdb");
//lipid index
apl_fp_lipids_up = fopen(apl_name_lipids_up,"w");
apl_fp_lipids_down = fopen(apl_name_lipids_down,"w");
apl_fp_over_time = fopen(apl_name_over_time,"w");
//others
apl_up_fp_avg_dat = fopen(apl_up_name_avg_dat,"w");
apl_down_fp_avg_dat = fopen(apl_down_name_avg_dat,"w");
apl_up_fp_sd_dat = fopen(apl_up_name_sd_dat,"w");
apl_down_fp_sd_dat = fopen(apl_down_name_sd_dat,"w");
apl_fp_avg_pdb = fopen(apl_name_avg_pdb,"w");
apl_fp_sd_pdb = fopen(apl_name_sd_pdb,"w");
if(mat)
{
foo_name = opt2fn("-mov_mat",NFILE,fnm);
snew(apl_up_name_mov_mat,strlen(foo_name)+20);
strcpy(apl_up_name_mov_mat,foo_name);
strcat(apl_up_name_mov_mat,"_up_apl.dat");
fp_mov_mat_apl_up=ffopen(apl_up_name_mov_mat,"w");
foo_name = opt2fn("-mov_mat",NFILE,fnm);
snew(apl_down_name_mov_mat,strlen(foo_name)+20);
strcpy(apl_down_name_mov_mat,foo_name);
strcat(apl_down_name_mov_mat,"_down_apl.dat");
fp_mov_mat_apl_down=ffopen(apl_down_name_mov_mat,"w");
}
}
/*------------- APL ---------------*/
/*------------- APL ---------------*/
/*------------- CURVATURE ---------------*/
/*------------- CURVATURE ---------------*/
char *mcurve_up_name_avg_dat,*gcurve_up_name_avg_dat,*mcurve_down_name_avg_dat,*gcurve_down_name_avg_dat;
char *mcurve_name_avg_pdb,*gcurve_name_avg_pdb;
FILE *mcurve_up_fp_avg_dat,*gcurve_up_fp_avg_dat,*mcurve_down_fp_avg_dat,*gcurve_down_fp_avg_dat;
FILE *mcurve_fp_avg_pdb,*gcurve_fp_avg_pdb;
char *mcurve_up_name_mov_mat, *mcurve_down_name_mov_mat;
char *gcurve_up_name_mov_mat, *gcurve_down_name_mov_mat;
FILE *fp_mov_mat_mcurve_up, *fp_mov_mat_mcurve_down;
FILE *fp_mov_mat_gcurve_up, *fp_mov_mat_gcurve_down;
gmx_bool curve= opt2bSet("-curve",NFILE,fnm);
if(curve)
{
const char *foo_name = opt2fn("-curve",NFILE,fnm);
//file names
snew(mcurve_up_name_avg_dat,strlen(foo_name)+20);
strcpy(mcurve_up_name_avg_dat,foo_name);
strcat(mcurve_up_name_avg_dat,"_mean_curve_up_avg.dat");
snew(mcurve_down_name_avg_dat,strlen(foo_name)+20);
strcpy(mcurve_down_name_avg_dat,foo_name);
strcat(mcurve_down_name_avg_dat,"_mean_curve_down_avg.dat");
snew(gcurve_up_name_avg_dat,strlen(foo_name)+20);
strcpy(gcurve_up_name_avg_dat,foo_name);
strcat(gcurve_up_name_avg_dat,"_gauss_curve_up_avg.dat");
snew(gcurve_down_name_avg_dat,strlen(foo_name)+20);
strcpy(gcurve_down_name_avg_dat,foo_name);
strcat(gcurve_down_name_avg_dat,"_gauss_curve_down_avg.dat");
snew(mcurve_name_avg_pdb,strlen(foo_name)+20);
strcpy(mcurve_name_avg_pdb,foo_name);
strcat(mcurve_name_avg_pdb,"_mean_curve_avg.pdb");
snew(gcurve_name_avg_pdb,strlen(foo_name)+20);
strcpy(gcurve_name_avg_pdb,foo_name);
strcat(gcurve_name_avg_pdb,"_gauss_curve_avg.pdb");
//file pointers
mcurve_up_fp_avg_dat = fopen(mcurve_up_name_avg_dat,"w");
mcurve_down_fp_avg_dat = fopen(mcurve_down_name_avg_dat,"w");
gcurve_up_fp_avg_dat = fopen(gcurve_up_name_avg_dat,"w");
gcurve_down_fp_avg_dat = fopen(gcurve_down_name_avg_dat,"w");
mcurve_fp_avg_pdb = fopen(mcurve_name_avg_pdb,"w");
gcurve_fp_avg_pdb = fopen(gcurve_name_avg_pdb,"w");
if(mat)
{
foo_name = opt2fn("-mov_mat",NFILE,fnm);
snew(mcurve_up_name_mov_mat,strlen(foo_name)+20);
strcpy(mcurve_up_name_mov_mat,foo_name);
strcat(mcurve_up_name_mov_mat,"_up_mean_curve.dat");
fp_mov_mat_mcurve_up=ffopen(mcurve_up_name_mov_mat,"w");
foo_name = opt2fn("-mov_mat",NFILE,fnm);
snew(mcurve_down_name_mov_mat,strlen(foo_name)+20);
strcpy(mcurve_down_name_mov_mat,foo_name);
strcat(mcurve_down_name_mov_mat,"_down_mean_curve.dat");
fp_mov_mat_mcurve_down=ffopen(mcurve_down_name_mov_mat,"w");
foo_name = opt2fn("-mov_mat",NFILE,fnm);
snew(gcurve_up_name_mov_mat,strlen(foo_name)+20);
strcpy(gcurve_up_name_mov_mat,foo_name);
strcat(gcurve_up_name_mov_mat,"_up_gauss_curve.dat");
fp_mov_mat_gcurve_up=ffopen(gcurve_up_name_mov_mat,"w");
foo_name = opt2fn("-mov_mat",NFILE,fnm);
snew(gcurve_down_name_mov_mat,strlen(foo_name)+20);
strcpy(gcurve_down_name_mov_mat,foo_name);
strcat(gcurve_down_name_mov_mat,"_down_gauss_curve.dat");
fp_mov_mat_gcurve_down=ffopen(gcurve_down_name_mov_mat,"w");
}
}
/*------------- CURVATURE ---------------*/
/*------------- CURVATURE ---------------*/
/*------------- ORDER PARAMETERS ---------------*/
/*------------- ORDER PARAMETERS ---------------*/
//number of atoms in a single chain
int order_atom_num1=0, order_atom_num2=0;
//up, sn-1 and sn-2 acyl chains
char *order_up_name_avg_dat_sn1;
char *order_up_name_avg_dat_sn2;
//down, sn-1 and sn-2
char *order_down_name_avg_dat_sn1;
char *order_down_name_avg_dat_sn2;
//pdb file names
char *order_name_avg_dat_sn1_pdb;
char *order_name_avg_dat_sn2_pdb;
//average over all lipids (as g_order), sn-1 and sn-2 acyl chains
char *order_AVG_name_sn1;
char *order_AVG_name_sn2;
//up, sn-1 and sn-2
FILE **order_up_fp_avg_dat_sn1;
FILE **order_up_fp_avg_dat_sn2;
//down, sn-1 and sn2
FILE **order_down_fp_avg_dat_sn1;
FILE **order_down_fp_avg_dat_sn2;
//pdb files, sn-1 and sn2
FILE **order_fp_avg_pdb_sn1;
FILE **order_fp_avg_pdb_sn2;
//average over all lipids (as g_order), sn-1 and sn-2 acyl chains
FILE *order_fp_AVG_sn1;
FILE *order_fp_AVG_sn2;
/**** movie files *******/
char *order_up_name_mov_mat1, *order_up_name_mov_mat2;
char *order_down_name_mov_mat1, *order_down_name_mov_mat2;
FILE **fp_mov_mat_order_up1, **fp_mov_mat_order_up2;
FILE **fp_mov_mat_order_down1, **fp_mov_mat_order_down2;
if(order)
{
order_atom_num1 = norder1/lipid_num;
order_atom_num2 = norder2/lipid_num;
snew(order_up_fp_avg_dat_sn1,order_atom_num1-2);
snew(order_down_fp_avg_dat_sn1,order_atom_num1-2);
snew(order_up_fp_avg_dat_sn2,order_atom_num2-2);
snew(order_down_fp_avg_dat_sn2,order_atom_num2-2);
/*pdb file pointer*/
snew(order_fp_avg_pdb_sn1,order_atom_num1-2);
snew(order_fp_avg_pdb_sn2,order_atom_num2-2);
/**** movie files *****/
snew(fp_mov_mat_order_up1,order_atom_num1-2);
snew(fp_mov_mat_order_down1,order_atom_num1-2);
snew(fp_mov_mat_order_up2,order_atom_num2-2);
snew(fp_mov_mat_order_down2,order_atom_num2-2);
const char *foo_name = opt2fn("-order",NFILE,fnm);
const char *foo_mov_name=NULL;
if(mat)
{
foo_mov_name = opt2fn("-mov_mat",NFILE,fnm);
}
/*** average over all lipids (as g_order) ***/
//sn1
snew(order_AVG_name_sn1,strlen(foo_name)+20);
strcpy(order_AVG_name_sn1,foo_name);
strcat(order_AVG_name_sn1,"_AVG_sn1.dat");
order_fp_AVG_sn1=ffopen(order_AVG_name_sn1,"w");
//sn2
snew(order_AVG_name_sn2,strlen(foo_name)+20);
strcpy(order_AVG_name_sn2,foo_name);
strcat(order_AVG_name_sn2,"_AVG_sn2.dat");
order_fp_AVG_sn2=ffopen(order_AVG_name_sn2,"w");
//sn1
for(i=2; i<order_atom_num1; i++)
{
if(mat)
{
//up mov_mat sn1
snew(order_up_name_mov_mat1,strlen(foo_mov_name)+20);
strcpy(order_up_name_mov_mat1,foo_mov_name);
strcat(order_up_name_mov_mat1,"_up_sn1_atom");
sprintf(order_up_name_mov_mat1,"%s%d",order_up_name_mov_mat1,i);
strcat(order_up_name_mov_mat1,".dat");
//down mov_mat sn1
snew(order_down_name_mov_mat1,strlen(foo_mov_name)+20);
strcpy(order_down_name_mov_mat1,foo_mov_name);
strcat(order_down_name_mov_mat1,"_down_sn1_atom");
sprintf(order_down_name_mov_mat1,"%s%d",order_down_name_mov_mat1,i);
strcat(order_down_name_mov_mat1,".dat");
//file pointers
fp_mov_mat_order_up1[i-2] = fopen(order_up_name_mov_mat1,"w"); sfree(order_up_name_mov_mat1);
fp_mov_mat_order_down1[i-2] = fopen(order_down_name_mov_mat1,"w"); sfree(order_down_name_mov_mat1);
}
//up avg sn1
snew(order_up_name_avg_dat_sn1,strlen(foo_name)+20);
strcpy(order_up_name_avg_dat_sn1,foo_name);
strcat(order_up_name_avg_dat_sn1,"_up_avg_sn1_atom");
sprintf(order_up_name_avg_dat_sn1,"%s%d",order_up_name_avg_dat_sn1,i);
strcat(order_up_name_avg_dat_sn1,".dat");
/*pdb avg sn1*/
snew(order_name_avg_dat_sn1_pdb,strlen(foo_name)+20);
strcpy(order_name_avg_dat_sn1_pdb,foo_name);
strcat(order_name_avg_dat_sn1_pdb,"_avg_sn1_atom");
sprintf(order_name_avg_dat_sn1_pdb,"%s%d",order_name_avg_dat_sn1_pdb,i);
strcat(order_name_avg_dat_sn1_pdb,".pdb");
//down avg sn1
snew(order_down_name_avg_dat_sn1,strlen(foo_name)+20);
strcpy(order_down_name_avg_dat_sn1,foo_name);
strcat(order_down_name_avg_dat_sn1,"_down_avg_sn1_atom");
sprintf(order_down_name_avg_dat_sn1,"%s%d",order_down_name_avg_dat_sn1,i);
strcat(order_down_name_avg_dat_sn1,".dat");
//file pointers
order_up_fp_avg_dat_sn1[i-2] = fopen(order_up_name_avg_dat_sn1,"w"); sfree(order_up_name_avg_dat_sn1);
// order_up_fp_sd_dat_sn1[i-2] = fopen(order_up_name_sd_dat_sn1,"w"); sfree(order_up_name_sd_dat_sn1);
order_down_fp_avg_dat_sn1[i-2] = fopen(order_down_name_avg_dat_sn1,"w"); sfree(order_down_name_avg_dat_sn1);
// order_down_fp_sd_dat_sn1[i-2] = fopen(order_down_name_sd_dat_sn1,"w"); sfree(order_down_name_sd_dat_sn1);
/*pdb file pointers*/
order_fp_avg_pdb_sn1[i-2] = fopen(order_name_avg_dat_sn1_pdb,"w"); sfree(order_name_avg_dat_sn1_pdb);
// order_fp_sd_pdb_sn1[i-2] = fopen(order_name_sd_dat_sn1_pdb,"w"); sfree(order_name_sd_dat_sn1_pdb);
}
//sn2
for(i=2; i<order_atom_num2; i++)
{
if(mat)
{
//up mov_mat sn2
snew(order_up_name_mov_mat2,strlen(foo_mov_name)+20);
strcpy(order_up_name_mov_mat2,foo_mov_name);
strcat(order_up_name_mov_mat2,"_up_sn2_atom");
sprintf(order_up_name_mov_mat2,"%s%d",order_up_name_mov_mat2,i);
strcat(order_up_name_mov_mat2,".dat");
//down mov_mat sn2
snew(order_down_name_mov_mat2,strlen(foo_mov_name)+20);
strcpy(order_down_name_mov_mat2,foo_mov_name);
strcat(order_down_name_mov_mat2,"_down_sn2_atom");
sprintf(order_down_name_mov_mat2,"%s%d",order_down_name_mov_mat2,i);
strcat(order_down_name_mov_mat2,".dat");
//file pointers
fp_mov_mat_order_up2[i-2] = fopen(order_up_name_mov_mat2,"w"); sfree(order_up_name_mov_mat2);
fp_mov_mat_order_down2[i-2] = fopen(order_down_name_mov_mat2,"w"); sfree(order_down_name_mov_mat2);
}
//up avg sn2
snew(order_up_name_avg_dat_sn2,strlen(foo_name)+20);
strcpy(order_up_name_avg_dat_sn2,foo_name);
strcat(order_up_name_avg_dat_sn2,"_up_avg_sn2_atom");
sprintf(order_up_name_avg_dat_sn2,"%s%d",order_up_name_avg_dat_sn2,i);
strcat(order_up_name_avg_dat_sn2,".dat");
/*pdb avg sn1*/
snew(order_name_avg_dat_sn2_pdb,strlen(foo_name)+20);
strcpy(order_name_avg_dat_sn2_pdb,foo_name);
strcat(order_name_avg_dat_sn2_pdb,"_avg_sn2_atom");
sprintf(order_name_avg_dat_sn2_pdb,"%s%d",order_name_avg_dat_sn2_pdb,i);
strcat(order_name_avg_dat_sn2_pdb,".pdb");
//down avg sn2
snew(order_down_name_avg_dat_sn2,strlen(foo_name)+20);
strcpy(order_down_name_avg_dat_sn2,foo_name);
strcat(order_down_name_avg_dat_sn2,"_down_avg_sn2_atom");
sprintf(order_down_name_avg_dat_sn2,"%s%d",order_down_name_avg_dat_sn2,i);
strcat(order_down_name_avg_dat_sn2,".dat");
//file pointers
order_up_fp_avg_dat_sn2[i-2] = fopen(order_up_name_avg_dat_sn2,"w"); sfree(order_up_name_avg_dat_sn2);
// order_up_fp_sd_dat_sn2[i-2] = fopen(order_up_name_sd_dat_sn2,"w"); sfree(order_up_name_sd_dat_sn2);
order_down_fp_avg_dat_sn2[i-2] = fopen(order_down_name_avg_dat_sn2,"w"); sfree(order_down_name_avg_dat_sn2);
// order_down_fp_sd_dat_sn2[i-2] = fopen(order_down_name_sd_dat_sn2,"w"); sfree(order_down_name_sd_dat_sn2);
/*pdb file pointers*/
order_fp_avg_pdb_sn2[i-2] = fopen(order_name_avg_dat_sn2_pdb,"w"); sfree(order_name_avg_dat_sn2_pdb);
// order_fp_sd_pdb_sn2[i-2] = fopen(order_name_sd_dat_sn2_pdb,"w"); sfree(order_name_sd_dat_sn2_pdb);
}
}
/*------------- ORDER PARAMETERS ---------------*/
/*------------- ORDER PARAMETERS ---------------*/
/*------------ DIFFUSION -------------------*/
/*------------ DIFFUSION -------------------*/
char *diffus_name_up_dat, *diffus_name_down_dat, *diffus_name_pdb_avg;
FILE *diffus_fp_up_dat, *diffus_fp_down_dat, *diffus_fp_pdb_avg;
gmx_bool diffus = FALSE; //opt2bSet("-diffus",NFILE,fnm);
if(diffus)
{
const char *foo_name = opt2fn("-diffus",NFILE,fnm);
snew(diffus_name_up_dat,strlen(foo_name)+20);
strcpy(diffus_name_up_dat,foo_name);
strcat(diffus_name_up_dat,"_up.dat");
snew(diffus_name_down_dat,strlen(foo_name)+20);
strcpy(diffus_name_down_dat,foo_name);
strcat(diffus_name_down_dat,"_down.dat");
snew(diffus_name_pdb_avg,strlen(foo_name)+20);
strcpy(diffus_name_pdb_avg,foo_name);
strcat(diffus_name_pdb_avg,"_avg.pdb");
diffus_fp_up_dat = fopen(diffus_name_up_dat,"w");
diffus_fp_down_dat = fopen(diffus_name_down_dat,"w");
diffus_fp_pdb_avg = fopen(diffus_name_pdb_avg,"w");
if(mat)
{
}
}
/*------------ DIFFUSION -------------------*/
/*------------ DIFFUSION -------------------*/
/************************ File names and booleans ***************************/
/************************ File names and booleans ***************************/
/************************ File names and booleans ***************************/
/************************ File names and booleans ***************************/
real left_x = 0.0, left_y = 0.0;
int dirz=0,dirx=1,diry=2;
if(normal==0)
{
dirz=0;dirx=1;diry=2;
if(swapxy)
{
dirz=0;dirx=2;diry=1;
}
}
if(normal==1)
{
dirz=1;dirx=0;diry=2;
if(swapxy)
{
dirz=1;dirx=2;diry=0;
}
}
if(normal==2)
{
dirz=2;dirx=0;diry=1;
if(swapxy)
{
dirz=2;dirx=1;diry=0;
}
}
//get the box dimensions: x, y and z
real grid_y = box[diry][diry];
real grid_x = box[dirx][dirx];
real grid_z = box[dirz][dirz];
//start reading the trajectory
t_trxstatus *trxhandle;
t_trxframe frame;
if (!read_first_frame(oenv, &trxhandle,in_file,&frame,TRX_READ_X || TRX_READ_V || TRX_READ_F))
gmx_fatal(FARGS,"Could not read first frame from trajectory %s",in_file);
int nlip_group = nlip/lipid_num; //number of atoms in one lipid group
int grid_size = binx*biny;
real area_of_cell = grid_x*grid_y/grid_size;
real pr2 = precision*precision;
real *grid_up_avg=NULL; //z-values up
real *grid_down_avg=NULL; //z-values down
snew(grid_up_avg,grid_size);
snew(grid_down_avg,grid_size);
int frame_num=0;
real bin_sizex = 0.0;
real bin_sizey = 0.0;
/***** if -mat_mov declared *****/
int counter_smooth=0; //tells when to print
/*****************THICKNESS***********/
real *grid=NULL; //stores thickness
real *grid_sd=NULL; //stores thickness standard deviation
real **grid_smooth_frames; //saves the last grids of the last #smooth frames
real *grid_smooth_avg; //grid averaged over the last #smooth frames
real **z_smooth_frames_up; //saves the last z-coordinates of the last #smooth frames
real **z_smooth_frames_down;
real *z_smooth_avg_up; //z-coord averaged over the last #smooth frames
real *z_smooth_avg_down;
real **thick_lip_up=NULL; //thickness by lipid index: thick_lip_up[lipid_num]=[idlip,thick,thick_sum,thick_sum^2,tmp_counter_of_cells_per_lipid]
real **thick_lip_down=NULL; //thickness by lipid index
if(thick)
{
snew(grid,grid_size);
snew(grid_sd,grid_size);
if(mat || pdb)
{
snew(grid_smooth_avg,grid_size);
snew(grid_smooth_frames,smooth);
for(foo=0; foo<smooth; foo++)
{
snew(grid_smooth_frames[foo],grid_size);
}
}
// thickness by lipid index
if(is_prot)
{
snew(thick_lip_up,lipid_num+1);
snew(thick_lip_down,lipid_num+1);
for(i=0;i<lipid_num+1;i++)
{
snew(thick_lip_up[i],5);
snew(thick_lip_down[i],5);
if(i<lipid_num)
{
thick_lip_up[i][0]=idlip[i];
thick_lip_down[i][0]=idlip[i];
}
else
{
thick_lip_up[i][0]=-1;
thick_lip_down[i][0]=-1;
}
}
}
else
{
snew(thick_lip_up,lipid_num);
snew(thick_lip_down,lipid_num);
int i=0;
for(i=0;i<lipid_num;i++)
{
snew(thick_lip_up[i],5);
thick_lip_up[i][0]=idlip[i];
snew(thick_lip_down[i],5);
thick_lip_down[i][0]=idlip[i];
}
}
}
if( pdb || (curve && mat) )