# cryodrgn abinit command API

### Required Arguments

**`particles` The input particle stack (.mrcs, .star, .cs, or .txt).**

**`--outdir/-o` The directory where model outputs will be saved.**

**`--ctf` Path to CTF parameters (.pkl). Must be the size of the full dataset.**

### Other input parameters

**`--ind`** Path to indices (.pkl) or number of images to keep (first images kept). Default is to use full dataset if not given.

**`--datadir`** When using a .star or .cs file with relative paths, path to the directory containing the .mrcs files.

**`--relion31`** Flag for RELION3.1 `.star` file format.

**`--uninvert-data`** Flag for not inverting input data (e.g. for EMPIAR-10076).

**`--load`** Path to a checkpoint (weights.\<epoch>.pkl) to load.

**`--load-poses`** Path to a pose file (pose.\<epoch>.pkl) to load.

**`--lazy`** Flag for lazy data loading, which uses less GPU memory.

**`--max-threads`** Number of threads to use for data loading.

**`--no-trans`** Flag for indicating that the dataset does not contain translations.

**`--norm`** Override the default method for normalizing the images stack using two values (mean, std).

### Training scheduling

**`--num-epochs`** Number of total epochs to train for.

**`--epochs-sgd`** Number of epochs to train for SGD.

**`--epochs-pose-search`** Number of epochs for hierarchical pose search.

**`--n-imgs-pose-search`** Alternatively, the number of images to use for hierarchical pose search instead of specifying in epochs.

### Loss

**`--beta-conf` \[string, default = 0.0]** Beta term penalizing the KL divergence of the posterior distribution of conformations. Only used in variational mode.

**`--trans-l1-regularizer` \[string, default = 0.0]** Strength of the L1 regularizer applied on estimated translations.

**`--l2-smoothness-regularizer` \[string, default = 0.0]** Strength of the L2 smoothness regularization (penalization of strong gradients).

### Optimizers

**`--hypervolume-optimizer-type`** **\[string, default = “adam”]** Optimizer type for the hypervolume (choice: “adam”).

**`--pose-table-optimizer-type`** **\[string, default = “adam”]** Optimizer for the pose table (choice: “adam”, “lbfgs”).

**`--conf-table-optimizer-type` \[string, default = “adam”]** Optimizer for the conformation table (choice: “adam”).

**`--conf-encoder-optimizer-type` \[string, default = “adam”]** Optimizer for the conformation encoder.

**`--lr` \[float, default = 1e-4]** Learning rate of the hypervolume.

**`--lr-pose_table` \[float, default = 1e-3]** Learning rate of the pose table.

**`--lr-conf-table` \[float, default = 1e-2]** Learning rate fo the conformation table.

**`--lr-conf-encoder` \[float, default = 1e-4]** Learning rate of the conformation encoder.

**`--wd` \[float, default = 0.0]** Weight decay used by Adam optimizers.

### Masking

**`--output-mask` \[string, default = “circ”]** Type of output mask (choice: "circ", “frequency\_marching”)

**`--add-one-frequency-every` \[int, default = 100,000]** Frequency for adding new frequencies in the output mask, during HPS (in images).

**`--n-frequencies-per-epoch` \[int, default = 10]** Number of frequencies to add in the output mask at each epoch, during SGD.

**`--max-freq` \[int, default = None]** Highest frequency to use in the loss. Use all frequencies if None.

**`--window-radius-gt-real` \[float, default = 0.85]** Radius of the circular mask applied on images in real space (maximum radius is 1).

**`--l-start-fm` \[int, default = 12]** Starting size for the output mask when using frequency marching.

### Conformations

**`--variational-het` \[bool, default = False]** Flag activating the variational mode of conformation estimation.

**`--zdim` \[int, default = 4]** Dimension of conformations.

**`--std-z-init` \[float, default = 0.1]** Standard deviation of the initial conformations (i.i.d. with a centered Gaussian distribution).

**`--use-conf-encoder` \[bool, default = False]** Flag for using an encoder to predict conformations.

**`--depth-cnn` \[int, default = 5]** Depth of the encoder.

**`--channels-cnn` \[int, default = 32]** Number of channels in the encoder.

**`--kernel-size-cnn` \[int, default = 3]** Size of the kernels in the encoder.

**`--resolution-encoder` \[int, default = None]** Resolution of images given to the encoder. Images are nto downsampled if None.

### Hypervolume

**`--explicit-volume` \[bool, default = False]** Flag for using an explicit volume (voxel array).

**`--layers` \[int, default = 3]** Number of hidden layers in the hypervolume.

**`--dim` \[int, default = 256]** Dimension of hidden layers in the hypervolume.

**`--pe-type` \[string, default = “gaussian”]** Type of positional encoding for Fourier coordinates (choice: “gaussian”).

**`--pe-dim` \[int, default = 64]** Number of frequencies used for positional encoding.

**`--feat-sigma` \[float, default = 0.5]** Standard deviation of encoding frquencies.

**`--hypervolume-domain` \[string, default = “hartley”]** Domain of the hypervolume (choice: “hartley”).

**`--pe-type-conf` \[string, default = None]** Type of positional encoding for conformations (choice: None, “geom”).

### Pre-training

**`--n-imgs-pretrain` \[int, default = 10,000]** Number of images used for pre-training.

**`--pretrain-with-gt-poses` \[bool, default = False]** Flag for using ground truth poses at pre-training time.

### Pose Search

**`--l-start` \[int, default = 12]** Number of frequencies used during the first pose search step.

**`--l-end` \[int, default = 32]** Number of frequencies used during the last pose search step.

**`--niter` \[int, default = 4]** Number of pose search iterations.

**`--t-extent` \[float, default = 20.0]** Extent of the translation seach grid, in pixels.

**`--t-ngrid` \[int, default = 7]** Number of point per dimension in the translation search grid.

**`--t-xshift` \[float, default = 0.0]** X-axis shift of the translation search grid.

**`--t-yshift` \[float, default = 0.0]** Y-axis shift of the translation search grid.

**`--no-trans-search-at-pose-search`** \[bool, default = False] Flag for by-passing the translation search.

**`--nkeptposes` \[int, default = 8]** Number of poses kept per image.

**`--base-healpy`: \[int, default = 2]** Base healpy index.

### Others

**`--color-palette` \[string, default = None]** Type of palette used to visualize the predicted conformations (choice: None, “rainbow”, “linear”).

**`--no-amp`** Flag for disabling `torch.cuda.amp` Automatic Mixed Precision.

**`--test-installation` \[bool, default = False]** Flag for testing the installation.

**`--seed` \[int, default = -1]** Random seed. Randomly chosen if negative.

**`--verbose` \[bool, default = False]** Flag for more verbose model logging.

**`--multigpu` \[bool, default = False]** Flag for activating multi-GPU mode if more than one GPU is available.

**`--checkpoint` \[int, default = 5]** Outputs from every nth epoch will saved, along with every pose search epoch.

**`--log-interval` \[int, default=10000]** Logging interval in number of images.
