.. _label_init_model_fields: Initialize Model Fields ======================== * `initfields` (json object) - Describes how to initialize fields within model. Options: * `file` (string) - Initialize fields by reading from filename * `field_type` (string) - types of fields to read from the file, `species` or `exchange` * `` (json object) - This is the name of the field that you want to initialze. For example, this can be `mu_minus` or `mu_plus` to initialize an exchange field or `mu_A` or `mu_B` to initialize species fields. The names of the species fields are based on the label of the `Species`, while the names of the exchange field depend on the model being used. If this is confusing, just to take a look at the examples below. Options: * `type` (string) - Initialization type. Options: * `gaussians` - Initialize fields using Gaussins * `random` - Initialize fields randomly Example: Initialize fields `mu_minus` and `mu_plus` using gaussians and from random, respectively. .. note:: Note that the field names must match the model used. E.g. `mu_minus` and `mu_plus` should be used for `MeltChiAB`, but `mu_1` and `mu_+` would be used for `MeltMeltChiMultiSpecies` with incompressibility (python):: fts.model(type='MeltChiAB', ...) fts.init_model_field(height=1.0,ngaussian=1,type='gaussians',width=0.1,centers=[0],fieldname='mu_minus') fts.init_model_field(type='random',mean=0.0,stdev=1.0,fieldname='mu_plus') json:: "model": { "type": "MeltChiAB" ... "initfields": { "mu_minus": { "center0": [ 0,0 ], "center1": [ 0.5,0.5 ], "height": 1.0, "ngaussian": 2, "type": "gaussians", "width": 0.1 }, "mu_plus": { "type": "random", "mean": 0.0, "stdev": 1.0 } ... }, Example: Initialize from file python :: import openfts fts = openfts.OpenFTS() ... field_filename="exchange_fields.in" fts.init_fields_from_file(filename=field_filename,field_type='exchange') ... json :: "model": { "type": ... ... "initfields": { "field_type": "exchange", "file":"exchange_fields.in" }, ... },