prisms-center / CASMcode

First-principles statistical mechanical software for the study of multi-component crystalline solids
Other
105 stars 69 forks source link

vasp.relax.report related issue #318

Open darjaved opened 11 months ago

darjaved commented 11 months ago

hii, i am getting error as " TypeError: properties() missing 1 required positional argument: 'calcdir'" when i try to use vasp.relax.report in the calculation directory. i am using the latest version

xivh commented 11 months ago

Are you running casm-calc --report?

darjaved commented 11 months ago

@xivh , have done my DFT calculations ( not within the CASM) separately, now i have folders with vasp output files. when i use casm-calc --report it gives error of "there is no calc.json file". how can use it when i have done my DFT calculations separately, not in a way we usually do when using CASM. i was trying the vasp.relax.report then i got the first error .

darjaved commented 11 months ago

where should i keep my all completed calculations (i have various folders with "POSCAR,CONTCAR, OUTCAR, vasprun.xml" files) to run the casm-calc --report?

xivh commented 11 months ago

The last calculation for each config should be inside of training_data/SCELXXX/X/calctype.default/run.final. For the calc.json error, you need to fill out the training_data/settings/calctype.default folder even if you are running the calculations by yourself. Here is an example calc.json

{
    "queue" : "batch",
    "walltime" : "48:00:00",
    "ppn" : "12",
    "nodes" : "1",
    "software" : "vasp",
    "final" : "INCAR.final",
    "method" : "relax"
}

Also select the configs you calculated and run casm query --write-structure before casm-calc --report.

darjaved commented 11 months ago

i don't have any folder with name "SCELXXXX". if i have done calculations by myself, i don't have to create any configurations then? i have created all the possible configurations through pymatgen separately. so far i used the following cammands : 1) ccasm init 2) basis set cammand 3) setting the references i have all my completed calculations(of different configurations as i got from the pymatgen) in different folders. now i don't know how to use the casm report and then import all the calculations. do i have to do the enumerations part also? how to run the "casm query --write-structure" ?

darjaved commented 11 months ago

i have created the directories namely "SCELXXXX" which contain the different configurations, but i have already results of 700 configurations in separate folders, now the thing is i don't have to the calculations again, but where should i keep my calculated output files.?

xivh commented 11 months ago

If you haven't enumerated anything with CASM then you can follow these steps:

  1. Select the composition axes with casm composition --calc and casm composition --select (sounds like you might have done this already)
  2. Create the files in training_data/settings/calctype.default. You need at least calc.json and maybe also the SPECIES, INCAR, and KPOINTS.
  3. Get a list of all your initial unrelaxed POSCARs and put the paths into a file.
  4. Import the configurations into CASM using casm import -b filename
  5. Select the configurations and generate the configuration folders using for example casm query --write-structure
  6. Copy your data into the right folders, training_data/SCELXXX/X/calctype.default with the final calculation inside of calctype.default/run.final. The mapping info to match the config name and your initial path will be inside the reports folder.
  7. Run casm update to import the VASP data

Make sure to check the results of the import and update, for example the import conflicts, the mapping scores, and whether your VASP relaxations mapped to primitive configurations or not. I've never tried importing an entire external project before. If the config database is completely empty, it might crash. You could try enumerating supercells up to your max volume first if that happens.

These are the steps that I would follow if your configurations from Pymatgen map directly into CASM configurations (if the results from step 4 have zero atomic and lattice deformation). Another option is to import your VASP data and relaxed structures directly. If you want to do this, you can either use the relaxed POSCARs in step 3 or maybe try this function:

https://github.com/seshasaibehara/pythermo/blob/main/pythermo/jobs/casm_jobs.py#L1037

Save the results from each one in properties.calc.json and import those with casm import.

xivh commented 11 months ago

What do you want to do with CASM? There are some things in the Python packages that might be simpler to use, depending on what your goal is.

darjaved commented 11 months ago

i am working on cluster expansion project, i want to create the CE and DFT convex hulls first.

darjaved commented 11 months ago

