aboutsummaryrefslogtreecommitdiff
path: root/src/cdm.h
blob: a0cae0155f9833742a22ad632331978e0cc8df65 (plain)
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
/*
 * cdm.h
 *
 * "Conventional" Direct Methods
 *
 * (c) 2006 Thomas White <taw27@cam.ac.uk>
 *  Synth2d - two-dimensional Fourier synthesis
 *
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifndef CDM_H
#define CDM_H

#include <stdint.h>

#include "reflist.h"
#include "symmetry.h"

#define MAX_TRIPLETS 65536

typedef struct {
	Reflection p;
	Reflection q;
	/* The other reflection in the triplet is -p-q */
	double G;
} Triplet;

typedef struct {
	Triplet triplets[MAX_TRIPLETS];
	unsigned int n_triplets;
} TripletList;

typedef struct s_phase_sol {

	unsigned int n;			/* Reference number */
	unsigned int phasing_code;	/* Phase values, binary 1->Pi, 0->0.  Only works for centro */
	double unflatness;		/* Luzzatti 'unflatness': sigma(rho^4) */
	double entropy;			/* Entropy -sigma(P*ln(P)) */
	
	struct s_phase_sol *next;
	
} PhasingSolution;

typedef struct {

	unsigned int auto_iterate;
	unsigned int refine;
	double emin;
	double gmin;
	double amin;
	Symmetry sym;

	ReflectionList *reflections;		/* Overall list of reflections (used to store results) */
	ReflectionList *strongest_reflections;	/* Strongest reflections (used for phasing) */
	TripletList *triplet_list;		/* List of active triplets */
	ReflectionList *basis_list;		/* Starting set of reflections */
	
	GtkWidget *solution_tree_view;
	GtkListStore *solution_list_store;
	
	PhasingSolution *solutions;
	
	unsigned int n_assigned_basis;
	unsigned int n_assigned_expansion;
	unsigned int n_refined;

} CDMContext;

extern void cdm_dialog_open(void);
extern unsigned int cdm_tangentexpansion(CDMContext *cdm);
extern void cdm_display_phasing_solution(CDMContext *cdm, PhasingSolution *sol, ReflectionList *reflections);

#endif	/* CDM_H */