when i tried to import one structure by giving the path as you mentioned above i got the "...reports/import_report.1/map_success.json" written as : [ { "atomic_deformation_cost" : 0.000000000000, "best_score" : null, "energy" : null, "final_path" : "/Users/dar/Desktop/init/sn/A0/POSCAR", "has_all_required_properties" : false, "has_any_required_properties" : false, "import_additional_files" : false, "import_properties" : false, "import_structure_file" : false, "initial_path" : "/Users/dar/Desktop/init/sn/A0/POSCAR", "is_new_best" : true, "is_new_config" : true, "lattice_deformation_cost" : 0.000001771258, "preexisting_data" : false, "preexisting_files" : false, "properties_origin" : "/Users/dar/Desktop/init/sn/A0/POSCAR", "score" : null, "selected" : false, "to_configname" : "SCEL8_2_2_2_0_0_0/0" }, { "atomic_deformation_cost" : null, "best_score" : null, "energy" : null, "final_path" : "/Users/dar/Desktop/init/sn/A0/POSCAR", "has_all_required_properties" : false, "has_any_required_properties" : false, "import_additional_files" : false, "import_properties" : false, "import_structure_file" : false, "initial_path" : "/Users/dar/Desktop/init/sn/A0/POSCAR", "is_new_best" : true, "is_new_config" : true, "lattice_deformation_cost" : null, "preexisting_data" : false, "preexisting_files" : false, "properties_origin" : "prim:/Users/dar/Desktop/init/sn/A0/POSCAR", "score" : null, "selected" : false, "to_configname" : "SCEL4_2_2_1_0_0_0/0" } ]

when i execute now the casm query --write-structure it does nothing.

xivh commented 11 months ago

If you run casm status -d that config should be there now, and you can select it with casm select --set 're(configname,"SCEL4_2_2_1_0_0_0/0")' or just casm select --set-on. Thencasm query --write-structure will write structure.json to training_data/SCEL4_2_2_1_0_0_0/0/structure.json.

I just saw that your initial config was non-primitive, so I actually I think you should put the calculation results inside of SCEL8_2_2_2_0_0_0/0. And if it didn't relax too much, after casm update ideally you would see those results mapped to SCEL4_2_2_1_0_0_0/0.

darjaved commented 11 months ago

thanks, yes its there i can see now. i gave path to only one POSCAR file, but it generated the two confignames as: SCEL4_2_2_1_0_0_0/0
SCEL8_2_2_2_0_0_0/0
it should generate only one? and first one has only 8 atoms and other has 16. and my poscar has 16 atoms. Do i have to manually copy my DFT data to the corresponding "/X/calctype.default/run.final" each folder should contain "vasprun.xml, CONTCAR, POSCAR,OUTCAR,OSZICAR " files i guess

xivh commented 11 months ago

CASM is saying that the initial configuration is not primitive and that it created a new primitive one. That is what "prim:" means in the second "properties_origin" field. By default, CASM will create configs that correspond to both the original and the primitive structures. casm query -k is_primitive --all should show that the SCEL8 config is not primitive. You can force CASM to import only primitive configurations, but then when you add the data from your calculations I don't think it will update successfully.

There is an option to copy automatically, but I am not sure if it is working. I forgot exactly what the command is, it's something like casm import -i '{data:{"import_additional_files"}}' or casm import -i '{data:{"copy_additional_files"}}'. You could also try the function I linked above to generate your own properties.calc.json files. Then you would not have to copy any data.

darjaved commented 11 months ago

in the casm_0.3, i used the use vasp.relax.report in each directory containing vasp output files and it could generate the properties,calc.json file, but its not working in this version.

xivh commented 11 months ago

I never used casm 0.3, but I think that properties_json_from_relaxation_dir in pythermo will do what you want.

darjaved commented 11 months ago

thanks. the function you mentioned, i could generate the properties.calc.json file. but when i try to import by ccasm import --batch file --ideal --data --min-energy its not working.

xivh commented 11 months ago

What is the error message?

darjaved commented 11 months ago

ERROR: unrecognised option '--ideal'

when i tried to use only the ccasm import --batch file it just imports the structure only, not any calculation data.

xivh commented 11 months ago

Try

casm import --batch filename -i '{"data":{"import_properties": true}}'

If you are sure that you want to use ideal mapping, you can pass it with

casm import --batch filename -i '{"data":{"import_properties": true},"mapping":{"ideal":true}}'